Share via


ContentSafetyClient.GetTextBlocklistItemAsync Method

Definition

Overloads

GetTextBlocklistItemAsync(String, String, RequestContext)

[Protocol Method] Get BlockItem By blocklistName And blockItemId

GetTextBlocklistItemAsync(String, String, CancellationToken)

Get BlockItem By blocklistName And blockItemId.

GetTextBlocklistItemAsync(String, String, RequestContext)

Source:
ContentSafetyClient.cs

[Protocol Method] Get BlockItem By blocklistName And blockItemId

public virtual System.Threading.Tasks.Task<Azure.Response> GetTextBlocklistItemAsync (string blocklistName, string blockItemId, 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 (blocklistName As String, blockItemId As String, context As RequestContext) As Task(Of Response)

Parameters

blocklistName
String

Text blocklist name.

blockItemId
String

Block Item Id. It will be 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

blocklistName or blockItemId is null.

blocklistName or blockItemId 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 with required parameters and parse the result.

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

Response response = await client.GetTextBlocklistItemAsync("<blocklistName>", "<blockItemId>", new RequestContext());

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

Applies to

GetTextBlocklistItemAsync(String, String, CancellationToken)

Source:
ContentSafetyClient.cs

Get BlockItem By blocklistName And blockItemId.

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

Parameters

blocklistName
String

Text blocklist name.

blockItemId
String

Block Item Id. It will be uuid.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

blocklistName or blockItemId is null.

blocklistName or blockItemId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetTextBlocklistItemAsync with required parameters.

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

var result = await client.GetTextBlocklistItemAsync("<blocklistName>", "<blockItemId>");

Remarks

Get blockItem By blockItemId from a text blocklist.

Applies to