public async Task<ImgurResponse<Comment>> CreateCommentAsync(string caption, string imageId, int? parentId = null)
{
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.");
var keyPairs = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("image_id", imageId),
new KeyValuePair<string, string>("comment", caption)
};
if (parentId != null) keyPairs.Add(new KeyValuePair<string, string>("parent_id", parentId.ToString()));
var multi = new FormUrlEncodedContent(keyPairs.ToArray());
return
await
Request.SubmitImgurRequestAsync<Comment>(Request.HttpMethod.Post, CommentCreateUrl,
ImgurClient.Authentication, content: multi);
}