BlocklistClient.GetTextBlocklistItemsAsync Method

Definition

Overloads

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

Get All BlocklistItems By blocklistName.

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

[Protocol Method] Get All BlocklistItems By blocklistName

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

Source:
BlocklistClient.cs

Get All BlocklistItems By blocklistName.

public virtual Azure.AsyncPageable<Azure.AI.ContentSafety.TextBlocklistItem> GetTextBlocklistItemsAsync (string name, 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.TextBlocklistItem>
override this.GetTextBlocklistItemsAsync : string * Nullable<int> * Nullable<int> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.AI.ContentSafety.TextBlocklistItem>
Public Overridable Function GetTextBlocklistItemsAsync (name 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 TextBlocklistItem)

Parameters

name
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

name is null.

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

Examples

This sample shows how to call GetTextBlocklistItemsAsync.

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

await foreach (TextBlocklistItem item in client.GetTextBlocklistItemsAsync("<Name>"))
{
}

This sample shows how to call GetTextBlocklistItemsAsync with all parameters.

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

await foreach (TextBlocklistItem item in client.GetTextBlocklistItemsAsync("<Name>", maxCount: 1234, skip: 1234, maxpagesize: 1234))
{
}

Remarks

Get all blocklistItems in a text blocklist.

Applies to

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

Source:
BlocklistClient.cs

[Protocol Method] Get All BlocklistItems By blocklistName

public virtual Azure.AsyncPageable<BinaryData> GetTextBlocklistItemsAsync (string name, 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 (name 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

name
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

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 GetTextBlocklistItemsAsync and parse the result.

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

await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("<Name>", null, null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("blocklistItemId").ToString());
    Console.WriteLine(result.GetProperty("text").ToString());
}

This sample shows how to call GetTextBlocklistItemsAsync 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);

await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("<Name>", 1234, 1234, 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("blocklistItemId").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("text").ToString());
}

Applies to