/// <summary> /// Updates the specified ReviewSet using PATCH. /// </summary> /// <param name="reviewSetToUpdate">The ReviewSet to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <exception cref="Microsoft.Graph.ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception> /// <returns>The updated ReviewSet.</returns> public async System.Threading.Tasks.Task <ReviewSet> UpdateAsync(ReviewSet reviewSetToUpdate, CancellationToken cancellationToken) { if (reviewSetToUpdate.AdditionalData != null) { if (reviewSetToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) || reviewSetToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode)) { throw new Microsoft.Graph.ClientException( new Microsoft.Graph.Error { Code = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, reviewSetToUpdate.GetType().Name) }); } } if (reviewSetToUpdate.AdditionalData != null) { if (reviewSetToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) || reviewSetToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode)) { throw new Microsoft.Graph.ClientException( new Microsoft.Graph.Error { Code = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, reviewSetToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <ReviewSet>(reviewSetToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified ReviewSet using POST. /// </summary> /// <param name="reviewSetToCreate">The ReviewSet to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ReviewSet.</returns> public async System.Threading.Tasks.Task <ReviewSet> CreateAsync(ReviewSet reviewSetToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <ReviewSet>(reviewSetToCreate, cancellationToken).ConfigureAwait(false); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="reviewSetToInitialize">The <see cref="ReviewSet"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(ReviewSet reviewSetToInitialize) { if (reviewSetToInitialize != null && reviewSetToInitialize.AdditionalData != null) { if (reviewSetToInitialize.Queries != null && reviewSetToInitialize.Queries.CurrentPage != null) { reviewSetToInitialize.Queries.AdditionalData = reviewSetToInitialize.AdditionalData; object nextPageLink; reviewSetToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { reviewSetToInitialize.Queries.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Adds the specified ReviewSet to the collection via POST. /// </summary> /// <param name="reviewSet">The ReviewSet to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ReviewSet.</returns> public System.Threading.Tasks.Task <ReviewSet> AddAsync(ReviewSet reviewSet, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <ReviewSet>(reviewSet, cancellationToken)); }
/// <summary> /// Adds the specified ReviewSet to the collection via POST. /// </summary> /// <param name="reviewSet">The ReviewSet to add.</param> /// <returns>The created ReviewSet.</returns> public System.Threading.Tasks.Task <ReviewSet> AddAsync(ReviewSet reviewSet) { return(this.AddAsync(reviewSet, CancellationToken.None)); }
/// <summary> /// Creates the specified ReviewSet using POST. /// </summary> /// <param name="reviewSetToCreate">The ReviewSet to create.</param> /// <returns>The created ReviewSet.</returns> public System.Threading.Tasks.Task <ReviewSet> CreateAsync(ReviewSet reviewSetToCreate) { return(this.CreateAsync(reviewSetToCreate, CancellationToken.None)); }