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

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

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