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

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

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