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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Updates the specified ProfilePhoto using PATCH.
        /// </summary>
        /// <param name="profilePhotoToUpdate">The ProfilePhoto to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The updated ProfilePhoto.</returns>
        public async System.Threading.Tasks.Task <ProfilePhoto> UpdateAsync(ProfilePhoto profilePhotoToUpdate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ProfilePhoto>(profilePhotoToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Esempio n. 4
0
 /// <summary>
 /// Adds the specified ProfilePhoto to the collection via POST.
 /// </summary>
 /// <param name="profilePhoto">The ProfilePhoto to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ProfilePhoto.</returns>
 public System.Threading.Tasks.Task <ProfilePhoto> AddAsync(ProfilePhoto profilePhoto, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ProfilePhoto>(profilePhoto, cancellationToken));
 }
Esempio n. 5
0
 /// <summary>
 /// Adds the specified ProfilePhoto to the collection via POST.
 /// </summary>
 /// <param name="profilePhoto">The ProfilePhoto to add.</param>
 /// <returns>The created ProfilePhoto.</returns>
 public System.Threading.Tasks.Task <ProfilePhoto> AddAsync(ProfilePhoto profilePhoto)
 {
     return(this.AddAsync(profilePhoto, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified ProfilePhoto using PUT.
 /// </summary>
 /// <param name="profilePhotoToCreate">The ProfilePhoto to create.</param>
 /// <returns>The created ProfilePhoto.</returns>
 public Task <ProfilePhoto> CreateAsync(ProfilePhoto profilePhotoToCreate)
 {
     return(this.CreateAsync(profilePhotoToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="profilePhotoToInitialize">The <see cref="ProfilePhoto"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ProfilePhoto profilePhotoToInitialize)
 {
 }
 /// <summary>
 /// Creates the specified ProfilePhoto using PUT.
 /// </summary>
 /// <param name="profilePhotoToCreate">The ProfilePhoto to create.</param>
 /// <returns>The created ProfilePhoto.</returns>
 public System.Threading.Tasks.Task <ProfilePhoto> CreateAsync(ProfilePhoto profilePhotoToCreate)
 {
     return(this.CreateAsync(profilePhotoToCreate, CancellationToken.None));
 }