BlocklistClient.GetTextBlocklistItem 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
GetTextBlocklistItem(String, String, RequestContext) |
[Protocol Method] Get BlocklistItem By blocklistName And blocklistItemId
|
GetTextBlocklistItem(String, String, CancellationToken) |
Get BlocklistItem By blocklistName And blocklistItemId. |
GetTextBlocklistItem(String, String, RequestContext)
- Source:
- BlocklistClient.cs
[Protocol Method] Get BlocklistItem By blocklistName And blocklistItemId
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetTextBlocklistItem(String, String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response GetTextBlocklistItem (string name, string blocklistItemId, Azure.RequestContext context);
abstract member GetTextBlocklistItem : string * string * Azure.RequestContext -> Azure.Response
override this.GetTextBlocklistItem : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetTextBlocklistItem (name As String, blocklistItemId As String, context As RequestContext) As 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 GetTextBlocklistItem 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 = client.GetTextBlocklistItem("<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 GetTextBlocklistItem 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 = client.GetTextBlocklistItem("<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
GetTextBlocklistItem(String, String, CancellationToken)
- Source:
- BlocklistClient.cs
Get BlocklistItem By blocklistName And blocklistItemId.
public virtual Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem> GetTextBlocklistItem (string name, string blocklistItemId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTextBlocklistItem : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem>
override this.GetTextBlocklistItem : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.ContentSafety.TextBlocklistItem>
Public Overridable Function GetTextBlocklistItem (name As String, blocklistItemId As String, Optional cancellationToken As CancellationToken = Nothing) As 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 GetTextBlocklistItem.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
BlocklistClient client = new BlocklistClient(endpoint, credential);
Response<TextBlocklistItem> response = client.GetTextBlocklistItem("<Name>", "<blocklistItemId>");
This sample shows how to call GetTextBlocklistItem 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 = client.GetTextBlocklistItem("<Name>", "<blocklistItemId>");
Remarks
Get blocklistItem by blocklistName and blocklistItemId from a text blocklist.
Applies to
Azure SDK for .NET