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