コード例 #1
0
 /// <summary>
 /// Invoke a digital twin root level command.
 /// </summary>
 /// <remarks>
 /// Invoke a digital twin root level command.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='commandName'>
 /// </param>
 /// <param name='payload'>
 /// </param>
 /// <param name='connectTimeoutInSeconds'>
 /// Maximum interval of time, in seconds, that the digital twin command will
 /// wait for the answer.
 /// </param>
 /// <param name='responseTimeoutInSeconds'>
 /// Maximum interval of time, in seconds, that the digital twin command will
 /// wait for the answer.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> InvokeRootLevelCommandAsync(this IDigitalTwin operations, string id, string commandName, string payload = default, int?connectTimeoutInSeconds = default(int?), int?responseTimeoutInSeconds = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.InvokeRootLevelCommandWithHttpMessagesAsync(id, commandName, payload, connectTimeoutInSeconds, responseTimeoutInSeconds, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #2
0
 /// <summary>
 /// Gets a digital twin.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Digital Twin ID.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> GetDigitalTwinAsync(this IDigitalTwin operations, string id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDigitalTwinWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #3
0
 /// <summary>
 /// Updates a digital twin.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Digital Twin ID.
 /// </param>
 /// <param name='digitalTwinPatch'>
 /// json-patch contents to update.
 /// </param>
 /// <param name='ifMatch'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DigitalTwinUpdateHeaders> UpdateDigitalTwinAsync(this IDigitalTwin operations, string id, string digitalTwinPatch, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateDigitalTwinWithHttpMessagesAsync(id, digitalTwinPatch, ifMatch, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Headers);
     }
 }
コード例 #4
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     DigitalTwin           = new DigitalTwin(this);
     BaseUri               = new System.Uri("https://fully-qualified-iothubname.azure-devices.net");
     ApiVersion            = "2020-09-30";
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }