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