DigitalTwinsClient.GetModelAsync(String, CancellationToken) 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.
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
- String
The Id of the model.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
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.
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
See also
Azure SDK for .NET