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

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

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