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

ReportCommentAsync() public method

Report a comment (made by a loser/douchebag) for being inappropriate
public ReportCommentAsync ( System.Int64 commentId ) : Task>
commentId System.Int64 The Id of the comment
return Task>
		public async Task<ImgurResponse<object>> ReportCommentAsync(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<object>(Request.HttpMethod.Post, String.Format(CommentReportUrl, commentId),
						ImgurClient.Authentication);
		}
	}

Usage Example

		public async Task TestReportComment()
		{
			var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient();
			var commentEndpoint = new CommentEndpoint(imgurClient);
			var comment = await commentEndpoint.ReportCommentAsync(193420645);

			// Assert the Reponse
			Assert.AreEqual(comment.Success, true);
			Assert.AreEqual(comment.Status, HttpStatusCode.OK);
		}