示例#1
0
 /// <summary>
 /// Adds the specified AndroidDeviceOwnerEnrollmentProfile to the collection via POST.
 /// </summary>
 /// <param name="androidDeviceOwnerEnrollmentProfile">The AndroidDeviceOwnerEnrollmentProfile to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created AndroidDeviceOwnerEnrollmentProfile.</returns>
 public System.Threading.Tasks.Task <AndroidDeviceOwnerEnrollmentProfile> AddAsync(AndroidDeviceOwnerEnrollmentProfile androidDeviceOwnerEnrollmentProfile, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <AndroidDeviceOwnerEnrollmentProfile>(androidDeviceOwnerEnrollmentProfile, cancellationToken));
 }
示例#2
0
 /// <summary>
 /// Adds the specified AndroidDeviceOwnerEnrollmentProfile to the collection via POST.
 /// </summary>
 /// <param name="androidDeviceOwnerEnrollmentProfile">The AndroidDeviceOwnerEnrollmentProfile to add.</param>
 /// <returns>The created AndroidDeviceOwnerEnrollmentProfile.</returns>
 public System.Threading.Tasks.Task <AndroidDeviceOwnerEnrollmentProfile> AddAsync(AndroidDeviceOwnerEnrollmentProfile androidDeviceOwnerEnrollmentProfile)
 {
     return(this.AddAsync(androidDeviceOwnerEnrollmentProfile, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="androidDeviceOwnerEnrollmentProfileToInitialize">The <see cref="AndroidDeviceOwnerEnrollmentProfile"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(AndroidDeviceOwnerEnrollmentProfile androidDeviceOwnerEnrollmentProfileToInitialize)
 {
 }
        /// <summary>
        /// Creates the specified AndroidDeviceOwnerEnrollmentProfile using POST.
        /// </summary>
        /// <param name="androidDeviceOwnerEnrollmentProfileToCreate">The AndroidDeviceOwnerEnrollmentProfile to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created AndroidDeviceOwnerEnrollmentProfile.</returns>
        public async System.Threading.Tasks.Task <AndroidDeviceOwnerEnrollmentProfile> CreateAsync(AndroidDeviceOwnerEnrollmentProfile androidDeviceOwnerEnrollmentProfileToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <AndroidDeviceOwnerEnrollmentProfile>(androidDeviceOwnerEnrollmentProfileToCreate, cancellationToken).ConfigureAwait(false);

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

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