Share via


MessageTemplateClient.GetTemplatesAsync Method

Definition

Overloads

GetTemplatesAsync(String, CancellationToken)

List all templates for given ACS channel asynchronously.

GetTemplatesAsync(Guid, Nullable<Int32>, RequestContext)

[Protocol Method] List all templates for given Azure Communication Services channel

GetTemplatesAsync(Guid, Nullable<Int32>, CancellationToken)

List all templates for given Azure Communication Services channel.

GetTemplatesAsync(String, CancellationToken)

Source:
MessageTemplateClient.cs

List all templates for given ACS channel asynchronously.

public virtual Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem> GetTemplatesAsync (string channelRegistrationId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTemplatesAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem>
override this.GetTemplatesAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem>
Public Overridable Function GetTemplatesAsync (channelRegistrationId As String, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of MessageTemplateItem)

Parameters

channelRegistrationId
String

The registration ID of the channel.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

The server returned an error. See Message for details returned from the server.

Applies to

GetTemplatesAsync(Guid, Nullable<Int32>, RequestContext)

Source:
MessageTemplateClient.cs

[Protocol Method] List all templates for given Azure Communication Services channel

public virtual Azure.AsyncPageable<BinaryData> GetTemplatesAsync (Guid channelId, int? maxpagesize, Azure.RequestContext context);
abstract member GetTemplatesAsync : Guid * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetTemplatesAsync : Guid * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetTemplatesAsync (channelId As Guid, maxpagesize As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

channelId
Guid

The registration ID of the channel.

maxpagesize
Nullable<Int32>

Number of objects to return 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

Service returned a non-success status code.

Examples

This sample shows how to call GetTemplatesAsync and parse the result.

MessageTemplateClient client = new MessageTemplateClient((string)null);

await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("language").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("kind").ToString());
}

This sample shows how to call GetTemplatesAsync with all parameters and parse the result.

MessageTemplateClient client = new MessageTemplateClient((string)null);

await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("language").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("kind").ToString());
}

Applies to

GetTemplatesAsync(Guid, Nullable<Int32>, CancellationToken)

Source:
MessageTemplateClient.cs

List all templates for given Azure Communication Services channel.

public virtual Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem> GetTemplatesAsync (Guid channelId, int? maxpagesize = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTemplatesAsync : Guid * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem>
override this.GetTemplatesAsync : Guid * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Communication.Messages.MessageTemplateItem>
Public Overridable Function GetTemplatesAsync (channelId As Guid, Optional maxpagesize As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of MessageTemplateItem)

Parameters

channelId
Guid

The registration ID of the channel.

maxpagesize
Nullable<Int32>

Number of objects to return per page.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetTemplatesAsync.

MessageTemplateClient client = new MessageTemplateClient((string)null);

await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")))
{
}

This sample shows how to call GetTemplatesAsync with all parameters.

MessageTemplateClient client = new MessageTemplateClient((string)null);

await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234))
{
}

Applies to