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,650 @@
|
|
|
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 Codespaces result
|
|
17
|
+
class CodespacesResult
|
|
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 CodespacesErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Codespaces endpoints.
|
|
37
|
+
class Codespaces
|
|
38
|
+
def self.list_codespaces_in_a_repository_for_the_authenticated_user(owner: nil, repo: nil, options: nil)
|
|
39
|
+
new.list_codespaces_in_a_repository_for_the_authenticated_user(owner, repo, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.create_a_codespace_in_a_repository(owner: nil, repo: nil, ref: nil, location: nil, machine: nil, working_directory: nil, idle_timeout_minutes: nil, display_name: nil, options: nil)
|
|
43
|
+
new.create_a_codespace_in_a_repository(owner, repo, ref, location, machine, working_directory, idle_timeout_minutes, display_name, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.create_a_codespace_from_a_pull_request(owner: nil, repo: nil, pull_number: nil, location: nil, machine: nil, working_directory: nil, idle_timeout_minutes: nil, display_name: nil, options: nil)
|
|
47
|
+
new.create_a_codespace_from_a_pull_request(owner, repo, pull_number, location, machine, working_directory, idle_timeout_minutes, display_name, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.list_codespaces_for_the_authenticated_user(options: nil)
|
|
51
|
+
new.list_codespaces_for_the_authenticated_user(options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.create_a_codespace_for_the_authenticated_user(repository_id: nil, ref: nil, location: nil, machine: nil, working_directory: nil, idle_timeout_minutes: nil, display_name: nil, pull_request: nil, options: nil)
|
|
55
|
+
new.create_a_codespace_for_the_authenticated_user(repository_id, ref, location, machine, working_directory, idle_timeout_minutes, display_name, pull_request, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.get_a_codespace_for_the_authenticated_user(codespace_name: nil, options: nil)
|
|
59
|
+
new.get_a_codespace_for_the_authenticated_user(codespace_name, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.update_a_codespace_for_the_authenticated_user(codespace_name: nil, machine: nil, display_name: nil, recent_folders: nil, options: nil)
|
|
63
|
+
new.update_a_codespace_for_the_authenticated_user(codespace_name, machine, display_name, recent_folders, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.delete_a_codespace_for_the_authenticated_user(codespace_name: nil, options: nil)
|
|
67
|
+
new.delete_a_codespace_for_the_authenticated_user(codespace_name, options)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.export_a_codespace_for_the_authenticated_user(codespace_name: nil, options: nil)
|
|
71
|
+
new.export_a_codespace_for_the_authenticated_user(codespace_name, options)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.get_details_about_a_codespace_export(codespace_name: nil, export_id: nil, options: nil)
|
|
75
|
+
new.get_details_about_a_codespace_export(codespace_name, export_id, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.start_a_codespace_for_the_authenticated_user(codespace_name: nil, options: nil)
|
|
79
|
+
new.start_a_codespace_for_the_authenticated_user(codespace_name, options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.stop_a_codespace_for_the_authenticated_user(codespace_name: nil, options: nil)
|
|
83
|
+
new.stop_a_codespace_for_the_authenticated_user(codespace_name, options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.list_available_machine_types_for_a_repository(owner: nil, repo: nil, options: nil)
|
|
87
|
+
new.list_available_machine_types_for_a_repository(owner, repo, options)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.list_machine_types_for_a_codespace(codespace_name: nil, options: nil)
|
|
91
|
+
new.list_machine_types_for_a_codespace(codespace_name, options)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.list_secrets_for_the_authenticated_user(options: nil)
|
|
95
|
+
new.list_secrets_for_the_authenticated_user(options)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.get_public_key_for_the_authenticated_user(options: nil)
|
|
99
|
+
new.get_public_key_for_the_authenticated_user(options)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.get_a_secret_for_the_authenticated_user(secret_name: nil, options: nil)
|
|
103
|
+
new.get_a_secret_for_the_authenticated_user(secret_name, options)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.create_or_update_a_secret_for_the_authenticated_user(secret_name: nil, encrypted_value: nil, key_id: nil, selected_repository_ids: nil, options: nil)
|
|
107
|
+
new.create_or_update_a_secret_for_the_authenticated_user(secret_name, encrypted_value, key_id, selected_repository_ids, options)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.delete_a_secret_for_the_authenticated_user(secret_name: nil, options: nil)
|
|
111
|
+
new.delete_a_secret_for_the_authenticated_user(secret_name, options)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.list_selected_repositories_for_a_user_secret(secret_name: nil, options: nil)
|
|
115
|
+
new.list_selected_repositories_for_a_user_secret(secret_name, options)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.set_selected_repositories_for_a_user_secret(secret_name: nil, selected_repository_ids: nil, options: nil)
|
|
119
|
+
new.set_selected_repositories_for_a_user_secret(secret_name, selected_repository_ids, options)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.add_a_selected_repository_to_a_user_secret(secret_name: nil, repository_id: nil, options: nil)
|
|
123
|
+
new.add_a_selected_repository_to_a_user_secret(secret_name, repository_id, options)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.remove_a_selected_repository_from_a_user_secret(secret_name: nil, repository_id: nil, options: nil)
|
|
127
|
+
new.remove_a_selected_repository_from_a_user_secret(secret_name, repository_id, options)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
private
|
|
131
|
+
|
|
132
|
+
# list codespaces in a repository for the authenticated user
|
|
133
|
+
#
|
|
134
|
+
# @param owner [String]
|
|
135
|
+
# @param repo [String]
|
|
136
|
+
#
|
|
137
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
138
|
+
def list_codespaces_in_a_repository_for_the_authenticated_user(owner, repo, options)
|
|
139
|
+
auth = nil
|
|
140
|
+
body = nil
|
|
141
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
142
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
143
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/codespaces"
|
|
144
|
+
|
|
145
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
146
|
+
|
|
147
|
+
if http_call.successful?
|
|
148
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
149
|
+
else
|
|
150
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# create a codespace in a repository
|
|
155
|
+
#
|
|
156
|
+
# @param owner [String]
|
|
157
|
+
# @param repo [String]
|
|
158
|
+
# @param ref [String] Git ref (typically a branch name) for this codespace
|
|
159
|
+
# @param location [String] Location for this codespace. Assigned by IP if not provided
|
|
160
|
+
# @param machine [String] Machine type to use for this codespace
|
|
161
|
+
# @param working_directory [String] Working directory for this codespace
|
|
162
|
+
# @param idle_timeout_minutes [Integer] Time in minutes before codespace stops from inactivity
|
|
163
|
+
# @param display_name [String] Display name for this codespace
|
|
164
|
+
#
|
|
165
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
166
|
+
def create_a_codespace_in_a_repository(owner, repo, ref, location, machine, working_directory, idle_timeout_minutes, display_name, _options)
|
|
167
|
+
auth = nil
|
|
168
|
+
body = { ref: ref, location: location, machine: machine, working_directory: working_directory, idle_timeout_minutes: idle_timeout_minutes, display_name: display_name }
|
|
169
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
170
|
+
params = nil
|
|
171
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/codespaces"
|
|
172
|
+
|
|
173
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
174
|
+
|
|
175
|
+
if http_call.successful?
|
|
176
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
177
|
+
else
|
|
178
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# create a codespace from a pull request
|
|
183
|
+
#
|
|
184
|
+
# @param owner [String]
|
|
185
|
+
# @param repo [String]
|
|
186
|
+
# @param pull_number [Integer]
|
|
187
|
+
# @param location [String] Location for this codespace. Assigned by IP if not provided
|
|
188
|
+
# @param machine [String] Machine type to use for this codespace
|
|
189
|
+
# @param working_directory [String] Working directory for this codespace
|
|
190
|
+
# @param idle_timeout_minutes [Integer] Time in minutes before codespace stops from inactivity
|
|
191
|
+
# @param display_name [String] Display name for this codespace
|
|
192
|
+
#
|
|
193
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
194
|
+
def create_a_codespace_from_a_pull_request(owner, repo, pull_number, location, machine, working_directory, idle_timeout_minutes, display_name, _options)
|
|
195
|
+
auth = nil
|
|
196
|
+
body = { location: location, machine: machine, working_directory: working_directory, idle_timeout_minutes: idle_timeout_minutes, display_name: display_name }
|
|
197
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
198
|
+
params = nil
|
|
199
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/pulls/#{pull_number}/codespaces"
|
|
200
|
+
|
|
201
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
202
|
+
|
|
203
|
+
if http_call.successful?
|
|
204
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
205
|
+
else
|
|
206
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# list codespaces for the authenticated user
|
|
211
|
+
#
|
|
212
|
+
# @params options [Hash]
|
|
213
|
+
#
|
|
214
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
215
|
+
def list_codespaces_for_the_authenticated_user(options)
|
|
216
|
+
auth = nil
|
|
217
|
+
body = nil
|
|
218
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
219
|
+
params = { per_page: options[:per_page], page: options[:page], repository_id: options[:repository_id] }
|
|
220
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces"
|
|
221
|
+
|
|
222
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
223
|
+
|
|
224
|
+
if http_call.successful?
|
|
225
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
226
|
+
else
|
|
227
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# create a codespace for the authenticated user
|
|
232
|
+
#
|
|
233
|
+
# @param repository_id [Integer] Required. Repository id for this codespace
|
|
234
|
+
# @param ref [String] Git ref (typically a branch name) for this codespace
|
|
235
|
+
# @param location [String] Location for this codespace. Assigned by IP if not provided
|
|
236
|
+
# @param machine [String] Machine type to use for this codespace
|
|
237
|
+
# @param working_directory [String] Working directory for this codespace
|
|
238
|
+
# @param idle_timeout_minutes [Integer] Time in minutes before codespace stops from inactivity
|
|
239
|
+
# @param display_name [String] Display name for this codespace
|
|
240
|
+
# @param pull_request [Object] Required. Pull request number for this codespace
|
|
241
|
+
#
|
|
242
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
243
|
+
def create_a_codespace_for_the_authenticated_user(repository_id, ref, location, machine, working_directory, idle_timeout_minutes, display_name, pull_request, _options)
|
|
244
|
+
auth = nil
|
|
245
|
+
body = { repository_id: repository_id, ref: ref, location: location, machine: machine, working_directory: working_directory, idle_timeout_minutes: idle_timeout_minutes, display_name: display_name, pull_request: pull_request }
|
|
246
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
247
|
+
params = nil
|
|
248
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces"
|
|
249
|
+
|
|
250
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
251
|
+
|
|
252
|
+
if http_call.successful?
|
|
253
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
254
|
+
else
|
|
255
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# get a codespace for the authenticated user
|
|
260
|
+
#
|
|
261
|
+
# @param codespace_name [String] The name of the codespace.
|
|
262
|
+
#
|
|
263
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
264
|
+
def get_a_codespace_for_the_authenticated_user(codespace_name, _options)
|
|
265
|
+
auth = nil
|
|
266
|
+
body = nil
|
|
267
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
268
|
+
params = nil
|
|
269
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}"
|
|
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
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
275
|
+
else
|
|
276
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# update a codespace for the authenticated user
|
|
281
|
+
#
|
|
282
|
+
# @param codespace_name [String] The name of the codespace.
|
|
283
|
+
# @param machine [String] A valid machine to transition this codespace to.
|
|
284
|
+
# @param display_name [String] Display name for this codespace
|
|
285
|
+
# @param recent_folders [Array of strings] Recently opened folders inside the codespace. It is currently used by the clients to determine the folder path to load the codespace in.
|
|
286
|
+
#
|
|
287
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
288
|
+
def update_a_codespace_for_the_authenticated_user(codespace_name, machine, display_name, recent_folders, _options)
|
|
289
|
+
auth = nil
|
|
290
|
+
body = { machine: machine, display_name: display_name, recent_folders: recent_folders }
|
|
291
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
292
|
+
params = nil
|
|
293
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}"
|
|
294
|
+
|
|
295
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
296
|
+
|
|
297
|
+
if http_call.successful?
|
|
298
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
299
|
+
else
|
|
300
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# delete a codespace for the authenticated user
|
|
305
|
+
#
|
|
306
|
+
# @param codespace_name [String] The name of the codespace.
|
|
307
|
+
#
|
|
308
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
309
|
+
def delete_a_codespace_for_the_authenticated_user(codespace_name, _options)
|
|
310
|
+
auth = nil
|
|
311
|
+
body = nil
|
|
312
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
313
|
+
params = nil
|
|
314
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}"
|
|
315
|
+
|
|
316
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
317
|
+
|
|
318
|
+
if http_call.successful?
|
|
319
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
320
|
+
else
|
|
321
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# export a codespace for the authenticated user
|
|
326
|
+
#
|
|
327
|
+
# @param codespace_name [String] The name of the codespace.
|
|
328
|
+
#
|
|
329
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
330
|
+
def export_a_codespace_for_the_authenticated_user(codespace_name, _options)
|
|
331
|
+
auth = nil
|
|
332
|
+
body = nil
|
|
333
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
334
|
+
params = nil
|
|
335
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}/exports"
|
|
336
|
+
|
|
337
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
338
|
+
|
|
339
|
+
if http_call.successful?
|
|
340
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
341
|
+
else
|
|
342
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# get details about a codespace export
|
|
347
|
+
#
|
|
348
|
+
# @param codespace_name [String] The name of the codespace.
|
|
349
|
+
# @param export_id [String] The ID of the export operation, or latest. Currently only latest is currently supported.
|
|
350
|
+
#
|
|
351
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
352
|
+
def get_details_about_a_codespace_export(codespace_name, export_id, _options)
|
|
353
|
+
auth = nil
|
|
354
|
+
body = nil
|
|
355
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
356
|
+
params = nil
|
|
357
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}/exports/#{export_id}"
|
|
358
|
+
|
|
359
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
360
|
+
|
|
361
|
+
if http_call.successful?
|
|
362
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
363
|
+
else
|
|
364
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# start a codespace for the authenticated user
|
|
369
|
+
#
|
|
370
|
+
# @param codespace_name [String] The name of the codespace.
|
|
371
|
+
#
|
|
372
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
373
|
+
def start_a_codespace_for_the_authenticated_user(codespace_name, _options)
|
|
374
|
+
auth = nil
|
|
375
|
+
body = nil
|
|
376
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
377
|
+
params = nil
|
|
378
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}/start"
|
|
379
|
+
|
|
380
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
381
|
+
|
|
382
|
+
if http_call.successful?
|
|
383
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
384
|
+
else
|
|
385
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# stop a codespace for the authenticated user
|
|
390
|
+
#
|
|
391
|
+
# @param codespace_name [String] The name of the codespace.
|
|
392
|
+
#
|
|
393
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
394
|
+
def stop_a_codespace_for_the_authenticated_user(codespace_name, _options)
|
|
395
|
+
auth = nil
|
|
396
|
+
body = nil
|
|
397
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
398
|
+
params = nil
|
|
399
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}/stop"
|
|
400
|
+
|
|
401
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
402
|
+
|
|
403
|
+
if http_call.successful?
|
|
404
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
405
|
+
else
|
|
406
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
# list available machine types for a repository
|
|
411
|
+
#
|
|
412
|
+
# @param owner [String]
|
|
413
|
+
# @param repo [String]
|
|
414
|
+
#
|
|
415
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
416
|
+
def list_available_machine_types_for_a_repository(owner, repo, options)
|
|
417
|
+
auth = nil
|
|
418
|
+
body = nil
|
|
419
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
420
|
+
params = { location: options[:location] }
|
|
421
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/codespaces/machines"
|
|
422
|
+
|
|
423
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
424
|
+
|
|
425
|
+
if http_call.successful?
|
|
426
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
427
|
+
else
|
|
428
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
# list machine types for a codespace
|
|
433
|
+
#
|
|
434
|
+
# @param codespace_name [String] The name of the codespace.
|
|
435
|
+
#
|
|
436
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
437
|
+
def list_machine_types_for_a_codespace(codespace_name, _options)
|
|
438
|
+
auth = nil
|
|
439
|
+
body = nil
|
|
440
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
441
|
+
params = nil
|
|
442
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/#{codespace_name}/machines"
|
|
443
|
+
|
|
444
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
445
|
+
|
|
446
|
+
if http_call.successful?
|
|
447
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
448
|
+
else
|
|
449
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
# list secrets for the authenticated user
|
|
454
|
+
#
|
|
455
|
+
# @params options [Hash]
|
|
456
|
+
#
|
|
457
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
458
|
+
def list_secrets_for_the_authenticated_user(options)
|
|
459
|
+
auth = nil
|
|
460
|
+
body = nil
|
|
461
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
462
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
463
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets"
|
|
464
|
+
|
|
465
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
466
|
+
|
|
467
|
+
if http_call.successful?
|
|
468
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
469
|
+
else
|
|
470
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
471
|
+
end
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
# get public key for the authenticated user
|
|
475
|
+
#
|
|
476
|
+
# @params options [Hash]
|
|
477
|
+
#
|
|
478
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
479
|
+
def get_public_key_for_the_authenticated_user(_options)
|
|
480
|
+
auth = nil
|
|
481
|
+
body = nil
|
|
482
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
483
|
+
params = nil
|
|
484
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/public-key"
|
|
485
|
+
|
|
486
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
487
|
+
|
|
488
|
+
if http_call.successful?
|
|
489
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
490
|
+
else
|
|
491
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
492
|
+
end
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
# get a secret for the authenticated user
|
|
496
|
+
#
|
|
497
|
+
# @param secret_name [String] secret_name parameter
|
|
498
|
+
#
|
|
499
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
500
|
+
def get_a_secret_for_the_authenticated_user(secret_name, _options)
|
|
501
|
+
auth = nil
|
|
502
|
+
body = nil
|
|
503
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
504
|
+
params = nil
|
|
505
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}"
|
|
506
|
+
|
|
507
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
508
|
+
|
|
509
|
+
if http_call.successful?
|
|
510
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
511
|
+
else
|
|
512
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
513
|
+
end
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
# create or update a secret for the authenticated user
|
|
517
|
+
#
|
|
518
|
+
# @param secret_name [String] secret_name parameter
|
|
519
|
+
# @param encrypted_value [String] Value for your secret, encrypted with LibSodium using the public key retrieved from the Get the public key for the authenticated user endpoint.
|
|
520
|
+
# @param key_id [String] Required. ID of the key you used to encrypt the secret.
|
|
521
|
+
# @param selected_repository_ids [Array of strings] An array of repository ids that can access the user secret. You can manage the list of selected repositories using the List selected repositories for a user secret, Set selected repositories for a user secret, and Remove a selected repository from a user secret endpoints.
|
|
522
|
+
#
|
|
523
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
524
|
+
def create_or_update_a_secret_for_the_authenticated_user(secret_name, encrypted_value, key_id, selected_repository_ids, _options)
|
|
525
|
+
auth = nil
|
|
526
|
+
body = { encrypted_value: encrypted_value, key_id: key_id, selected_repository_ids: selected_repository_ids }
|
|
527
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
528
|
+
params = nil
|
|
529
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}"
|
|
530
|
+
|
|
531
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
532
|
+
|
|
533
|
+
if http_call.successful?
|
|
534
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
535
|
+
else
|
|
536
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
# delete a secret for the authenticated user
|
|
541
|
+
#
|
|
542
|
+
# @param secret_name [String] secret_name parameter
|
|
543
|
+
#
|
|
544
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
545
|
+
def delete_a_secret_for_the_authenticated_user(secret_name, _options)
|
|
546
|
+
auth = nil
|
|
547
|
+
body = nil
|
|
548
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
549
|
+
params = nil
|
|
550
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}"
|
|
551
|
+
|
|
552
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
553
|
+
|
|
554
|
+
if http_call.successful?
|
|
555
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
556
|
+
else
|
|
557
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
558
|
+
end
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
# list selected repositories for a user secret
|
|
562
|
+
#
|
|
563
|
+
# @param secret_name [String] secret_name parameter
|
|
564
|
+
#
|
|
565
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
566
|
+
def list_selected_repositories_for_a_user_secret(secret_name, _options)
|
|
567
|
+
auth = nil
|
|
568
|
+
body = nil
|
|
569
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
570
|
+
params = nil
|
|
571
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}/repositories"
|
|
572
|
+
|
|
573
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
574
|
+
|
|
575
|
+
if http_call.successful?
|
|
576
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
577
|
+
else
|
|
578
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
579
|
+
end
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
# set selected repositories for a user secret
|
|
583
|
+
#
|
|
584
|
+
# @param secret_name [String] secret_name parameter
|
|
585
|
+
# @param selected_repository_ids [Array of integers] Required. An array of repository ids for which a codespace can access the secret. You can manage the list of selected repositories using the List selected repositories for a user secret, Add a selected repository to a user secret, and Remove a selected repository from a user secret endpoints.
|
|
586
|
+
#
|
|
587
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
588
|
+
def set_selected_repositories_for_a_user_secret(secret_name, selected_repository_ids, _options)
|
|
589
|
+
auth = nil
|
|
590
|
+
body = { selected_repository_ids: selected_repository_ids }
|
|
591
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
592
|
+
params = nil
|
|
593
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}/repositories"
|
|
594
|
+
|
|
595
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
596
|
+
|
|
597
|
+
if http_call.successful?
|
|
598
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
599
|
+
else
|
|
600
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
# add a selected repository to a user secret
|
|
605
|
+
#
|
|
606
|
+
# @param secret_name [String] secret_name parameter
|
|
607
|
+
# @param repository_id [Integer]
|
|
608
|
+
#
|
|
609
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
610
|
+
def add_a_selected_repository_to_a_user_secret(secret_name, repository_id, _options)
|
|
611
|
+
auth = nil
|
|
612
|
+
body = nil
|
|
613
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
614
|
+
params = nil
|
|
615
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}/repositories/#{repository_id}"
|
|
616
|
+
|
|
617
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
618
|
+
|
|
619
|
+
if http_call.successful?
|
|
620
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
621
|
+
else
|
|
622
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
623
|
+
end
|
|
624
|
+
end
|
|
625
|
+
|
|
626
|
+
# remove a selected repository from a user secret
|
|
627
|
+
#
|
|
628
|
+
# @param secret_name [String] secret_name parameter
|
|
629
|
+
# @param repository_id [Integer]
|
|
630
|
+
#
|
|
631
|
+
# @return CodespacesResult, CodespacesErrorResult
|
|
632
|
+
def remove_a_selected_repository_from_a_user_secret(secret_name, repository_id, _options)
|
|
633
|
+
auth = nil
|
|
634
|
+
body = nil
|
|
635
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
636
|
+
params = nil
|
|
637
|
+
uri = "#{Gitabu::BASE_URL}/user/codespaces/secrets/#{secret_name}/repositories/#{repository_id}"
|
|
638
|
+
|
|
639
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
640
|
+
|
|
641
|
+
if http_call.successful?
|
|
642
|
+
CodespacesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
643
|
+
else
|
|
644
|
+
CodespacesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
645
|
+
end
|
|
646
|
+
end
|
|
647
|
+
end
|
|
648
|
+
end
|
|
649
|
+
end
|
|
650
|
+
end
|