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,961 @@
|
|
|
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 Apps result
|
|
17
|
+
class AppsResult
|
|
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 AppsErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Apps endpoints.
|
|
37
|
+
class Apps
|
|
38
|
+
def self.get_the_authenticated_app(options: nil)
|
|
39
|
+
new.get_the_authenticated_app(options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.create_a_github_app_from_a_manifest(code: nil, options: nil)
|
|
43
|
+
new.create_a_github_app_from_a_manifest(code, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.list_installations_for_the_authenticated_app(options: nil)
|
|
47
|
+
new.list_installations_for_the_authenticated_app(options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.get_an_installation_for_the_authenticated_app(installation_id: nil, options: nil)
|
|
51
|
+
new.get_an_installation_for_the_authenticated_app(installation_id, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.delete_an_installation_for_the_authenticated_app(installation_id: nil, options: nil)
|
|
55
|
+
new.delete_an_installation_for_the_authenticated_app(installation_id, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.create_an_installation_access_token_for_an_app(installation_id: nil, repositories: nil, repository_ids: nil, permissions: nil, options: nil)
|
|
59
|
+
new.create_an_installation_access_token_for_an_app(installation_id, repositories, repository_ids, permissions, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.suspend_an_app_installation(installation_id: nil, options: nil)
|
|
63
|
+
new.suspend_an_app_installation(installation_id, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.unsuspend_an_app_installation(installation_id: nil, options: nil)
|
|
67
|
+
new.unsuspend_an_app_installation(installation_id, options)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.get_an_app(app_slug: nil, options: nil)
|
|
71
|
+
new.get_an_app(app_slug, options)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.get_an_organization_installation_for_the_authenticated_app(org: nil, options: nil)
|
|
75
|
+
new.get_an_organization_installation_for_the_authenticated_app(org, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.get_a_repository_installation_for_the_authenticated_app(owner: nil, repo: nil, options: nil)
|
|
79
|
+
new.get_a_repository_installation_for_the_authenticated_app(owner, repo, options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.get_a_user_installation_for_the_authenticated_app(username: nil, options: nil)
|
|
83
|
+
new.get_a_user_installation_for_the_authenticated_app(username, options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.list_repositories_accessible_to_the_app_installation(options: nil)
|
|
87
|
+
new.list_repositories_accessible_to_the_app_installation(options)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.revoke_an_installation_access_token(options: nil)
|
|
91
|
+
new.revoke_an_installation_access_token(options)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.list_app_installations_accessible_to_the_user_access_token(options: nil)
|
|
95
|
+
new.list_app_installations_accessible_to_the_user_access_token(options)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.list_repositories_accessible_to_the_user_access_token(installation_id: nil, options: nil)
|
|
99
|
+
new.list_repositories_accessible_to_the_user_access_token(installation_id, options)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.add_a_repository_to_an_app_installation(installation_id: nil, repository_id: nil, options: nil)
|
|
103
|
+
new.add_a_repository_to_an_app_installation(installation_id, repository_id, options)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.remove_a_repository_from_an_app_installation(installation_id: nil, repository_id: nil, options: nil)
|
|
107
|
+
new.remove_a_repository_from_an_app_installation(installation_id, repository_id, options)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.get_a_subscription_plan_for_an_account(account_id: nil, options: nil)
|
|
111
|
+
new.get_a_subscription_plan_for_an_account(account_id, options)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.list_plans(options: nil)
|
|
115
|
+
new.list_plans(options)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.list_accounts_for_a_plan(plan_id: nil, options: nil)
|
|
119
|
+
new.list_accounts_for_a_plan(plan_id, options)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.get_a_subscription_plan_for_an_account_stubbed(account_id: nil, options: nil)
|
|
123
|
+
new.get_a_subscription_plan_for_an_account_stubbed(account_id, options)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.list_plans_stubbed(options: nil)
|
|
127
|
+
new.list_plans_stubbed(options)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.list_accounts_for_a_plan_stubbed(plan_id: nil, options: nil)
|
|
131
|
+
new.list_accounts_for_a_plan_stubbed(plan_id, options)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self.list_subscriptions_for_the_authenticated_user(options: nil)
|
|
135
|
+
new.list_subscriptions_for_the_authenticated_user(options)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.list_subscriptions_for_the_authenticated_user_stubbed(options: nil)
|
|
139
|
+
new.list_subscriptions_for_the_authenticated_user_stubbed(options)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def self.delete_an_app_authorization(client_id: nil, access_token: nil, options: nil)
|
|
143
|
+
new.delete_an_app_authorization(client_id, access_token, options)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def self.check_a_token(client_id: nil, access_token: nil, options: nil)
|
|
147
|
+
new.check_a_token(client_id, access_token, options)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def self.reset_a_token(client_id: nil, access_token: nil, options: nil)
|
|
151
|
+
new.reset_a_token(client_id, access_token, options)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def self.delete_an_app_token(client_id: nil, access_token: nil, options: nil)
|
|
155
|
+
new.delete_an_app_token(client_id, access_token, options)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def self.create_a_scoped_access_token(client_id: nil, access_token: nil, target: nil, target_id: nil, repositories: nil, repository_ids: nil, permissions: nil, options: nil)
|
|
159
|
+
new.create_a_scoped_access_token(client_id, access_token, target, target_id, repositories, repository_ids, permissions, options)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def self.get_a_webhook_configuration_for_an_app(options: nil)
|
|
163
|
+
new.get_a_webhook_configuration_for_an_app(options)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def self.update_a_webhook_configuration_for_an_app(url: nil, content_type: nil, secret: nil, insecure_ssl: nil, options: nil)
|
|
167
|
+
new.update_a_webhook_configuration_for_an_app(url, content_type, secret, insecure_ssl, options)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def self.list_deliveries_for_an_app_webhook(options: nil)
|
|
171
|
+
new.list_deliveries_for_an_app_webhook(options)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def self.get_a_delivery_for_an_app_webhook(delivery_id: nil, options: nil)
|
|
175
|
+
new.get_a_delivery_for_an_app_webhook(delivery_id, options)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def self.redeliver_a_delivery_for_an_app_webhook(delivery_id: nil, options: nil)
|
|
179
|
+
new.redeliver_a_delivery_for_an_app_webhook(delivery_id, options)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
private
|
|
183
|
+
|
|
184
|
+
# get the authenticated app
|
|
185
|
+
#
|
|
186
|
+
# @params options [Hash]
|
|
187
|
+
#
|
|
188
|
+
# @return AppsResult, AppsErrorResult
|
|
189
|
+
def get_the_authenticated_app(_options)
|
|
190
|
+
auth = nil
|
|
191
|
+
body = nil
|
|
192
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
193
|
+
params = nil
|
|
194
|
+
uri = "#{Gitabu::BASE_URL}/app"
|
|
195
|
+
|
|
196
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
197
|
+
|
|
198
|
+
if http_call.successful?
|
|
199
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
200
|
+
else
|
|
201
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# create a github app from a manifest
|
|
206
|
+
#
|
|
207
|
+
# @param code [String]
|
|
208
|
+
#
|
|
209
|
+
# @return AppsResult, AppsErrorResult
|
|
210
|
+
def create_a_github_app_from_a_manifest(code, _options)
|
|
211
|
+
auth = nil
|
|
212
|
+
body = nil
|
|
213
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
214
|
+
params = nil
|
|
215
|
+
uri = "#{Gitabu::BASE_URL}/app-manifests/#{code}/conversions"
|
|
216
|
+
|
|
217
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
218
|
+
|
|
219
|
+
if http_call.successful?
|
|
220
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
221
|
+
else
|
|
222
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# list installations for the authenticated app
|
|
227
|
+
#
|
|
228
|
+
# @params options [Hash]
|
|
229
|
+
#
|
|
230
|
+
# @return AppsResult, AppsErrorResult
|
|
231
|
+
def list_installations_for_the_authenticated_app(options)
|
|
232
|
+
auth = nil
|
|
233
|
+
body = nil
|
|
234
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
235
|
+
params = { per_page: options[:per_page], page: options[:page], since: options[:since], outdated: options[:outdated] }
|
|
236
|
+
uri = "#{Gitabu::BASE_URL}/app/installations"
|
|
237
|
+
|
|
238
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
239
|
+
|
|
240
|
+
if http_call.successful?
|
|
241
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
242
|
+
else
|
|
243
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# get an installation for the authenticated app
|
|
248
|
+
#
|
|
249
|
+
# @param installation_id [Integer] installation_id parameter
|
|
250
|
+
#
|
|
251
|
+
# @return AppsResult, AppsErrorResult
|
|
252
|
+
def get_an_installation_for_the_authenticated_app(installation_id, _options)
|
|
253
|
+
auth = nil
|
|
254
|
+
body = nil
|
|
255
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
256
|
+
params = nil
|
|
257
|
+
uri = "#{Gitabu::BASE_URL}/app/installations/#{installation_id}"
|
|
258
|
+
|
|
259
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
260
|
+
|
|
261
|
+
if http_call.successful?
|
|
262
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
263
|
+
else
|
|
264
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# delete an installation for the authenticated app
|
|
269
|
+
#
|
|
270
|
+
# @param installation_id [Integer] installation_id parameter
|
|
271
|
+
#
|
|
272
|
+
# @return AppsResult, AppsErrorResult
|
|
273
|
+
def delete_an_installation_for_the_authenticated_app(installation_id, _options)
|
|
274
|
+
auth = nil
|
|
275
|
+
body = nil
|
|
276
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
277
|
+
params = nil
|
|
278
|
+
uri = "#{Gitabu::BASE_URL}/app/installations/#{installation_id}"
|
|
279
|
+
|
|
280
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
281
|
+
|
|
282
|
+
if http_call.successful?
|
|
283
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
284
|
+
else
|
|
285
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# create an installation access token for an app
|
|
290
|
+
#
|
|
291
|
+
# @param installation_id [Integer] installation_id parameter
|
|
292
|
+
# @param repositories [Array of strings] List of repository names that the token should have access to
|
|
293
|
+
# @param repository_ids [Array of integers] List of repository IDs that the token should have access to
|
|
294
|
+
# @param permissions [Object] The permissions granted to the user-to-server access token.
|
|
295
|
+
#
|
|
296
|
+
# @return AppsResult, AppsErrorResult
|
|
297
|
+
def create_an_installation_access_token_for_an_app(installation_id, repositories, repository_ids, permissions, _options)
|
|
298
|
+
auth = nil
|
|
299
|
+
body = { repositories: repositories, repository_ids: repository_ids, permissions: permissions }
|
|
300
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
301
|
+
params = nil
|
|
302
|
+
uri = "#{Gitabu::BASE_URL}/app/installations/#{installation_id}/access_tokens"
|
|
303
|
+
|
|
304
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
305
|
+
|
|
306
|
+
if http_call.successful?
|
|
307
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
308
|
+
else
|
|
309
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# suspend an app installation
|
|
314
|
+
#
|
|
315
|
+
# @param installation_id [Integer] installation_id parameter
|
|
316
|
+
#
|
|
317
|
+
# @return AppsResult, AppsErrorResult
|
|
318
|
+
def suspend_an_app_installation(installation_id, _options)
|
|
319
|
+
auth = nil
|
|
320
|
+
body = nil
|
|
321
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
322
|
+
params = nil
|
|
323
|
+
uri = "#{Gitabu::BASE_URL}/app/installations/#{installation_id}/suspended"
|
|
324
|
+
|
|
325
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
326
|
+
|
|
327
|
+
if http_call.successful?
|
|
328
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
329
|
+
else
|
|
330
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# unsuspend an app installation
|
|
335
|
+
#
|
|
336
|
+
# @param installation_id [Integer] installation_id parameter
|
|
337
|
+
#
|
|
338
|
+
# @return AppsResult, AppsErrorResult
|
|
339
|
+
def unsuspend_an_app_installation(installation_id, _options)
|
|
340
|
+
auth = nil
|
|
341
|
+
body = nil
|
|
342
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
343
|
+
params = nil
|
|
344
|
+
uri = "#{Gitabu::BASE_URL}/app/installations/#{installation_id}/suspended"
|
|
345
|
+
|
|
346
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
347
|
+
|
|
348
|
+
if http_call.successful?
|
|
349
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
350
|
+
else
|
|
351
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# get an app
|
|
356
|
+
#
|
|
357
|
+
# @param app_slug [String]
|
|
358
|
+
#
|
|
359
|
+
# @return AppsResult, AppsErrorResult
|
|
360
|
+
def get_an_app(app_slug, _options)
|
|
361
|
+
auth = nil
|
|
362
|
+
body = nil
|
|
363
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
364
|
+
params = nil
|
|
365
|
+
uri = "#{Gitabu::BASE_URL}/apps/#{app_slug}"
|
|
366
|
+
|
|
367
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
368
|
+
|
|
369
|
+
if http_call.successful?
|
|
370
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
371
|
+
else
|
|
372
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# get an organization installation for the authenticated app
|
|
377
|
+
#
|
|
378
|
+
# @param org [String]
|
|
379
|
+
#
|
|
380
|
+
# @return AppsResult, AppsErrorResult
|
|
381
|
+
def get_an_organization_installation_for_the_authenticated_app(org, _options)
|
|
382
|
+
auth = nil
|
|
383
|
+
body = nil
|
|
384
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
385
|
+
params = nil
|
|
386
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/installation"
|
|
387
|
+
|
|
388
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
389
|
+
|
|
390
|
+
if http_call.successful?
|
|
391
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
392
|
+
else
|
|
393
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
# get a repository installation for the authenticated app
|
|
398
|
+
#
|
|
399
|
+
# @param owner [String]
|
|
400
|
+
# @param repo [String]
|
|
401
|
+
#
|
|
402
|
+
# @return AppsResult, AppsErrorResult
|
|
403
|
+
def get_a_repository_installation_for_the_authenticated_app(owner, repo, _options)
|
|
404
|
+
auth = nil
|
|
405
|
+
body = nil
|
|
406
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
407
|
+
params = nil
|
|
408
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/installation"
|
|
409
|
+
|
|
410
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
411
|
+
|
|
412
|
+
if http_call.successful?
|
|
413
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
414
|
+
else
|
|
415
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
# get a user installation for the authenticated app
|
|
420
|
+
#
|
|
421
|
+
# @param username [String]
|
|
422
|
+
#
|
|
423
|
+
# @return AppsResult, AppsErrorResult
|
|
424
|
+
def get_a_user_installation_for_the_authenticated_app(username, _options)
|
|
425
|
+
auth = nil
|
|
426
|
+
body = nil
|
|
427
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
428
|
+
params = nil
|
|
429
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/installation"
|
|
430
|
+
|
|
431
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
432
|
+
|
|
433
|
+
if http_call.successful?
|
|
434
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
435
|
+
else
|
|
436
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# list repositories accessible to the app installation
|
|
441
|
+
#
|
|
442
|
+
# @params options [Hash]
|
|
443
|
+
#
|
|
444
|
+
# @return AppsResult, AppsErrorResult
|
|
445
|
+
def list_repositories_accessible_to_the_app_installation(options)
|
|
446
|
+
auth = nil
|
|
447
|
+
body = nil
|
|
448
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
449
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
450
|
+
uri = "#{Gitabu::BASE_URL}/installation/repositories"
|
|
451
|
+
|
|
452
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
453
|
+
|
|
454
|
+
if http_call.successful?
|
|
455
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
456
|
+
else
|
|
457
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
458
|
+
end
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
# revoke an installation access token
|
|
462
|
+
#
|
|
463
|
+
# @params options [Hash]
|
|
464
|
+
#
|
|
465
|
+
# @return AppsResult, AppsErrorResult
|
|
466
|
+
def revoke_an_installation_access_token(_options)
|
|
467
|
+
auth = nil
|
|
468
|
+
body = nil
|
|
469
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
470
|
+
params = nil
|
|
471
|
+
uri = "#{Gitabu::BASE_URL}/installation/token"
|
|
472
|
+
|
|
473
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
474
|
+
|
|
475
|
+
if http_call.successful?
|
|
476
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
477
|
+
else
|
|
478
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# list app installations accessible to the user access token
|
|
483
|
+
#
|
|
484
|
+
# @params options [Hash]
|
|
485
|
+
#
|
|
486
|
+
# @return AppsResult, AppsErrorResult
|
|
487
|
+
def list_app_installations_accessible_to_the_user_access_token(options)
|
|
488
|
+
auth = nil
|
|
489
|
+
body = nil
|
|
490
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
491
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
492
|
+
uri = "#{Gitabu::BASE_URL}/user/installations"
|
|
493
|
+
|
|
494
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
495
|
+
|
|
496
|
+
if http_call.successful?
|
|
497
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
498
|
+
else
|
|
499
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
# list repositories accessible to the user access token
|
|
504
|
+
#
|
|
505
|
+
# @param installation_id [Integer] installation_id parameter
|
|
506
|
+
#
|
|
507
|
+
# @return AppsResult, AppsErrorResult
|
|
508
|
+
def list_repositories_accessible_to_the_user_access_token(installation_id, options)
|
|
509
|
+
auth = nil
|
|
510
|
+
body = nil
|
|
511
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
512
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
513
|
+
uri = "#{Gitabu::BASE_URL}/user/installations/#{installation_id}/repositories"
|
|
514
|
+
|
|
515
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
516
|
+
|
|
517
|
+
if http_call.successful?
|
|
518
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
519
|
+
else
|
|
520
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
# add a repository to an app installation
|
|
525
|
+
#
|
|
526
|
+
# @param installation_id [Integer] installation_id parameter
|
|
527
|
+
# @param repository_id [Integer]
|
|
528
|
+
#
|
|
529
|
+
# @return AppsResult, AppsErrorResult
|
|
530
|
+
def add_a_repository_to_an_app_installation(installation_id, repository_id, _options)
|
|
531
|
+
auth = nil
|
|
532
|
+
body = nil
|
|
533
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
534
|
+
params = nil
|
|
535
|
+
uri = "#{Gitabu::BASE_URL}/user/installations/#{installation_id}/repositories/#{repository_id}"
|
|
536
|
+
|
|
537
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
538
|
+
|
|
539
|
+
if http_call.successful?
|
|
540
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
541
|
+
else
|
|
542
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
# remove a repository from an app installation
|
|
547
|
+
#
|
|
548
|
+
# @param installation_id [Integer] installation_id parameter
|
|
549
|
+
# @param repository_id [Integer]
|
|
550
|
+
#
|
|
551
|
+
# @return AppsResult, AppsErrorResult
|
|
552
|
+
def remove_a_repository_from_an_app_installation(installation_id, repository_id, _options)
|
|
553
|
+
auth = nil
|
|
554
|
+
body = nil
|
|
555
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
556
|
+
params = nil
|
|
557
|
+
uri = "#{Gitabu::BASE_URL}/user/installations/#{installation_id}/repositories/#{repository_id}"
|
|
558
|
+
|
|
559
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
560
|
+
|
|
561
|
+
if http_call.successful?
|
|
562
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
563
|
+
else
|
|
564
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
565
|
+
end
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
# get a subscription plan for an account
|
|
569
|
+
#
|
|
570
|
+
# @param account_id [Integer] account_id parameter
|
|
571
|
+
#
|
|
572
|
+
# @return AppsResult, AppsErrorResult
|
|
573
|
+
def get_a_subscription_plan_for_an_account(account_id, _options)
|
|
574
|
+
auth = nil
|
|
575
|
+
body = nil
|
|
576
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
577
|
+
params = nil
|
|
578
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/accounts/#{account_id}"
|
|
579
|
+
|
|
580
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
581
|
+
|
|
582
|
+
if http_call.successful?
|
|
583
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
584
|
+
else
|
|
585
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
586
|
+
end
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
# list plans
|
|
590
|
+
#
|
|
591
|
+
# @params options [Hash]
|
|
592
|
+
#
|
|
593
|
+
# @return AppsResult, AppsErrorResult
|
|
594
|
+
def list_plans(options)
|
|
595
|
+
auth = nil
|
|
596
|
+
body = nil
|
|
597
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
598
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
599
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/plans"
|
|
600
|
+
|
|
601
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
602
|
+
|
|
603
|
+
if http_call.successful?
|
|
604
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
605
|
+
else
|
|
606
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
607
|
+
end
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
# list accounts for a plan
|
|
611
|
+
#
|
|
612
|
+
# @param plan_id [Integer] plan_id parameter
|
|
613
|
+
#
|
|
614
|
+
# @return AppsResult, AppsErrorResult
|
|
615
|
+
def list_accounts_for_a_plan(plan_id, options)
|
|
616
|
+
auth = nil
|
|
617
|
+
body = nil
|
|
618
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
619
|
+
params = { sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
|
620
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/plans/#{plan_id}/accounts"
|
|
621
|
+
|
|
622
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
623
|
+
|
|
624
|
+
if http_call.successful?
|
|
625
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
626
|
+
else
|
|
627
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
628
|
+
end
|
|
629
|
+
end
|
|
630
|
+
|
|
631
|
+
# get a subscription plan for an account (stubbed)
|
|
632
|
+
#
|
|
633
|
+
# @param account_id [Integer] account_id parameter
|
|
634
|
+
#
|
|
635
|
+
# @return AppsResult, AppsErrorResult
|
|
636
|
+
def get_a_subscription_plan_for_an_account_stubbed(account_id, _options)
|
|
637
|
+
auth = nil
|
|
638
|
+
body = nil
|
|
639
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
640
|
+
params = nil
|
|
641
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/stubbed/accounts/#{account_id}"
|
|
642
|
+
|
|
643
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
644
|
+
|
|
645
|
+
if http_call.successful?
|
|
646
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
647
|
+
else
|
|
648
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
649
|
+
end
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
# list plans (stubbed)
|
|
653
|
+
#
|
|
654
|
+
# @params options [Hash]
|
|
655
|
+
#
|
|
656
|
+
# @return AppsResult, AppsErrorResult
|
|
657
|
+
def list_plans_stubbed(options)
|
|
658
|
+
auth = nil
|
|
659
|
+
body = nil
|
|
660
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
661
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
662
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/stubbed/plans"
|
|
663
|
+
|
|
664
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
665
|
+
|
|
666
|
+
if http_call.successful?
|
|
667
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
668
|
+
else
|
|
669
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
670
|
+
end
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
# list accounts for a plan (stubbed)
|
|
674
|
+
#
|
|
675
|
+
# @param plan_id [Integer] plan_id parameter
|
|
676
|
+
#
|
|
677
|
+
# @return AppsResult, AppsErrorResult
|
|
678
|
+
def list_accounts_for_a_plan_stubbed(plan_id, options)
|
|
679
|
+
auth = nil
|
|
680
|
+
body = nil
|
|
681
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
682
|
+
params = { sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
|
683
|
+
uri = "#{Gitabu::BASE_URL}/marketplace_listing/stubbed/plans/#{plan_id}/accounts"
|
|
684
|
+
|
|
685
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
686
|
+
|
|
687
|
+
if http_call.successful?
|
|
688
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
689
|
+
else
|
|
690
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
691
|
+
end
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# list subscriptions for the authenticated user
|
|
695
|
+
#
|
|
696
|
+
# @params options [Hash]
|
|
697
|
+
#
|
|
698
|
+
# @return AppsResult, AppsErrorResult
|
|
699
|
+
def list_subscriptions_for_the_authenticated_user(options)
|
|
700
|
+
auth = nil
|
|
701
|
+
body = nil
|
|
702
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
703
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
704
|
+
uri = "#{Gitabu::BASE_URL}/user/marketplace_purchases"
|
|
705
|
+
|
|
706
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
707
|
+
|
|
708
|
+
if http_call.successful?
|
|
709
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
710
|
+
else
|
|
711
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
712
|
+
end
|
|
713
|
+
end
|
|
714
|
+
|
|
715
|
+
# list subscriptions for the authenticated user (stubbed)
|
|
716
|
+
#
|
|
717
|
+
# @params options [Hash]
|
|
718
|
+
#
|
|
719
|
+
# @return AppsResult, AppsErrorResult
|
|
720
|
+
def list_subscriptions_for_the_authenticated_user_stubbed(options)
|
|
721
|
+
auth = nil
|
|
722
|
+
body = nil
|
|
723
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
724
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
725
|
+
uri = "#{Gitabu::BASE_URL}/user/marketplace_purchases/stubbed"
|
|
726
|
+
|
|
727
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
728
|
+
|
|
729
|
+
if http_call.successful?
|
|
730
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
731
|
+
else
|
|
732
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
733
|
+
end
|
|
734
|
+
end
|
|
735
|
+
|
|
736
|
+
# delete an app authorization
|
|
737
|
+
#
|
|
738
|
+
# @param client_id [String] The client ID of your GitHub app.
|
|
739
|
+
# @param access_token [String] Required. The OAuth access token used to authenticate to the GitHub API.
|
|
740
|
+
#
|
|
741
|
+
# @return AppsResult, AppsErrorResult
|
|
742
|
+
def delete_an_app_authorization(client_id, access_token, _options)
|
|
743
|
+
auth = nil
|
|
744
|
+
body = { access_token: access_token }
|
|
745
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
746
|
+
params = nil
|
|
747
|
+
uri = "#{Gitabu::BASE_URL}/applications/#{client_id}/grant"
|
|
748
|
+
|
|
749
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
750
|
+
|
|
751
|
+
if http_call.successful?
|
|
752
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
753
|
+
else
|
|
754
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
# check a token
|
|
759
|
+
#
|
|
760
|
+
# @param client_id [String] The client ID of your GitHub app.
|
|
761
|
+
# @param access_token [String] Required. The access_token of the OAuth application.
|
|
762
|
+
#
|
|
763
|
+
# @return AppsResult, AppsErrorResult
|
|
764
|
+
def check_a_token(client_id, access_token, _options)
|
|
765
|
+
auth = nil
|
|
766
|
+
body = { access_token: access_token }
|
|
767
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
768
|
+
params = nil
|
|
769
|
+
uri = "#{Gitabu::BASE_URL}/applications/#{client_id}/token"
|
|
770
|
+
|
|
771
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
772
|
+
|
|
773
|
+
if http_call.successful?
|
|
774
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
775
|
+
else
|
|
776
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
777
|
+
end
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
# reset a token
|
|
781
|
+
#
|
|
782
|
+
# @param client_id [String] The client ID of your GitHub app.
|
|
783
|
+
# @param access_token [String] Required. The access_token of the OAuth application.
|
|
784
|
+
#
|
|
785
|
+
# @return AppsResult, AppsErrorResult
|
|
786
|
+
def reset_a_token(client_id, access_token, _options)
|
|
787
|
+
auth = nil
|
|
788
|
+
body = { access_token: access_token }
|
|
789
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
790
|
+
params = nil
|
|
791
|
+
uri = "#{Gitabu::BASE_URL}/applications/#{client_id}/token"
|
|
792
|
+
|
|
793
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
794
|
+
|
|
795
|
+
if http_call.successful?
|
|
796
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
797
|
+
else
|
|
798
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
799
|
+
end
|
|
800
|
+
end
|
|
801
|
+
|
|
802
|
+
# delete an app token
|
|
803
|
+
#
|
|
804
|
+
# @param client_id [String] The client ID of your GitHub app.
|
|
805
|
+
# @param access_token [String] Required. The OAuth access token used to authenticate to the GitHub API.
|
|
806
|
+
#
|
|
807
|
+
# @return AppsResult, AppsErrorResult
|
|
808
|
+
def delete_an_app_token(client_id, access_token, _options)
|
|
809
|
+
auth = nil
|
|
810
|
+
body = { access_token: access_token }
|
|
811
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
812
|
+
params = nil
|
|
813
|
+
uri = "#{Gitabu::BASE_URL}/applications/#{client_id}/token"
|
|
814
|
+
|
|
815
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
816
|
+
|
|
817
|
+
if http_call.successful?
|
|
818
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
819
|
+
else
|
|
820
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
|
|
824
|
+
# create a scoped access token
|
|
825
|
+
#
|
|
826
|
+
# @param client_id [String] The client ID of your GitHub app.
|
|
827
|
+
# @param access_token [String] Required. The OAuth access token used to authenticate to the GitHub API.
|
|
828
|
+
# @param target [String] The name of the user or organization to scope the user-to-server access token to. Required unless target_id is specified.
|
|
829
|
+
# @param target_id [Integer] The ID of the user or organization to scope the user-to-server access token to. Required unless target is specified.
|
|
830
|
+
# @param repositories [Array of strings] The list of repository names to scope the user-to-server access token to. repositories may not be specified if repository_ids is specified.
|
|
831
|
+
# @param repository_ids [Array of integers] The list of repository IDs to scope the user-to-server access token to. repository_ids may not be specified if repositories is specified.
|
|
832
|
+
# @param permissions [Object] The permissions granted to the user-to-server access token.
|
|
833
|
+
#
|
|
834
|
+
# @return AppsResult, AppsErrorResult
|
|
835
|
+
def create_a_scoped_access_token(client_id, access_token, target, target_id, repositories, repository_ids, permissions, _options)
|
|
836
|
+
auth = nil
|
|
837
|
+
body = { access_token: access_token, target: target, target_id: target_id, repositories: repositories, repository_ids: repository_ids, permissions: permissions }
|
|
838
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
839
|
+
params = nil
|
|
840
|
+
uri = "#{Gitabu::BASE_URL}/applications/#{client_id}/token/scoped"
|
|
841
|
+
|
|
842
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
843
|
+
|
|
844
|
+
if http_call.successful?
|
|
845
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
846
|
+
else
|
|
847
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
848
|
+
end
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
# get a webhook configuration for an app
|
|
852
|
+
#
|
|
853
|
+
# @params options [Hash]
|
|
854
|
+
#
|
|
855
|
+
# @return AppsResult, AppsErrorResult
|
|
856
|
+
def get_a_webhook_configuration_for_an_app(_options)
|
|
857
|
+
auth = nil
|
|
858
|
+
body = nil
|
|
859
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
860
|
+
params = nil
|
|
861
|
+
uri = "#{Gitabu::BASE_URL}/app/hook/config"
|
|
862
|
+
|
|
863
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
864
|
+
|
|
865
|
+
if http_call.successful?
|
|
866
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
867
|
+
else
|
|
868
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
869
|
+
end
|
|
870
|
+
end
|
|
871
|
+
|
|
872
|
+
# update a webhook configuration for an app
|
|
873
|
+
#
|
|
874
|
+
# @param url [String] The URL to which the payloads will be delivered.
|
|
875
|
+
# @param content_type [String] The media type used to serialize the payloads. Supported values include json and form. The default is form.
|
|
876
|
+
# @param secret [String] If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.
|
|
877
|
+
# @param insecure_ssl [String or number or ] Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.
|
|
878
|
+
#
|
|
879
|
+
# @return AppsResult, AppsErrorResult
|
|
880
|
+
def update_a_webhook_configuration_for_an_app(url, content_type, secret, insecure_ssl, _options)
|
|
881
|
+
auth = nil
|
|
882
|
+
body = { url: url, content_type: content_type, secret: secret, insecure_ssl: insecure_ssl }
|
|
883
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
884
|
+
params = nil
|
|
885
|
+
uri = "#{Gitabu::BASE_URL}/app/hook/config"
|
|
886
|
+
|
|
887
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
888
|
+
|
|
889
|
+
if http_call.successful?
|
|
890
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
891
|
+
else
|
|
892
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
893
|
+
end
|
|
894
|
+
end
|
|
895
|
+
|
|
896
|
+
# list deliveries for an app webhook
|
|
897
|
+
#
|
|
898
|
+
# @params options [Hash]
|
|
899
|
+
#
|
|
900
|
+
# @return AppsResult, AppsErrorResult
|
|
901
|
+
def list_deliveries_for_an_app_webhook(options)
|
|
902
|
+
auth = nil
|
|
903
|
+
body = nil
|
|
904
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
905
|
+
params = { per_page: options[:per_page], cursor: options[:cursor] }
|
|
906
|
+
uri = "#{Gitabu::BASE_URL}/app/hook/deliveries"
|
|
907
|
+
|
|
908
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
909
|
+
|
|
910
|
+
if http_call.successful?
|
|
911
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
912
|
+
else
|
|
913
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
914
|
+
end
|
|
915
|
+
end
|
|
916
|
+
|
|
917
|
+
# get a delivery for an app webhook
|
|
918
|
+
#
|
|
919
|
+
# @param delivery_id [Integer]
|
|
920
|
+
#
|
|
921
|
+
# @return AppsResult, AppsErrorResult
|
|
922
|
+
def get_a_delivery_for_an_app_webhook(delivery_id, _options)
|
|
923
|
+
auth = nil
|
|
924
|
+
body = nil
|
|
925
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
926
|
+
params = nil
|
|
927
|
+
uri = "#{Gitabu::BASE_URL}/app/hook/deliveries/#{delivery_id}"
|
|
928
|
+
|
|
929
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
930
|
+
|
|
931
|
+
if http_call.successful?
|
|
932
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
933
|
+
else
|
|
934
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
935
|
+
end
|
|
936
|
+
end
|
|
937
|
+
|
|
938
|
+
# redeliver a delivery for an app webhook
|
|
939
|
+
#
|
|
940
|
+
# @param delivery_id [Integer]
|
|
941
|
+
#
|
|
942
|
+
# @return AppsResult, AppsErrorResult
|
|
943
|
+
def redeliver_a_delivery_for_an_app_webhook(delivery_id, _options)
|
|
944
|
+
auth = nil
|
|
945
|
+
body = nil
|
|
946
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
947
|
+
params = nil
|
|
948
|
+
uri = "#{Gitabu::BASE_URL}/app/hook/deliveries/#{delivery_id}/attempts"
|
|
949
|
+
|
|
950
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
951
|
+
|
|
952
|
+
if http_call.successful?
|
|
953
|
+
AppsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
954
|
+
else
|
|
955
|
+
AppsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
956
|
+
end
|
|
957
|
+
end
|
|
958
|
+
end
|
|
959
|
+
end
|
|
960
|
+
end
|
|
961
|
+
end
|