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