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

GetAccountFavoritesAsync() public method

Returns the users favorited images. OAuth authentication required.
/// 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 GetAccountFavoritesAsync ( ) : Task>
return Task>
        public async Task<IEnumerable<IGalleryItem>> GetAccountFavoritesAsync()
        {
            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = "account/me/favorites";

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

Usage Example

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

            var favourites = await endpoint.GetAccountFavoritesAsync();

            Assert.IsTrue(favourites.Any());
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::GetAccountFavoritesAsync