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

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

            return(newEntity);
        }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="depMacOSEnrollmentProfileToInitialize">The <see cref="DepMacOSEnrollmentProfile"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(DepMacOSEnrollmentProfile depMacOSEnrollmentProfileToInitialize)
 {
 }