ImgurNet.ApiEndpoints.AccountEndpoint.GetAccountAlbumCountAsync C# (CSharp) Method

GetAccountAlbumCountAsync() public method

Gets the number of albums the user has uploaded.
This tests throws a "Imgur over capacity error right now.. No idea why
public GetAccountAlbumCountAsync ( string username = "me" ) : Task>
username string The username to get album count from. Can be ignored if using OAuth2, and it will use that account.
return Task>
		public async Task<ImgurResponse<int>> GetAccountAlbumCountAsync(string username = "me")
		{
			if (ImgurClient.Authentication == null)
				throw new InvalidAuthenticationException("Authentication can not be null. Set it in the main Imgur class.");

			if (username == "me" && !(ImgurClient.Authentication is OAuth2Authentication))
				throw new InvalidAuthenticationException("You need to use OAuth2Authentication to call this Endpoint.");

			return
				await
					Request.SubmitImgurRequestAsync<int>(Request.HttpMethod.Get, String.Format(AccountAlbumCountUrl, username),
						ImgurClient.Authentication);
		}
		

Usage Example

		public async Task TestGetAccountAlbumCount()
		{
			var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient();
			var accountEndpoint = new AccountEndpoint(imgurClient);
			var accountAlbumCount = await accountEndpoint.GetAccountAlbumCountAsync();

			// Assert the Response
			Assert.IsNotNull(accountAlbumCount.Data);
			Assert.AreEqual(accountAlbumCount.Success, true);
			Assert.AreEqual(accountAlbumCount.Status, HttpStatusCode.OK);
		}