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