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