Share via


ContentSafetyClient.GetTextBlocklistItemsAsync Method

Definition

Overloads

GetTextBlocklistItemsAsync(String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, RequestContext)

[Protocol Method] Get All BlockItems By blocklistName

GetTextBlocklistItemsAsync(String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, CancellationToken)

Get All BlockItems By blocklistName.

GetTextBlocklistItemsAsync(String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, RequestContext)

Source:
ContentSafetyClient.cs

[Protocol Method] Get All BlockItems By blocklistName

public virtual Azure.AsyncPageable<BinaryData> GetTextBlocklistItemsAsync (string blocklistName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context);
abstract member GetTextBlocklistItemsAsync : string * Nullable<int> * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetTextBlocklistItemsAsync : string * Nullable<int> * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetTextBlocklistItemsAsync (blocklistName As String, maxCount As Nullable(Of Integer), skip As Nullable(Of Integer), maxpagesize As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

blocklistName
String

Text blocklist name.

maxCount
Nullable<Int32>

The number of result items to return.

skip
Nullable<Int32>

The number of result items to skip.

maxpagesize
Nullable<Int32>

The maximum number of result items per page.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

blocklistName is null.

blocklistName 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 GetTextBlocklistItemsAsync 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);

await foreach (var item in client.GetTextBlocklistItemsAsync("<blocklistName>", 1234, 1234, 1234, new RequestContext()))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("blockItemId").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("text").ToString());
}

Applies to

GetTextBlocklistItemsAsync(String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, CancellationToken)

Source:
ContentSafetyClient.cs

Get All BlockItems By blocklistName.

public virtual Azure.AsyncPageable<Azure.AI.ContentSafety.TextBlockItem> GetTextBlocklistItemsAsync (string blocklistName, int? maxCount = default, int? skip = default, int? maxpagesize = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTextBlocklistItemsAsync : string * Nullable<int> * Nullable<int> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.AI.ContentSafety.TextBlockItem>
override this.GetTextBlocklistItemsAsync : string * Nullable<int> * Nullable<int> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.AI.ContentSafety.TextBlockItem>
Public Overridable Function GetTextBlocklistItemsAsync (blocklistName As String, Optional maxCount As Nullable(Of Integer) = Nothing, Optional skip As Nullable(Of Integer) = Nothing, Optional maxpagesize As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of TextBlockItem)

Parameters

blocklistName
String

Text blocklist name.

maxCount
Nullable<Int32>

The number of result items to return.

skip
Nullable<Int32>

The number of result items to skip.

maxpagesize
Nullable<Int32>

The maximum number of result items per page.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

blocklistName is null.

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

Examples

This sample shows how to call GetTextBlocklistItemsAsync with required parameters.

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

await foreach (var item in client.GetTextBlocklistItemsAsync("<blocklistName>", 1234, 1234, 1234))
{
}

Remarks

Get all blockItems in a text blocklist.

Applies to