gitabu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/gitabu.gemspec +41 -0
- data/lib/gitabu/api/v3/actions.rb +3724 -0
- data/lib/gitabu/api/v3/activity.rb +835 -0
- data/lib/gitabu/api/v3/apps.rb +961 -0
- data/lib/gitabu/api/v3/billing.rb +217 -0
- data/lib/gitabu/api/v3/branches.rb +1098 -0
- data/lib/gitabu/api/v3/checks.rb +384 -0
- data/lib/gitabu/api/v3/code_scanning.rb +315 -0
- data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
- data/lib/gitabu/api/v3/codespaces.rb +650 -0
- data/lib/gitabu/api/v3/collaborators.rb +341 -0
- data/lib/gitabu/api/v3/commits.rb +428 -0
- data/lib/gitabu/api/v3/dependabot.rb +419 -0
- data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
- data/lib/gitabu/api/v3/deployments.rb +356 -0
- data/lib/gitabu/api/v3/emojis.rb +67 -0
- data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
- data/lib/gitabu/api/v3/gists.rb +552 -0
- data/lib/gitabu/api/v3/git.rb +409 -0
- data/lib/gitabu/api/v3/gitignore.rb +92 -0
- data/lib/gitabu/api/v3/interactions.rb +275 -0
- data/lib/gitabu/api/v3/issues.rb +1119 -0
- data/lib/gitabu/api/v3/licenses.rb +118 -0
- data/lib/gitabu/api/v3/markdown.rb +94 -0
- data/lib/gitabu/api/v3/meta.rb +142 -0
- data/lib/gitabu/api/v3/metrics.rb +302 -0
- data/lib/gitabu/api/v3/migrations.rb +631 -0
- data/lib/gitabu/api/v3/orgs.rb +1291 -0
- data/lib/gitabu/api/v3/packages.rb +686 -0
- data/lib/gitabu/api/v3/pages.rb +282 -0
- data/lib/gitabu/api/v3/projects.rb +693 -0
- data/lib/gitabu/api/v3/pulls.rb +816 -0
- data/lib/gitabu/api/v3/rate_limit.rb +67 -0
- data/lib/gitabu/api/v3/reactions.rb +734 -0
- data/lib/gitabu/api/v3/releases.rb +411 -0
- data/lib/gitabu/api/v3/repos.rb +1136 -0
- data/lib/gitabu/api/v3/scim.rb +214 -0
- data/lib/gitabu/api/v3/search.rb +217 -0
- data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
- data/lib/gitabu/api/v3/teams.rb +1963 -0
- data/lib/gitabu/api/v3/users.rb +851 -0
- data/lib/gitabu/api/v3/webhooks.rb +379 -0
- data/lib/gitabu/builder.rb +37 -0
- data/lib/gitabu/client.rb +8 -0
- data/lib/gitabu/generator.rb +75 -0
- data/lib/gitabu/http_client.rb +96 -0
- data/lib/gitabu/items.rb +110 -0
- data/lib/gitabu/public/api/v3/actions.json +5779 -0
- data/lib/gitabu/public/api/v3/activity.json +1248 -0
- data/lib/gitabu/public/api/v3/apps.json +1174 -0
- data/lib/gitabu/public/api/v3/billing.json +183 -0
- data/lib/gitabu/public/api/v3/branches.json +1886 -0
- data/lib/gitabu/public/api/v3/checks.json +856 -0
- data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
- data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
- data/lib/gitabu/public/api/v3/codespaces.json +884 -0
- data/lib/gitabu/public/api/v3/collaborators.json +464 -0
- data/lib/gitabu/public/api/v3/commits.json +830 -0
- data/lib/gitabu/public/api/v3/dependabot.json +596 -0
- data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
- data/lib/gitabu/public/api/v3/deployments.json +698 -0
- data/lib/gitabu/public/api/v3/emojis.json +18 -0
- data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
- data/lib/gitabu/public/api/v3/gists.json +689 -0
- data/lib/gitabu/public/api/v3/git.json +735 -0
- data/lib/gitabu/public/api/v3/gitignore.json +41 -0
- data/lib/gitabu/public/api/v3/interactions.json +265 -0
- data/lib/gitabu/public/api/v3/issues.json +2359 -0
- data/lib/gitabu/public/api/v3/licenses.json +100 -0
- data/lib/gitabu/public/api/v3/markdown.json +59 -0
- data/lib/gitabu/public/api/v3/meta.json +69 -0
- data/lib/gitabu/public/api/v3/metrics.json +342 -0
- data/lib/gitabu/public/api/v3/migrations.json +960 -0
- data/lib/gitabu/public/api/v3/orgs.json +1989 -0
- data/lib/gitabu/public/api/v3/packages.json +1078 -0
- data/lib/gitabu/public/api/v3/pages.json +373 -0
- data/lib/gitabu/public/api/v3/projects.json +966 -0
- data/lib/gitabu/public/api/v3/pulls.json +1768 -0
- data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
- data/lib/gitabu/public/api/v3/reactions.json +1425 -0
- data/lib/gitabu/public/api/v3/releases.json +753 -0
- data/lib/gitabu/public/api/v3/repos.json +2314 -0
- data/lib/gitabu/public/api/v3/scim.json +412 -0
- data/lib/gitabu/public/api/v3/search.json +408 -0
- data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
- data/lib/gitabu/public/api/v3/teams.json +3126 -0
- data/lib/gitabu/public/api/v3/users.json +956 -0
- data/lib/gitabu/public/api/v3/webhooks.json +667 -0
- data/lib/gitabu/run.rb +237 -0
- data/lib/gitabu/scraper.rb +86 -0
- data/lib/gitabu/templates/template.rb.erb +70 -0
- data/lib/gitabu/version.rb +6 -0
- data/lib/gitabu.rb +57 -0
- data/sig/gitabu.rbs +4 -0
- metadata +177 -0
@@ -0,0 +1,631 @@
|
|
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 Migrations result
|
17
|
+
class MigrationsResult
|
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 MigrationsErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Migrations endpoints.
|
37
|
+
class Migrations
|
38
|
+
def self.list_organization_migrations(org: nil, options: nil)
|
39
|
+
new.list_organization_migrations(org, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.start_an_organization_migration(org: nil, repositories: nil, lock_repositories: nil, exclude_attachments: nil, exclude_releases: nil, exclude_owner_projects: nil, exclude: nil, options: nil)
|
43
|
+
new.start_an_organization_migration(org, repositories, lock_repositories, exclude_attachments, exclude_releases, exclude_owner_projects, exclude, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_an_organization_migration_status(org: nil, migration_id: nil, options: nil)
|
47
|
+
new.get_an_organization_migration_status(org, migration_id, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.download_an_organization_migration_archive(org: nil, migration_id: nil, options: nil)
|
51
|
+
new.download_an_organization_migration_archive(org, migration_id, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.delete_an_organization_migration_archive(org: nil, migration_id: nil, options: nil)
|
55
|
+
new.delete_an_organization_migration_archive(org, migration_id, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.unlock_an_organization_repository(org: nil, migration_id: nil, repo_name: nil, options: nil)
|
59
|
+
new.unlock_an_organization_repository(org, migration_id, repo_name, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.list_repositories_in_an_organization_migration(org: nil, migration_id: nil, options: nil)
|
63
|
+
new.list_repositories_in_an_organization_migration(org, migration_id, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.get_an_import_status(owner: nil, repo: nil, options: nil)
|
67
|
+
new.get_an_import_status(owner, repo, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.start_an_import(owner: nil, repo: nil, vcs_url: nil, vcs: nil, vcs_username: nil, vcs_password: nil, tfvc_project: nil, options: nil)
|
71
|
+
new.start_an_import(owner, repo, vcs_url, vcs, vcs_username, vcs_password, tfvc_project, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.update_an_import(owner: nil, repo: nil, vcs_username: nil, vcs_password: nil, vcs: nil, tfvc_project: nil, options: nil)
|
75
|
+
new.update_an_import(owner, repo, vcs_username, vcs_password, vcs, tfvc_project, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.cancel_an_import(owner: nil, repo: nil, options: nil)
|
79
|
+
new.cancel_an_import(owner, repo, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.get_commit_authors(owner: nil, repo: nil, options: nil)
|
83
|
+
new.get_commit_authors(owner, repo, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.map_a_commit_author(owner: nil, repo: nil, author_id: nil, email: nil, name: nil, options: nil)
|
87
|
+
new.map_a_commit_author(owner, repo, author_id, email, name, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.get_large_files(owner: nil, repo: nil, options: nil)
|
91
|
+
new.get_large_files(owner, repo, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.update_git_lfs_preference(owner: nil, repo: nil, use_lfs: nil, options: nil)
|
95
|
+
new.update_git_lfs_preference(owner, repo, use_lfs, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.list_user_migrations(options: nil)
|
99
|
+
new.list_user_migrations(options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.start_a_user_migration(lock_repositories: nil, exclude_attachments: nil, exclude_releases: nil, exclude_owner_projects: nil, exclude: nil, repositories: nil, options: nil)
|
103
|
+
new.start_a_user_migration(lock_repositories, exclude_attachments, exclude_releases, exclude_owner_projects, exclude, repositories, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.get_a_user_migration_status(migration_id: nil, options: nil)
|
107
|
+
new.get_a_user_migration_status(migration_id, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.download_a_user_migration_archive(migration_id: nil, options: nil)
|
111
|
+
new.download_a_user_migration_archive(migration_id, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.delete_a_user_migration_archive(migration_id: nil, options: nil)
|
115
|
+
new.delete_a_user_migration_archive(migration_id, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.unlock_a_user_repository(migration_id: nil, repo_name: nil, options: nil)
|
119
|
+
new.unlock_a_user_repository(migration_id, repo_name, options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.list_repositories_for_a_user_migration(migration_id: nil, options: nil)
|
123
|
+
new.list_repositories_for_a_user_migration(migration_id, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
# list organization migrations
|
129
|
+
#
|
130
|
+
# @param org [String]
|
131
|
+
#
|
132
|
+
# @return MigrationsResult, MigrationsErrorResult
|
133
|
+
def list_organization_migrations(org, options)
|
134
|
+
auth = nil
|
135
|
+
body = nil
|
136
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
137
|
+
params = { per_page: options[:per_page], page: options[:page], exclude: options[:exclude] }
|
138
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations"
|
139
|
+
|
140
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
141
|
+
|
142
|
+
if http_call.successful?
|
143
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
144
|
+
else
|
145
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# start an organization migration
|
150
|
+
#
|
151
|
+
# @param org [String]
|
152
|
+
# @param repositories [Array of strings] Required. A list of arrays indicating which repositories should be migrated.
|
153
|
+
# @param lock_repositories [Boolean] Indicates whether repositories should be locked (to prevent manipulation) while migrating data.
|
154
|
+
# @param exclude_attachments [Boolean] Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).
|
155
|
+
# @param exclude_releases [Boolean] Indicates whether releases should be excluded from the migration (to reduce migration archive file size).
|
156
|
+
# @param exclude_owner_projects [Boolean] Indicates whether projects owned by the organization or users should be excluded. from the migration.
|
157
|
+
# @param exclude [Array of strings]
|
158
|
+
#
|
159
|
+
# @return MigrationsResult, MigrationsErrorResult
|
160
|
+
def start_an_organization_migration(org, repositories, lock_repositories, exclude_attachments, exclude_releases, exclude_owner_projects, exclude, _options)
|
161
|
+
auth = nil
|
162
|
+
body = { repositories: repositories, lock_repositories: lock_repositories, exclude_attachments: exclude_attachments, exclude_releases: exclude_releases, exclude_owner_projects: exclude_owner_projects, exclude: exclude }
|
163
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
164
|
+
params = nil
|
165
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations"
|
166
|
+
|
167
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
168
|
+
|
169
|
+
if http_call.successful?
|
170
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
171
|
+
else
|
172
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# get an organization migration status
|
177
|
+
#
|
178
|
+
# @param org [String]
|
179
|
+
# @param migration_id [Integer] migration_id parameter
|
180
|
+
#
|
181
|
+
# @return MigrationsResult, MigrationsErrorResult
|
182
|
+
def get_an_organization_migration_status(org, migration_id, options)
|
183
|
+
auth = nil
|
184
|
+
body = nil
|
185
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
186
|
+
params = { exclude: options[:exclude] }
|
187
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations/#{migration_id}"
|
188
|
+
|
189
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
190
|
+
|
191
|
+
if http_call.successful?
|
192
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
193
|
+
else
|
194
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# download an organization migration archive
|
199
|
+
#
|
200
|
+
# @param org [String]
|
201
|
+
# @param migration_id [Integer] migration_id parameter
|
202
|
+
#
|
203
|
+
# @return MigrationsResult, MigrationsErrorResult
|
204
|
+
def download_an_organization_migration_archive(org, migration_id, _options)
|
205
|
+
auth = nil
|
206
|
+
body = nil
|
207
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
208
|
+
params = nil
|
209
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations/#{migration_id}/archive"
|
210
|
+
|
211
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
212
|
+
|
213
|
+
if http_call.successful?
|
214
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
215
|
+
else
|
216
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# delete an organization migration archive
|
221
|
+
#
|
222
|
+
# @param org [String]
|
223
|
+
# @param migration_id [Integer] migration_id parameter
|
224
|
+
#
|
225
|
+
# @return MigrationsResult, MigrationsErrorResult
|
226
|
+
def delete_an_organization_migration_archive(org, migration_id, _options)
|
227
|
+
auth = nil
|
228
|
+
body = nil
|
229
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
230
|
+
params = nil
|
231
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations/#{migration_id}/archive"
|
232
|
+
|
233
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
234
|
+
|
235
|
+
if http_call.successful?
|
236
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
237
|
+
else
|
238
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# unlock an organization repository
|
243
|
+
#
|
244
|
+
# @param org [String]
|
245
|
+
# @param migration_id [Integer] migration_id parameter
|
246
|
+
# @param repo_name [String] repo_name parameter
|
247
|
+
#
|
248
|
+
# @return MigrationsResult, MigrationsErrorResult
|
249
|
+
def unlock_an_organization_repository(org, migration_id, repo_name, _options)
|
250
|
+
auth = nil
|
251
|
+
body = nil
|
252
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
253
|
+
params = nil
|
254
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations/#{migration_id}/repos/#{repo_name}/lock"
|
255
|
+
|
256
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
257
|
+
|
258
|
+
if http_call.successful?
|
259
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
260
|
+
else
|
261
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
# list repositories in an organization migration
|
266
|
+
#
|
267
|
+
# @param org [String]
|
268
|
+
# @param migration_id [Integer] migration_id parameter
|
269
|
+
#
|
270
|
+
# @return MigrationsResult, MigrationsErrorResult
|
271
|
+
def list_repositories_in_an_organization_migration(org, migration_id, options)
|
272
|
+
auth = nil
|
273
|
+
body = nil
|
274
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
275
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
276
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/migrations/#{migration_id}/repositories"
|
277
|
+
|
278
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
279
|
+
|
280
|
+
if http_call.successful?
|
281
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
282
|
+
else
|
283
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
# get an import status
|
288
|
+
#
|
289
|
+
# @param owner [String]
|
290
|
+
# @param repo [String]
|
291
|
+
#
|
292
|
+
# @return MigrationsResult, MigrationsErrorResult
|
293
|
+
def get_an_import_status(owner, repo, _options)
|
294
|
+
auth = nil
|
295
|
+
body = nil
|
296
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
297
|
+
params = nil
|
298
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import"
|
299
|
+
|
300
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
301
|
+
|
302
|
+
if http_call.successful?
|
303
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
304
|
+
else
|
305
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# start an import
|
310
|
+
#
|
311
|
+
# @param owner [String]
|
312
|
+
# @param repo [String]
|
313
|
+
# @param vcs_url [String] Required. The URL of the originating repository.
|
314
|
+
# @param vcs [String] The originating VCS type. Can be one of subversion, git, mercurial, or tfvc. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response.
|
315
|
+
# @param vcs_username [String] If authentication is required, the username to provide to vcs_url.
|
316
|
+
# @param vcs_password [String] If authentication is required, the password to provide to vcs_url.
|
317
|
+
# @param tfvc_project [String] For a tfvc import, the name of the project that is being imported.
|
318
|
+
#
|
319
|
+
# @return MigrationsResult, MigrationsErrorResult
|
320
|
+
def start_an_import(owner, repo, vcs_url, vcs, vcs_username, vcs_password, tfvc_project, _options)
|
321
|
+
auth = nil
|
322
|
+
body = { vcs_url: vcs_url, vcs: vcs, vcs_username: vcs_username, vcs_password: vcs_password, tfvc_project: tfvc_project }
|
323
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
324
|
+
params = nil
|
325
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import"
|
326
|
+
|
327
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
328
|
+
|
329
|
+
if http_call.successful?
|
330
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
331
|
+
else
|
332
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# update an import
|
337
|
+
#
|
338
|
+
# @param owner [String]
|
339
|
+
# @param repo [String]
|
340
|
+
# @param vcs_username [String] The username to provide to the originating repository.
|
341
|
+
# @param vcs_password [String] The password to provide to the originating repository.
|
342
|
+
# @param vcs [String] The type of version control system you are migrating from.
|
343
|
+
# @param tfvc_project [String] For a tfvc import, the name of the project that is being imported.
|
344
|
+
#
|
345
|
+
# @return MigrationsResult, MigrationsErrorResult
|
346
|
+
def update_an_import(owner, repo, vcs_username, vcs_password, vcs, tfvc_project, _options)
|
347
|
+
auth = nil
|
348
|
+
body = { vcs_username: vcs_username, vcs_password: vcs_password, vcs: vcs, tfvc_project: tfvc_project }
|
349
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
350
|
+
params = nil
|
351
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import"
|
352
|
+
|
353
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
354
|
+
|
355
|
+
if http_call.successful?
|
356
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
357
|
+
else
|
358
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# cancel an import
|
363
|
+
#
|
364
|
+
# @param owner [String]
|
365
|
+
# @param repo [String]
|
366
|
+
#
|
367
|
+
# @return MigrationsResult, MigrationsErrorResult
|
368
|
+
def cancel_an_import(owner, repo, _options)
|
369
|
+
auth = nil
|
370
|
+
body = nil
|
371
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
372
|
+
params = nil
|
373
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import"
|
374
|
+
|
375
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
376
|
+
|
377
|
+
if http_call.successful?
|
378
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
379
|
+
else
|
380
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
# get commit authors
|
385
|
+
#
|
386
|
+
# @param owner [String]
|
387
|
+
# @param repo [String]
|
388
|
+
#
|
389
|
+
# @return MigrationsResult, MigrationsErrorResult
|
390
|
+
def get_commit_authors(owner, repo, options)
|
391
|
+
auth = nil
|
392
|
+
body = nil
|
393
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
394
|
+
params = { since: options[:since] }
|
395
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import/authors"
|
396
|
+
|
397
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
398
|
+
|
399
|
+
if http_call.successful?
|
400
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
401
|
+
else
|
402
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
# map a commit author
|
407
|
+
#
|
408
|
+
# @param owner [String]
|
409
|
+
# @param repo [String]
|
410
|
+
# @param author_id [Integer]
|
411
|
+
# @param email [String] The new Git author email.
|
412
|
+
# @param name [String] The new Git author name.
|
413
|
+
#
|
414
|
+
# @return MigrationsResult, MigrationsErrorResult
|
415
|
+
def map_a_commit_author(owner, repo, author_id, email, name, _options)
|
416
|
+
auth = nil
|
417
|
+
body = { email: email, name: name }
|
418
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
419
|
+
params = nil
|
420
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import/authors/#{author_id}"
|
421
|
+
|
422
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
423
|
+
|
424
|
+
if http_call.successful?
|
425
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
426
|
+
else
|
427
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
# get large files
|
432
|
+
#
|
433
|
+
# @param owner [String]
|
434
|
+
# @param repo [String]
|
435
|
+
#
|
436
|
+
# @return MigrationsResult, MigrationsErrorResult
|
437
|
+
def get_large_files(owner, repo, _options)
|
438
|
+
auth = nil
|
439
|
+
body = nil
|
440
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
441
|
+
params = nil
|
442
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import/large_files"
|
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
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
448
|
+
else
|
449
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
# update git lfs preference
|
454
|
+
#
|
455
|
+
# @param owner [String]
|
456
|
+
# @param repo [String]
|
457
|
+
# @param use_lfs [String] Required. Can be one of opt_in (large files will be stored using Git LFS) or opt_out (large files will be removed during the import).
|
458
|
+
#
|
459
|
+
# @return MigrationsResult, MigrationsErrorResult
|
460
|
+
def update_git_lfs_preference(owner, repo, use_lfs, _options)
|
461
|
+
auth = nil
|
462
|
+
body = { use_lfs: use_lfs }
|
463
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
464
|
+
params = nil
|
465
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/import/lfs"
|
466
|
+
|
467
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
468
|
+
|
469
|
+
if http_call.successful?
|
470
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
471
|
+
else
|
472
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
# list user migrations
|
477
|
+
#
|
478
|
+
# @params options [Hash]
|
479
|
+
#
|
480
|
+
# @return MigrationsResult, MigrationsErrorResult
|
481
|
+
def list_user_migrations(options)
|
482
|
+
auth = nil
|
483
|
+
body = nil
|
484
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
485
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
486
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations"
|
487
|
+
|
488
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
489
|
+
|
490
|
+
if http_call.successful?
|
491
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
492
|
+
else
|
493
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
# start a user migration
|
498
|
+
#
|
499
|
+
# @param lock_repositories [Boolean] Lock the repositories being migrated at the start of the migration
|
500
|
+
# @param exclude_attachments [Boolean] Do not include attachments in the migration
|
501
|
+
# @param exclude_releases [Boolean] Do not include releases in the migration
|
502
|
+
# @param exclude_owner_projects [Boolean] Indicates whether projects owned by the organization or users should be excluded.
|
503
|
+
# @param exclude [Array of strings] Exclude attributes from the API response to improve performance
|
504
|
+
# @param repositories [Array of strings] Required.
|
505
|
+
#
|
506
|
+
# @return MigrationsResult, MigrationsErrorResult
|
507
|
+
def start_a_user_migration(lock_repositories, exclude_attachments, exclude_releases, exclude_owner_projects, exclude, repositories, _options)
|
508
|
+
auth = nil
|
509
|
+
body = { lock_repositories: lock_repositories, exclude_attachments: exclude_attachments, exclude_releases: exclude_releases, exclude_owner_projects: exclude_owner_projects, exclude: exclude, repositories: repositories }
|
510
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
511
|
+
params = nil
|
512
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations"
|
513
|
+
|
514
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
515
|
+
|
516
|
+
if http_call.successful?
|
517
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
518
|
+
else
|
519
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
523
|
+
# get a user migration status
|
524
|
+
#
|
525
|
+
# @param migration_id [Integer] migration_id parameter
|
526
|
+
#
|
527
|
+
# @return MigrationsResult, MigrationsErrorResult
|
528
|
+
def get_a_user_migration_status(migration_id, options)
|
529
|
+
auth = nil
|
530
|
+
body = nil
|
531
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
532
|
+
params = { exclude: options[:exclude] }
|
533
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations/#{migration_id}"
|
534
|
+
|
535
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
536
|
+
|
537
|
+
if http_call.successful?
|
538
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
539
|
+
else
|
540
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
# download a user migration archive
|
545
|
+
#
|
546
|
+
# @param migration_id [Integer] migration_id parameter
|
547
|
+
#
|
548
|
+
# @return MigrationsResult, MigrationsErrorResult
|
549
|
+
def download_a_user_migration_archive(migration_id, _options)
|
550
|
+
auth = nil
|
551
|
+
body = nil
|
552
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
553
|
+
params = nil
|
554
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations/#{migration_id}/archive"
|
555
|
+
|
556
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
557
|
+
|
558
|
+
if http_call.successful?
|
559
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
560
|
+
else
|
561
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
# delete a user migration archive
|
566
|
+
#
|
567
|
+
# @param migration_id [Integer] migration_id parameter
|
568
|
+
#
|
569
|
+
# @return MigrationsResult, MigrationsErrorResult
|
570
|
+
def delete_a_user_migration_archive(migration_id, _options)
|
571
|
+
auth = nil
|
572
|
+
body = nil
|
573
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
574
|
+
params = nil
|
575
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations/#{migration_id}/archive"
|
576
|
+
|
577
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
578
|
+
|
579
|
+
if http_call.successful?
|
580
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
581
|
+
else
|
582
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
# unlock a user repository
|
587
|
+
#
|
588
|
+
# @param migration_id [Integer] migration_id parameter
|
589
|
+
# @param repo_name [String] repo_name parameter
|
590
|
+
#
|
591
|
+
# @return MigrationsResult, MigrationsErrorResult
|
592
|
+
def unlock_a_user_repository(migration_id, repo_name, _options)
|
593
|
+
auth = nil
|
594
|
+
body = nil
|
595
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
596
|
+
params = nil
|
597
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations/#{migration_id}/repos/#{repo_name}/lock"
|
598
|
+
|
599
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
600
|
+
|
601
|
+
if http_call.successful?
|
602
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
603
|
+
else
|
604
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
# list repositories for a user migration
|
609
|
+
#
|
610
|
+
# @param migration_id [Integer] migration_id parameter
|
611
|
+
#
|
612
|
+
# @return MigrationsResult, MigrationsErrorResult
|
613
|
+
def list_repositories_for_a_user_migration(migration_id, options)
|
614
|
+
auth = nil
|
615
|
+
body = nil
|
616
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
617
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
618
|
+
uri = "#{Gitabu::BASE_URL}/user/migrations/#{migration_id}/repositories"
|
619
|
+
|
620
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
621
|
+
|
622
|
+
if http_call.successful?
|
623
|
+
MigrationsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
624
|
+
else
|
625
|
+
MigrationsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
626
|
+
end
|
627
|
+
end
|
628
|
+
end
|
629
|
+
end
|
630
|
+
end
|
631
|
+
end
|