Ejemplo n.º 1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="androidDeviceOwnerScepCertificateProfileToInitialize">The <see cref="AndroidDeviceOwnerScepCertificateProfile"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(AndroidDeviceOwnerScepCertificateProfile androidDeviceOwnerScepCertificateProfileToInitialize)
        {
            if (androidDeviceOwnerScepCertificateProfileToInitialize != null && androidDeviceOwnerScepCertificateProfileToInitialize.AdditionalData != null)
            {
                if (androidDeviceOwnerScepCertificateProfileToInitialize.ManagedDeviceCertificateStates != null && androidDeviceOwnerScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.CurrentPage != null)
                {
                    androidDeviceOwnerScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.AdditionalData = androidDeviceOwnerScepCertificateProfileToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        androidDeviceOwnerScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the specified AndroidDeviceOwnerScepCertificateProfile using POST.
        /// </summary>
        /// <param name="androidDeviceOwnerScepCertificateProfileToCreate">The AndroidDeviceOwnerScepCertificateProfile to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created AndroidDeviceOwnerScepCertificateProfile.</returns>
        public async System.Threading.Tasks.Task <AndroidDeviceOwnerScepCertificateProfile> CreateAsync(AndroidDeviceOwnerScepCertificateProfile androidDeviceOwnerScepCertificateProfileToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <AndroidDeviceOwnerScepCertificateProfile>(androidDeviceOwnerScepCertificateProfileToCreate, cancellationToken).ConfigureAwait(false);

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

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