/// <summary>
        /// Updates the specified CaseOperation using PATCH.
        /// </summary>
        /// <param name="caseOperationToUpdate">The CaseOperation 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 CaseOperation.</returns>
        public async System.Threading.Tasks.Task <CaseOperation> UpdateAsync(CaseOperation caseOperationToUpdate, CancellationToken cancellationToken)
        {
            if (caseOperationToUpdate.AdditionalData != null)
            {
                if (caseOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    caseOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, caseOperationToUpdate.GetType().Name)
                    });
                }
            }
            if (caseOperationToUpdate.AdditionalData != null)
            {
                if (caseOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    caseOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, caseOperationToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <CaseOperation>(caseOperationToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified CaseOperation to the collection via POST.
 /// </summary>
 /// <param name="caseOperation">The CaseOperation to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> AddAsync(CaseOperation caseOperation, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <CaseOperation>(caseOperation, cancellationToken));
 }
 /// <summary>
 /// Adds the specified CaseOperation to the collection via POST.
 /// </summary>
 /// <param name="caseOperation">The CaseOperation to add.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> AddAsync(CaseOperation caseOperation)
 {
     return(this.AddAsync(caseOperation, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified CaseOperation using POST.
 /// </summary>
 /// <param name="caseOperationToCreate">The CaseOperation to create.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> CreateAsync(CaseOperation caseOperationToCreate)
 {
     return(this.CreateAsync(caseOperationToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="caseOperationToInitialize">The <see cref="CaseOperation"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(CaseOperation caseOperationToInitialize)
 {
 }