# Data QnA v1alpha API - Class AutoSuggestionServiceClient (2.0.0-alpha02)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.0.0-alpha02 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient)
- [2.0.0-alpha01](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/2.0.0-alpha01/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient)
- [1.0.0-alpha03](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/1.0.0-alpha03/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient)

    public abstract class AutoSuggestionServiceClient

Reference documentation and code samples for the Data QnA v1alpha API class AutoSuggestionServiceClient.

AutoSuggestionService client wrapper, for convenient use.

## Inheritance

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

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

[AutoSuggestionServiceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClientImpl)

## Namespace

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

## Assembly

Google.Cloud.DataQnA.V1Alpha.dll

## Remarks

This stateless API provides automatic suggestions for natural language
queries for the data sources in the provided project and location.

The service provides a resourceless operation `suggestQueries` that can be
called to get a list of suggestions for a given incomplete query and scope
(or list of scopes) under which the query is to be interpreted.

There are two types of suggestions, ENTITY for single entity suggestions
and TEMPLATE for full sentences. By default, both types are returned.

Example Request:

    GetSuggestions({
    parent: "locations/us/projects/my-project"
    scopes:
    "//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table"
    query: "top it"
    })

The service will retrieve information based on the given scope(s) and give
suggestions based on that (e.g. "top item" for "top it" if "item" is a known
dimension for the provided scope).

    suggestions {
    suggestion_info {
    annotated_suggestion {
    text_formatted: "top item by sum of usd_revenue_net"
    markups {
    type: DIMENSION
    start_char_index: 4
    length: 4
    }
    markups {
    type: METRIC
    start_char_index: 19
    length: 15
    }
    }
    query_matches {
    start_char_index: 0
    length: 6
    }
    }
    suggestion_type: TEMPLATE
    ranking_score: 0.9
    }
    suggestions {
    suggestion_info {
    annotated_suggestion {
    text_formatted: "item"
    markups {
    type: DIMENSION
    start_char_index: 4
    length: 2
    }
    }
    query_matches {
    start_char_index: 0
    length: 6
    }
    }
    suggestion_type: ENTITY
    ranking_score: 0.8
    }

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the AutoSuggestionService service, which is a host of "dataqna.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 AutoSuggestionService 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 AutoSuggestionService scopes are:

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

<br />

### GrpcClient

    public virtual AutoSuggestionService.AutoSuggestionServiceClient GrpcClient { get; }

The underlying gRPC AutoSuggestionService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionService.AutoSuggestionServiceClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://github.com/googleapis/gax-dotnet/blob/510f63bbae727cfa4cee5180d0a9916bc2dee248/Google.Api.Gax.Grpc/ServiceMetadata.cs` |   |

## Methods

### Create()

    public static AutoSuggestionServiceClient Create()

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

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

### CreateAsync(CancellationToken)

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

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

| **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.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient` | The task representing the created [AutoSuggestionServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient). |

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient#Google_Cloud_DataQnA_V1Alpha_AutoSuggestionServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient#Google_Cloud_DataQnA_V1Alpha_AutoSuggestionServiceClient_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.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient#Google_Cloud_DataQnA_V1Alpha_AutoSuggestionServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AutoSuggestionServiceClient#Google_Cloud_DataQnA_V1Alpha_AutoSuggestionServiceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### SuggestQueries(SuggestQueriesRequest, CallSettings)

    public virtual SuggestQueriesResponse SuggestQueries(SuggestQueriesRequest request, CallSettings callSettings = null)

Gets a list of suggestions based on a prefix string.
AutoSuggestion tolerance should be less than 1 second.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://github.com/googleapis/gax-dotnet/blob/510f63bbae727cfa4cee5180d0a9916bc2dee248/Google.Api.Gax.Grpc/CallSettings.cs` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesResponse` | The RPC response. |

**Example**

    // Create client
    AutoSuggestionServiceClient autoSuggestionServiceClient = AutoSuggestionServiceClient.Create();
    // Initialize request argument(s)
    SuggestQueriesRequest request = new SuggestQueriesRequest
    {
        ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
        Scopes = { "", },
        Query = "",
        SuggestionTypes =
        {
            SuggestionType.Unspecified,
        },
    };
    // Make the request
    SuggestQueriesResponse response = autoSuggestionServiceClient.SuggestQueries(request);

### SuggestQueriesAsync(SuggestQueriesRequest, CallSettings)

    public virtual Task<SuggestQueriesResponse> SuggestQueriesAsync(SuggestQueriesRequest request, CallSettings callSettings = null)

Gets a list of suggestions based on a prefix string.
AutoSuggestion tolerance should be less than 1 second.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://github.com/googleapis/gax-dotnet/blob/510f63bbae727cfa4cee5180d0a9916bc2dee248/Google.Api.Gax.Grpc/CallSettings.cs` 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.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AutoSuggestionServiceClient autoSuggestionServiceClient = await AutoSuggestionServiceClient.CreateAsync();
    // Initialize request argument(s)
    SuggestQueriesRequest request = new SuggestQueriesRequest
    {
        ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
        Scopes = { "", },
        Query = "",
        SuggestionTypes =
        {
            SuggestionType.Unspecified,
        },
    };
    // Make the request
    SuggestQueriesResponse response = await autoSuggestionServiceClient.SuggestQueriesAsync(request);

### SuggestQueriesAsync(SuggestQueriesRequest, CancellationToken)

    public virtual Task<SuggestQueriesResponse> SuggestQueriesAsync(SuggestQueriesRequest request, CancellationToken cancellationToken)

Gets a list of suggestions based on a prefix string.
AutoSuggestion tolerance should be less than 1 second.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesRequest` 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.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.SuggestQueriesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AutoSuggestionServiceClient autoSuggestionServiceClient = await AutoSuggestionServiceClient.CreateAsync();
    // Initialize request argument(s)
    SuggestQueriesRequest request = new SuggestQueriesRequest
    {
        ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
        Scopes = { "", },
        Query = "",
        SuggestionTypes =
        {
            SuggestionType.Unspecified,
        },
    };
    // Make the request
    SuggestQueriesResponse response = await autoSuggestionServiceClient.SuggestQueriesAsync(request);