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

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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified ThumbnailSet to the collection via POST.
 /// </summary>
 /// <param name="thumbnailSet">The ThumbnailSet to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ThumbnailSet.</returns>
 public System.Threading.Tasks.Task <ThumbnailSet> AddAsync(ThumbnailSet thumbnailSet, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ThumbnailSet>(thumbnailSet, cancellationToken));
 }
 /// <summary>
 /// Adds the specified ThumbnailSet to the collection via POST.
 /// </summary>
 /// <param name="thumbnailSet">The ThumbnailSet to add.</param>
 /// <returns>The created ThumbnailSet.</returns>
 public System.Threading.Tasks.Task <ThumbnailSet> AddAsync(ThumbnailSet thumbnailSet)
 {
     return(this.AddAsync(thumbnailSet, CancellationToken.None));
 }
示例#6
0
 /// <summary>
 /// Creates the specified ThumbnailSet using POST.
 /// </summary>
 /// <param name="thumbnailSetToCreate">The ThumbnailSet to create.</param>
 /// <returns>The created ThumbnailSet.</returns>
 public System.Threading.Tasks.Task <ThumbnailSet> CreateAsync(ThumbnailSet thumbnailSetToCreate)
 {
     return(this.CreateAsync(thumbnailSetToCreate, CancellationToken.None));
 }
示例#7
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="thumbnailSetToInitialize">The <see cref="ThumbnailSet"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ThumbnailSet thumbnailSetToInitialize)
 {
 }
示例#8
0
 /// <summary>
 /// Creates the specified ThumbnailSet using PUT.
 /// </summary>
 /// <param name="thumbnailSetToCreate">The ThumbnailSet to create.</param>
 /// <returns>The created ThumbnailSet.</returns>
 public Task <ThumbnailSet> CreateAsync(ThumbnailSet thumbnailSetToCreate)
 {
     return(this.CreateAsync(thumbnailSetToCreate, CancellationToken.None));
 }