BlocklistClient.GetTextBlocklistItemAsync Method

Definition

Overloads

GetTextBlocklistItemAsync(String, String, RequestContext)

[Protocol Method] Get BlocklistItem By blocklistName And blocklistItemId

GetTextBlocklistItemAsync(String, String, CancellationToken)

Get BlocklistItem By blocklistName And blocklistItemId.

GetTextBlocklistItemAsync(String, String, RequestContext)

Source:
BlocklistClient.cs

[Protocol Method] Get BlocklistItem By blocklistName And blocklistItemId

public virtual System.Threading.Tasks.Task<Azure.Response> GetTextBlocklistItemAsync (string name, string blocklistItemId, Azure.RequestContext context);
abstract member GetTextBlocklistItemAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetTextBlocklistItemAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetTextBlocklistItemAsync (name As String, blocklistItemId As String, context As RequestContext) As Task(Of Response)

Parameters

name
String

Text blocklist name.

blocklistItemId
String

The service will generate a BlocklistItemId, which will be a UUID.

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 or blocklistItemId is null.

name or blocklistItemId 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 GetTextBlocklistItemAsync 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.GetTextBlocklistItemAsync("<Name>", "<blocklistItemId>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("blocklistItemId").ToString());
Console.WriteLine(result.GetProperty("text").ToString());

This sample shows how to call GetTextBlocklistItemAsync 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.GetTextBlocklistItemAsync("<Name>", "<blocklistItemId>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("blocklistItemId").ToString());
Console.WriteLine(result.GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("text").ToString());

Applies to

GetTextBlocklistItemAsync(String, String, CancellationToken)

Source:
BlocklistClient.cs

Get BlocklistItem By blocklistName And blocklistItemId.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem>> GetTextBlocklistItemAsync (string name, string blocklistItemId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTextBlocklistItemAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem>>
override this.GetTextBlocklistItemAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem>>
Public Overridable Function GetTextBlocklistItemAsync (name As String, blocklistItemId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of TextBlocklistItem))

Parameters

name
String

Text blocklist name.

blocklistItemId
String

The service will generate a BlocklistItemId, which will be a UUID.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

name or blocklistItemId is null.

name or blocklistItemId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetTextBlocklistItemAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);

Response<TextBlocklistItem> response = await client.GetTextBlocklistItemAsync("<Name>", "<blocklistItemId>");

This sample shows how to call GetTextBlocklistItemAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);

Response<TextBlocklistItem> response = await client.GetTextBlocklistItemAsync("<Name>", "<blocklistItemId>");

Remarks

Get blocklistItem by blocklistName and blocklistItemId from a text blocklist.

Applies to