gitabu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +33 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +65 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +42 -0
  9. data/Rakefile +12 -0
  10. data/gitabu.gemspec +41 -0
  11. data/lib/gitabu/api/v3/actions.rb +3724 -0
  12. data/lib/gitabu/api/v3/activity.rb +835 -0
  13. data/lib/gitabu/api/v3/apps.rb +961 -0
  14. data/lib/gitabu/api/v3/billing.rb +217 -0
  15. data/lib/gitabu/api/v3/branches.rb +1098 -0
  16. data/lib/gitabu/api/v3/checks.rb +384 -0
  17. data/lib/gitabu/api/v3/code_scanning.rb +315 -0
  18. data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
  19. data/lib/gitabu/api/v3/codespaces.rb +650 -0
  20. data/lib/gitabu/api/v3/collaborators.rb +341 -0
  21. data/lib/gitabu/api/v3/commits.rb +428 -0
  22. data/lib/gitabu/api/v3/dependabot.rb +419 -0
  23. data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
  24. data/lib/gitabu/api/v3/deployments.rb +356 -0
  25. data/lib/gitabu/api/v3/emojis.rb +67 -0
  26. data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
  27. data/lib/gitabu/api/v3/gists.rb +552 -0
  28. data/lib/gitabu/api/v3/git.rb +409 -0
  29. data/lib/gitabu/api/v3/gitignore.rb +92 -0
  30. data/lib/gitabu/api/v3/interactions.rb +275 -0
  31. data/lib/gitabu/api/v3/issues.rb +1119 -0
  32. data/lib/gitabu/api/v3/licenses.rb +118 -0
  33. data/lib/gitabu/api/v3/markdown.rb +94 -0
  34. data/lib/gitabu/api/v3/meta.rb +142 -0
  35. data/lib/gitabu/api/v3/metrics.rb +302 -0
  36. data/lib/gitabu/api/v3/migrations.rb +631 -0
  37. data/lib/gitabu/api/v3/orgs.rb +1291 -0
  38. data/lib/gitabu/api/v3/packages.rb +686 -0
  39. data/lib/gitabu/api/v3/pages.rb +282 -0
  40. data/lib/gitabu/api/v3/projects.rb +693 -0
  41. data/lib/gitabu/api/v3/pulls.rb +816 -0
  42. data/lib/gitabu/api/v3/rate_limit.rb +67 -0
  43. data/lib/gitabu/api/v3/reactions.rb +734 -0
  44. data/lib/gitabu/api/v3/releases.rb +411 -0
  45. data/lib/gitabu/api/v3/repos.rb +1136 -0
  46. data/lib/gitabu/api/v3/scim.rb +214 -0
  47. data/lib/gitabu/api/v3/search.rb +217 -0
  48. data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
  49. data/lib/gitabu/api/v3/teams.rb +1963 -0
  50. data/lib/gitabu/api/v3/users.rb +851 -0
  51. data/lib/gitabu/api/v3/webhooks.rb +379 -0
  52. data/lib/gitabu/builder.rb +37 -0
  53. data/lib/gitabu/client.rb +8 -0
  54. data/lib/gitabu/generator.rb +75 -0
  55. data/lib/gitabu/http_client.rb +96 -0
  56. data/lib/gitabu/items.rb +110 -0
  57. data/lib/gitabu/public/api/v3/actions.json +5779 -0
  58. data/lib/gitabu/public/api/v3/activity.json +1248 -0
  59. data/lib/gitabu/public/api/v3/apps.json +1174 -0
  60. data/lib/gitabu/public/api/v3/billing.json +183 -0
  61. data/lib/gitabu/public/api/v3/branches.json +1886 -0
  62. data/lib/gitabu/public/api/v3/checks.json +856 -0
  63. data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
  64. data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
  65. data/lib/gitabu/public/api/v3/codespaces.json +884 -0
  66. data/lib/gitabu/public/api/v3/collaborators.json +464 -0
  67. data/lib/gitabu/public/api/v3/commits.json +830 -0
  68. data/lib/gitabu/public/api/v3/dependabot.json +596 -0
  69. data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
  70. data/lib/gitabu/public/api/v3/deployments.json +698 -0
  71. data/lib/gitabu/public/api/v3/emojis.json +18 -0
  72. data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
  73. data/lib/gitabu/public/api/v3/gists.json +689 -0
  74. data/lib/gitabu/public/api/v3/git.json +735 -0
  75. data/lib/gitabu/public/api/v3/gitignore.json +41 -0
  76. data/lib/gitabu/public/api/v3/interactions.json +265 -0
  77. data/lib/gitabu/public/api/v3/issues.json +2359 -0
  78. data/lib/gitabu/public/api/v3/licenses.json +100 -0
  79. data/lib/gitabu/public/api/v3/markdown.json +59 -0
  80. data/lib/gitabu/public/api/v3/meta.json +69 -0
  81. data/lib/gitabu/public/api/v3/metrics.json +342 -0
  82. data/lib/gitabu/public/api/v3/migrations.json +960 -0
  83. data/lib/gitabu/public/api/v3/orgs.json +1989 -0
  84. data/lib/gitabu/public/api/v3/packages.json +1078 -0
  85. data/lib/gitabu/public/api/v3/pages.json +373 -0
  86. data/lib/gitabu/public/api/v3/projects.json +966 -0
  87. data/lib/gitabu/public/api/v3/pulls.json +1768 -0
  88. data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
  89. data/lib/gitabu/public/api/v3/reactions.json +1425 -0
  90. data/lib/gitabu/public/api/v3/releases.json +753 -0
  91. data/lib/gitabu/public/api/v3/repos.json +2314 -0
  92. data/lib/gitabu/public/api/v3/scim.json +412 -0
  93. data/lib/gitabu/public/api/v3/search.json +408 -0
  94. data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
  95. data/lib/gitabu/public/api/v3/teams.json +3126 -0
  96. data/lib/gitabu/public/api/v3/users.json +956 -0
  97. data/lib/gitabu/public/api/v3/webhooks.json +667 -0
  98. data/lib/gitabu/run.rb +237 -0
  99. data/lib/gitabu/scraper.rb +86 -0
  100. data/lib/gitabu/templates/template.rb.erb +70 -0
  101. data/lib/gitabu/version.rb +6 -0
  102. data/lib/gitabu.rb +57 -0
  103. data/sig/gitabu.rbs +4 -0
  104. metadata +177 -0
