Imgur.API.Endpoints.Impl.AccountEndpoint.GetAlbumAsync C# (CSharp) Method

GetAlbumAsync() public method

Get additional information about an album, this works the same as the Album Endpoint.
/// 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 GetAlbumAsync ( string albumId, string username = "me" ) : Task
albumId string The album id.
username string The user account. Default: me
return Task
        public async Task<IAlbum> GetAlbumAsync(string albumId, string username = "me")
        {
            if (string.IsNullOrWhiteSpace(albumId))
                throw new ArgumentNullException(nameof(albumId));

            if (string.IsNullOrWhiteSpace(username))
                throw new ArgumentNullException(nameof(username));

            if (username.Equals("me", StringComparison.OrdinalIgnoreCase)
                && ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

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

            using (var request = AlbumRequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var album = await SendRequestAsync<Album>(request).ConfigureAwait(false);
                return album;
            }
        }

Usage Example

コード例 #1
0
        public async Task GetAlbumAsync_IsNotNull()
        {
            var client = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new AccountEndpoint(client);

            var album = await endpoint.GetAlbumAsync("SbU9Y", "sarah");

            Assert.IsNotNull(album);
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::GetAlbumAsync