# Google Cloud Dialogflow v2beta1 API - Class SessionsClient (1.0.0-beta30)

1.0.0-beta30 (latest) 1.0.0-beta29

    public abstract class SessionsClient

Reference documentation and code samples for the Google Cloud Dialogflow v2beta1 API class SessionsClient.

Sessions client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> SessionsClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[SessionsClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClientImpl)

## Namespace

[Google.Cloud.Dialogflow.V2Beta1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1)

## Assembly

Google.Cloud.Dialogflow.V2Beta1.dll

## Remarks

A service used for session interactions.

For more information, see the [API interactions
guide](https://cloud.google.com/dialogflow/docs/api-overview).

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default Sessions scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default Sessions scopes are:

- <https://www.googleapis.com/auth/cloud-platform>
- <https://www.googleapis.com/auth/dialogflow>

### GrpcClient

    public virtual Sessions.SessionsClient GrpcClient { get; }

The underlying gRPC Sessions client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.Sessionshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.Sessions.SessionsClient` |   |

### LocationsClient

    public virtual LocationsClient LocationsClient { get; }

The [LocationsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### Create()

    public static SessionsClient Create()

Synchronously creates a [SessionsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [SessionsClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient` | The created [SessionsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient). |

### CreateAsync(CancellationToken)

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

Asynchronously creates a [SessionsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [SessionsClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient` | The task representing the created [SessionsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient). |

### DetectIntent(DetectIntentRequest, CallSettings)

    public virtual DetectIntentResponse DetectIntent(DetectIntentRequest request, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | The RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = SessionsClient.Create();
    // Initialize request argument(s)
    DetectIntentRequest request = new DetectIntentRequest
    {
        SessionAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
        QueryParams = new QueryParameters(),
        QueryInput = new QueryInput(),
        OutputAudioConfig = new OutputAudioConfig(),
        InputAudio = ByteString.Empty,
        OutputAudioConfigMask = new FieldMask(),
    };
    // Make the request
    DetectIntentResponse response = sessionsClient.DetectIntent(request);

### DetectIntent(SessionName, QueryInput, CallSettings)

    public virtual DetectIntentResponse DetectIntent(SessionName session, QueryInput queryInput, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionName` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | The RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = SessionsClient.Create();
    // Initialize request argument(s)
    SessionName session = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = sessionsClient.DetectIntent(session, queryInput);

### DetectIntent(string, QueryInput, CallSettings)

    public virtual DetectIntentResponse DetectIntent(string session, QueryInput queryInput, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | The RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = SessionsClient.Create();
    // Initialize request argument(s)
    string session = "projects/[PROJECT]/agent/sessions/[SESSION]";
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = sessionsClient.DetectIntent(session, queryInput);

### DetectIntentAsync(DetectIntentRequest, CallSettings)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(DetectIntentRequest request, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    DetectIntentRequest request = new DetectIntentRequest
    {
        SessionAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
        QueryParams = new QueryParameters(),
        QueryInput = new QueryInput(),
        OutputAudioConfig = new OutputAudioConfig(),
        InputAudio = ByteString.Empty,
        OutputAudioConfigMask = new FieldMask(),
    };
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(request);

### DetectIntentAsync(DetectIntentRequest, CancellationToken)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(DetectIntentRequest request, CancellationToken cancellationToken)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    DetectIntentRequest request = new DetectIntentRequest
    {
        SessionAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
        QueryParams = new QueryParameters(),
        QueryInput = new QueryInput(),
        OutputAudioConfig = new OutputAudioConfig(),
        InputAudio = ByteString.Empty,
        OutputAudioConfigMask = new FieldMask(),
    };
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(request);

### DetectIntentAsync(SessionName, QueryInput, CallSettings)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(SessionName session, QueryInput queryInput, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionName` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    SessionName session = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(session, queryInput);

### DetectIntentAsync(SessionName, QueryInput, CancellationToken)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(SessionName session, QueryInput queryInput, CancellationToken cancellationToken)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionName` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    SessionName session = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(session, queryInput);

### DetectIntentAsync(string, QueryInput, CallSettings)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(string session, QueryInput queryInput, CallSettings callSettings = null)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    string session = "projects/[PROJECT]/agent/sessions/[SESSION]";
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(session, queryInput);

### DetectIntentAsync(string, QueryInput, CancellationToken)

    public virtual Task<DetectIntentResponse> DetectIntentAsync(string session, QueryInput queryInput, CancellationToken cancellationToken)

Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[AnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent\]
instead of `DetectIntent`. `AnalyzeContent` has additional
functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the session this query is sent to. Supported formats: - \`projects/\<Project ID\>/agent/sessions/\<Session ID\>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview). Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). |
| `queryInput` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.QueryInput` Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.DetectIntentResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    SessionsClient sessionsClient = await SessionsClient.CreateAsync();
    // Initialize request argument(s)
    string session = "projects/[PROJECT]/agent/sessions/[SESSION]";
    QueryInput queryInput = new QueryInput();
    // Make the request
    DetectIntentResponse response = await sessionsClient.DetectIntentAsync(session, queryInput);

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient#Google_Cloud_Dialogflow_V2Beta1_SessionsClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient#Google_Cloud_Dialogflow_V2Beta1_SessionsClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient#Google_Cloud_Dialogflow_V2Beta1_SessionsClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient#Google_Cloud_Dialogflow_V2Beta1_SessionsClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### StreamingDetectIntent(CallSettings, BidirectionalStreamingSettings)

    public virtual SessionsClient.StreamingDetectIntentStream StreamingDetectIntent(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Processes a natural language query in audio format in a streaming fashion
and returns structured, actionable data as a result. This method is only
available via the gRPC API (not REST).

If you might use
[Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
or other CCAI products now or in the future, consider using
\[StreamingAnalyzeContent\]\[google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent\]
instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has
additional functionality for Agent Assist and other CCAI products.

Note: Always use agent versions for production traffic.
See [Versions and
environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |
| `streamingSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings.html` If not null, applies streaming overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.V2Beta1/latest/Google.Cloud.Dialogflow.V2Beta1.SessionsClient.StreamingDetectIntentStream` | The client-server stream. |

**Example**

    // Create client
    SessionsClient sessionsClient = SessionsClient.Create();
    // Initialize streaming call, retrieving the stream object
    using SessionsClient.StreamingDetectIntentStream response = sessionsClient.StreamingDetectIntent();

    // Sending requests and retrieving responses can be arbitrarily interleaved
    // Exact sequence will depend on client/server behavior

    // Create task to do something with responses from server
    Task responseHandlerTask = Task.Run(async () =>
    {
        // Note that C# 8 code can use await foreach
        AsyncResponseStream<StreamingDetectIntentResponse> responseStream = response.GetResponseStream();
        while (await responseStream.MoveNextAsync())
        {
            StreamingDetectIntentResponse responseItem = responseStream.Current;
            // Do something with streamed response
        }
        // The response stream has completed
    });

    // Send requests to the server
    bool done = false;
    while (!done)
    {
        // Initialize a request
        StreamingDetectIntentRequest request = new StreamingDetectIntentRequest
        {
            SessionAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
            QueryParams = new QueryParameters(),
            QueryInput = new QueryInput(),
            OutputAudioConfig = new OutputAudioConfig(),
            InputAudio = ByteString.Empty,
            OutputAudioConfigMask = new FieldMask(),
            EnableDebuggingInfo = false,
        };
        // Stream a request to the server
        await response.WriteAsync(request);
        // Set "done" to true when sending requests is complete
    }

    // Complete writing requests to the stream
    await response.WriteCompleteAsync();
    // Await the response handler
    // This will complete once all server responses have been processed
    await responseHandlerTask;