forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReviews.hs
More file actions
165 lines (155 loc) · 4.92 KB
/
Reviews.hs
File metadata and controls
165 lines (155 loc) · 4.92 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
-----------------------------------------------------------------------------
-- |
-- License : BSD-3-Clause
-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
--
-- The reviews API as described on <http://developer.github.com/v3/pulls/reviews/>.
module GitHub.Endpoints.PullRequests.Reviews
( pullRequestReviewsR
, pullRequestReviews
, pullRequestReviews'
, pullRequestReviewR
, pullRequestReview
, pullRequestReview'
, pullRequestReviewCommentsR
, pullRequestReviewCommentsIO
, pullRequestReviewCommentsIO'
, module GitHub.Data
) where
import GitHub.Data
import GitHub.Data.Id (Id)
import GitHub.Internal.Prelude
import GitHub.Request
(Request, executeRequest', executeRequestMaybe)
import Prelude ()
-- | List reviews for a pull request.
-- See <https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request>
pullRequestReviewsR
:: Name Owner
-> Name Repo
-> IssueNumber
-> FetchCount
-> Request k (Vector Review)
pullRequestReviewsR owner repo prid =
pagedQuery
[ "repos"
, toPathPart owner
, toPathPart repo
, "pulls"
, toPathPart prid
, "reviews"
]
[]
-- | All reviews for a pull request given the repo owner, repo name and the pull
-- request id.
--
-- > pullRequestReviews "thoughtbot" "paperclip" (Id 101)
pullRequestReviews
:: Name Owner
-> Name Repo
-> IssueNumber
-> IO (Either Error (Vector Review))
pullRequestReviews owner repo prid =
executeRequest' $ pullRequestReviewsR owner repo prid FetchAll
-- | All reviews for a pull request given the repo owner, repo name and the pull
-- request id. With authentication.
--
-- > pullRequestReviews' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 101)
pullRequestReviews'
:: Maybe Auth
-> Name Owner
-> Name Repo
-> IssueNumber
-> IO (Either Error (Vector Review))
pullRequestReviews' auth owner repo pr =
executeRequestMaybe auth $ pullRequestReviewsR owner repo pr FetchAll
-- | Query a single pull request review.
-- see <https://developer.github.com/v3/pulls/reviews/#get-a-single-review>
pullRequestReviewR
:: Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> Request k Review
pullRequestReviewR owner repo prid rid =
query
[ "repos"
, toPathPart owner
, toPathPart repo
, "pulls"
, toPathPart prid
, "reviews"
, toPathPart rid
]
[]
-- | A detailed review on a pull request given the repo owner, repo name, pull
-- request id and review id.
--
-- > pullRequestReview "thoughtbot" "factory_girl" (Id 301819) (Id 332)
pullRequestReview
:: Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> IO (Either Error Review)
pullRequestReview owner repo prid rid =
executeRequest' $ pullRequestReviewR owner repo prid rid
-- | A detailed review on a pull request given the repo owner, repo name, pull
-- request id and review id. With authentication.
--
-- > pullRequestReview' (Just $ BasicAuth "github-username" "github-password")
-- > "thoughtbot" "factory_girl" (Id 301819) (Id 332)
pullRequestReview'
:: Maybe Auth
-> Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> IO (Either Error Review)
pullRequestReview' auth owner repo prid rid =
executeRequestMaybe auth $ pullRequestReviewR owner repo prid rid
-- | Query the comments for a single pull request review.
-- see <https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review>
pullRequestReviewCommentsR
:: Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> Request k [ReviewComment]
pullRequestReviewCommentsR owner repo prid rid =
query
[ "repos"
, toPathPart owner
, toPathPart repo
, "pulls"
, toPathPart prid
, "reviews"
, toPathPart rid
, "comments"
]
[]
-- | All comments for a review on a pull request given the repo owner, repo
-- name, pull request id and review id.
--
-- > pullRequestReviewComments "thoughtbot" "factory_girl" (Id 301819) (Id 332)
pullRequestReviewCommentsIO
:: Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> IO (Either Error [ReviewComment])
pullRequestReviewCommentsIO owner repo prid rid =
executeRequest' $ pullRequestReviewCommentsR owner repo prid rid
-- | All comments for a review on a pull request given the repo owner, repo
-- name, pull request id and review id. With authentication.
--
-- > pullRequestReviewComments' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "factory_girl" (Id 301819) (Id 332)
pullRequestReviewCommentsIO'
:: Maybe Auth
-> Name Owner
-> Name Repo
-> IssueNumber
-> Id Review
-> IO (Either Error [ReviewComment])
pullRequestReviewCommentsIO' auth owner repo prid rid =
executeRequestMaybe auth $ pullRequestReviewCommentsR owner repo prid rid