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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }