Discovery.AutoCompleteAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AutoCompleteAsync(AutoCompleteConfig, CancellationToken) |
Get auto complete options. |
AutoCompleteAsync(RequestContent, RequestContext) |
[Protocol Method] Get auto complete options.
|
AutoCompleteAsync(AutoCompleteConfig, CancellationToken)
- Source:
- Discovery.cs
Get auto complete options.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AutoCompleteResult>> AutoCompleteAsync (Azure.Analytics.Purview.DataMap.AutoCompleteConfig autoCompleteConfig, System.Threading.CancellationToken cancellationToken = default);
abstract member AutoCompleteAsync : Azure.Analytics.Purview.DataMap.AutoCompleteConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AutoCompleteResult>>
override this.AutoCompleteAsync : Azure.Analytics.Purview.DataMap.AutoCompleteConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AutoCompleteResult>>
Public Overridable Function AutoCompleteAsync (autoCompleteConfig As AutoCompleteConfig, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AutoCompleteResult))
Parameters
- autoCompleteConfig
- AutoCompleteConfig
The payload of autocomplete request.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
autoCompleteConfig
is null.
Examples
This sample shows how to call AutoCompleteAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
AutoCompleteConfig autoCompleteConfig = new AutoCompleteConfig();
Response<AutoCompleteResult> response = await client.AutoCompleteAsync(autoCompleteConfig);
This sample shows how to call AutoCompleteAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
AutoCompleteConfig autoCompleteConfig = new AutoCompleteConfig
{
Keywords = "<keywords>",
Limit = 1234,
Filter = BinaryData.FromObjectAsJson(new object()),
};
Response<AutoCompleteResult> response = await client.AutoCompleteAsync(autoCompleteConfig);
Applies to
AutoCompleteAsync(RequestContent, RequestContext)
- Source:
- Discovery.cs
[Protocol Method] Get auto complete options.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler AutoCompleteAsync(AutoCompleteConfig, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> AutoCompleteAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AutoCompleteAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.AutoCompleteAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AutoCompleteAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call AutoCompleteAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
using RequestContent content = RequestContent.Create(new object());
Response response = await client.AutoCompleteAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call AutoCompleteAsync with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
using RequestContent content = RequestContent.Create(new
{
keywords = "<keywords>",
limit = 1234,
filter = new object(),
});
Response response = await client.AutoCompleteAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("value")[0].GetProperty("text").ToString());
Console.WriteLine(result.GetProperty("value")[0].GetProperty("queryPlusText").ToString());
Applies to
Azure SDK for .NET