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

GetAccountSubmissionsAsync() public method

Return the images a user has submitted to the gallery.
/// 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 GetAccountSubmissionsAsync ( string username = "me", int page = null ) : Task>
username string The user account. Default: me
page int Set the page number so you don't have to retrieve all the data at once. Default: null
return Task>
        public async Task<IEnumerable<IGalleryItem>> GetAccountSubmissionsAsync(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}/submissions/{page}";

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

Usage Example

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

            var submissions = await endpoint.GetAccountSubmissionsAsync("sarah");

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