DigitalTwinsClient.GetModelAsync(String, CancellationToken) Method

Definition

Gets a model, including the model metadata and the model definition asynchronously.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData>> GetModelAsync (string modelId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetModelAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData>>
override this.GetModelAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData>>
Public Overridable Function GetModelAsync (modelId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of DigitalTwinsModelData))

Parameters

modelId
System.String

The Id of the model.

cancellationToken
System.Threading.CancellationToken

The cancellation token.

Returns

System.Threading.Tasks.Task<Response<DigitalTwinsModelData>>

The application/json model and the http response Response<T>.

Exceptions

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

System.ArgumentNullException

The exception is thrown when modelId is null.

Examples

Response<DigitalTwinsModelData> sampleModelResponse = await client.GetModelAsync(sampleModelId);
Console.WriteLine($"Retrieved model '{sampleModelResponse.Value.Id}'.");

Remarks

For more samples, see our repo samples.

Applies to