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