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,384 @@
|
|
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 Checks result
|
17
|
+
class ChecksResult
|
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 ChecksErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Checks endpoints.
|
37
|
+
class Checks
|
38
|
+
def self.create_a_check_run(owner: nil, repo: nil, name: nil, head_sha: nil, details_url: nil, external_id: nil, status: nil, started_at: nil, conclusion: nil, completed_at: nil, output: nil, actions: nil, options: nil)
|
39
|
+
new.create_a_check_run(owner, repo, name, head_sha, details_url, external_id, status, started_at, conclusion, completed_at, output, actions, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get_a_check_run(owner: nil, repo: nil, check_run_id: nil, options: nil)
|
43
|
+
new.get_a_check_run(owner, repo, check_run_id, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.update_a_check_run(owner: nil, repo: nil, check_run_id: nil, name: nil, details_url: nil, external_id: nil, started_at: nil, status: nil, conclusion: nil, completed_at: nil, output: nil, actions: nil, options: nil)
|
47
|
+
new.update_a_check_run(owner, repo, check_run_id, name, details_url, external_id, started_at, status, conclusion, completed_at, output, actions, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.list_check_run_annotations(owner: nil, repo: nil, check_run_id: nil, options: nil)
|
51
|
+
new.list_check_run_annotations(owner, repo, check_run_id, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.rerequest_a_check_run(owner: nil, repo: nil, check_run_id: nil, options: nil)
|
55
|
+
new.rerequest_a_check_run(owner, repo, check_run_id, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.list_check_runs_in_a_check_suite(owner: nil, repo: nil, check_suite_id: nil, options: nil)
|
59
|
+
new.list_check_runs_in_a_check_suite(owner, repo, check_suite_id, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.list_check_runs_for_a_git_reference(owner: nil, repo: nil, ref: nil, options: nil)
|
63
|
+
new.list_check_runs_for_a_git_reference(owner, repo, ref, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.create_a_check_suite(owner: nil, repo: nil, head_sha: nil, options: nil)
|
67
|
+
new.create_a_check_suite(owner, repo, head_sha, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.update_repository_preferences_for_check_suites(owner: nil, repo: nil, auto_trigger_checks: nil, options: nil)
|
71
|
+
new.update_repository_preferences_for_check_suites(owner, repo, auto_trigger_checks, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_a_check_suite(owner: nil, repo: nil, check_suite_id: nil, options: nil)
|
75
|
+
new.get_a_check_suite(owner, repo, check_suite_id, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.rerequest_a_check_suite(owner: nil, repo: nil, check_suite_id: nil, options: nil)
|
79
|
+
new.rerequest_a_check_suite(owner, repo, check_suite_id, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.list_check_suites_for_a_git_reference(owner: nil, repo: nil, ref: nil, options: nil)
|
83
|
+
new.list_check_suites_for_a_git_reference(owner, repo, ref, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
# create a check run
|
89
|
+
#
|
90
|
+
# @param owner [String]
|
91
|
+
# @param repo [String]
|
92
|
+
# @param name [String] Required. The name of the check. For example, "code-coverage".
|
93
|
+
# @param head_sha [String] Required. The SHA of the commit.
|
94
|
+
# @param details_url [String] The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.
|
95
|
+
# @param external_id [String] A reference for the run on the integrator's system.
|
96
|
+
# @param status [String] The current status. Can be one of queued, in_progress, or completed.Default: queued
|
97
|
+
# @param started_at [String] The time that the check run began. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
98
|
+
# @param conclusion [String] Required if you provide completed_at or a status of completed. The final conclusion of the check. Can be one of action_required, cancelled, failure, neutral, success, skipped, stale, or timed_out. When the conclusion is action_required, additional details should be provided on the site specified by details_url.
|
99
|
+
# @param completed_at [String] The time the check completed. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
100
|
+
# @param output [Object] Check runs can accept a variety of data in the output object, including a title and summary and can optionally provide descriptive details about the run. See the output object description.
|
101
|
+
# @param actions [Array of objects] Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the check_run.requested_action webhook to your app. Each action includes a label, identifier and description. A maximum of three actions are accepted. See the actions object description. To learn more about check runs and requested actions, see "Check runs and requested actions."
|
102
|
+
#
|
103
|
+
# @return ChecksResult, ChecksErrorResult
|
104
|
+
def create_a_check_run(owner, repo, name, head_sha, details_url, external_id, status, started_at, conclusion, completed_at, output, actions, _options)
|
105
|
+
auth = nil
|
106
|
+
body = { name: name, head_sha: head_sha, details_url: details_url, external_id: external_id, status: status, started_at: started_at, conclusion: conclusion, completed_at: completed_at, output: output, actions: actions }
|
107
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
108
|
+
params = nil
|
109
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-runs"
|
110
|
+
|
111
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
112
|
+
|
113
|
+
if http_call.successful?
|
114
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
115
|
+
else
|
116
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# get a check run
|
121
|
+
#
|
122
|
+
# @param owner [String]
|
123
|
+
# @param repo [String]
|
124
|
+
# @param check_run_id [Integer] check_run_id parameter
|
125
|
+
#
|
126
|
+
# @return ChecksResult, ChecksErrorResult
|
127
|
+
def get_a_check_run(owner, repo, check_run_id, _options)
|
128
|
+
auth = nil
|
129
|
+
body = nil
|
130
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
131
|
+
params = nil
|
132
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-runs/#{check_run_id}"
|
133
|
+
|
134
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
135
|
+
|
136
|
+
if http_call.successful?
|
137
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
138
|
+
else
|
139
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# update a check run
|
144
|
+
#
|
145
|
+
# @param owner [String]
|
146
|
+
# @param repo [String]
|
147
|
+
# @param check_run_id [Integer] check_run_id parameter
|
148
|
+
# @param name [String] The name of the check. For example, "code-coverage".
|
149
|
+
# @param details_url [String] The URL of the integrator's site that has the full details of the check.
|
150
|
+
# @param external_id [String] A reference for the run on the integrator's system.
|
151
|
+
# @param started_at [String] This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
152
|
+
# @param status [String] The current status. Can be one of queued, in_progress, or completed.
|
153
|
+
# @param conclusion [String] Required if you provide completed_at or a status of completed. The final conclusion of the check. Can be one of action_required, cancelled, failure, neutral, success, skipped, stale, or timed_out.
|
154
|
+
# @param completed_at [String] The time the check completed. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
155
|
+
# @param output [Object] Check runs can accept a variety of data in the output object, including a title and summary and can optionally provide descriptive details about the run. See the output object description.
|
156
|
+
# @param actions [Array of objects] Possible further actions the integrator can perform, which a user may trigger. Each action includes a label, identifier and description. A maximum of three actions are accepted. See the actions object description. To learn more about check runs and requested actions, see "Check runs and requested actions."
|
157
|
+
#
|
158
|
+
# @return ChecksResult, ChecksErrorResult
|
159
|
+
def update_a_check_run(owner, repo, check_run_id, name, details_url, external_id, started_at, status, conclusion, completed_at, output, actions, _options)
|
160
|
+
auth = nil
|
161
|
+
body = { name: name, details_url: details_url, external_id: external_id, started_at: started_at, status: status, conclusion: conclusion, completed_at: completed_at, output: output, actions: actions }
|
162
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
163
|
+
params = nil
|
164
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-runs/#{check_run_id}"
|
165
|
+
|
166
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
167
|
+
|
168
|
+
if http_call.successful?
|
169
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
170
|
+
else
|
171
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# list check run annotations
|
176
|
+
#
|
177
|
+
# @param owner [String]
|
178
|
+
# @param repo [String]
|
179
|
+
# @param check_run_id [Integer] check_run_id parameter
|
180
|
+
#
|
181
|
+
# @return ChecksResult, ChecksErrorResult
|
182
|
+
def list_check_run_annotations(owner, repo, check_run_id, options)
|
183
|
+
auth = nil
|
184
|
+
body = nil
|
185
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
186
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
187
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-runs/#{check_run_id}/annotations"
|
188
|
+
|
189
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
190
|
+
|
191
|
+
if http_call.successful?
|
192
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
193
|
+
else
|
194
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# rerequest a check run
|
199
|
+
#
|
200
|
+
# @param owner [String]
|
201
|
+
# @param repo [String]
|
202
|
+
# @param check_run_id [Integer] check_run_id parameter
|
203
|
+
#
|
204
|
+
# @return ChecksResult, ChecksErrorResult
|
205
|
+
def rerequest_a_check_run(owner, repo, check_run_id, _options)
|
206
|
+
auth = nil
|
207
|
+
body = nil
|
208
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
209
|
+
params = nil
|
210
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-runs/#{check_run_id}/rerequest"
|
211
|
+
|
212
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
213
|
+
|
214
|
+
if http_call.successful?
|
215
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
216
|
+
else
|
217
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# list check runs in a check suite
|
222
|
+
#
|
223
|
+
# @param owner [String]
|
224
|
+
# @param repo [String]
|
225
|
+
# @param check_suite_id [Integer] check_suite_id parameter
|
226
|
+
#
|
227
|
+
# @return ChecksResult, ChecksErrorResult
|
228
|
+
def list_check_runs_in_a_check_suite(owner, repo, check_suite_id, options)
|
229
|
+
auth = nil
|
230
|
+
body = nil
|
231
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
232
|
+
params = { check_name: options[:check_name], status: options[:status], filter: options[:filter], per_page: options[:per_page], page: options[:page] }
|
233
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-suites/#{check_suite_id}/check-runs"
|
234
|
+
|
235
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
236
|
+
|
237
|
+
if http_call.successful?
|
238
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
239
|
+
else
|
240
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# list check runs for a git reference
|
245
|
+
#
|
246
|
+
# @param owner [String]
|
247
|
+
# @param repo [String]
|
248
|
+
# @param ref [String] ref parameter
|
249
|
+
#
|
250
|
+
# @return ChecksResult, ChecksErrorResult
|
251
|
+
def list_check_runs_for_a_git_reference(owner, repo, ref, options)
|
252
|
+
auth = nil
|
253
|
+
body = nil
|
254
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
255
|
+
params = { check_name: options[:check_name], status: options[:status], filter: options[:filter], per_page: options[:per_page], page: options[:page], app_id: options[:app_id] }
|
256
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{ref}/check-runs"
|
257
|
+
|
258
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
259
|
+
|
260
|
+
if http_call.successful?
|
261
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
262
|
+
else
|
263
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# create a check suite
|
268
|
+
#
|
269
|
+
# @param owner [String]
|
270
|
+
# @param repo [String]
|
271
|
+
# @param head_sha [String] Required. The sha of the head commit.
|
272
|
+
#
|
273
|
+
# @return ChecksResult, ChecksErrorResult
|
274
|
+
def create_a_check_suite(owner, repo, head_sha, _options)
|
275
|
+
auth = nil
|
276
|
+
body = { head_sha: head_sha }
|
277
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
278
|
+
params = nil
|
279
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-suites"
|
280
|
+
|
281
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
282
|
+
|
283
|
+
if http_call.successful?
|
284
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
285
|
+
else
|
286
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# update repository preferences for check suites
|
291
|
+
#
|
292
|
+
# @param owner [String]
|
293
|
+
# @param repo [String]
|
294
|
+
# @param auto_trigger_checks [Array of objects] Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default. See the auto_trigger_checks object description for details.
|
295
|
+
#
|
296
|
+
# @return ChecksResult, ChecksErrorResult
|
297
|
+
def update_repository_preferences_for_check_suites(owner, repo, auto_trigger_checks, _options)
|
298
|
+
auth = nil
|
299
|
+
body = { auto_trigger_checks: auto_trigger_checks }
|
300
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
301
|
+
params = nil
|
302
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-suites/preferences"
|
303
|
+
|
304
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
305
|
+
|
306
|
+
if http_call.successful?
|
307
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
308
|
+
else
|
309
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
# get a check suite
|
314
|
+
#
|
315
|
+
# @param owner [String]
|
316
|
+
# @param repo [String]
|
317
|
+
# @param check_suite_id [Integer] check_suite_id parameter
|
318
|
+
#
|
319
|
+
# @return ChecksResult, ChecksErrorResult
|
320
|
+
def get_a_check_suite(owner, repo, check_suite_id, _options)
|
321
|
+
auth = nil
|
322
|
+
body = nil
|
323
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
324
|
+
params = nil
|
325
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-suites/#{check_suite_id}"
|
326
|
+
|
327
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
328
|
+
|
329
|
+
if http_call.successful?
|
330
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
331
|
+
else
|
332
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# rerequest a check suite
|
337
|
+
#
|
338
|
+
# @param owner [String]
|
339
|
+
# @param repo [String]
|
340
|
+
# @param check_suite_id [Integer] check_suite_id parameter
|
341
|
+
#
|
342
|
+
# @return ChecksResult, ChecksErrorResult
|
343
|
+
def rerequest_a_check_suite(owner, repo, check_suite_id, _options)
|
344
|
+
auth = nil
|
345
|
+
body = nil
|
346
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
347
|
+
params = nil
|
348
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/check-suites/#{check_suite_id}/rerequest"
|
349
|
+
|
350
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
351
|
+
|
352
|
+
if http_call.successful?
|
353
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
354
|
+
else
|
355
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
# list check suites for a git reference
|
360
|
+
#
|
361
|
+
# @param owner [String]
|
362
|
+
# @param repo [String]
|
363
|
+
# @param ref [String] ref parameter
|
364
|
+
#
|
365
|
+
# @return ChecksResult, ChecksErrorResult
|
366
|
+
def list_check_suites_for_a_git_reference(owner, repo, ref, options)
|
367
|
+
auth = nil
|
368
|
+
body = nil
|
369
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
370
|
+
params = { app_id: options[:app_id], check_name: options[:check_name], per_page: options[:per_page], page: options[:page] }
|
371
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/commits/#{ref}/check-suites"
|
372
|
+
|
373
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
374
|
+
|
375
|
+
if http_call.successful?
|
376
|
+
ChecksResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
377
|
+
else
|
378
|
+
ChecksErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|