Пример #1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="deviceCompliancePolicySettingStateSummaryToInitialize">The <see cref="DeviceCompliancePolicySettingStateSummary"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(DeviceCompliancePolicySettingStateSummary deviceCompliancePolicySettingStateSummaryToInitialize)
        {

            if (deviceCompliancePolicySettingStateSummaryToInitialize != null && deviceCompliancePolicySettingStateSummaryToInitialize.AdditionalData != null)
            {

                if (deviceCompliancePolicySettingStateSummaryToInitialize.DeviceComplianceSettingStates != null && deviceCompliancePolicySettingStateSummaryToInitialize.DeviceComplianceSettingStates.CurrentPage != null)
                {
                    deviceCompliancePolicySettingStateSummaryToInitialize.DeviceComplianceSettingStates.AdditionalData = deviceCompliancePolicySettingStateSummaryToInitialize.AdditionalData;

                    object nextPageLink;
                    deviceCompliancePolicySettingStateSummaryToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        deviceCompliancePolicySettingStateSummaryToInitialize.DeviceComplianceSettingStates.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

            }


        }
Пример #2
0
 /// <summary>
 /// Adds the specified DeviceCompliancePolicySettingStateSummary to the collection via POST.
 /// </summary>
 /// <param name="deviceCompliancePolicySettingStateSummary">The DeviceCompliancePolicySettingStateSummary to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created DeviceCompliancePolicySettingStateSummary.</returns>
 public System.Threading.Tasks.Task <DeviceCompliancePolicySettingStateSummary> AddAsync(DeviceCompliancePolicySettingStateSummary deviceCompliancePolicySettingStateSummary, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <DeviceCompliancePolicySettingStateSummary>(deviceCompliancePolicySettingStateSummary, cancellationToken));
 }
Пример #3
0
 /// <summary>
 /// Adds the specified DeviceCompliancePolicySettingStateSummary to the collection via POST.
 /// </summary>
 /// <param name="deviceCompliancePolicySettingStateSummary">The DeviceCompliancePolicySettingStateSummary to add.</param>
 /// <returns>The created DeviceCompliancePolicySettingStateSummary.</returns>
 public System.Threading.Tasks.Task <DeviceCompliancePolicySettingStateSummary> AddAsync(DeviceCompliancePolicySettingStateSummary deviceCompliancePolicySettingStateSummary)
 {
     return(this.AddAsync(deviceCompliancePolicySettingStateSummary, CancellationToken.None));
 }
Пример #4
0
        /// <summary>
        /// Creates the specified DeviceCompliancePolicySettingStateSummary using POST.
        /// </summary>
        /// <param name="deviceCompliancePolicySettingStateSummaryToCreate">The DeviceCompliancePolicySettingStateSummary to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created DeviceCompliancePolicySettingStateSummary.</returns>
        public async System.Threading.Tasks.Task <DeviceCompliancePolicySettingStateSummary> CreateAsync(DeviceCompliancePolicySettingStateSummary deviceCompliancePolicySettingStateSummaryToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <DeviceCompliancePolicySettingStateSummary>(deviceCompliancePolicySettingStateSummaryToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Пример #6
0
 /// <summary>
 /// Creates the specified DeviceCompliancePolicySettingStateSummary using POST.
 /// </summary>
 /// <param name="deviceCompliancePolicySettingStateSummaryToCreate">The DeviceCompliancePolicySettingStateSummary to create.</param>
 /// <returns>The created DeviceCompliancePolicySettingStateSummary.</returns>
 public System.Threading.Tasks.Task<DeviceCompliancePolicySettingStateSummary> CreateAsync(DeviceCompliancePolicySettingStateSummary deviceCompliancePolicySettingStateSummaryToCreate)
 {
     return this.CreateAsync(deviceCompliancePolicySettingStateSummaryToCreate, CancellationToken.None);
 }