/// <summary> /// Updates the specified EmbeddedSIMDeviceState using PATCH. /// </summary> /// <param name="embeddedSIMDeviceStateToUpdate">The EmbeddedSIMDeviceState to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception> /// <returns>The updated EmbeddedSIMDeviceState.</returns> public async System.Threading.Tasks.Task <EmbeddedSIMDeviceState> UpdateAsync(EmbeddedSIMDeviceState embeddedSIMDeviceStateToUpdate, CancellationToken cancellationToken) { if (embeddedSIMDeviceStateToUpdate.AdditionalData != null) { if (embeddedSIMDeviceStateToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || embeddedSIMDeviceStateToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, embeddedSIMDeviceStateToUpdate.GetType().Name) }); } } if (embeddedSIMDeviceStateToUpdate.AdditionalData != null) { if (embeddedSIMDeviceStateToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || embeddedSIMDeviceStateToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, embeddedSIMDeviceStateToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <EmbeddedSIMDeviceState>(embeddedSIMDeviceStateToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="embeddedSIMDeviceStateToInitialize">The <see cref="EmbeddedSIMDeviceState"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(EmbeddedSIMDeviceState embeddedSIMDeviceStateToInitialize) { }
/// <summary> /// Updates the specified EmbeddedSIMDeviceState using PATCH. /// </summary> /// <param name="embeddedSIMDeviceStateToUpdate">The EmbeddedSIMDeviceState to update.</param> /// <returns>The updated EmbeddedSIMDeviceState.</returns> public System.Threading.Tasks.Task <EmbeddedSIMDeviceState> UpdateAsync(EmbeddedSIMDeviceState embeddedSIMDeviceStateToUpdate) { return(this.UpdateAsync(embeddedSIMDeviceStateToUpdate, CancellationToken.None)); }