gitabu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/gitabu.gemspec +41 -0
- data/lib/gitabu/api/v3/actions.rb +3724 -0
- data/lib/gitabu/api/v3/activity.rb +835 -0
- data/lib/gitabu/api/v3/apps.rb +961 -0
- data/lib/gitabu/api/v3/billing.rb +217 -0
- data/lib/gitabu/api/v3/branches.rb +1098 -0
- data/lib/gitabu/api/v3/checks.rb +384 -0
- data/lib/gitabu/api/v3/code_scanning.rb +315 -0
- data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
- data/lib/gitabu/api/v3/codespaces.rb +650 -0
- data/lib/gitabu/api/v3/collaborators.rb +341 -0
- data/lib/gitabu/api/v3/commits.rb +428 -0
- data/lib/gitabu/api/v3/dependabot.rb +419 -0
- data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
- data/lib/gitabu/api/v3/deployments.rb +356 -0
- data/lib/gitabu/api/v3/emojis.rb +67 -0
- data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
- data/lib/gitabu/api/v3/gists.rb +552 -0
- data/lib/gitabu/api/v3/git.rb +409 -0
- data/lib/gitabu/api/v3/gitignore.rb +92 -0
- data/lib/gitabu/api/v3/interactions.rb +275 -0
- data/lib/gitabu/api/v3/issues.rb +1119 -0
- data/lib/gitabu/api/v3/licenses.rb +118 -0
- data/lib/gitabu/api/v3/markdown.rb +94 -0
- data/lib/gitabu/api/v3/meta.rb +142 -0
- data/lib/gitabu/api/v3/metrics.rb +302 -0
- data/lib/gitabu/api/v3/migrations.rb +631 -0
- data/lib/gitabu/api/v3/orgs.rb +1291 -0
- data/lib/gitabu/api/v3/packages.rb +686 -0
- data/lib/gitabu/api/v3/pages.rb +282 -0
- data/lib/gitabu/api/v3/projects.rb +693 -0
- data/lib/gitabu/api/v3/pulls.rb +816 -0
- data/lib/gitabu/api/v3/rate_limit.rb +67 -0
- data/lib/gitabu/api/v3/reactions.rb +734 -0
- data/lib/gitabu/api/v3/releases.rb +411 -0
- data/lib/gitabu/api/v3/repos.rb +1136 -0
- data/lib/gitabu/api/v3/scim.rb +214 -0
- data/lib/gitabu/api/v3/search.rb +217 -0
- data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
- data/lib/gitabu/api/v3/teams.rb +1963 -0
- data/lib/gitabu/api/v3/users.rb +851 -0
- data/lib/gitabu/api/v3/webhooks.rb +379 -0
- data/lib/gitabu/builder.rb +37 -0
- data/lib/gitabu/client.rb +8 -0
- data/lib/gitabu/generator.rb +75 -0
- data/lib/gitabu/http_client.rb +96 -0
- data/lib/gitabu/items.rb +110 -0
- data/lib/gitabu/public/api/v3/actions.json +5779 -0
- data/lib/gitabu/public/api/v3/activity.json +1248 -0
- data/lib/gitabu/public/api/v3/apps.json +1174 -0
- data/lib/gitabu/public/api/v3/billing.json +183 -0
- data/lib/gitabu/public/api/v3/branches.json +1886 -0
- data/lib/gitabu/public/api/v3/checks.json +856 -0
- data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
- data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
- data/lib/gitabu/public/api/v3/codespaces.json +884 -0
- data/lib/gitabu/public/api/v3/collaborators.json +464 -0
- data/lib/gitabu/public/api/v3/commits.json +830 -0
- data/lib/gitabu/public/api/v3/dependabot.json +596 -0
- data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
- data/lib/gitabu/public/api/v3/deployments.json +698 -0
- data/lib/gitabu/public/api/v3/emojis.json +18 -0
- data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
- data/lib/gitabu/public/api/v3/gists.json +689 -0
- data/lib/gitabu/public/api/v3/git.json +735 -0
- data/lib/gitabu/public/api/v3/gitignore.json +41 -0
- data/lib/gitabu/public/api/v3/interactions.json +265 -0
- data/lib/gitabu/public/api/v3/issues.json +2359 -0
- data/lib/gitabu/public/api/v3/licenses.json +100 -0
- data/lib/gitabu/public/api/v3/markdown.json +59 -0
- data/lib/gitabu/public/api/v3/meta.json +69 -0
- data/lib/gitabu/public/api/v3/metrics.json +342 -0
- data/lib/gitabu/public/api/v3/migrations.json +960 -0
- data/lib/gitabu/public/api/v3/orgs.json +1989 -0
- data/lib/gitabu/public/api/v3/packages.json +1078 -0
- data/lib/gitabu/public/api/v3/pages.json +373 -0
- data/lib/gitabu/public/api/v3/projects.json +966 -0
- data/lib/gitabu/public/api/v3/pulls.json +1768 -0
- data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
- data/lib/gitabu/public/api/v3/reactions.json +1425 -0
- data/lib/gitabu/public/api/v3/releases.json +753 -0
- data/lib/gitabu/public/api/v3/repos.json +2314 -0
- data/lib/gitabu/public/api/v3/scim.json +412 -0
- data/lib/gitabu/public/api/v3/search.json +408 -0
- data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
- data/lib/gitabu/public/api/v3/teams.json +3126 -0
- data/lib/gitabu/public/api/v3/users.json +956 -0
- data/lib/gitabu/public/api/v3/webhooks.json +667 -0
- data/lib/gitabu/run.rb +237 -0
- data/lib/gitabu/scraper.rb +86 -0
- data/lib/gitabu/templates/template.rb.erb +70 -0
- data/lib/gitabu/version.rb +6 -0
- data/lib/gitabu.rb +57 -0
- data/sig/gitabu.rbs +4 -0
- metadata +177 -0
@@ -0,0 +1,816 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# INFO ON GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated.
|
6
|
+
# See the contribution guide on how to improve the code.
|
7
|
+
#
|
8
|
+
# INFO ON GENERATED CODE
|
9
|
+
|
10
|
+
# Ruby gem that helps you work with Github API.
|
11
|
+
module Gitabu
|
12
|
+
# API module
|
13
|
+
module Api
|
14
|
+
# Github Version 3
|
15
|
+
module V3
|
16
|
+
# Class to display Pulls result
|
17
|
+
class PullsResult
|
18
|
+
attr_accessor :result, :message
|
19
|
+
|
20
|
+
def initialize(result:, message:)
|
21
|
+
@result = result
|
22
|
+
@message = message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Class to display error result
|
27
|
+
class PullsErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Pulls endpoints.
|
37
|
+
class Pulls
|
38
|
+
def self.list_pull_requests(owner: nil, repo: nil, options: nil)
|
39
|
+
new.list_pull_requests(owner, repo, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_a_pull_request(owner: nil, repo: nil, title: nil, head: nil, base: nil, body: nil, maintainer_can_modify: nil, draft: nil, issue: nil, options: nil)
|
43
|
+
new.create_a_pull_request(owner, repo, title, head, base, body, maintainer_can_modify, draft, issue, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_a_pull_request(owner: nil, repo: nil, pull_number: nil, options: nil)
|
47
|
+
new.get_a_pull_request(owner, repo, pull_number, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.update_a_pull_request(owner: nil, repo: nil, pull_number: nil, title: nil, body: nil, state: nil, base: nil, maintainer_can_modify: nil, options: nil)
|
51
|
+
new.update_a_pull_request(owner, repo, pull_number, title, body, state, base, maintainer_can_modify, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_commits_on_a_pull_request(owner: nil, repo: nil, pull_number: nil, options: nil)
|
55
|
+
new.list_commits_on_a_pull_request(owner, repo, pull_number, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.list_pull_requests_files(owner: nil, repo: nil, pull_number: nil, options: nil)
|
59
|
+
new.list_pull_requests_files(owner, repo, pull_number, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.check_if_a_pull_request_has_been_merged(owner: nil, repo: nil, pull_number: nil, options: nil)
|
63
|
+
new.check_if_a_pull_request_has_been_merged(owner, repo, pull_number, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.merge_a_pull_request(owner: nil, repo: nil, pull_number: nil, commit_title: nil, commit_message: nil, sha: nil, merge_method: nil, options: nil)
|
67
|
+
new.merge_a_pull_request(owner, repo, pull_number, commit_title, commit_message, sha, merge_method, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.update_a_pull_request_branch(owner: nil, repo: nil, pull_number: nil, expected_head_sha: nil, options: nil)
|
71
|
+
new.update_a_pull_request_branch(owner, repo, pull_number, expected_head_sha, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.list_review_comments_in_a_repository(owner: nil, repo: nil, options: nil)
|
75
|
+
new.list_review_comments_in_a_repository(owner, repo, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.get_a_review_comment_for_a_pull_request(owner: nil, repo: nil, comment_id: nil, options: nil)
|
79
|
+
new.get_a_review_comment_for_a_pull_request(owner, repo, comment_id, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.update_a_review_comment_for_a_pull_request(owner: nil, repo: nil, comment_id: nil, body: nil, options: nil)
|
83
|
+
new.update_a_review_comment_for_a_pull_request(owner, repo, comment_id, body, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.delete_a_review_comment_for_a_pull_request(owner: nil, repo: nil, comment_id: nil, options: nil)
|
87
|
+
new.delete_a_review_comment_for_a_pull_request(owner, repo, comment_id, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.list_review_comments_on_a_pull_request(owner: nil, repo: nil, pull_number: nil, options: nil)
|
91
|
+
new.list_review_comments_on_a_pull_request(owner, repo, pull_number, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.create_a_review_comment_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, body: nil, commit_id: nil, path: nil, position: nil, side: nil, line: nil, start_line: nil, start_side: nil, in_reply_to: nil, options: nil)
|
95
|
+
new.create_a_review_comment_for_a_pull_request(owner, repo, pull_number, body, commit_id, path, position, side, line, start_line, start_side, in_reply_to, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.create_a_reply_for_a_review_comment(owner: nil, repo: nil, pull_number: nil, comment_id: nil, body: nil, options: nil)
|
99
|
+
new.create_a_reply_for_a_review_comment(owner, repo, pull_number, comment_id, body, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.list_requested_reviewers_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, options: nil)
|
103
|
+
new.list_requested_reviewers_for_a_pull_request(owner, repo, pull_number, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.request_reviewers_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, reviewers: nil, team_reviewers: nil, options: nil)
|
107
|
+
new.request_reviewers_for_a_pull_request(owner, repo, pull_number, reviewers, team_reviewers, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.remove_requested_reviewers_from_a_pull_request(owner: nil, repo: nil, pull_number: nil, reviewers: nil, team_reviewers: nil, options: nil)
|
111
|
+
new.remove_requested_reviewers_from_a_pull_request(owner, repo, pull_number, reviewers, team_reviewers, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.list_reviews_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, options: nil)
|
115
|
+
new.list_reviews_for_a_pull_request(owner, repo, pull_number, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.create_a_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, commit_id: nil, body: nil, event: nil, comments: nil, options: nil)
|
119
|
+
new.create_a_review_for_a_pull_request(owner, repo, pull_number, commit_id, body, event, comments, options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.get_a_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, review_id: nil, options: nil)
|
123
|
+
new.get_a_review_for_a_pull_request(owner, repo, pull_number, review_id, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.update_a_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, review_id: nil, body: nil, options: nil)
|
127
|
+
new.update_a_review_for_a_pull_request(owner, repo, pull_number, review_id, body, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.delete_a_pending_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, review_id: nil, options: nil)
|
131
|
+
new.delete_a_pending_review_for_a_pull_request(owner, repo, pull_number, review_id, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.list_comments_for_a_pull_request_review(owner: nil, repo: nil, pull_number: nil, review_id: nil, options: nil)
|
135
|
+
new.list_comments_for_a_pull_request_review(owner, repo, pull_number, review_id, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.dismiss_a_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, review_id: nil, message: nil, event: nil, options: nil)
|
139
|
+
new.dismiss_a_review_for_a_pull_request(owner, repo, pull_number, review_id, message, event, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.submit_a_review_for_a_pull_request(owner: nil, repo: nil, pull_number: nil, review_id: nil, body: nil, event: nil, options: nil)
|
143
|
+
new.submit_a_review_for_a_pull_request(owner, repo, pull_number, review_id, body, event, options)
|
144
|
+
end
|
145
|
+
|
146
|
+
private
|
147
|
+
|
148
|
+
# list pull requests
|
149
|
+
#
|
150
|
+
# @param owner [String]
|
151
|
+
# @param repo [String]
|
152
|
+
#
|
153
|
+
# @return PullsResult, PullsErrorResult
|
154
|
+
def list_pull_requests(owner, repo, options)
|
155
|
+
auth = nil
|
156
|
+
body = nil
|
157
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
158
|
+
params = { state: options[:state], head: options[:head], base: options[:base], sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
159
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls"
|
160
|
+
|
161
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
162
|
+
|
163
|
+
if http_call.successful?
|
164
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
165
|
+
else
|
166
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# create a pull request
|
171
|
+
#
|
172
|
+
# @param owner [String]
|
173
|
+
# @param repo [String]
|
174
|
+
# @param title [String] The title of the new pull request.
|
175
|
+
# @param head [String] Required. The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.
|
176
|
+
# @param base [String] Required. The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
|
177
|
+
# @param body [String] The contents of the pull request.
|
178
|
+
# @param maintainer_can_modify [Boolean] Indicates whether maintainers can modify the pull request.
|
179
|
+
# @param draft [Boolean] Indicates whether the pull request is a draft. See "Draft Pull Requests" in the GitHub Help documentation to learn more.
|
180
|
+
# @param issue [Integer]
|
181
|
+
#
|
182
|
+
# @return PullsResult, PullsErrorResult
|
183
|
+
def create_a_pull_request(owner, repo, title, head, base, body, maintainer_can_modify, draft, issue, _options)
|
184
|
+
auth = nil
|
185
|
+
body = { title: title, head: head, base: base, body: body, maintainer_can_modify: maintainer_can_modify, draft: draft, issue: issue }
|
186
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
187
|
+
params = nil
|
188
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls"
|
189
|
+
|
190
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
191
|
+
|
192
|
+
if http_call.successful?
|
193
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
194
|
+
else
|
195
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# get a pull request
|
200
|
+
#
|
201
|
+
# @param owner [String]
|
202
|
+
# @param repo [String]
|
203
|
+
# @param pull_number [Integer]
|
204
|
+
#
|
205
|
+
# @return PullsResult, PullsErrorResult
|
206
|
+
def get_a_pull_request(owner, repo, pull_number, _options)
|
207
|
+
auth = nil
|
208
|
+
body = nil
|
209
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
210
|
+
params = nil
|
211
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}"
|
212
|
+
|
213
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
214
|
+
|
215
|
+
if http_call.successful?
|
216
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
217
|
+
else
|
218
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# update a pull request
|
223
|
+
#
|
224
|
+
# @param owner [String]
|
225
|
+
# @param repo [String]
|
226
|
+
# @param pull_number [Integer]
|
227
|
+
# @param title [String] The title of the pull request.
|
228
|
+
# @param body [String] The contents of the pull request.
|
229
|
+
# @param state [String] State of this Pull Request. Either open or closed.
|
230
|
+
# @param base [String] The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository.
|
231
|
+
# @param maintainer_can_modify [Boolean] Indicates whether maintainers can modify the pull request.
|
232
|
+
#
|
233
|
+
# @return PullsResult, PullsErrorResult
|
234
|
+
def update_a_pull_request(owner, repo, pull_number, title, body, state, base, maintainer_can_modify, _options)
|
235
|
+
auth = nil
|
236
|
+
body = { title: title, body: body, state: state, base: base, maintainer_can_modify: maintainer_can_modify }
|
237
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
238
|
+
params = nil
|
239
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}"
|
240
|
+
|
241
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
242
|
+
|
243
|
+
if http_call.successful?
|
244
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
245
|
+
else
|
246
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# list commits on a pull request
|
251
|
+
#
|
252
|
+
# @param owner [String]
|
253
|
+
# @param repo [String]
|
254
|
+
# @param pull_number [Integer]
|
255
|
+
#
|
256
|
+
# @return PullsResult, PullsErrorResult
|
257
|
+
def list_commits_on_a_pull_request(owner, repo, pull_number, options)
|
258
|
+
auth = nil
|
259
|
+
body = nil
|
260
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
261
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
262
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/commits"
|
263
|
+
|
264
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
265
|
+
|
266
|
+
if http_call.successful?
|
267
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
268
|
+
else
|
269
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
# list pull requests files
|
274
|
+
#
|
275
|
+
# @param owner [String]
|
276
|
+
# @param repo [String]
|
277
|
+
# @param pull_number [Integer]
|
278
|
+
#
|
279
|
+
# @return PullsResult, PullsErrorResult
|
280
|
+
def list_pull_requests_files(owner, repo, pull_number, options)
|
281
|
+
auth = nil
|
282
|
+
body = nil
|
283
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
284
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
285
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/files"
|
286
|
+
|
287
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
288
|
+
|
289
|
+
if http_call.successful?
|
290
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
291
|
+
else
|
292
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# check if a pull request has been merged
|
297
|
+
#
|
298
|
+
# @param owner [String]
|
299
|
+
# @param repo [String]
|
300
|
+
# @param pull_number [Integer]
|
301
|
+
#
|
302
|
+
# @return PullsResult, PullsErrorResult
|
303
|
+
def check_if_a_pull_request_has_been_merged(owner, repo, pull_number, _options)
|
304
|
+
auth = nil
|
305
|
+
body = nil
|
306
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
307
|
+
params = nil
|
308
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/merge"
|
309
|
+
|
310
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
311
|
+
|
312
|
+
if http_call.successful?
|
313
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
314
|
+
else
|
315
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# merge a pull request
|
320
|
+
#
|
321
|
+
# @param owner [String]
|
322
|
+
# @param repo [String]
|
323
|
+
# @param pull_number [Integer]
|
324
|
+
# @param commit_title [String] Title for the automatic commit message.
|
325
|
+
# @param commit_message [String] Extra detail to append to automatic commit message.
|
326
|
+
# @param sha [String] SHA that pull request head must match to allow merge.
|
327
|
+
# @param merge_method [String] Merge method to use. Possible values are merge, squash or rebase. Default is merge.
|
328
|
+
#
|
329
|
+
# @return PullsResult, PullsErrorResult
|
330
|
+
def merge_a_pull_request(owner, repo, pull_number, commit_title, commit_message, sha, merge_method, _options)
|
331
|
+
auth = nil
|
332
|
+
body = { commit_title: commit_title, commit_message: commit_message, sha: sha, merge_method: merge_method }
|
333
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
334
|
+
params = nil
|
335
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/merge"
|
336
|
+
|
337
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
338
|
+
|
339
|
+
if http_call.successful?
|
340
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
341
|
+
else
|
342
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
# update a pull request branch
|
347
|
+
#
|
348
|
+
# @param owner [String]
|
349
|
+
# @param repo [String]
|
350
|
+
# @param pull_number [Integer]
|
351
|
+
# @param expected_head_sha [String] The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a 422 Unprocessable Entity status. You can use the "List commits" endpoint to find the most recent commit SHA. Default: SHA of the pull request's current HEAD ref.
|
352
|
+
#
|
353
|
+
# @return PullsResult, PullsErrorResult
|
354
|
+
def update_a_pull_request_branch(owner, repo, pull_number, expected_head_sha, _options)
|
355
|
+
auth = nil
|
356
|
+
body = { expected_head_sha: expected_head_sha }
|
357
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
358
|
+
params = nil
|
359
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/update-branch"
|
360
|
+
|
361
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
362
|
+
|
363
|
+
if http_call.successful?
|
364
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
365
|
+
else
|
366
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
# list review comments in a repository
|
371
|
+
#
|
372
|
+
# @param owner [String]
|
373
|
+
# @param repo [String]
|
374
|
+
#
|
375
|
+
# @return PullsResult, PullsErrorResult
|
376
|
+
def list_review_comments_in_a_repository(owner, repo, options)
|
377
|
+
auth = nil
|
378
|
+
body = nil
|
379
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
380
|
+
params = { sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
381
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/comments"
|
382
|
+
|
383
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
384
|
+
|
385
|
+
if http_call.successful?
|
386
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
387
|
+
else
|
388
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
# get a review comment for a pull request
|
393
|
+
#
|
394
|
+
# @param owner [String]
|
395
|
+
# @param repo [String]
|
396
|
+
# @param comment_id [Integer] comment_id parameter
|
397
|
+
#
|
398
|
+
# @return PullsResult, PullsErrorResult
|
399
|
+
def get_a_review_comment_for_a_pull_request(owner, repo, comment_id, _options)
|
400
|
+
auth = nil
|
401
|
+
body = nil
|
402
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
403
|
+
params = nil
|
404
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/comments/#{comment_id}"
|
405
|
+
|
406
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
407
|
+
|
408
|
+
if http_call.successful?
|
409
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
410
|
+
else
|
411
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
# update a review comment for a pull request
|
416
|
+
#
|
417
|
+
# @param owner [String]
|
418
|
+
# @param repo [String]
|
419
|
+
# @param comment_id [Integer] comment_id parameter
|
420
|
+
# @param body [String] Required. The text of the reply to the review comment.
|
421
|
+
#
|
422
|
+
# @return PullsResult, PullsErrorResult
|
423
|
+
def update_a_review_comment_for_a_pull_request(owner, repo, comment_id, body, _options)
|
424
|
+
auth = nil
|
425
|
+
body = { body: body }
|
426
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
427
|
+
params = nil
|
428
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/comments/#{comment_id}"
|
429
|
+
|
430
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
431
|
+
|
432
|
+
if http_call.successful?
|
433
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
434
|
+
else
|
435
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
# delete a review comment for a pull request
|
440
|
+
#
|
441
|
+
# @param owner [String]
|
442
|
+
# @param repo [String]
|
443
|
+
# @param comment_id [Integer] comment_id parameter
|
444
|
+
#
|
445
|
+
# @return PullsResult, PullsErrorResult
|
446
|
+
def delete_a_review_comment_for_a_pull_request(owner, repo, comment_id, _options)
|
447
|
+
auth = nil
|
448
|
+
body = nil
|
449
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
450
|
+
params = nil
|
451
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/comments/#{comment_id}"
|
452
|
+
|
453
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
454
|
+
|
455
|
+
if http_call.successful?
|
456
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
457
|
+
else
|
458
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
# list review comments on a pull request
|
463
|
+
#
|
464
|
+
# @param owner [String]
|
465
|
+
# @param repo [String]
|
466
|
+
# @param pull_number [Integer]
|
467
|
+
#
|
468
|
+
# @return PullsResult, PullsErrorResult
|
469
|
+
def list_review_comments_on_a_pull_request(owner, repo, pull_number, options)
|
470
|
+
auth = nil
|
471
|
+
body = nil
|
472
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
473
|
+
params = { sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
474
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/comments"
|
475
|
+
|
476
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
477
|
+
|
478
|
+
if http_call.successful?
|
479
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
480
|
+
else
|
481
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
# create a review comment for a pull request
|
486
|
+
#
|
487
|
+
# @param owner [String]
|
488
|
+
# @param repo [String]
|
489
|
+
# @param pull_number [Integer]
|
490
|
+
# @param body [String] Required. The text of the review comment.
|
491
|
+
# @param commit_id [String] The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the position.
|
492
|
+
# @param path [String] The relative path to the file that necessitates a comment.
|
493
|
+
# @param position [Integer] Required without comfort-fade preview unless using in_reply_to. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note above.
|
494
|
+
# @param side [String] Required with comfort-fade preview unless using in_reply_to. In a split diff view, the side of the diff that the pull request's changes appear on. Can be LEFT or RIGHT. Use LEFT for deletions that appear in red. Use RIGHT for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "Diff view options" in the GitHub Help documentation.
|
495
|
+
# @param line [Integer] Required with comfort-fade preview unless using in_reply_to. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
|
496
|
+
# @param start_line [Integer] Required when using multi-line comments unless using in_reply_to. To create multi-line comments, you must use the comfort-fade preview header. The start_line is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see "Commenting on a pull request" in the GitHub Help documentation.
|
497
|
+
# @param start_side [String] Required when using multi-line comments unless using in_reply_to. To create multi-line comments, you must use the comfort-fade preview header. The start_side is the starting side of the diff that the comment applies to. Can be LEFT or RIGHT. To learn more about multi-line comments, see "Commenting on a pull request" in the GitHub Help documentation. See side in this table for additional context.
|
498
|
+
# @param in_reply_to [Integer] The ID of the review comment to reply to. To find the ID of a review comment with "List review comments on a pull request". When specified, all parameters other than body in the request body are ignored.
|
499
|
+
#
|
500
|
+
# @return PullsResult, PullsErrorResult
|
501
|
+
def create_a_review_comment_for_a_pull_request(owner, repo, pull_number, body, commit_id, path, position, side, line, start_line, start_side, in_reply_to, _options)
|
502
|
+
auth = nil
|
503
|
+
body = { body: body, commit_id: commit_id, path: path, position: position, side: side, line: line, start_line: start_line, start_side: start_side, in_reply_to: in_reply_to }
|
504
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
505
|
+
params = nil
|
506
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/comments"
|
507
|
+
|
508
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
509
|
+
|
510
|
+
if http_call.successful?
|
511
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
512
|
+
else
|
513
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
# create a reply for a review comment
|
518
|
+
#
|
519
|
+
# @param owner [String]
|
520
|
+
# @param repo [String]
|
521
|
+
# @param pull_number [Integer]
|
522
|
+
# @param comment_id [Integer] comment_id parameter
|
523
|
+
# @param body [String] Required. The text of the review comment.
|
524
|
+
#
|
525
|
+
# @return PullsResult, PullsErrorResult
|
526
|
+
def create_a_reply_for_a_review_comment(owner, repo, pull_number, comment_id, body, _options)
|
527
|
+
auth = nil
|
528
|
+
body = { body: body }
|
529
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
530
|
+
params = nil
|
531
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/comments/#{comment_id}/replies"
|
532
|
+
|
533
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
534
|
+
|
535
|
+
if http_call.successful?
|
536
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
537
|
+
else
|
538
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
# list requested reviewers for a pull request
|
543
|
+
#
|
544
|
+
# @param owner [String]
|
545
|
+
# @param repo [String]
|
546
|
+
# @param pull_number [Integer]
|
547
|
+
#
|
548
|
+
# @return PullsResult, PullsErrorResult
|
549
|
+
def list_requested_reviewers_for_a_pull_request(owner, repo, pull_number, options)
|
550
|
+
auth = nil
|
551
|
+
body = nil
|
552
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
553
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
554
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/requested_reviewers"
|
555
|
+
|
556
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
557
|
+
|
558
|
+
if http_call.successful?
|
559
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
560
|
+
else
|
561
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
# request reviewers for a pull request
|
566
|
+
#
|
567
|
+
# @param owner [String]
|
568
|
+
# @param repo [String]
|
569
|
+
# @param pull_number [Integer]
|
570
|
+
# @param reviewers [Array of strings] An array of user logins that will be requested.
|
571
|
+
# @param team_reviewers [Array of strings] An array of team slugs that will be requested.
|
572
|
+
#
|
573
|
+
# @return PullsResult, PullsErrorResult
|
574
|
+
def request_reviewers_for_a_pull_request(owner, repo, pull_number, reviewers, team_reviewers, _options)
|
575
|
+
auth = nil
|
576
|
+
body = { reviewers: reviewers, team_reviewers: team_reviewers }
|
577
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
578
|
+
params = nil
|
579
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/requested_reviewers"
|
580
|
+
|
581
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
582
|
+
|
583
|
+
if http_call.successful?
|
584
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
585
|
+
else
|
586
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
# remove requested reviewers from a pull request
|
591
|
+
#
|
592
|
+
# @param owner [String]
|
593
|
+
# @param repo [String]
|
594
|
+
# @param pull_number [Integer]
|
595
|
+
# @param reviewers [Array of strings] Required. An array of user logins that will be removed.
|
596
|
+
# @param team_reviewers [Array of strings] An array of team slugs that will be removed.
|
597
|
+
#
|
598
|
+
# @return PullsResult, PullsErrorResult
|
599
|
+
def remove_requested_reviewers_from_a_pull_request(owner, repo, pull_number, reviewers, team_reviewers, _options)
|
600
|
+
auth = nil
|
601
|
+
body = { reviewers: reviewers, team_reviewers: team_reviewers }
|
602
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
603
|
+
params = nil
|
604
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/requested_reviewers"
|
605
|
+
|
606
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
607
|
+
|
608
|
+
if http_call.successful?
|
609
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
610
|
+
else
|
611
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
# list reviews for a pull request
|
616
|
+
#
|
617
|
+
# @param owner [String]
|
618
|
+
# @param repo [String]
|
619
|
+
# @param pull_number [Integer]
|
620
|
+
#
|
621
|
+
# @return PullsResult, PullsErrorResult
|
622
|
+
def list_reviews_for_a_pull_request(owner, repo, pull_number, options)
|
623
|
+
auth = nil
|
624
|
+
body = nil
|
625
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
626
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
627
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews"
|
628
|
+
|
629
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
630
|
+
|
631
|
+
if http_call.successful?
|
632
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
633
|
+
else
|
634
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
635
|
+
end
|
636
|
+
end
|
637
|
+
|
638
|
+
# create a review for a pull request
|
639
|
+
#
|
640
|
+
# @param owner [String]
|
641
|
+
# @param repo [String]
|
642
|
+
# @param pull_number [Integer]
|
643
|
+
# @param commit_id [String] The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the position. Defaults to the most recent commit in the pull request when you do not specify a value.
|
644
|
+
# @param body [String] Required when using REQUEST_CHANGES or COMMENT for the event parameter. The body text of the pull request review.
|
645
|
+
# @param event [String] The review action you want to perform. The review actions include: APPROVE, REQUEST_CHANGES, or COMMENT. By leaving this blank, you set the review action state to PENDING, which means you will need to submit the pull request review when you are ready.
|
646
|
+
# @param comments [Array of objects] Use the following table to specify the location, destination, and contents of the draft review comment.
|
647
|
+
#
|
648
|
+
# @return PullsResult, PullsErrorResult
|
649
|
+
def create_a_review_for_a_pull_request(owner, repo, pull_number, commit_id, body, event, comments, _options)
|
650
|
+
auth = nil
|
651
|
+
body = { commit_id: commit_id, body: body, event: event, comments: comments }
|
652
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
653
|
+
params = nil
|
654
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews"
|
655
|
+
|
656
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
657
|
+
|
658
|
+
if http_call.successful?
|
659
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
660
|
+
else
|
661
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
665
|
+
# get a review for a pull request
|
666
|
+
#
|
667
|
+
# @param owner [String]
|
668
|
+
# @param repo [String]
|
669
|
+
# @param pull_number [Integer]
|
670
|
+
# @param review_id [Integer] review_id parameter
|
671
|
+
#
|
672
|
+
# @return PullsResult, PullsErrorResult
|
673
|
+
def get_a_review_for_a_pull_request(owner, repo, pull_number, review_id, _options)
|
674
|
+
auth = nil
|
675
|
+
body = nil
|
676
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
677
|
+
params = nil
|
678
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}"
|
679
|
+
|
680
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
681
|
+
|
682
|
+
if http_call.successful?
|
683
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
684
|
+
else
|
685
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
# update a review for a pull request
|
690
|
+
#
|
691
|
+
# @param owner [String]
|
692
|
+
# @param repo [String]
|
693
|
+
# @param pull_number [Integer]
|
694
|
+
# @param review_id [Integer] review_id parameter
|
695
|
+
# @param body [String] Required. The body text of the pull request review.
|
696
|
+
#
|
697
|
+
# @return PullsResult, PullsErrorResult
|
698
|
+
def update_a_review_for_a_pull_request(owner, repo, pull_number, review_id, body, _options)
|
699
|
+
auth = nil
|
700
|
+
body = { body: body }
|
701
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
702
|
+
params = nil
|
703
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}"
|
704
|
+
|
705
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
706
|
+
|
707
|
+
if http_call.successful?
|
708
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
709
|
+
else
|
710
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
711
|
+
end
|
712
|
+
end
|
713
|
+
|
714
|
+
# delete a pending review for a pull request
|
715
|
+
#
|
716
|
+
# @param owner [String]
|
717
|
+
# @param repo [String]
|
718
|
+
# @param pull_number [Integer]
|
719
|
+
# @param review_id [Integer] review_id parameter
|
720
|
+
#
|
721
|
+
# @return PullsResult, PullsErrorResult
|
722
|
+
def delete_a_pending_review_for_a_pull_request(owner, repo, pull_number, review_id, _options)
|
723
|
+
auth = nil
|
724
|
+
body = nil
|
725
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
726
|
+
params = nil
|
727
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}"
|
728
|
+
|
729
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
730
|
+
|
731
|
+
if http_call.successful?
|
732
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
733
|
+
else
|
734
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
735
|
+
end
|
736
|
+
end
|
737
|
+
|
738
|
+
# list comments for a pull request review
|
739
|
+
#
|
740
|
+
# @param owner [String]
|
741
|
+
# @param repo [String]
|
742
|
+
# @param pull_number [Integer]
|
743
|
+
# @param review_id [Integer] review_id parameter
|
744
|
+
#
|
745
|
+
# @return PullsResult, PullsErrorResult
|
746
|
+
def list_comments_for_a_pull_request_review(owner, repo, pull_number, review_id, options)
|
747
|
+
auth = nil
|
748
|
+
body = nil
|
749
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
750
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
751
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}/comments"
|
752
|
+
|
753
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
754
|
+
|
755
|
+
if http_call.successful?
|
756
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
757
|
+
else
|
758
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
# dismiss a review for a pull request
|
763
|
+
#
|
764
|
+
# @param owner [String]
|
765
|
+
# @param repo [String]
|
766
|
+
# @param pull_number [Integer]
|
767
|
+
# @param review_id [Integer] review_id parameter
|
768
|
+
# @param message [String] Required. The message for the pull request review dismissal
|
769
|
+
# @param event [String]
|
770
|
+
#
|
771
|
+
# @return PullsResult, PullsErrorResult
|
772
|
+
def dismiss_a_review_for_a_pull_request(owner, repo, pull_number, review_id, message, event, _options)
|
773
|
+
auth = nil
|
774
|
+
body = { message: message, event: event }
|
775
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
776
|
+
params = nil
|
777
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}/dismissals"
|
778
|
+
|
779
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
780
|
+
|
781
|
+
if http_call.successful?
|
782
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
783
|
+
else
|
784
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
# submit a review for a pull request
|
789
|
+
#
|
790
|
+
# @param owner [String]
|
791
|
+
# @param repo [String]
|
792
|
+
# @param pull_number [Integer]
|
793
|
+
# @param review_id [Integer] review_id parameter
|
794
|
+
# @param body [String] The body text of the pull request review
|
795
|
+
# @param event [String] Required. The review action you want to perform. The review actions include: APPROVE, REQUEST_CHANGES, or COMMENT. When you leave this blank, the API returns HTTP 422 (Unrecognizable entity) and sets the review action state to PENDING, which means you will need to re-submit the pull request review using a review action.
|
796
|
+
#
|
797
|
+
# @return PullsResult, PullsErrorResult
|
798
|
+
def submit_a_review_for_a_pull_request(owner, repo, pull_number, review_id, body, event, _options)
|
799
|
+
auth = nil
|
800
|
+
body = { body: body, event: event }
|
801
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
802
|
+
params = nil
|
803
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/reviews/#{review_id}/events"
|
804
|
+
|
805
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
806
|
+
|
807
|
+
if http_call.successful?
|
808
|
+
PullsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
809
|
+
else
|
810
|
+
PullsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
811
|
+
end
|
812
|
+
end
|
813
|
+
end
|
814
|
+
end
|
815
|
+
end
|
816
|
+
end
|