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,315 @@
|
|
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 Code_scanning result
|
17
|
+
class CodeScanningResult
|
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 CodeScanningErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Code scanning endpoints.
|
37
|
+
class CodeScanning
|
38
|
+
def self.list_code_scanning_alerts_for_an_organization(org: nil, options: nil)
|
39
|
+
new.list_code_scanning_alerts_for_an_organization(org, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.list_code_scanning_alerts_for_a_repository(owner: nil, repo: nil, options: nil)
|
43
|
+
new.list_code_scanning_alerts_for_a_repository(owner, repo, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_a_code_scanning_alert(owner: nil, repo: nil, alert_number: nil, options: nil)
|
47
|
+
new.get_a_code_scanning_alert(owner, repo, alert_number, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.update_a_code_scanning_alert(owner: nil, repo: nil, alert_number: nil, state: nil, dismissed_reason: nil, options: nil)
|
51
|
+
new.update_a_code_scanning_alert(owner, repo, alert_number, state, dismissed_reason, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_instances_of_a_code_scanning_alert(owner: nil, repo: nil, alert_number: nil, options: nil)
|
55
|
+
new.list_instances_of_a_code_scanning_alert(owner, repo, alert_number, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.list_code_scanning_analyses_for_a_repository(owner: nil, repo: nil, options: nil)
|
59
|
+
new.list_code_scanning_analyses_for_a_repository(owner, repo, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.get_a_code_scanning_analysis_for_a_repository(owner: nil, repo: nil, analysis_id: nil, options: nil)
|
63
|
+
new.get_a_code_scanning_analysis_for_a_repository(owner, repo, analysis_id, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.delete_a_code_scanning_analysis_from_a_repository(owner: nil, repo: nil, analysis_id: nil, options: nil)
|
67
|
+
new.delete_a_code_scanning_analysis_from_a_repository(owner, repo, analysis_id, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.upload_an_analysis_as_sarif_data(owner: nil, repo: nil, commit_sha: nil, ref: nil, sarif: nil, checkout_uri: nil, started_at: nil, tool_name: nil, options: nil)
|
71
|
+
new.upload_an_analysis_as_sarif_data(owner, repo, commit_sha, ref, sarif, checkout_uri, started_at, tool_name, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_information_about_a_sarif_upload(owner: nil, repo: nil, sarif_id: nil, options: nil)
|
75
|
+
new.get_information_about_a_sarif_upload(owner, repo, sarif_id, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
# list code scanning alerts for an organization
|
81
|
+
#
|
82
|
+
# @param org [String]
|
83
|
+
#
|
84
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
85
|
+
def list_code_scanning_alerts_for_an_organization(org, options)
|
86
|
+
auth = nil
|
87
|
+
body = nil
|
88
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
89
|
+
params = { before: options[:before], after: options[:after], page: options[:page], per_page: options[:per_page], direction: options[:direction], state: options[:state], sort: options[:sort] }
|
90
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/code-scanning/alerts"
|
91
|
+
|
92
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
93
|
+
|
94
|
+
if http_call.successful?
|
95
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
96
|
+
else
|
97
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# list code scanning alerts for a repository
|
102
|
+
#
|
103
|
+
# @param owner [String]
|
104
|
+
# @param repo [String]
|
105
|
+
#
|
106
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
107
|
+
def list_code_scanning_alerts_for_a_repository(owner, repo, options)
|
108
|
+
auth = nil
|
109
|
+
body = nil
|
110
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
111
|
+
params = { tool_name: options[:tool_name], tool_guid: options[:tool_guid], page: options[:page], per_page: options[:per_page], ref: options[:ref], direction: options[:direction], sort: options[:sort], state: options[:state] }
|
112
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/alerts"
|
113
|
+
|
114
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
115
|
+
|
116
|
+
if http_call.successful?
|
117
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
118
|
+
else
|
119
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# get a code scanning alert
|
124
|
+
#
|
125
|
+
# @param owner [String]
|
126
|
+
# @param repo [String]
|
127
|
+
# @param alert_number [Integer] The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
|
128
|
+
#
|
129
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
130
|
+
def get_a_code_scanning_alert(owner, repo, alert_number, _options)
|
131
|
+
auth = nil
|
132
|
+
body = nil
|
133
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
134
|
+
params = nil
|
135
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/alerts/#{alert_number}"
|
136
|
+
|
137
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
138
|
+
|
139
|
+
if http_call.successful?
|
140
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
141
|
+
else
|
142
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# update a code scanning alert
|
147
|
+
#
|
148
|
+
# @param owner [String]
|
149
|
+
# @param repo [String]
|
150
|
+
# @param alert_number [Integer] The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
|
151
|
+
# @param state [String] Required. Sets the state of the code scanning alert. Can be one of open or dismissed. You must provide dismissed_reason when you set the state to dismissed.
|
152
|
+
# @param dismissed_reason [String or null] Required when the state is dismissed. The reason for dismissing or closing the alert. Can be one of: false positive, won't fix, and used in tests.
|
153
|
+
#
|
154
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
155
|
+
def update_a_code_scanning_alert(owner, repo, alert_number, state, dismissed_reason, _options)
|
156
|
+
auth = nil
|
157
|
+
body = { state: state, dismissed_reason: dismissed_reason }
|
158
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
159
|
+
params = nil
|
160
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/alerts/#{alert_number}"
|
161
|
+
|
162
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
163
|
+
|
164
|
+
if http_call.successful?
|
165
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
166
|
+
else
|
167
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# list instances of a code scanning alert
|
172
|
+
#
|
173
|
+
# @param owner [String]
|
174
|
+
# @param repo [String]
|
175
|
+
# @param alert_number [Integer] The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
|
176
|
+
#
|
177
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
178
|
+
def list_instances_of_a_code_scanning_alert(owner, repo, alert_number, options)
|
179
|
+
auth = nil
|
180
|
+
body = nil
|
181
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
182
|
+
params = { page: options[:page], per_page: options[:per_page], ref: options[:ref] }
|
183
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/alerts/#{alert_number}/instances"
|
184
|
+
|
185
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
186
|
+
|
187
|
+
if http_call.successful?
|
188
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
189
|
+
else
|
190
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# list code scanning analyses for a repository
|
195
|
+
#
|
196
|
+
# @param owner [String]
|
197
|
+
# @param repo [String]
|
198
|
+
#
|
199
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
200
|
+
def list_code_scanning_analyses_for_a_repository(owner, repo, options)
|
201
|
+
auth = nil
|
202
|
+
body = nil
|
203
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
204
|
+
params = { tool_name: options[:tool_name], tool_guid: options[:tool_guid], page: options[:page], per_page: options[:per_page], ref: options[:ref], sarif_id: options[:sarif_id] }
|
205
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/analyses"
|
206
|
+
|
207
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
208
|
+
|
209
|
+
if http_call.successful?
|
210
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
211
|
+
else
|
212
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# get a code scanning analysis for a repository
|
217
|
+
#
|
218
|
+
# @param owner [String]
|
219
|
+
# @param repo [String]
|
220
|
+
# @param analysis_id [Integer] The ID of the analysis, as returned from the GET /repos/{owner}/{repo}/code-scanning/analyses operation.
|
221
|
+
#
|
222
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
223
|
+
def get_a_code_scanning_analysis_for_a_repository(owner, repo, analysis_id, _options)
|
224
|
+
auth = nil
|
225
|
+
body = nil
|
226
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
227
|
+
params = nil
|
228
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/analyses/#{analysis_id}"
|
229
|
+
|
230
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
231
|
+
|
232
|
+
if http_call.successful?
|
233
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
234
|
+
else
|
235
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# delete a code scanning analysis from a repository
|
240
|
+
#
|
241
|
+
# @param owner [String]
|
242
|
+
# @param repo [String]
|
243
|
+
# @param analysis_id [Integer] The ID of the analysis, as returned from the GET /repos/{owner}/{repo}/code-scanning/analyses operation.
|
244
|
+
#
|
245
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
246
|
+
def delete_a_code_scanning_analysis_from_a_repository(owner, repo, analysis_id, options)
|
247
|
+
auth = nil
|
248
|
+
body = nil
|
249
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
250
|
+
params = { confirm_delete: options[:confirm_delete] }
|
251
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/analyses/#{analysis_id}"
|
252
|
+
|
253
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
254
|
+
|
255
|
+
if http_call.successful?
|
256
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
257
|
+
else
|
258
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# upload an analysis as sarif data
|
263
|
+
#
|
264
|
+
# @param owner [String]
|
265
|
+
# @param repo [String]
|
266
|
+
# @param commit_sha [String] Required. The SHA of the commit to which the analysis you are uploading relates.
|
267
|
+
# @param ref [String] Required. The full Git reference, formatted as refs/heads/<branch name>, refs/pull/<number>/merge, or refs/pull/<number>/head.
|
268
|
+
# @param sarif [String] Required. A Base64 string representing the SARIF file to upload. You must first compress your SARIF file using gzip and then translate the contents of the file into a Base64 encoding string. For more information, see "SARIF support for code scanning."
|
269
|
+
# @param checkout_uri [String] The base directory used in the analysis, as it appears in the SARIF file. This property is used to convert file paths from absolute to relative, so that alerts can be mapped to their correct location in the repository.
|
270
|
+
# @param started_at [String] The time that the analysis run began. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
271
|
+
# @param tool_name [String] The name of the tool used to generate the code scanning analysis. If this parameter is not used, the tool name defaults to "API". If the uploaded SARIF contains a tool GUID, this will be available for filtering using the tool_guid parameter of operations such as GET /repos/{owner}/{repo}/code-scanning/alerts.
|
272
|
+
#
|
273
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
274
|
+
def upload_an_analysis_as_sarif_data(owner, repo, commit_sha, ref, sarif, checkout_uri, started_at, tool_name, _options)
|
275
|
+
auth = nil
|
276
|
+
body = { commit_sha: commit_sha, ref: ref, sarif: sarif, checkout_uri: checkout_uri, started_at: started_at, tool_name: tool_name }
|
277
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
278
|
+
params = nil
|
279
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/sarifs"
|
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
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
285
|
+
else
|
286
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# get information about a sarif upload
|
291
|
+
#
|
292
|
+
# @param owner [String]
|
293
|
+
# @param repo [String]
|
294
|
+
# @param sarif_id [String] The SARIF ID obtained after uploading.
|
295
|
+
#
|
296
|
+
# @return CodeScanningResult, CodeScanningErrorResult
|
297
|
+
def get_information_about_a_sarif_upload(owner, repo, sarif_id, _options)
|
298
|
+
auth = nil
|
299
|
+
body = nil
|
300
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
301
|
+
params = nil
|
302
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/code-scanning/sarifs/#{sarif_id}"
|
303
|
+
|
304
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
305
|
+
|
306
|
+
if http_call.successful?
|
307
|
+
CodeScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
308
|
+
else
|
309
|
+
CodeScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
@@ -0,0 +1,92 @@
|
|
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 Codes_of_conduct result
|
17
|
+
class CodesOfConductResult
|
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 CodesOfConductErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Codes of conduct endpoints.
|
37
|
+
class CodesOfConduct
|
38
|
+
def self.get_all_codes_of_conduct(options: nil)
|
39
|
+
new.get_all_codes_of_conduct(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get_a_code_of_conduct(key: nil, options: nil)
|
43
|
+
new.get_a_code_of_conduct(key, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# get all codes of conduct
|
49
|
+
#
|
50
|
+
# @params options [Hash]
|
51
|
+
#
|
52
|
+
# @return CodesOfConductResult, CodesOfConductErrorResult
|
53
|
+
def get_all_codes_of_conduct(_options)
|
54
|
+
auth = nil
|
55
|
+
body = nil
|
56
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
57
|
+
params = nil
|
58
|
+
uri = "#{Gitabu::BASE_URL}/codes_of_conduct"
|
59
|
+
|
60
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
61
|
+
|
62
|
+
if http_call.successful?
|
63
|
+
CodesOfConductResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
64
|
+
else
|
65
|
+
CodesOfConductErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# get a code of conduct
|
70
|
+
#
|
71
|
+
# @param key [String]
|
72
|
+
#
|
73
|
+
# @return CodesOfConductResult, CodesOfConductErrorResult
|
74
|
+
def get_a_code_of_conduct(key, _options)
|
75
|
+
auth = nil
|
76
|
+
body = nil
|
77
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
78
|
+
params = nil
|
79
|
+
uri = "#{Gitabu::BASE_URL}/codes_of_conduct/#{key}"
|
80
|
+
|
81
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
82
|
+
|
83
|
+
if http_call.successful?
|
84
|
+
CodesOfConductResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
85
|
+
else
|
86
|
+
CodesOfConductErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|