@@ -0,0 +1,686 @@
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 Packages result
17
+ class PackagesResult
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 PackagesErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Packages endpoints.
37
+ class Packages
38
+ def self.list_packages_for_an_organization(org: nil, options: nil)
39
+ new.list_packages_for_an_organization(org, options)
40
+ end
41
+
42
+ def self.get_a_package_for_an_organization(package_type: nil, package_name: nil, org: nil, options: nil)
43
+ new.get_a_package_for_an_organization(package_type, package_name, org, options)
44
+ end
45
+
46
+ def self.delete_a_package_for_an_organization(package_type: nil, package_name: nil, org: nil, options: nil)
47
+ new.delete_a_package_for_an_organization(package_type, package_name, org, options)
48
+ end
49
+
50
+ def self.restore_a_package_for_an_organization(package_type: nil, package_name: nil, org: nil, options: nil)
51
+ new.restore_a_package_for_an_organization(package_type, package_name, org, options)
52
+ end
53
+
54
+ def self.get_all_package_versions_for_a_package_owned_by_an_organization(package_type: nil, package_name: nil, org: nil, options: nil)
55
+ new.get_all_package_versions_for_a_package_owned_by_an_organization(package_type, package_name, org, options)
56
+ end
57
+
58
+ def self.get_a_package_version_for_an_organization(package_type: nil, package_name: nil, org: nil, package_version_id: nil, options: nil)
59
+ new.get_a_package_version_for_an_organization(package_type, package_name, org, package_version_id, options)
60
+ end
61
+
62
+ def self.delete_package_version_for_an_organization(package_type: nil, package_name: nil, org: nil, package_version_id: nil, options: nil)
63
+ new.delete_package_version_for_an_organization(package_type, package_name, org, package_version_id, options)
64
+ end
65
+
66
+ def self.restore_package_version_for_an_organization(package_type: nil, package_name: nil, org: nil, package_version_id: nil, options: nil)
67
+ new.restore_package_version_for_an_organization(package_type, package_name, org, package_version_id, options)
68
+ end
69
+
70
+ def self.list_packages_for_the_authenticated_user_namespace(options: nil)
71
+ new.list_packages_for_the_authenticated_user_namespace(options)
72
+ end
73
+
74
+ def self.get_a_package_for_the_authenticated_user(package_type: nil, package_name: nil, options: nil)
75
+ new.get_a_package_for_the_authenticated_user(package_type, package_name, options)
76
+ end
77
+
78
+ def self.delete_a_package_for_the_authenticated_user(package_type: nil, package_name: nil, options: nil)
79
+ new.delete_a_package_for_the_authenticated_user(package_type, package_name, options)
80
+ end
81
+
82
+ def self.restore_a_package_for_the_authenticated_user(package_type: nil, package_name: nil, options: nil)
83
+ new.restore_a_package_for_the_authenticated_user(package_type, package_name, options)
84
+ end
85
+
86
+ def self.get_all_package_versions_for_a_package_owned_by_the_authenticated_user(package_type: nil, package_name: nil, options: nil)
87
+ new.get_all_package_versions_for_a_package_owned_by_the_authenticated_user(package_type, package_name, options)
88
+ end
89
+
90
+ def self.get_a_package_version_for_the_authenticated_user(package_type: nil, package_name: nil, package_version_id: nil, options: nil)
91
+ new.get_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, options)
92
+ end
93
+
94
+ def self.delete_a_package_version_for_the_authenticated_user(package_type: nil, package_name: nil, package_version_id: nil, options: nil)
95
+ new.delete_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, options)
96
+ end
97
+
98
+ def self.restore_a_package_version_for_the_authenticated_user(package_type: nil, package_name: nil, package_version_id: nil, options: nil)
99
+ new.restore_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, options)
100
+ end
101
+
102
+ def self.list_packages_for_a_user(username: nil, options: nil)
103
+ new.list_packages_for_a_user(username, options)
104
+ end
105
+
106
+ def self.get_a_package_for_a_user(package_type: nil, package_name: nil, username: nil, options: nil)
107
+ new.get_a_package_for_a_user(package_type, package_name, username, options)
108
+ end
109
+
110
+ def self.delete_a_package_for_a_user(package_type: nil, package_name: nil, username: nil, options: nil)
111
+ new.delete_a_package_for_a_user(package_type, package_name, username, options)
112
+ end
113
+
114
+ def self.restore_a_package_for_a_user(package_type: nil, package_name: nil, username: nil, options: nil)
115
+ new.restore_a_package_for_a_user(package_type, package_name, username, options)
116
+ end
117
+
118
+ def self.get_all_package_versions_for_a_package_owned_by_a_user(package_type: nil, package_name: nil, username: nil, options: nil)
119
+ new.get_all_package_versions_for_a_package_owned_by_a_user(package_type, package_name, username, options)
120
+ end
121
+
122
+ def self.get_a_package_version_for_a_user(package_type: nil, package_name: nil, package_version_id: nil, username: nil, options: nil)
123
+ new.get_a_package_version_for_a_user(package_type, package_name, package_version_id, username, options)
124
+ end
125
+
126
+ def self.delete_package_version_for_a_user(package_type: nil, package_name: nil, username: nil, package_version_id: nil, options: nil)
127
+ new.delete_package_version_for_a_user(package_type, package_name, username, package_version_id, options)
128
+ end
129
+
130
+ def self.restore_package_version_for_a_user(package_type: nil, package_name: nil, username: nil, package_version_id: nil, options: nil)
131
+ new.restore_package_version_for_a_user(package_type, package_name, username, package_version_id, options)
132
+ end
133
+
134
+ private
135
+
136
+ # list packages for an organization
137
+ #
138
+ # @param org [String]
139
+ #
140
+ # @return PackagesResult, PackagesErrorResult
141
+ def list_packages_for_an_organization(org, options)
142
+ auth = nil
143
+ body = nil
144
+ headers = { accept: 'application/vnd.github.v3+json' }
145
+ params = { package_type: options[:package_type], visibility: options[:visibility] }
146
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages"
147
+
148
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
149
+
150
+ if http_call.successful?
151
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
152
+ else
153
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
154
+ end
155
+ end
156
+
157
+ # get a package for an organization
158
+ #
159
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
160
+ # @param package_name [String] The name of the package.
161
+ # @param org [String]
162
+ #
163
+ # @return PackagesResult, PackagesErrorResult
164
+ def get_a_package_for_an_organization(package_type, package_name, org, _options)
165
+ auth = nil
166
+ body = nil
167
+ headers = { accept: 'application/vnd.github.v3+json' }
168
+ params = nil
169
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}"
170
+
171
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
172
+
173
+ if http_call.successful?
174
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
175
+ else
176
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
177
+ end
178
+ end
179
+
180
+ # delete a package for an organization
181
+ #
182
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
183
+ # @param package_name [String] The name of the package.
184
+ # @param org [String]
185
+ #
186
+ # @return PackagesResult, PackagesErrorResult
187
+ def delete_a_package_for_an_organization(package_type, package_name, org, _options)
188
+ auth = nil
189
+ body = nil
190
+ headers = { accept: 'application/vnd.github.v3+json' }
191
+ params = nil
192
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}"
193
+
194
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
195
+
196
+ if http_call.successful?
197
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
198
+ else
199
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
200
+ end
201
+ end
202
+
203
+ # restore a package for an organization
204
+ #
205
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
206
+ # @param package_name [String] The name of the package.
207
+ # @param org [String]
208
+ #
209
+ # @return PackagesResult, PackagesErrorResult
210
+ def restore_a_package_for_an_organization(package_type, package_name, org, options)
211
+ auth = nil
212
+ body = nil
213
+ headers = { accept: 'application/vnd.github.v3+json' }
214
+ params = { token: options[:token] }
215
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}/restore"
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
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
221
+ else
222
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
223
+ end
224
+ end
225
+
226
+ # get all package versions for a package owned by an organization
227
+ #
228
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
229
+ # @param package_name [String] The name of the package.
230
+ # @param org [String]
231
+ #
232
+ # @return PackagesResult, PackagesErrorResult
233
+ def get_all_package_versions_for_a_package_owned_by_an_organization(package_type, package_name, org, options)
234
+ auth = nil
235
+ body = nil
236
+ headers = { accept: 'application/vnd.github.v3+json' }
237
+ params = { page: options[:page], per_page: options[:per_page], state: options[:state] }
238
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}/versions"
239
+
240
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
241
+
242
+ if http_call.successful?
243
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
244
+ else
245
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
246
+ end
247
+ end
248
+
249
+ # get a package version for an organization
250
+ #
251
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
252
+ # @param package_name [String] The name of the package.
253
+ # @param org [String]
254
+ # @param package_version_id [Integer] Unique identifier of the package version.
255
+ #
256
+ # @return PackagesResult, PackagesErrorResult
257
+ def get_a_package_version_for_an_organization(package_type, package_name, org, package_version_id, _options)
258
+ auth = nil
259
+ body = nil
260
+ headers = { accept: 'application/vnd.github.v3+json' }
261
+ params = nil
262
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
263
+
264
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
265
+
266
+ if http_call.successful?
267
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
268
+ else
269
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
270
+ end
271
+ end
272
+
273
+ # delete package version for an organization
274
+ #
275
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
276
+ # @param package_name [String] The name of the package.
277
+ # @param org [String]
278
+ # @param package_version_id [Integer] Unique identifier of the package version.
279
+ #
280
+ # @return PackagesResult, PackagesErrorResult
281
+ def delete_package_version_for_an_organization(package_type, package_name, org, package_version_id, _options)
282
+ auth = nil
283
+ body = nil
284
+ headers = { accept: 'application/vnd.github.v3+json' }
285
+ params = nil
286
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
287
+
288
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
289
+
290
+ if http_call.successful?
291
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
292
+ else
293
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
294
+ end
295
+ end
296
+
297
+ # restore package version for an organization
298
+ #
299
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
300
+ # @param package_name [String] The name of the package.
301
+ # @param org [String]
302
+ # @param package_version_id [Integer] Unique identifier of the package version.
303
+ #
304
+ # @return PackagesResult, PackagesErrorResult
305
+ def restore_package_version_for_an_organization(package_type, package_name, org, package_version_id, _options)
306
+ auth = nil
307
+ body = nil
308
+ headers = { accept: 'application/vnd.github.v3+json' }
309
+ params = nil
310
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
311
+
312
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
313
+
314
+ if http_call.successful?
315
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
316
+ else
317
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
318
+ end
319
+ end
320
+
321
+ # list packages for the authenticated user's namespace
322
+ #
323
+ # @params options [Hash]
324
+ #
325
+ # @return PackagesResult, PackagesErrorResult
326
+ def list_packages_for_the_authenticated_user_namespace(options)
327
+ auth = nil
328
+ body = nil
329
+ headers = { accept: 'application/vnd.github.v3+json' }
330
+ params = { package_type: options[:package_type], visibility: options[:visibility] }
331
+ uri = "#{Gitabu::BASE_URL}/user/packages"
332
+
333
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
334
+
335
+ if http_call.successful?
336
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
337
+ else
338
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
339
+ end
340
+ end
341
+
342
+ # get a package for the authenticated user
343
+ #
344
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
345
+ # @param package_name [String] The name of the package.
346
+ #
347
+ # @return PackagesResult, PackagesErrorResult
348
+ def get_a_package_for_the_authenticated_user(package_type, package_name, _options)
349
+ auth = nil
350
+ body = nil
351
+ headers = { accept: 'application/vnd.github.v3+json' }
352
+ params = nil
353
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}"
354
+
355
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
356
+
357
+ if http_call.successful?
358
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
359
+ else
360
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
361
+ end
362
+ end
363
+
364
+ # delete a package for the authenticated user
365
+ #
366
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
367
+ # @param package_name [String] The name of the package.
368
+ #
369
+ # @return PackagesResult, PackagesErrorResult
370
+ def delete_a_package_for_the_authenticated_user(package_type, package_name, _options)
371
+ auth = nil
372
+ body = nil
373
+ headers = { accept: 'application/vnd.github.v3+json' }
374
+ params = nil
375
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}"
376
+
377
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
378
+
379
+ if http_call.successful?
380
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
381
+ else
382
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
383
+ end
384
+ end
385
+
386
+ # restore a package for the authenticated user
387
+ #
388
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
389
+ # @param package_name [String] The name of the package.
390
+ #
391
+ # @return PackagesResult, PackagesErrorResult
392
+ def restore_a_package_for_the_authenticated_user(package_type, package_name, options)
393
+ auth = nil
394
+ body = nil
395
+ headers = { accept: 'application/vnd.github.v3+json' }
396
+ params = { token: options[:token] }
397
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}/restore"
398
+
399
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
400
+
401
+ if http_call.successful?
402
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
403
+ else
404
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
405
+ end
406
+ end
407
+
408
+ # get all package versions for a package owned by the authenticated user
409
+ #
410
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
411
+ # @param package_name [String] The name of the package.
412
+ #
413
+ # @return PackagesResult, PackagesErrorResult
414
+ def get_all_package_versions_for_a_package_owned_by_the_authenticated_user(package_type, package_name, options)
415
+ auth = nil
416
+ body = nil
417
+ headers = { accept: 'application/vnd.github.v3+json' }
418
+ params = { page: options[:page], per_page: options[:per_page], state: options[:state] }
419
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}/versions"
420
+
421
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
422
+
423
+ if http_call.successful?
424
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
425
+ else
426
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
427
+ end
428
+ end
429
+
430
+ # get a package version for the authenticated user
431
+ #
432
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
433
+ # @param package_name [String] The name of the package.
434
+ # @param package_version_id [Integer] Unique identifier of the package version.
435
+ #
436
+ # @return PackagesResult, PackagesErrorResult
437
+ def get_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, _options)
438
+ auth = nil
439
+ body = nil
440
+ headers = { accept: 'application/vnd.github.v3+json' }
441
+ params = nil
442
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
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
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
448
+ else
449
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
450
+ end
451
+ end
452
+
453
+ # delete a package version for the authenticated user
454
+ #
455
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
456
+ # @param package_name [String] The name of the package.
457
+ # @param package_version_id [Integer] Unique identifier of the package version.
458
+ #
459
+ # @return PackagesResult, PackagesErrorResult
460
+ def delete_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, _options)
461
+ auth = nil
462
+ body = nil
463
+ headers = { accept: 'application/vnd.github.v3+json' }
464
+ params = nil
465
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
466
+
467
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
468
+
469
+ if http_call.successful?
470
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
471
+ else
472
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
473
+ end
474
+ end
475
+
476
+ # restore a package version for the authenticated user
477
+ #
478
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
479
+ # @param package_name [String] The name of the package.
480
+ # @param package_version_id [Integer] Unique identifier of the package version.
481
+ #
482
+ # @return PackagesResult, PackagesErrorResult
483
+ def restore_a_package_version_for_the_authenticated_user(package_type, package_name, package_version_id, _options)
484
+ auth = nil
485
+ body = nil
486
+ headers = { accept: 'application/vnd.github.v3+json' }
487
+ params = nil
488
+ uri = "#{Gitabu::BASE_URL}/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
489
+
490
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
491
+
492
+ if http_call.successful?
493
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
494
+ else
495
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
496
+ end
497
+ end
498
+
499
+ # list packages for a user
500
+ #
501
+ # @param username [String]
502
+ #
503
+ # @return PackagesResult, PackagesErrorResult
504
+ def list_packages_for_a_user(username, options)
505
+ auth = nil
506
+ body = nil
507
+ headers = { accept: 'application/vnd.github.v3+json' }
508
+ params = { package_type: options[:package_type], visibility: options[:visibility] }
509
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages"
510
+
511
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
512
+
513
+ if http_call.successful?
514
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
515
+ else
516
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
517
+ end
518
+ end
519
+
520
+ # get a package for a user
521
+ #
522
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
523
+ # @param package_name [String] The name of the package.
524
+ # @param username [String]
525
+ #
526
+ # @return PackagesResult, PackagesErrorResult
527
+ def get_a_package_for_a_user(package_type, package_name, username, _options)
528
+ auth = nil
529
+ body = nil
530
+ headers = { accept: 'application/vnd.github.v3+json' }
531
+ params = nil
532
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}"
533
+
534
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
535
+
536
+ if http_call.successful?
537
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
538
+ else
539
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
540
+ end
541
+ end
542
+
543
+ # delete a package for a user
544
+ #
545
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
546
+ # @param package_name [String] The name of the package.
547
+ # @param username [String]
548
+ #
549
+ # @return PackagesResult, PackagesErrorResult
550
+ def delete_a_package_for_a_user(package_type, package_name, username, _options)
551
+ auth = nil
552
+ body = nil
553
+ headers = { accept: 'application/vnd.github.v3+json' }
554
+ params = nil
555
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}"
556
+
557
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
558
+
559
+ if http_call.successful?
560
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
561
+ else
562
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
563
+ end
564
+ end
565
+
566
+ # restore a package for a user
567
+ #
568
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
569
+ # @param package_name [String] The name of the package.
570
+ # @param username [String]
571
+ #
572
+ # @return PackagesResult, PackagesErrorResult
573
+ def restore_a_package_for_a_user(package_type, package_name, username, options)
574
+ auth = nil
575
+ body = nil
576
+ headers = { accept: 'application/vnd.github.v3+json' }
577
+ params = { token: options[:token] }
578
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}/restore"
579
+
580
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
581
+
582
+ if http_call.successful?
583
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
584
+ else
585
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
586
+ end
587
+ end
588
+
589
+ # get all package versions for a package owned by a user
590
+ #
591
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
592
+ # @param package_name [String] The name of the package.
593
+ # @param username [String]
594
+ #
595
+ # @return PackagesResult, PackagesErrorResult
596
+ def get_all_package_versions_for_a_package_owned_by_a_user(package_type, package_name, username, _options)
597
+ auth = nil
598
+ body = nil
599
+ headers = { accept: 'application/vnd.github.v3+json' }
600
+ params = nil
601
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}/versions"
602
+
603
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
604
+
605
+ if http_call.successful?
606
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
607
+ else
608
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
609
+ end
610
+ end
611
+
612
+ # get a package version for a user
613
+ #
614
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
615
+ # @param package_name [String] The name of the package.
616
+ # @param package_version_id [Integer] Unique identifier of the package version.
617
+ # @param username [String]
618
+ #
619
+ # @return PackagesResult, PackagesErrorResult
620
+ def get_a_package_version_for_a_user(package_type, package_name, package_version_id, username, _options)
621
+ auth = nil
622
+ body = nil
623
+ headers = { accept: 'application/vnd.github.v3+json' }
624
+ params = nil
625
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
626
+
627
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
628
+
629
+ if http_call.successful?
630
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
631
+ else
632
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
633
+ end
634
+ end
635
+
636
+ # delete package version for a user
637
+ #
638
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
639
+ # @param package_name [String] The name of the package.
640
+ # @param username [String]
641
+ # @param package_version_id [Integer] Unique identifier of the package version.
642
+ #
643
+ # @return PackagesResult, PackagesErrorResult
644
+ def delete_package_version_for_a_user(package_type, package_name, username, package_version_id, _options)
645
+ auth = nil
646
+ body = nil
647
+ headers = { accept: 'application/vnd.github.v3+json' }
648
+ params = nil
649
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
650
+
651
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
652
+
653
+ if http_call.successful?
654
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
655
+ else
656
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
657
+ end
658
+ end
659
+
660
+ # restore package version for a user
661
+ #
662
+ # @param package_type [String] The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.
663
+ # @param package_name [String] The name of the package.
664
+ # @param username [String]
665
+ # @param package_version_id [Integer] Unique identifier of the package version.
666
+ #
667
+ # @return PackagesResult, PackagesErrorResult
668
+ def restore_package_version_for_a_user(package_type, package_name, username, package_version_id, _options)
669
+ auth = nil
670
+ body = nil
671
+ headers = { accept: 'application/vnd.github.v3+json' }
672
+ params = nil
673
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
674
+
675
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
676
+
677
+ if http_call.successful?
678
+ PackagesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
679
+ else
680
+ PackagesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
681
+ end
682
+ end
683
+ end
684
+ end
685
+ end
686
+ end