1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
-- | The Github issue comments API from
-- <http://developer.github.com/v3/issues/comments/>.
module Github.Issues.Comments (
comment
,comments
,comments'
-- * Modifying Comments
-- |
-- Only authenticated users may create and edit comments.
,GithubAuth(..)
,createComment
,editComment
,module Github.Data
) where
import Github.Data
import Github.Private
-- | A specific comment, by ID.
--
-- > comment "thoughtbot" "paperclip" 1468184
comment :: String -> String -> Int -> IO (Either Error IssueComment)
comment user reqRepoName reqCommentId =
githubGet ["repos", user, reqRepoName, "issues", "comments", show reqCommentId]
-- | All comments on an issue, by the issue's number.
--
-- > comments "thoughtbot" "paperclip" 635
comments :: String -> String -> Int -> IO (Either Error [IssueComment])
comments user reqRepoName reqIssueNumber =
githubGet ["repos", user, reqRepoName, "issues", show reqIssueNumber, "comments"]
-- | All comments on an issue, by the issue's number, using authentication.
--
-- > comments' (GithubUser (user, password)) "thoughtbot" "paperclip" 635
comments' :: Maybe GithubAuth -> String -> String -> Int -> IO (Either Error [IssueComment])
comments' auth user reqRepoName reqIssueNumber =
githubGet' auth ["repos", user, reqRepoName, "issues", show reqIssueNumber, "comments"]
-- |
-- Create a new comment.
--
-- > createComment (GithubUser (user, password)) user repo issue
-- > "some words"
createComment :: GithubAuth -> String -> String -> Int -> String
-> IO (Either Error Comment)
createComment auth user repo iss body =
githubPost auth
["repos", user, repo, "issues", show iss, "comments"] (NewComment body)
-- |
-- Edit a comment.
--
-- > editComment (GithubUser (user, password)) user repo commentid
-- > "new words"
editComment :: GithubAuth -> String -> String -> Int -> String
-> IO (Either Error Comment)
editComment auth user repo commid body =
githubPatch auth ["repos", user, repo, "issues", "comments", show commid]
(EditComment body)
|