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

GetGalleryProfileAsync() public method

The totals for a users gallery information.
/// 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 GetGalleryProfileAsync ( string username = "me" ) : Task
username string The user account. Default: me
return Task
        public async Task<IGalleryProfile> GetGalleryProfileAsync(string username = "me")
        {
            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}/gallery_profile";

            using (var request = ImageRequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var profile = await SendRequestAsync<GalleryProfile>(request).ConfigureAwait(false);
                return profile;
            }
        }
    }

Usage Example

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

            var profile = await endpoint.GetGalleryProfileAsync();

            Assert.IsFalse(profile.Trophies.Any());
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::GetGalleryProfileAsync