@@ -12,6 +12,12 @@ module GitHub.Endpoints.PullRequests (
1212 pullRequest' ,
1313 pullRequest ,
1414 pullRequestR ,
15+ pullRequestDiff' ,
16+ pullRequestDiff ,
17+ pullRequestDiffR ,
18+ pullRequestPatch' ,
19+ pullRequestPatch ,
20+ pullRequestPatchR ,
1521 createPullRequest ,
1622 createPullRequestR ,
1723 updatePullRequest ,
@@ -33,6 +39,7 @@ import GitHub.Data
3339import GitHub.Internal.Prelude
3440import GitHub.Request
3541import Prelude ()
42+ import Data.ByteString.Lazy (ByteString )
3643
3744-- | All open pull requests for the repo, by owner and repo name.
3845--
@@ -60,25 +67,60 @@ pullRequestsForR user repo opts = pagedQuery
6067 [" repos" , toPathPart user, toPathPart repo, " pulls" ]
6168 (prModToQueryString opts)
6269
70+ -- | Obtain the diff of a pull request
71+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
72+ pullRequestDiff' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString )
73+ pullRequestDiff' auth user repo prid =
74+ executeRequestMaybe auth $ pullRequestDiffR user repo prid
75+
76+ -- | Obtain the diff of a pull request
77+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
78+ pullRequestDiff :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString )
79+ pullRequestDiff = pullRequestDiff' Nothing
80+
81+ -- | Query a single pull request to obtain the diff
82+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
83+ pullRequestDiffR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtDiff rw ByteString
84+ pullRequestDiffR user repo prid =
85+ Query [" repos" , toPathPart user, toPathPart repo, " pulls" , toPathPart prid] []
86+
87+ -- | Obtain the patch of a pull request
88+ --
89+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
90+ pullRequestPatch' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString )
91+ pullRequestPatch' auth user repo prid =
92+ executeRequestMaybe auth $ pullRequestPatchR user repo prid
93+
94+ -- | Obtain the patch of a pull request
95+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
96+ pullRequestPatch :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString )
97+ pullRequestPatch = pullRequestPatch' Nothing
98+
99+ -- | Query a single pull request to obtain the patch
100+ -- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
101+ pullRequestPatchR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtPatch rw ByteString
102+ pullRequestPatchR user repo prid =
103+ Query [" repos" , toPathPart user, toPathPart repo, " pulls" , toPathPart prid] []
104+
63105-- | A detailed pull request, which has much more information. This takes the
64106-- repo owner and name along with the number assigned to the pull request.
65107-- With authentification.
66108--
67109-- > pullRequest' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 562
68- pullRequest' :: Maybe Auth -> Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error PullRequest )
110+ pullRequest' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest )
69111pullRequest' auth user repo prid =
70112 executeRequestMaybe auth $ pullRequestR user repo prid
71113
72114-- | A detailed pull request, which has much more information. This takes the
73115-- repo owner and name along with the number assigned to the pull request.
74116--
75117-- > pullRequest "thoughtbot" "paperclip" 562
76- pullRequest :: Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error PullRequest )
118+ pullRequest :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest )
77119pullRequest = pullRequest' Nothing
78120
79121-- | Query a single pull request.
80122-- See <https://developer.github.com/v3/pulls/#get-a-single-pull-request>
81- pullRequestR :: Name Owner -> Name Repo -> Id PullRequest -> Request k PullRequest
123+ pullRequestR :: Name Owner -> Name Repo -> IssueNumber -> Request k PullRequest
82124pullRequestR user repo prid =
83125 query [" repos" , toPathPart user, toPathPart repo, " pulls" , toPathPart prid] []
84126
@@ -100,15 +142,15 @@ createPullRequestR user repo cpr =
100142 command Post [" repos" , toPathPart user, toPathPart repo, " pulls" ] (encode cpr)
101143
102144-- | Update a pull request
103- updatePullRequest :: Auth -> Name Owner -> Name Repo -> Id PullRequest -> EditPullRequest -> IO (Either Error PullRequest )
145+ updatePullRequest :: Auth -> Name Owner -> Name Repo -> IssueNumber -> EditPullRequest -> IO (Either Error PullRequest )
104146updatePullRequest auth user repo prid epr =
105147 executeRequest auth $ updatePullRequestR user repo prid epr
106148
107149-- | Update a pull request.
108150-- See <https://developer.github.com/v3/pulls/#update-a-pull-request>
109151updatePullRequestR :: Name Owner
110152 -> Name Repo
111- -> Id PullRequest
153+ -> IssueNumber
112154 -> EditPullRequest
113155 -> Request 'RW PullRequest
114156updatePullRequestR user repo prid epr =
@@ -119,20 +161,20 @@ updatePullRequestR user repo prid epr =
119161-- With authentification.
120162--
121163-- > pullRequestCommits' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 688
122- pullRequestCommits' :: Maybe Auth -> Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error (Vector Commit ))
164+ pullRequestCommits' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit ))
123165pullRequestCommits' auth user repo prid =
124166 executeRequestMaybe auth $ pullRequestCommitsR user repo prid FetchAll
125167
126168-- | All the commits on a pull request, given the repo owner, repo name, and
127169-- the number of the pull request.
128170--
129171-- > pullRequestCommits "thoughtbot" "paperclip" 688
130- pullRequestCommitsIO :: Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error (Vector Commit ))
172+ pullRequestCommitsIO :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit ))
131173pullRequestCommitsIO = pullRequestCommits' Nothing
132174
133175-- | List commits on a pull request.
134176-- See <https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request>
135- pullRequestCommitsR :: Name Owner -> Name Repo -> Id PullRequest -> FetchCount -> Request k (Vector Commit )
177+ pullRequestCommitsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Commit )
136178pullRequestCommitsR user repo prid =
137179 pagedQuery [" repos" , toPathPart user, toPathPart repo, " pulls" , toPathPart prid, " commits" ] []
138180
@@ -141,20 +183,20 @@ pullRequestCommitsR user repo prid =
141183-- With authentification.
142184--
143185-- > pullRequestFiles' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 688
144- pullRequestFiles' :: Maybe Auth -> Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error (Vector File ))
186+ pullRequestFiles' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File ))
145187pullRequestFiles' auth user repo prid =
146188 executeRequestMaybe auth $ pullRequestFilesR user repo prid FetchAll
147189
148190-- | The individual files that a pull request patches. Takes the repo owner and
149191-- name, plus the number assigned to the pull request.
150192--
151193-- > pullRequestFiles "thoughtbot" "paperclip" 688
152- pullRequestFiles :: Name Owner -> Name Repo -> Id PullRequest -> IO (Either Error (Vector File ))
194+ pullRequestFiles :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File ))
153195pullRequestFiles = pullRequestFiles' Nothing
154196
155197-- | List pull requests files.
156198-- See <https://developer.github.com/v3/pulls/#list-pull-requests-files>
157- pullRequestFilesR :: Name Owner -> Name Repo -> Id PullRequest -> FetchCount -> Request k (Vector File )
199+ pullRequestFilesR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector File )
158200pullRequestFilesR user repo prid =
159201 pagedQuery [" repos" , toPathPart user, toPathPart repo, " pulls" , toPathPart prid, " files" ] []
160202
0 commit comments