/// <summary> /// Adds or replaces a digital twin. /// Status codes: /// 200 (OK): Success. /// 400 (Bad Request): The request is invalid. /// 412 (Precondition Failed): The model is decommissioned or the digital twin /// already exists (when using If-None-Match: *). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// The id of the digital twin. The id is unique within the service and case /// sensitive. /// </param> /// <param name='twin'> /// The digital twin instance being added. If provided, the $dtId property is /// ignored. /// </param> /// <param name='ifNoneMatch'> /// Only perform the operation if the entity does not already exist. Possible /// values include: '*' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> AddAsync(this IDigitalTwinsOperations operations, string id, object twin, string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AddWithHttpMessagesAsync(id, twin, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }