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,214 @@
|
|
|
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 Scim result
|
|
17
|
+
class ScimResult
|
|
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 ScimErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Scim endpoints.
|
|
37
|
+
class Scim
|
|
38
|
+
def self.list_scim_provisioned_identities(org: nil, options: nil)
|
|
39
|
+
new.list_scim_provisioned_identities(org, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.provision_and_invite_a_scim_user(org: nil, username: nil, displayname: nil, name: nil, emails: nil, schemas: nil, externalid: nil, groups: nil, active: nil, options: nil)
|
|
43
|
+
new.provision_and_invite_a_scim_user(org, username, displayname, name, emails, schemas, externalid, groups, active, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.get_scim_provisioning_information_for_a_user(org: nil, scim_user_id: nil, options: nil)
|
|
47
|
+
new.get_scim_provisioning_information_for_a_user(org, scim_user_id, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.update_a_provisioned_organization_membership(org: nil, scim_user_id: nil, schemas: nil, displayname: nil, externalid: nil, groups: nil, active: nil, username: nil, name: nil, emails: nil, options: nil)
|
|
51
|
+
new.update_a_provisioned_organization_membership(org, scim_user_id, schemas, displayname, externalid, groups, active, username, name, emails, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.update_an_attribute_for_a_scim_user(org: nil, scim_user_id: nil, schemas: nil, operations: nil, options: nil)
|
|
55
|
+
new.update_an_attribute_for_a_scim_user(org, scim_user_id, schemas, operations, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.delete_a_scim_user_from_an_organization(org: nil, scim_user_id: nil, options: nil)
|
|
59
|
+
new.delete_a_scim_user_from_an_organization(org, scim_user_id, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
# list scim provisioned identities
|
|
65
|
+
#
|
|
66
|
+
# @param org [String]
|
|
67
|
+
#
|
|
68
|
+
# @return ScimResult, ScimErrorResult
|
|
69
|
+
def list_scim_provisioned_identities(org, options)
|
|
70
|
+
auth = nil
|
|
71
|
+
body = nil
|
|
72
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
73
|
+
params = { startIndex: options[:startIndex], count: options[:count], filter: options[:filter] }
|
|
74
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users"
|
|
75
|
+
|
|
76
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
77
|
+
|
|
78
|
+
if http_call.successful?
|
|
79
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
80
|
+
else
|
|
81
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# provision and invite a scim user
|
|
86
|
+
#
|
|
87
|
+
# @param org [String]
|
|
88
|
+
# @param username [String] Required. Configured by the admin. Could be an email, login, or username
|
|
89
|
+
# @param displayname [String] The name of the user, suitable for display to end-users
|
|
90
|
+
# @param name [Object] Required.
|
|
91
|
+
# @param emails [Array of objects] Required. user emails
|
|
92
|
+
# @param schemas [Array of strings]
|
|
93
|
+
# @param externalid [String]
|
|
94
|
+
# @param groups [Array of strings]
|
|
95
|
+
# @param active [Boolean]
|
|
96
|
+
#
|
|
97
|
+
# @return ScimResult, ScimErrorResult
|
|
98
|
+
def provision_and_invite_a_scim_user(org, username, displayname, name, emails, schemas, externalid, groups, active, _options)
|
|
99
|
+
auth = nil
|
|
100
|
+
body = { username: username, displayname: displayname, name: name, emails: emails, schemas: schemas, externalid: externalid, groups: groups, active: active }
|
|
101
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
102
|
+
params = nil
|
|
103
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users"
|
|
104
|
+
|
|
105
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
106
|
+
|
|
107
|
+
if http_call.successful?
|
|
108
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
109
|
+
else
|
|
110
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# get scim provisioning information for a user
|
|
115
|
+
#
|
|
116
|
+
# @param org [String]
|
|
117
|
+
# @param scim_user_id [String] scim_user_id parameter
|
|
118
|
+
#
|
|
119
|
+
# @return ScimResult, ScimErrorResult
|
|
120
|
+
def get_scim_provisioning_information_for_a_user(org, scim_user_id, _options)
|
|
121
|
+
auth = nil
|
|
122
|
+
body = nil
|
|
123
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
124
|
+
params = nil
|
|
125
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users/#{scim_user_id}"
|
|
126
|
+
|
|
127
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
128
|
+
|
|
129
|
+
if http_call.successful?
|
|
130
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
131
|
+
else
|
|
132
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# update a provisioned organization membership
|
|
137
|
+
#
|
|
138
|
+
# @param org [String]
|
|
139
|
+
# @param scim_user_id [String] scim_user_id parameter
|
|
140
|
+
# @param schemas [Array of strings]
|
|
141
|
+
# @param displayname [String] The name of the user, suitable for display to end-users
|
|
142
|
+
# @param externalid [String]
|
|
143
|
+
# @param groups [Array of strings]
|
|
144
|
+
# @param active [Boolean]
|
|
145
|
+
# @param username [String] Required. Configured by the admin. Could be an email, login, or username
|
|
146
|
+
# @param name [Object] Required.
|
|
147
|
+
# @param emails [Array of objects] Required. user emails
|
|
148
|
+
#
|
|
149
|
+
# @return ScimResult, ScimErrorResult
|
|
150
|
+
def update_a_provisioned_organization_membership(org, scim_user_id, schemas, displayname, externalid, groups, active, username, name, emails, _options)
|
|
151
|
+
auth = nil
|
|
152
|
+
body = { schemas: schemas, displayname: displayname, externalid: externalid, groups: groups, active: active, username: username, name: name, emails: emails }
|
|
153
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
154
|
+
params = nil
|
|
155
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users/#{scim_user_id}"
|
|
156
|
+
|
|
157
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
158
|
+
|
|
159
|
+
if http_call.successful?
|
|
160
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
161
|
+
else
|
|
162
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# update an attribute for a scim user
|
|
167
|
+
#
|
|
168
|
+
# @param org [String]
|
|
169
|
+
# @param scim_user_id [String] scim_user_id parameter
|
|
170
|
+
# @param schemas [Array of strings]
|
|
171
|
+
# @param operations [Array of objects] Required. Set of operations to be performed
|
|
172
|
+
#
|
|
173
|
+
# @return ScimResult, ScimErrorResult
|
|
174
|
+
def update_an_attribute_for_a_scim_user(org, scim_user_id, schemas, operations, _options)
|
|
175
|
+
auth = nil
|
|
176
|
+
body = { schemas: schemas, operations: operations }
|
|
177
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
178
|
+
params = nil
|
|
179
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users/#{scim_user_id}"
|
|
180
|
+
|
|
181
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
182
|
+
|
|
183
|
+
if http_call.successful?
|
|
184
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
185
|
+
else
|
|
186
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# delete a scim user from an organization
|
|
191
|
+
#
|
|
192
|
+
# @param org [String]
|
|
193
|
+
# @param scim_user_id [String] scim_user_id parameter
|
|
194
|
+
#
|
|
195
|
+
# @return ScimResult, ScimErrorResult
|
|
196
|
+
def delete_a_scim_user_from_an_organization(org, scim_user_id, _options)
|
|
197
|
+
auth = nil
|
|
198
|
+
body = nil
|
|
199
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
200
|
+
params = nil
|
|
201
|
+
uri = "#{Gitabu::BASE_URL}/scim/v2/organizations/#{org}/Users/#{scim_user_id}"
|
|
202
|
+
|
|
203
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
204
|
+
|
|
205
|
+
if http_call.successful?
|
|
206
|
+
ScimResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
207
|
+
else
|
|
208
|
+
ScimErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
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 Search result
|
|
17
|
+
class SearchResult
|
|
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 SearchErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Search endpoints.
|
|
37
|
+
class Search
|
|
38
|
+
def self.search_code(options: nil)
|
|
39
|
+
new.search_code(options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.search_commits(options: nil)
|
|
43
|
+
new.search_commits(options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.search_issues_and_pull_requests(options: nil)
|
|
47
|
+
new.search_issues_and_pull_requests(options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.search_labels(options: nil)
|
|
51
|
+
new.search_labels(options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.search_repositories(options: nil)
|
|
55
|
+
new.search_repositories(options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.search_topics(options: nil)
|
|
59
|
+
new.search_topics(options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.search_users(options: nil)
|
|
63
|
+
new.search_users(options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
# search code
|
|
69
|
+
#
|
|
70
|
+
# @params options [Hash]
|
|
71
|
+
#
|
|
72
|
+
# @return SearchResult, SearchErrorResult
|
|
73
|
+
def search_code(options)
|
|
74
|
+
auth = nil
|
|
75
|
+
body = nil
|
|
76
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
77
|
+
params = { q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
78
|
+
uri = "#{Gitabu::BASE_URL}/search/code"
|
|
79
|
+
|
|
80
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
81
|
+
|
|
82
|
+
if http_call.successful?
|
|
83
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
84
|
+
else
|
|
85
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# search commits
|
|
90
|
+
#
|
|
91
|
+
# @params options [Hash]
|
|
92
|
+
#
|
|
93
|
+
# @return SearchResult, SearchErrorResult
|
|
94
|
+
def search_commits(options)
|
|
95
|
+
auth = nil
|
|
96
|
+
body = nil
|
|
97
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
98
|
+
params = { q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
99
|
+
uri = "#{Gitabu::BASE_URL}/search/commits"
|
|
100
|
+
|
|
101
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
102
|
+
|
|
103
|
+
if http_call.successful?
|
|
104
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
105
|
+
else
|
|
106
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# search issues and pull requests
|
|
111
|
+
#
|
|
112
|
+
# @params options [Hash]
|
|
113
|
+
#
|
|
114
|
+
# @return SearchResult, SearchErrorResult
|
|
115
|
+
def search_issues_and_pull_requests(options)
|
|
116
|
+
auth = nil
|
|
117
|
+
body = nil
|
|
118
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
119
|
+
params = { q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
120
|
+
uri = "#{Gitabu::BASE_URL}/search/issues"
|
|
121
|
+
|
|
122
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
123
|
+
|
|
124
|
+
if http_call.successful?
|
|
125
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
126
|
+
else
|
|
127
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# search labels
|
|
132
|
+
#
|
|
133
|
+
# @params options [Hash]
|
|
134
|
+
#
|
|
135
|
+
# @return SearchResult, SearchErrorResult
|
|
136
|
+
def search_labels(options)
|
|
137
|
+
auth = nil
|
|
138
|
+
body = nil
|
|
139
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
140
|
+
params = { repository_id: options[:repository_id], q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
141
|
+
uri = "#{Gitabu::BASE_URL}/search/labels"
|
|
142
|
+
|
|
143
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
144
|
+
|
|
145
|
+
if http_call.successful?
|
|
146
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
147
|
+
else
|
|
148
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# search repositories
|
|
153
|
+
#
|
|
154
|
+
# @params options [Hash]
|
|
155
|
+
#
|
|
156
|
+
# @return SearchResult, SearchErrorResult
|
|
157
|
+
def search_repositories(options)
|
|
158
|
+
auth = nil
|
|
159
|
+
body = nil
|
|
160
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
161
|
+
params = { q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
162
|
+
uri = "#{Gitabu::BASE_URL}/search/repositories"
|
|
163
|
+
|
|
164
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
165
|
+
|
|
166
|
+
if http_call.successful?
|
|
167
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
168
|
+
else
|
|
169
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# search topics
|
|
174
|
+
#
|
|
175
|
+
# @params options [Hash]
|
|
176
|
+
#
|
|
177
|
+
# @return SearchResult, SearchErrorResult
|
|
178
|
+
def search_topics(options)
|
|
179
|
+
auth = nil
|
|
180
|
+
body = nil
|
|
181
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
182
|
+
params = { q: options[:q], per_page: options[:per_page], page: options[:page] }
|
|
183
|
+
uri = "#{Gitabu::BASE_URL}/search/topics"
|
|
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
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
189
|
+
else
|
|
190
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# search users
|
|
195
|
+
#
|
|
196
|
+
# @params options [Hash]
|
|
197
|
+
#
|
|
198
|
+
# @return SearchResult, SearchErrorResult
|
|
199
|
+
def search_users(options)
|
|
200
|
+
auth = nil
|
|
201
|
+
body = nil
|
|
202
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
203
|
+
params = { q: options[:q], sort: options[:sort], order: options[:order], per_page: options[:per_page], page: options[:page] }
|
|
204
|
+
uri = "#{Gitabu::BASE_URL}/search/users"
|
|
205
|
+
|
|
206
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
207
|
+
|
|
208
|
+
if http_call.successful?
|
|
209
|
+
SearchResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
210
|
+
else
|
|
211
|
+
SearchErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
@@ -0,0 +1,201 @@
|
|
|
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 Secret scanning result
|
|
17
|
+
class SecretScanningResult
|
|
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 SecretScanningErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Secret scanning endpoints.
|
|
37
|
+
class SecretScanning
|
|
38
|
+
def self.list_secret_scanning_alerts_for_an_enterprise(enterprise: nil, options: nil)
|
|
39
|
+
new.list_secret_scanning_alerts_for_an_enterprise(enterprise, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.list_secret_scanning_alerts_for_an_organization(org: nil, options: nil)
|
|
43
|
+
new.list_secret_scanning_alerts_for_an_organization(org, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.list_secret_scanning_alerts_for_a_repository(owner: nil, repo: nil, options: nil)
|
|
47
|
+
new.list_secret_scanning_alerts_for_a_repository(owner, repo, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.get_a_secret_scanning_alert(owner: nil, repo: nil, alert_number: nil, options: nil)
|
|
51
|
+
new.get_a_secret_scanning_alert(owner, repo, alert_number, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.update_a_secret_scanning_alert(owner: nil, repo: nil, alert_number: nil, state: nil, resolution: nil, options: nil)
|
|
55
|
+
new.update_a_secret_scanning_alert(owner, repo, alert_number, state, resolution, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.list_locations_for_a_secret_scanning_alert(owner: nil, repo: nil, alert_number: nil, options: nil)
|
|
59
|
+
new.list_locations_for_a_secret_scanning_alert(owner, repo, alert_number, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
# list secret scanning alerts for an enterprise
|
|
65
|
+
#
|
|
66
|
+
# @param enterprise [String] The slug version of the enterprise name. You can also substitute this value with the enterprise id.
|
|
67
|
+
#
|
|
68
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
69
|
+
def list_secret_scanning_alerts_for_an_enterprise(enterprise, options)
|
|
70
|
+
auth = nil
|
|
71
|
+
body = nil
|
|
72
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
73
|
+
params = { state: options[:state], secret_type: options[:secret_type], resolution: options[:resolution], per_page: options[:per_page], before: options[:before], after: options[:after] }
|
|
74
|
+
uri = "#{Gitabu::BASE_URL}/enterprises/#{enterprise}/secret-scanning/alerts"
|
|
75
|
+
|
|
76
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
77
|
+
|
|
78
|
+
if http_call.successful?
|
|
79
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
80
|
+
else
|
|
81
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# list secret scanning alerts for an organization
|
|
86
|
+
#
|
|
87
|
+
# @param org [String]
|
|
88
|
+
#
|
|
89
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
90
|
+
def list_secret_scanning_alerts_for_an_organization(org, options)
|
|
91
|
+
auth = nil
|
|
92
|
+
body = nil
|
|
93
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
94
|
+
params = { state: options[:state], secret_type: options[:secret_type], resolution: options[:resolution], page: options[:page], per_page: options[:per_page] }
|
|
95
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/secret-scanning/alerts"
|
|
96
|
+
|
|
97
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
98
|
+
|
|
99
|
+
if http_call.successful?
|
|
100
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
101
|
+
else
|
|
102
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# list secret scanning alerts for a repository
|
|
107
|
+
#
|
|
108
|
+
# @param owner [String]
|
|
109
|
+
# @param repo [String]
|
|
110
|
+
#
|
|
111
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
112
|
+
def list_secret_scanning_alerts_for_a_repository(owner, repo, options)
|
|
113
|
+
auth = nil
|
|
114
|
+
body = nil
|
|
115
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
116
|
+
params = { state: options[:state], secret_type: options[:secret_type], resolution: options[:resolution], page: options[:page], per_page: options[:per_page] }
|
|
117
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/secret-scanning/alerts"
|
|
118
|
+
|
|
119
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
120
|
+
|
|
121
|
+
if http_call.successful?
|
|
122
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
123
|
+
else
|
|
124
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# get a secret scanning alert
|
|
129
|
+
#
|
|
130
|
+
# @param owner [String]
|
|
131
|
+
# @param repo [String]
|
|
132
|
+
# @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.
|
|
133
|
+
#
|
|
134
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
135
|
+
def get_a_secret_scanning_alert(owner, repo, alert_number, _options)
|
|
136
|
+
auth = nil
|
|
137
|
+
body = nil
|
|
138
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
139
|
+
params = nil
|
|
140
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}"
|
|
141
|
+
|
|
142
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
143
|
+
|
|
144
|
+
if http_call.successful?
|
|
145
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
146
|
+
else
|
|
147
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# update a secret scanning alert
|
|
152
|
+
#
|
|
153
|
+
# @param owner [String]
|
|
154
|
+
# @param repo [String]
|
|
155
|
+
# @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.
|
|
156
|
+
# @param state [String] Required. Sets the state of the secret scanning alert. Can be either open or resolved. You must provide resolution when you set the state to resolved.
|
|
157
|
+
# @param resolution [String or null] Required when the state is resolved. The reason for resolving the alert. Can be one of false_positive, wont_fix, revoked, or used_in_tests.
|
|
158
|
+
#
|
|
159
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
160
|
+
def update_a_secret_scanning_alert(owner, repo, alert_number, state, resolution, _options)
|
|
161
|
+
auth = nil
|
|
162
|
+
body = { state: state, resolution: resolution }
|
|
163
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
164
|
+
params = nil
|
|
165
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}"
|
|
166
|
+
|
|
167
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
168
|
+
|
|
169
|
+
if http_call.successful?
|
|
170
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
171
|
+
else
|
|
172
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# list locations for a secret scanning alert
|
|
177
|
+
#
|
|
178
|
+
# @param owner [String]
|
|
179
|
+
# @param repo [String]
|
|
180
|
+
# @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.
|
|
181
|
+
#
|
|
182
|
+
# @return SecretScanningResult, SecretScanningErrorResult
|
|
183
|
+
def list_locations_for_a_secret_scanning_alert(owner, repo, alert_number, options)
|
|
184
|
+
auth = nil
|
|
185
|
+
body = nil
|
|
186
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
187
|
+
params = { page: options[:page], per_page: options[:per_page] }
|
|
188
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}/locations"
|
|
189
|
+
|
|
190
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
191
|
+
|
|
192
|
+
if http_call.successful?
|
|
193
|
+
SecretScanningResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
194
|
+
else
|
|
195
|
+
SecretScanningErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|