/// <summary>
        /// Creates the specified PrintUsageSummaryByUser using POST.
        /// </summary>
        /// <param name="printUsageSummaryByUserToCreate">The PrintUsageSummaryByUser to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created PrintUsageSummaryByUser.</returns>
        public async System.Threading.Tasks.Task <PrintUsageSummaryByUser> CreateAsync(PrintUsageSummaryByUser printUsageSummaryByUserToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <PrintUsageSummaryByUser>(printUsageSummaryByUserToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified PrintUsageSummaryByUser to the collection via POST.
 /// </summary>
 /// <param name="PrintUsageSummaryByUser">The PrintUsageSummaryByUser to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created PrintUsageSummaryByUser.</returns>
 public System.Threading.Tasks.Task <PrintUsageSummaryByUser> AddAsync(PrintUsageSummaryByUser PrintUsageSummaryByUser, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <PrintUsageSummaryByUser>(PrintUsageSummaryByUser, cancellationToken));
 }
 /// <summary>
 /// Adds the specified PrintUsageSummaryByUser to the collection via POST.
 /// </summary>
 /// <param name="PrintUsageSummaryByUser">The PrintUsageSummaryByUser to add.</param>
 /// <returns>The created PrintUsageSummaryByUser.</returns>
 public System.Threading.Tasks.Task <PrintUsageSummaryByUser> AddAsync(PrintUsageSummaryByUser PrintUsageSummaryByUser)
 {
     return(this.AddAsync(PrintUsageSummaryByUser, CancellationToken.None));
 }