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