BlocklistClient.GetTextBlocklistAsync 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
GetTextBlocklistAsync(String, CancellationToken) |
Get Text Blocklist By blocklistName. |
GetTextBlocklistAsync(String, RequestContext) |
[Protocol Method] Get Text Blocklist By blocklistName
|
GetTextBlocklistAsync(String, CancellationToken)
- Source:
- BlocklistClient.cs
Get Text Blocklist By blocklistName.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklist>> GetTextBlocklistAsync (string name, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTextBlocklistAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklist>>
override this.GetTextBlocklistAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklist>>
Public Overridable Function GetTextBlocklistAsync (name As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of TextBlocklist))
Parameters
- name
- String
Text blocklist name.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
name
is null.
name
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetTextBlocklistAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);
Response<TextBlocklist> response = await client.GetTextBlocklistAsync("<Name>");
This sample shows how to call GetTextBlocklistAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);
Response<TextBlocklist> response = await client.GetTextBlocklistAsync("<Name>");
Remarks
Returns text blocklist details.
Applies to
GetTextBlocklistAsync(String, RequestContext)
- Source:
- BlocklistClient.cs
[Protocol Method] Get Text Blocklist By blocklistName
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetTextBlocklistAsync(String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetTextBlocklistAsync (string name, Azure.RequestContext context);
abstract member GetTextBlocklistAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetTextBlocklistAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetTextBlocklistAsync (name As String, context As RequestContext) As Task(Of Response)
Parameters
- name
- String
Text blocklist name.
- 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
name
is null.
name
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call GetTextBlocklistAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);
Response response = await client.GetTextBlocklistAsync("<Name>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("blocklistName").ToString());
This sample shows how to call GetTextBlocklistAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);
Response response = await client.GetTextBlocklistAsync("<Name>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("blocklistName").ToString());
Console.WriteLine(result.GetProperty("description").ToString());
Applies to
Azure SDK for .NET