Imgur.API.Endpoints.Impl.AlbumEndpoint.UpdateAlbumAsync C# (CSharp) Méthode

UpdateAlbumAsync() public méthode

Update the information of an album. For anonymous albums, {albumId} should be the deletehash that is returned at creation.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public UpdateAlbumAsync ( string albumId, string title = null, string description = null, AlbumPrivacy privacy = null, AlbumLayout layout = null, string coverId = null, IEnumerable imageIds = null ) : Task
albumId string The id or deletehash of the album.
title string The title of the album.
description string The description of the album.
privacy AlbumPrivacy Sets the privacy level of the album.
layout AlbumLayout Sets the layout to display the album.
coverId string The Id of an image that you want to be the cover of the album.
imageIds IEnumerable The imageIds that you want to be included in the album.
Résultat Task
        public async Task<bool> UpdateAlbumAsync(string albumId, string title = null, string description = null,
            AlbumPrivacy? privacy = null, AlbumLayout? layout = null, string coverId = null,
            IEnumerable<string> imageIds = null)
        {
            if (string.IsNullOrWhiteSpace(albumId))
                throw new ArgumentNullException(nameof(albumId));

            var url = $"album/{albumId}";

            using (var request = RequestBuilder.UpdateAlbumRequest(url, title, description,
                privacy, layout, coverId, imageIds))
            {
                var updated = await SendRequestAsync<bool>(request).ConfigureAwait(false);
                return updated;
            }
        }
    }

Usage Example

        public async Task UpdateAlbumAsync_WithIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.UpdateAlbumAsync(null).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AlbumEndpoint::UpdateAlbumAsync