Aracılığıyla paylaş


DigitalTwinsClient.GetModelsAsync(GetModelsOptions, CancellationToken) Method

Definition

Gets the list of models by iterating through a collection asynchronously.

public virtual Azure.AsyncPageable<Azure.DigitalTwins.Core.DigitalTwinsModelData> GetModelsAsync (Azure.DigitalTwins.Core.GetModelsOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetModelsAsync : Azure.DigitalTwins.Core.GetModelsOptions * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.DigitalTwins.Core.DigitalTwinsModelData>
override this.GetModelsAsync : Azure.DigitalTwins.Core.GetModelsOptions * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.DigitalTwins.Core.DigitalTwinsModelData>
Public Overridable Function GetModelsAsync (Optional options As GetModelsOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of DigitalTwinsModelData)

Parameters

options
GetModelsOptions

The optional parameters for this request. If null, the default option values will be used.

cancellationToken
CancellationToken

The cancellation token.

Returns

The pageable list AsyncPageable<T> of application/json models and the HTTP response.

Exceptions

The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.

Examples

AsyncPageable<DigitalTwinsModelData> allModels = client.GetModelsAsync();
await foreach (DigitalTwinsModelData model in allModels)
{
    Console.WriteLine($"Retrieved model '{model.Id}', " +
        $"display name '{model.LanguageDisplayNames["en"]}', " +
        $"uploaded on '{model.UploadedOn}', " +
        $"and decommissioned '{model.Decommissioned}'");
}

Remarks

For more samples, see our repo samples.

Applies to

See also