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