gitabu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,428 @@
|
|
|
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 Commits result
|
|
17
|
+
class CommitsResult
|
|
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 CommitsErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Commits endpoints.
|
|
37
|
+
class Commits
|
|
38
|
+
def self.list_commits(owner: nil, repo: nil, options: nil)
|
|
39
|
+
new.list_commits(owner, repo, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.list_branches_for_head_commit(owner: nil, repo: nil, commit_sha: nil, options: nil)
|
|
43
|
+
new.list_branches_for_head_commit(owner, repo, commit_sha, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.list_pull_requests_associated_with_a_commit(owner: nil, repo: nil, commit_sha: nil, options: nil)
|
|
47
|
+
new.list_pull_requests_associated_with_a_commit(owner, repo, commit_sha, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.get_a_commit(owner: nil, repo: nil, ref: nil, options: nil)
|
|
51
|
+
new.get_a_commit(owner, repo, ref, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.compare_two_commits(owner: nil, repo: nil, basehead: nil, options: nil)
|
|
55
|
+
new.compare_two_commits(owner, repo, basehead, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.list_commit_comments_for_a_repository(owner: nil, repo: nil, options: nil)
|
|
59
|
+
new.list_commit_comments_for_a_repository(owner, repo, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.get_a_commit_comment(owner: nil, repo: nil, comment_id: nil, options: nil)
|
|
63
|
+
new.get_a_commit_comment(owner, repo, comment_id, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.update_a_commit_comment(owner: nil, repo: nil, comment_id: nil, body: nil, options: nil)
|
|
67
|
+
new.update_a_commit_comment(owner, repo, comment_id, body, options)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.delete_a_commit_comment(owner: nil, repo: nil, comment_id: nil, options: nil)
|
|
71
|
+
new.delete_a_commit_comment(owner, repo, comment_id, options)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.list_commit_comments(owner: nil, repo: nil, commit_sha: nil, options: nil)
|
|
75
|
+
new.list_commit_comments(owner, repo, commit_sha, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.create_a_commit_comment(owner: nil, repo: nil, commit_sha: nil, body: nil, path: nil, position: nil, line: nil, options: nil)
|
|
79
|
+
new.create_a_commit_comment(owner, repo, commit_sha, body, path, position, line, options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.get_the_combined_status_for_a_specific_reference(owner: nil, repo: nil, ref: nil, options: nil)
|
|
83
|
+
new.get_the_combined_status_for_a_specific_reference(owner, repo, ref, options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.list_commit_statuses_for_a_reference(owner: nil, repo: nil, ref: nil, options: nil)
|
|
87
|
+
new.list_commit_statuses_for_a_reference(owner, repo, ref, options)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.create_a_commit_status(owner: nil, repo: nil, sha: nil, state: nil, target_url: nil, description: nil, context: nil, options: nil)
|
|
91
|
+
new.create_a_commit_status(owner, repo, sha, state, target_url, description, context, options)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
# list commits
|
|
97
|
+
#
|
|
98
|
+
# @param owner [String]
|
|
99
|
+
# @param repo [String]
|
|
100
|
+
#
|
|
101
|
+
# @return CommitsResult, CommitsErrorResult
|
|
102
|
+
def list_commits(owner, repo, options)
|
|
103
|
+
auth = nil
|
|
104
|
+
body = nil
|
|
105
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
106
|
+
params = { sha: options[:sha], path: options[:path], author: options[:author], since: options[:since], until: options[:until], per_page: options[:per_page], page: options[:page] }
|
|
107
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits"
|
|
108
|
+
|
|
109
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
110
|
+
|
|
111
|
+
if http_call.successful?
|
|
112
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
113
|
+
else
|
|
114
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# list branches for head commit
|
|
119
|
+
#
|
|
120
|
+
# @param owner [String]
|
|
121
|
+
# @param repo [String]
|
|
122
|
+
# @param commit_sha [String] commit_sha parameter
|
|
123
|
+
#
|
|
124
|
+
# @return CommitsResult, CommitsErrorResult
|
|
125
|
+
def list_branches_for_head_commit(owner, repo, commit_sha, _options)
|
|
126
|
+
auth = nil
|
|
127
|
+
body = nil
|
|
128
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
129
|
+
params = nil
|
|
130
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{commit_sha}/branches-where-head"
|
|
131
|
+
|
|
132
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
133
|
+
|
|
134
|
+
if http_call.successful?
|
|
135
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
136
|
+
else
|
|
137
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# list pull requests associated with a commit
|
|
142
|
+
#
|
|
143
|
+
# @param owner [String]
|
|
144
|
+
# @param repo [String]
|
|
145
|
+
# @param commit_sha [String] commit_sha parameter
|
|
146
|
+
#
|
|
147
|
+
# @return CommitsResult, CommitsErrorResult
|
|
148
|
+
def list_pull_requests_associated_with_a_commit(owner, repo, commit_sha, options)
|
|
149
|
+
auth = nil
|
|
150
|
+
body = nil
|
|
151
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
152
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
153
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{commit_sha}/pulls"
|
|
154
|
+
|
|
155
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
156
|
+
|
|
157
|
+
if http_call.successful?
|
|
158
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
159
|
+
else
|
|
160
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# get a commit
|
|
165
|
+
#
|
|
166
|
+
# @param owner [String]
|
|
167
|
+
# @param repo [String]
|
|
168
|
+
# @param ref [String] ref parameter
|
|
169
|
+
#
|
|
170
|
+
# @return CommitsResult, CommitsErrorResult
|
|
171
|
+
def get_a_commit(owner, repo, ref, options)
|
|
172
|
+
auth = nil
|
|
173
|
+
body = nil
|
|
174
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
175
|
+
params = { page: options[:page], per_page: options[:per_page] }
|
|
176
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{ref}"
|
|
177
|
+
|
|
178
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
179
|
+
|
|
180
|
+
if http_call.successful?
|
|
181
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
182
|
+
else
|
|
183
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# compare two commits
|
|
188
|
+
#
|
|
189
|
+
# @param owner [String]
|
|
190
|
+
# @param repo [String]
|
|
191
|
+
# @param basehead [String] The base branch and head branch to compare. This parameter expects the format {base}...{head}.
|
|
192
|
+
#
|
|
193
|
+
# @return CommitsResult, CommitsErrorResult
|
|
194
|
+
def compare_two_commits(owner, repo, basehead, options)
|
|
195
|
+
auth = nil
|
|
196
|
+
body = nil
|
|
197
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
198
|
+
params = { page: options[:page], per_page: options[:per_page] }
|
|
199
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/compare/#{basehead}"
|
|
200
|
+
|
|
201
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
202
|
+
|
|
203
|
+
if http_call.successful?
|
|
204
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
205
|
+
else
|
|
206
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# list commit comments for a repository
|
|
211
|
+
#
|
|
212
|
+
# @param owner [String]
|
|
213
|
+
# @param repo [String]
|
|
214
|
+
#
|
|
215
|
+
# @return CommitsResult, CommitsErrorResult
|
|
216
|
+
def list_commit_comments_for_a_repository(owner, repo, options)
|
|
217
|
+
auth = nil
|
|
218
|
+
body = nil
|
|
219
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
220
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
221
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/comments"
|
|
222
|
+
|
|
223
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
224
|
+
|
|
225
|
+
if http_call.successful?
|
|
226
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
227
|
+
else
|
|
228
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# get a commit comment
|
|
233
|
+
#
|
|
234
|
+
# @param owner [String]
|
|
235
|
+
# @param repo [String]
|
|
236
|
+
# @param comment_id [Integer] comment_id parameter
|
|
237
|
+
#
|
|
238
|
+
# @return CommitsResult, CommitsErrorResult
|
|
239
|
+
def get_a_commit_comment(owner, repo, comment_id, _options)
|
|
240
|
+
auth = nil
|
|
241
|
+
body = nil
|
|
242
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
243
|
+
params = nil
|
|
244
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/comments/#{comment_id}"
|
|
245
|
+
|
|
246
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
247
|
+
|
|
248
|
+
if http_call.successful?
|
|
249
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
250
|
+
else
|
|
251
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# update a commit comment
|
|
256
|
+
#
|
|
257
|
+
# @param owner [String]
|
|
258
|
+
# @param repo [String]
|
|
259
|
+
# @param comment_id [Integer] comment_id parameter
|
|
260
|
+
# @param body [String] Required. The contents of the comment
|
|
261
|
+
#
|
|
262
|
+
# @return CommitsResult, CommitsErrorResult
|
|
263
|
+
def update_a_commit_comment(owner, repo, comment_id, body, _options)
|
|
264
|
+
auth = nil
|
|
265
|
+
body = { body: body }
|
|
266
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
267
|
+
params = nil
|
|
268
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/comments/#{comment_id}"
|
|
269
|
+
|
|
270
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
271
|
+
|
|
272
|
+
if http_call.successful?
|
|
273
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
274
|
+
else
|
|
275
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# delete a commit comment
|
|
280
|
+
#
|
|
281
|
+
# @param owner [String]
|
|
282
|
+
# @param repo [String]
|
|
283
|
+
# @param comment_id [Integer] comment_id parameter
|
|
284
|
+
#
|
|
285
|
+
# @return CommitsResult, CommitsErrorResult
|
|
286
|
+
def delete_a_commit_comment(owner, repo, comment_id, _options)
|
|
287
|
+
auth = nil
|
|
288
|
+
body = nil
|
|
289
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
290
|
+
params = nil
|
|
291
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/comments/#{comment_id}"
|
|
292
|
+
|
|
293
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
294
|
+
|
|
295
|
+
if http_call.successful?
|
|
296
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
297
|
+
else
|
|
298
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# list commit comments
|
|
303
|
+
#
|
|
304
|
+
# @param owner [String]
|
|
305
|
+
# @param repo [String]
|
|
306
|
+
# @param commit_sha [String] commit_sha parameter
|
|
307
|
+
#
|
|
308
|
+
# @return CommitsResult, CommitsErrorResult
|
|
309
|
+
def list_commit_comments(owner, repo, commit_sha, options)
|
|
310
|
+
auth = nil
|
|
311
|
+
body = nil
|
|
312
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
313
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
314
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{commit_sha}/comments"
|
|
315
|
+
|
|
316
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
317
|
+
|
|
318
|
+
if http_call.successful?
|
|
319
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
320
|
+
else
|
|
321
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# create a commit comment
|
|
326
|
+
#
|
|
327
|
+
# @param owner [String]
|
|
328
|
+
# @param repo [String]
|
|
329
|
+
# @param commit_sha [String] commit_sha parameter
|
|
330
|
+
# @param body [String] Required. The contents of the comment.
|
|
331
|
+
# @param path [String] Relative path of the file to comment on.
|
|
332
|
+
# @param position [Integer] Line index in the diff to comment on.
|
|
333
|
+
# @param line [Integer] Deprecated. Use position parameter instead. Line number in the file to comment on.
|
|
334
|
+
#
|
|
335
|
+
# @return CommitsResult, CommitsErrorResult
|
|
336
|
+
def create_a_commit_comment(owner, repo, commit_sha, body, path, position, line, _options)
|
|
337
|
+
auth = nil
|
|
338
|
+
body = { body: body, path: path, position: position, line: line }
|
|
339
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
340
|
+
params = nil
|
|
341
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{commit_sha}/comments"
|
|
342
|
+
|
|
343
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
344
|
+
|
|
345
|
+
if http_call.successful?
|
|
346
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
347
|
+
else
|
|
348
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# get the combined status for a specific reference
|
|
353
|
+
#
|
|
354
|
+
# @param owner [String]
|
|
355
|
+
# @param repo [String]
|
|
356
|
+
# @param ref [String] ref parameter
|
|
357
|
+
#
|
|
358
|
+
# @return CommitsResult, CommitsErrorResult
|
|
359
|
+
def get_the_combined_status_for_a_specific_reference(owner, repo, ref, options)
|
|
360
|
+
auth = nil
|
|
361
|
+
body = nil
|
|
362
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
363
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
364
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{ref}/status"
|
|
365
|
+
|
|
366
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
367
|
+
|
|
368
|
+
if http_call.successful?
|
|
369
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
370
|
+
else
|
|
371
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# list commit statuses for a reference
|
|
376
|
+
#
|
|
377
|
+
# @param owner [String]
|
|
378
|
+
# @param repo [String]
|
|
379
|
+
# @param ref [String] ref parameter
|
|
380
|
+
#
|
|
381
|
+
# @return CommitsResult, CommitsErrorResult
|
|
382
|
+
def list_commit_statuses_for_a_reference(owner, repo, ref, options)
|
|
383
|
+
auth = nil
|
|
384
|
+
body = nil
|
|
385
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
386
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
387
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{ref}/statuses"
|
|
388
|
+
|
|
389
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
390
|
+
|
|
391
|
+
if http_call.successful?
|
|
392
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
393
|
+
else
|
|
394
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# create a commit status
|
|
399
|
+
#
|
|
400
|
+
# @param owner [String]
|
|
401
|
+
# @param repo [String]
|
|
402
|
+
# @param sha [String]
|
|
403
|
+
# @param state [String] Required. The state of the status. Can be one of error, failure, pending, or success.
|
|
404
|
+
# @param target_url [String] The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status.
|
|
405
|
+
# For example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: http://ci.example.com/user/repo/build/sha
|
|
406
|
+
# @param description [String] A short description of the status.
|
|
407
|
+
# @param context [String] A string label to differentiate this status from the status of other systems. This field is case-insensitive.Default: default
|
|
408
|
+
#
|
|
409
|
+
# @return CommitsResult, CommitsErrorResult
|
|
410
|
+
def create_a_commit_status(owner, repo, sha, state, target_url, description, context, _options)
|
|
411
|
+
auth = nil
|
|
412
|
+
body = { state: state, target_url: target_url, description: description, context: context }
|
|
413
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
414
|
+
params = nil
|
|
415
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/statuses/#{sha}"
|
|
416
|
+
|
|
417
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
418
|
+
|
|
419
|
+
if http_call.successful?
|
|
420
|
+
CommitsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
421
|
+
else
|
|
422
|
+
CommitsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
end
|
|
427
|
+
end
|
|
428
|
+
end
|