ImgurNet.ApiEndpoints.CommentEndpoint.GetCommentAsync C# (CSharp) Method

GetCommentAsync() public method

Get information about a specific comment
public GetCommentAsync ( System.Int64 commentId ) : Task>
commentId System.Int64 The Id of the comment
return Task>
		public async Task<ImgurResponse<Comment>> GetCommentAsync(Int64 commentId)
		{
			if (ImgurClient.Authentication == null)
				throw new InvalidAuthenticationException("Authentication can not be null. Set it in the main Imgur class.");

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

			return
				await
					Request.SubmitImgurRequestAsync<Comment>(Request.HttpMethod.Get, String.Format(CommentDetailsUrl, commentId),
						ImgurClient.Authentication);
		}

Usage Example

		public async Task TestVoteComment()
		{
			var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient();
			var commentEndpoint = new CommentEndpoint(imgurClient);
			var comment = await commentEndpoint.GetCommentAsync(193421419);
			var votedComment = await commentEndpoint.VoteCommentAsync(comment.Data.Id, VoteDirection.Up);

			// Assert the Reponse
			Assert.IsNotNull(votedComment.Data);
			Assert.AreEqual(votedComment.Success, true);
			Assert.AreEqual(votedComment.Status, HttpStatusCode.OK);
		}
All Usage Examples Of ImgurNet.ApiEndpoints.CommentEndpoint::GetCommentAsync