/// <summary> /// Creates the specified UnsupportedDeviceConfiguration using POST. /// </summary> /// <param name="unsupportedDeviceConfigurationToCreate">The UnsupportedDeviceConfiguration to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created UnsupportedDeviceConfiguration.</returns> public async System.Threading.Tasks.Task <UnsupportedDeviceConfiguration> CreateAsync(UnsupportedDeviceConfiguration unsupportedDeviceConfigurationToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <UnsupportedDeviceConfiguration>(unsupportedDeviceConfigurationToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="unsupportedDeviceConfigurationToInitialize">The <see cref="UnsupportedDeviceConfiguration"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(UnsupportedDeviceConfiguration unsupportedDeviceConfigurationToInitialize) { }
/// <summary> /// Creates the specified UnsupportedDeviceConfiguration using POST. /// </summary> /// <param name="unsupportedDeviceConfigurationToCreate">The UnsupportedDeviceConfiguration to create.</param> /// <returns>The created UnsupportedDeviceConfiguration.</returns> public System.Threading.Tasks.Task <UnsupportedDeviceConfiguration> CreateAsync(UnsupportedDeviceConfiguration unsupportedDeviceConfigurationToCreate) { return(this.CreateAsync(unsupportedDeviceConfigurationToCreate, CancellationToken.None)); }
/// <summary> /// Updates the specified UnsupportedDeviceConfiguration using PATCH. /// </summary> /// <param name="unsupportedDeviceConfigurationToUpdate">The UnsupportedDeviceConfiguration 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 UnsupportedDeviceConfiguration.</returns> public async System.Threading.Tasks.Task <UnsupportedDeviceConfiguration> UpdateAsync(UnsupportedDeviceConfiguration unsupportedDeviceConfigurationToUpdate, CancellationToken cancellationToken) { if (unsupportedDeviceConfigurationToUpdate.AdditionalData != null) { if (unsupportedDeviceConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || unsupportedDeviceConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unsupportedDeviceConfigurationToUpdate.GetType().Name) }); } } if (unsupportedDeviceConfigurationToUpdate.AdditionalData != null) { if (unsupportedDeviceConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || unsupportedDeviceConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unsupportedDeviceConfigurationToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <UnsupportedDeviceConfiguration>(unsupportedDeviceConfigurationToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }