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