Share via


BlocklistClient.CreateOrUpdateTextBlocklist Method

Definition

[Protocol Method] Create Or Update Text Blocklist

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response CreateOrUpdateTextBlocklist (string name, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrUpdateTextBlocklist : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.CreateOrUpdateTextBlocklist : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateOrUpdateTextBlocklist (name As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response

Parameters

name
String

Text blocklist name.

content
RequestContent

The content to send as the body of the request.

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

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

using RequestContent content = RequestContent.Create(new
{
    blocklistName = "<blocklistName>",
});
Response response = client.CreateOrUpdateTextBlocklist("<Name>", content);

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

This sample shows how to call CreateOrUpdateTextBlocklist with all parameters and request content and parse the result.

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

using RequestContent content = RequestContent.Create(new
{
    blocklistName = "<blocklistName>",
    description = "<description>",
});
Response response = client.CreateOrUpdateTextBlocklist("<Name>", content);

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

Applies to