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,282 @@
|
|
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 Pages result
|
17
|
+
class PagesResult
|
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 PagesErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Pages endpoints.
|
37
|
+
class Pages
|
38
|
+
def self.get_a_github_pages_site(owner: nil, repo: nil, options: nil)
|
39
|
+
new.get_a_github_pages_site(owner, repo, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_a_github_pages_site(owner: nil, repo: nil, source: nil, options: nil)
|
43
|
+
new.create_a_github_pages_site(owner, repo, source, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.update_information_about_a_github_pages_site(owner: nil, repo: nil, cname: nil, https_enforced: nil, public: nil, source: nil, options: nil)
|
47
|
+
new.update_information_about_a_github_pages_site(owner, repo, cname, https_enforced, public, source, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.delete_a_github_pages_site(owner: nil, repo: nil, options: nil)
|
51
|
+
new.delete_a_github_pages_site(owner, repo, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_github_pages_builds(owner: nil, repo: nil, options: nil)
|
55
|
+
new.list_github_pages_builds(owner, repo, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.request_a_github_pages_build(owner: nil, repo: nil, options: nil)
|
59
|
+
new.request_a_github_pages_build(owner, repo, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.get_latest_pages_build(owner: nil, repo: nil, options: nil)
|
63
|
+
new.get_latest_pages_build(owner, repo, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.get_github_pages_build(owner: nil, repo: nil, build_id: nil, options: nil)
|
67
|
+
new.get_github_pages_build(owner, repo, build_id, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_a_dns_health_check_for_github_pages(owner: nil, repo: nil, options: nil)
|
71
|
+
new.get_a_dns_health_check_for_github_pages(owner, repo, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
# get a github pages site
|
77
|
+
#
|
78
|
+
# @param owner [String]
|
79
|
+
# @param repo [String]
|
80
|
+
#
|
81
|
+
# @return PagesResult, PagesErrorResult
|
82
|
+
def get_a_github_pages_site(owner, repo, _options)
|
83
|
+
auth = nil
|
84
|
+
body = nil
|
85
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
86
|
+
params = nil
|
87
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages"
|
88
|
+
|
89
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
90
|
+
|
91
|
+
if http_call.successful?
|
92
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
93
|
+
else
|
94
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# create a github pages site
|
99
|
+
#
|
100
|
+
# @param owner [String]
|
101
|
+
# @param repo [String]
|
102
|
+
# @param source [Object] Required. The source branch and directory used to publish your Pages site.
|
103
|
+
#
|
104
|
+
# @return PagesResult, PagesErrorResult
|
105
|
+
def create_a_github_pages_site(owner, repo, source, _options)
|
106
|
+
auth = nil
|
107
|
+
body = { source: source }
|
108
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
109
|
+
params = nil
|
110
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages"
|
111
|
+
|
112
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
113
|
+
|
114
|
+
if http_call.successful?
|
115
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
116
|
+
else
|
117
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# update information about a github pages site
|
122
|
+
#
|
123
|
+
# @param owner [String]
|
124
|
+
# @param repo [String]
|
125
|
+
# @param cname [String or null] Specify a custom domain for the repository. Sending a null value will remove the custom domain. For more about custom domains, see "Using a custom domain with GitHub Pages."
|
126
|
+
# @param https_enforced [Boolean] Specify whether HTTPS should be enforced for the repository.
|
127
|
+
# @param public [Boolean] Configures access controls for the GitHub Pages site. If public is set to true, the site is accessible to anyone on the internet. If set to false, the site will only be accessible to users who have at least read access to the repository that published the site. This includes anyone in your Enterprise if the repository is set to internal visibility. This feature is only available to repositories in an organization on an Enterprise plan.
|
128
|
+
# @param source []
|
129
|
+
#
|
130
|
+
# @return PagesResult, PagesErrorResult
|
131
|
+
def update_information_about_a_github_pages_site(owner, repo, cname, https_enforced, public, source, _options)
|
132
|
+
auth = nil
|
133
|
+
body = { cname: cname, https_enforced: https_enforced, public: public, source: source }
|
134
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
135
|
+
params = nil
|
136
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages"
|
137
|
+
|
138
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
139
|
+
|
140
|
+
if http_call.successful?
|
141
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
142
|
+
else
|
143
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# delete a github pages site
|
148
|
+
#
|
149
|
+
# @param owner [String]
|
150
|
+
# @param repo [String]
|
151
|
+
#
|
152
|
+
# @return PagesResult, PagesErrorResult
|
153
|
+
def delete_a_github_pages_site(owner, repo, _options)
|
154
|
+
auth = nil
|
155
|
+
body = nil
|
156
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
157
|
+
params = nil
|
158
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages"
|
159
|
+
|
160
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
161
|
+
|
162
|
+
if http_call.successful?
|
163
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
164
|
+
else
|
165
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# list github pages builds
|
170
|
+
#
|
171
|
+
# @param owner [String]
|
172
|
+
# @param repo [String]
|
173
|
+
#
|
174
|
+
# @return PagesResult, PagesErrorResult
|
175
|
+
def list_github_pages_builds(owner, repo, options)
|
176
|
+
auth = nil
|
177
|
+
body = nil
|
178
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
179
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
180
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages/builds"
|
181
|
+
|
182
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
183
|
+
|
184
|
+
if http_call.successful?
|
185
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
186
|
+
else
|
187
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# request a github pages build
|
192
|
+
#
|
193
|
+
# @param owner [String]
|
194
|
+
# @param repo [String]
|
195
|
+
#
|
196
|
+
# @return PagesResult, PagesErrorResult
|
197
|
+
def request_a_github_pages_build(owner, repo, _options)
|
198
|
+
auth = nil
|
199
|
+
body = nil
|
200
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
201
|
+
params = nil
|
202
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages/builds"
|
203
|
+
|
204
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
205
|
+
|
206
|
+
if http_call.successful?
|
207
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
208
|
+
else
|
209
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# get latest pages build
|
214
|
+
#
|
215
|
+
# @param owner [String]
|
216
|
+
# @param repo [String]
|
217
|
+
#
|
218
|
+
# @return PagesResult, PagesErrorResult
|
219
|
+
def get_latest_pages_build(owner, repo, _options)
|
220
|
+
auth = nil
|
221
|
+
body = nil
|
222
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
223
|
+
params = nil
|
224
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages/builds/latest"
|
225
|
+
|
226
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
227
|
+
|
228
|
+
if http_call.successful?
|
229
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
230
|
+
else
|
231
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# get github pages build
|
236
|
+
#
|
237
|
+
# @param owner [String]
|
238
|
+
# @param repo [String]
|
239
|
+
# @param build_id [Integer]
|
240
|
+
#
|
241
|
+
# @return PagesResult, PagesErrorResult
|
242
|
+
def get_github_pages_build(owner, repo, build_id, _options)
|
243
|
+
auth = nil
|
244
|
+
body = nil
|
245
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
246
|
+
params = nil
|
247
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages/builds/#{build_id}"
|
248
|
+
|
249
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
250
|
+
|
251
|
+
if http_call.successful?
|
252
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
253
|
+
else
|
254
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# get a dns health check for github pages
|
259
|
+
#
|
260
|
+
# @param owner [String]
|
261
|
+
# @param repo [String]
|
262
|
+
#
|
263
|
+
# @return PagesResult, PagesErrorResult
|
264
|
+
def get_a_dns_health_check_for_github_pages(owner, repo, _options)
|
265
|
+
auth = nil
|
266
|
+
body = nil
|
267
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
268
|
+
params = nil
|
269
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pages/health"
|
270
|
+
|
271
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
272
|
+
|
273
|
+
if http_call.successful?
|
274
|
+
PagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
275
|
+
else
|
276
|
+
PagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|