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