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