Google Cloud Dialogflow v2 API - Class ContextsClient (4.5.0)

public abstract class ContextsClient

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

Contexts client wrapper, for convenient use.

Inheritance

Object > ContextsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.V2

Assembly

Google.Cloud.Dialogflow.V2.dll

Remarks

Service for managing [Contexts][google.cloud.dialogflow.v2.Context].

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Contexts 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 Contexts scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual Contexts.ContextsClient GrpcClient { get; }

The underlying gRPC Contexts client

Property Value
TypeDescription
Contexts.ContextsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static ContextsClient Create()

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

Returns
TypeDescription
ContextsClient

The created ContextsClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<ContextsClient>

The task representing the created ContextsClient.

CreateContext(CreateContextRequest, CallSettings)

public virtual Context CreateContext(CreateContextRequest request, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
requestCreateContextRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Context CreateContext(SessionName parent, Context context, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentSessionName

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Context CreateContext(string parent, Context context, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentString

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Task<Context> CreateContextAsync(CreateContextRequest request, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
requestCreateContextRequest

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<Context>

A Task containing the RPC response.

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

public virtual Task<Context> CreateContextAsync(CreateContextRequest request, CancellationToken cancellationToken)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
requestCreateContextRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> CreateContextAsync(SessionName parent, Context context, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentSessionName

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> CreateContextAsync(SessionName parent, Context context, CancellationToken cancellationToken)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentSessionName

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> CreateContextAsync(string parent, Context context, CallSettings callSettings = null)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentString

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> CreateContextAsync(string parent, Context context, CancellationToken cancellationToken)

Creates a context.

If the specified context already exists, overrides the context.

Parameters
NameDescription
parentString

Required. The session to create a context for. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

contextContext

Required. The context to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual void DeleteAllContexts(DeleteAllContextsRequest request, CallSettings callSettings = null)

Deletes all active contexts in the specified session.

Parameters
NameDescription
requestDeleteAllContextsRequest

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

public virtual void DeleteAllContexts(SessionName parent, CallSettings callSettings = null)

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentSessionName

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

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

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

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentString

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

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

public virtual Task DeleteAllContextsAsync(DeleteAllContextsRequest request, CallSettings callSettings = null)

Deletes all active contexts in the specified session.

Parameters
NameDescription
requestDeleteAllContextsRequest

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

public virtual Task DeleteAllContextsAsync(DeleteAllContextsRequest request, CancellationToken cancellationToken)

Deletes all active contexts in the specified session.

Parameters
NameDescription
requestDeleteAllContextsRequest

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

public virtual Task DeleteAllContextsAsync(SessionName parent, CallSettings callSettings = null)

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentSessionName

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Task DeleteAllContextsAsync(SessionName parent, CancellationToken cancellationToken)

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentSessionName

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

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

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentString

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Task DeleteAllContextsAsync(string parent, CancellationToken cancellationToken)

Deletes all active contexts in the specified session.

Parameters
NameDescription
parentString

Required. The name of the session to delete all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual void DeleteContext(ContextName name, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

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

public virtual void DeleteContext(DeleteContextRequest request, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
requestDeleteContextRequest

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

public virtual void DeleteContext(string name, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
nameString

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

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

public virtual Task DeleteContextAsync(ContextName name, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Task DeleteContextAsync(ContextName name, CancellationToken cancellationToken)

Deletes the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Task DeleteContextAsync(DeleteContextRequest request, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
requestDeleteContextRequest

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

public virtual Task DeleteContextAsync(DeleteContextRequest request, CancellationToken cancellationToken)

Deletes the specified context.

Parameters
NameDescription
requestDeleteContextRequest

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

public virtual Task DeleteContextAsync(string name, CallSettings callSettings = null)

Deletes the specified context.

Parameters
NameDescription
nameString

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Task DeleteContextAsync(string name, CancellationToken cancellationToken)

Deletes the specified context.

Parameters
NameDescription
nameString

Required. The name of the context to delete. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

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

public virtual Context GetContext(ContextName name, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Context GetContext(GetContextRequest request, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
requestGetContextRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Context GetContext(string name, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
nameString

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Task<Context> GetContextAsync(ContextName name, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> GetContextAsync(ContextName name, CancellationToken cancellationToken)

Retrieves the specified context.

Parameters
NameDescription
nameContextName

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> GetContextAsync(GetContextRequest request, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
requestGetContextRequest

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<Context>

A Task containing the RPC response.

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

public virtual Task<Context> GetContextAsync(GetContextRequest request, CancellationToken cancellationToken)

Retrieves the specified context.

Parameters
NameDescription
requestGetContextRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> GetContextAsync(string name, CallSettings callSettings = null)

Retrieves the specified context.

Parameters
NameDescription
nameString

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> GetContextAsync(string name, CancellationToken cancellationToken)

Retrieves the specified context.

Parameters
NameDescription
nameString

Required. The name of the context. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID>/contexts/&lt;Context ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>/contexts/&lt;Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(ListContextsRequest request, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
requestListContextsRequest

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<ListContextsResponse, Context>

A pageable sequence of Context resources.

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

public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(SessionName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
parentSessionName

Required. The session to list all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

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<ListContextsResponse, Context>

A pageable sequence of Context resources.

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

public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
parentString

Required. The session to list all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

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<ListContextsResponse, Context>

A pageable sequence of Context resources.

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

public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(ListContextsRequest request, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
requestListContextsRequest

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<ListContextsResponse, Context>

A pageable asynchronous sequence of Context resources.

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

public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(SessionName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
parentSessionName

Required. The session to list all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

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<ListContextsResponse, Context>

A pageable asynchronous sequence of Context resources.

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

public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all contexts in the specified session.

Parameters
NameDescription
parentString

Required. The session to list all contexts from. Format: projects/&lt;Project ID>/agent/sessions/&lt;Session ID> or projects/&lt;Project ID>/agent/environments/&lt;Environment ID>/users/&lt;User ID>/sessions/&lt;Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.

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<ListContextsResponse, Context>

A pageable asynchronous sequence of Context resources.

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

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.

UpdateContext(Context, FieldMask, CallSettings)

public virtual Context UpdateContext(Context context, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified context.

Parameters
NameDescription
contextContext

Required. The context to update.

updateMaskFieldMask

Optional. The mask to control which fields get updated.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Context UpdateContext(UpdateContextRequest request, CallSettings callSettings = null)

Updates the specified context.

Parameters
NameDescription
requestUpdateContextRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Context

The RPC response.

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

public virtual Task<Context> UpdateContextAsync(Context context, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified context.

Parameters
NameDescription
contextContext

Required. The context to update.

updateMaskFieldMask

Optional. The mask to control which fields get updated.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> UpdateContextAsync(Context context, FieldMask updateMask, CancellationToken cancellationToken)

Updates the specified context.

Parameters
NameDescription
contextContext

Required. The context to update.

updateMaskFieldMask

Optional. The mask to control which fields get updated.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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

public virtual Task<Context> UpdateContextAsync(UpdateContextRequest request, CallSettings callSettings = null)

Updates the specified context.

Parameters
NameDescription
requestUpdateContextRequest

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<Context>

A Task containing the RPC response.

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

public virtual Task<Context> UpdateContextAsync(UpdateContextRequest request, CancellationToken cancellationToken)

Updates the specified context.

Parameters
NameDescription
requestUpdateContextRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Context>

A Task containing the RPC response.

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