|
| 1 | +-- | |
| 2 | +-- The Reactions API as described at |
| 3 | +-- <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28>. |
| 4 | +module GitHub.Endpoints.Reactions ( |
| 5 | + issueReactionsR, |
| 6 | + createIssueReactionR, |
| 7 | + deleteIssueReactionR, |
| 8 | + commentReactionsR, |
| 9 | + createCommentReactionR, |
| 10 | + deleteCommentReactionR, |
| 11 | + module GitHub.Data, |
| 12 | +) where |
| 13 | + |
| 14 | +import GitHub.Data |
| 15 | +import GitHub.Internal.Prelude |
| 16 | +import Prelude () |
| 17 | + |
| 18 | +-- | List reactions for an issue. |
| 19 | +-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue> |
| 20 | +issueReactionsR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector Reaction) |
| 21 | +issueReactionsR owner repo iid = |
| 22 | + pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"] [] |
| 23 | + |
| 24 | +-- | Create reaction for an issue comment. |
| 25 | +-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue> |
| 26 | +createIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> ReactionContent -> Request 'RW Reaction |
| 27 | +createIssueReactionR owner repo iid content = |
| 28 | + command Post parts (encode $ NewReaction content) |
| 29 | + where |
| 30 | + parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"] |
| 31 | + |
| 32 | +-- | Delete an issue comment reaction. |
| 33 | +-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction> |
| 34 | +deleteIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> Id Reaction -> GenRequest 'MtUnit 'RW () |
| 35 | +deleteIssueReactionR owner repo iid rid = |
| 36 | + Command Delete parts mempty |
| 37 | + where |
| 38 | + parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions", toPathPart rid] |
| 39 | + |
| 40 | +-- | List reactions for an issue comment. |
| 41 | +-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue-comment> |
| 42 | +commentReactionsR :: Name Owner -> Name Repo -> Id Comment -> FetchCount -> Request k (Vector Reaction) |
| 43 | +commentReactionsR owner repo cid = |
| 44 | + pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"] [] |
| 45 | + |
| 46 | +-- | Create reaction for an issue comment. |
| 47 | +-- See https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment |
| 48 | +createCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> ReactionContent -> Request 'RW Reaction |
| 49 | +createCommentReactionR owner repo cid content = |
| 50 | + command Post parts (encode $ NewReaction content) |
| 51 | + where |
| 52 | + parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"] |
| 53 | + |
| 54 | +-- | Delete an issue comment reaction. |
| 55 | +-- See <https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction> |
| 56 | +deleteCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> Id Reaction -> GenRequest 'MtUnit 'RW () |
| 57 | +deleteCommentReactionR owner repo cid rid = |
| 58 | + Command Delete parts mempty |
| 59 | + where |
| 60 | + parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions", toPathPart rid] |
0 commit comments