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