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