/// <summary> /// Updates the specified AccessReviewInstance using PATCH. /// </summary> /// <param name="accessReviewInstanceToUpdate">The AccessReviewInstance 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 AccessReviewInstance.</returns> public async System.Threading.Tasks.Task <AccessReviewInstance> UpdateAsync(AccessReviewInstance accessReviewInstanceToUpdate, CancellationToken cancellationToken) { if (accessReviewInstanceToUpdate.AdditionalData != null) { if (accessReviewInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || accessReviewInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, accessReviewInstanceToUpdate.GetType().Name) }); } } if (accessReviewInstanceToUpdate.AdditionalData != null) { if (accessReviewInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || accessReviewInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, accessReviewInstanceToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <AccessReviewInstance>(accessReviewInstanceToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified AccessReviewInstance using POST. /// </summary> /// <param name="accessReviewInstanceToCreate">The AccessReviewInstance to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created AccessReviewInstance.</returns> public async System.Threading.Tasks.Task <AccessReviewInstance> CreateAsync(AccessReviewInstance accessReviewInstanceToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <AccessReviewInstance>(accessReviewInstanceToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="accessReviewInstanceToInitialize">The <see cref="AccessReviewInstance"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(AccessReviewInstance accessReviewInstanceToInitialize) { if (accessReviewInstanceToInitialize != null && accessReviewInstanceToInitialize.AdditionalData != null) { if (accessReviewInstanceToInitialize.Decisions != null && accessReviewInstanceToInitialize.Decisions.CurrentPage != null) { accessReviewInstanceToInitialize.Decisions.AdditionalData = accessReviewInstanceToInitialize.AdditionalData; object nextPageLink; accessReviewInstanceToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { accessReviewInstanceToInitialize.Decisions.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Adds the specified AccessReviewInstance to the collection via POST. /// </summary> /// <param name="accessReviewInstance">The AccessReviewInstance to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created AccessReviewInstance.</returns> public System.Threading.Tasks.Task <AccessReviewInstance> AddAsync(AccessReviewInstance accessReviewInstance, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <AccessReviewInstance>(accessReviewInstance, cancellationToken)); }
/// <summary> /// Adds the specified AccessReviewInstance to the collection via POST. /// </summary> /// <param name="accessReviewInstance">The AccessReviewInstance to add.</param> /// <returns>The created AccessReviewInstance.</returns> public System.Threading.Tasks.Task <AccessReviewInstance> AddAsync(AccessReviewInstance accessReviewInstance) { return(this.AddAsync(accessReviewInstance, CancellationToken.None)); }
/// <summary> /// Updates the specified AccessReviewInstance using PATCH. /// </summary> /// <param name="accessReviewInstanceToUpdate">The AccessReviewInstance to update.</param> /// <returns>The updated AccessReviewInstance.</returns> public System.Threading.Tasks.Task <AccessReviewInstance> UpdateAsync(AccessReviewInstance accessReviewInstanceToUpdate) { return(this.UpdateAsync(accessReviewInstanceToUpdate, CancellationToken.None)); }