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