forked from cscheid/rgithub
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpulls.R
More file actions
206 lines (192 loc) · 6.32 KB
/
pulls.R
File metadata and controls
206 lines (192 loc) · 6.32 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#' list all pull requests
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param ... extra parameters. See http://developer.github.com/v3/pulls/#list-pull-requests for details
#'
#' @param ctx the github context object
#'
#' @return the list of pull requests
get.pull.requests <- function(owner, repo, ..., ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls"), params=list(...))
#' get a specific pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ctx the github context object
#'
#' @return the specific pull request
get.pull.request <- function(owner, repo, id, ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", id))
#' create a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param content the JSON object representing the new pull request. See http://developer.github.com/v3/pulls/#create-a-pull-request for details.
#'
#' @param ctx the github context object
#'
#' @return the specific pull request
create.pull.request <- function(owner, repo, content, ctx = get.github.context())
.api.post.request(ctx, c("repos", owner, repo, "pulls"), body=content)
#' edit pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param content the JSON object representing the pull request. See http://developer.github.com/v3/pulls/#update-a-pull-request for details.
#'
#' @param ctx the github context object
#'
#' @return the specific pull request
modify.pull.request <- function(owner, repo, id, content, ctx = get.github.context())
.api.patch.request(ctx, c("repos", owner, repo, "pulls", id), body=content)
#' list commits for a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ctx the github context object
#'
#' @return the list of pull request commits
get.pull.request.commits <- function(owner, repo, id, ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", id, "commits"))
#' list files for a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ctx the github context object
#'
#' @return the list of pull request files
get.pull.request.files <- function(owner, repo, id, ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", id, "files"))
#' test if pull request has been merged
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ctx the github context object
#'
#' @return TRUE if pull request has been merged
is.pull.request.merged <- function(owner, repo, id, ctx = get.github.context())
.api.test.request(ctx, c("repos", owner, repo, "pulls", id, "merge"))
#' merge a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ... extra parameters to control the merge. See http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade for details.
#'
#' @param ctx the github context object
#'
#' @return none
perform.merge.pull.request <- function(owner, repo, id, ..., ctx = get.github.context()) # "perform" here is just awful, but makes the S3method checker in CRAN happy.
.api.put.request(ctx, c("repos", owner, repo, "pulls", id, "merge"), params=list(...))
################################################################################
# comments
#' List comments on a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param id the pull request id
#'
#' @param ctx the github context object
#'
#' @return the list of comments for the pull request
get.pull.request.comments <- function(owner, repo, id, ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", id, "comments"))
#' List comments on all pull requests for a repo
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param ... extra parameters to control pagination. See http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository for details.
#'
#' @param ctx the github context object
#'
#' @return the list of comments for the pull request
get.pull.requests.comments <- function(owner, repo, ..., ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", "comments"), params=list(...))
#' Get specific comment for a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param comment.id the id of the comment
#'
#' @param ctx the github context object
#'
#' @return the comment
get.pull.requests.comment <- function(owner, repo, comment.id, ctx = get.github.context())
.api.get.request(ctx, c("repos", owner, repo, "pulls", "comments", comment.id))
#' Create a comment on a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param pull.id the id of the pull request
#'
#' @param content the JSON object describing the content. See http://developer.github.com/v3/pulls/comments/#create-a-comment for details.
#'
#' @param ctx the github context object
#'
#' @return the comment
create.pull.request.comment <- function(owner, repo, pull.id, content, ctx = get.github.context())
.api.post.request(ctx, c("repos", owner, repo, "pulls", pull.id, "comments"), body=content)
#' Modify a comment on a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param pull.id the id of the pull request
#'
#' @param content the JSON object describing the edited content. See http://developer.github.com/v3/pulls/comments/#edit-a-comment for details.
#'
#' @param ctx the github context object
#'
#' @return the comment
modify.pull.request.comment <- function(owner, repo, pull.id, content, ctx = get.github.context())
.api.patch.request(ctx, c("repos", owner, repo, "pulls", pull.id, "comments"), body=content)
#' Delete a comment on a pull request
#'
#' @param owner the repo owner
#'
#' @param repo the repo name
#'
#' @param comment.id the id of the pull request
#'
#' @param ctx the github context object
#'
#' @return the comment
delete.pull.request.comment <- function(owner, repo, comment.id, ctx = get.github.context())
.api.delete.request(ctx, c("repos", owner, repo, "pulls", "comments", comment.id))