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

GetAlbumIdsAsync() public method

Return a list of all of the album IDs.
/// 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 GetAlbumIdsAsync ( string username = "me", int page = null ) : Task>
username string The user account. Default: me
page int Allows you to set the page number so you don't have to retrieve all the data at once. Default: null
return Task>
        public async Task<IEnumerable<string>> GetAlbumIdsAsync(string username = "me", int? page = null)
        {
            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}/albums/ids/{page}";

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

Usage Example

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

            var albums = await endpoint.GetAlbumIdsAsync("sarah");

            Assert.AreEqual(50, albums.Count());
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::GetAlbumIdsAsync