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,411 @@
|
|
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 Releases result
|
17
|
+
class ReleasesResult
|
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 ReleasesErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Releases endpoints.
|
37
|
+
class Releases
|
38
|
+
def self.list_releases(owner: nil, repo: nil, options: nil)
|
39
|
+
new.list_releases(owner, repo, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_a_release(owner: nil, repo: nil, tag_name: nil, target_commitish: nil, name: nil, body: nil, draft: nil, prerelease: nil, discussion_category_name: nil, generate_release_notes: nil, options: nil)
|
43
|
+
new.create_a_release(owner, repo, tag_name, target_commitish, name, body, draft, prerelease, discussion_category_name, generate_release_notes, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.generate_release_notes_content_for_a_release(owner: nil, repo: nil, tag_name: nil, target_commitish: nil, previous_tag_name: nil, configuration_file_path: nil, options: nil)
|
47
|
+
new.generate_release_notes_content_for_a_release(owner, repo, tag_name, target_commitish, previous_tag_name, configuration_file_path, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.get_the_latest_release(owner: nil, repo: nil, options: nil)
|
51
|
+
new.get_the_latest_release(owner, repo, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_a_release_by_tag_name(owner: nil, repo: nil, tag: nil, options: nil)
|
55
|
+
new.get_a_release_by_tag_name(owner, repo, tag, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.get_a_release(owner: nil, repo: nil, release_id: nil, options: nil)
|
59
|
+
new.get_a_release(owner, repo, release_id, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.update_a_release(owner: nil, repo: nil, release_id: nil, tag_name: nil, target_commitish: nil, name: nil, body: nil, draft: nil, prerelease: nil, discussion_category_name: nil, options: nil)
|
63
|
+
new.update_a_release(owner, repo, release_id, tag_name, target_commitish, name, body, draft, prerelease, discussion_category_name, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.delete_a_release(owner: nil, repo: nil, release_id: nil, options: nil)
|
67
|
+
new.delete_a_release(owner, repo, release_id, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_a_release_asset(owner: nil, repo: nil, asset_id: nil, options: nil)
|
71
|
+
new.get_a_release_asset(owner, repo, asset_id, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.update_a_release_asset(owner: nil, repo: nil, asset_id: nil, name: nil, label: nil, state: nil, options: nil)
|
75
|
+
new.update_a_release_asset(owner, repo, asset_id, name, label, state, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.delete_a_release_asset(owner: nil, repo: nil, asset_id: nil, options: nil)
|
79
|
+
new.delete_a_release_asset(owner, repo, asset_id, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.list_release_assets(owner: nil, repo: nil, release_id: nil, options: nil)
|
83
|
+
new.list_release_assets(owner, repo, release_id, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.upload_a_release_asset(owner: nil, repo: nil, release_id: nil, options: nil)
|
87
|
+
new.upload_a_release_asset(owner, repo, release_id, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# list releases
|
93
|
+
#
|
94
|
+
# @param owner [String]
|
95
|
+
# @param repo [String]
|
96
|
+
#
|
97
|
+
# @return ReleasesResult, ReleasesErrorResult
|
98
|
+
def list_releases(owner, repo, options)
|
99
|
+
auth = nil
|
100
|
+
body = nil
|
101
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
102
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
103
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases"
|
104
|
+
|
105
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
106
|
+
|
107
|
+
if http_call.successful?
|
108
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
109
|
+
else
|
110
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# create a release
|
115
|
+
#
|
116
|
+
# @param owner [String]
|
117
|
+
# @param repo [String]
|
118
|
+
# @param tag_name [String] Required. The name of the tag.
|
119
|
+
# @param target_commitish [String] Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually master).
|
120
|
+
# @param name [String] The name of the release.
|
121
|
+
# @param body [String] Text describing the contents of the tag.
|
122
|
+
# @param draft [Boolean] true to create a draft (unpublished) release, false to create a published one.
|
123
|
+
# @param prerelease [Boolean] true to identify the release as a prerelease. false to identify the release as a full release.
|
124
|
+
# @param discussion_category_name [String] If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see "Managing categories for discussions in your repository."
|
125
|
+
# @param generate_release_notes [Boolean] Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes.
|
126
|
+
#
|
127
|
+
# @return ReleasesResult, ReleasesErrorResult
|
128
|
+
def create_a_release(owner, repo, tag_name, target_commitish, name, body, draft, prerelease, discussion_category_name, generate_release_notes, _options)
|
129
|
+
auth = nil
|
130
|
+
body = { tag_name: tag_name, target_commitish: target_commitish, name: name, body: body, draft: draft, prerelease: prerelease, discussion_category_name: discussion_category_name, generate_release_notes: generate_release_notes }
|
131
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
132
|
+
params = nil
|
133
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases"
|
134
|
+
|
135
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
136
|
+
|
137
|
+
if http_call.successful?
|
138
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
139
|
+
else
|
140
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# generate release notes content for a release
|
145
|
+
#
|
146
|
+
# @param owner [String]
|
147
|
+
# @param repo [String]
|
148
|
+
# @param tag_name [String] Required. The tag name for the release. This can be an existing tag or a new one.
|
149
|
+
# @param target_commitish [String] Specifies the commitish value that will be the target for the release's tag. Required if the supplied tag_name does not reference an existing tag. Ignored if the tag_name already exists.
|
150
|
+
# @param previous_tag_name [String] The name of the previous tag to use as the starting point for the release notes. Use to manually specify the range for the set of changes considered as part this release.
|
151
|
+
# @param configuration_file_path [String] Specifies a path to a file in the repository containing configuration settings used for generating the release notes. If unspecified, the configuration file located in the repository at '.github/release.yml' or '.github/release.yaml' will be used. If that is not present, the default configuration will be used.
|
152
|
+
#
|
153
|
+
# @return ReleasesResult, ReleasesErrorResult
|
154
|
+
def generate_release_notes_content_for_a_release(owner, repo, tag_name, target_commitish, previous_tag_name, configuration_file_path, _options)
|
155
|
+
auth = nil
|
156
|
+
body = { tag_name: tag_name, target_commitish: target_commitish, previous_tag_name: previous_tag_name, configuration_file_path: configuration_file_path }
|
157
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
158
|
+
params = nil
|
159
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/generate-notes"
|
160
|
+
|
161
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
162
|
+
|
163
|
+
if http_call.successful?
|
164
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
165
|
+
else
|
166
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# get the latest release
|
171
|
+
#
|
172
|
+
# @param owner [String]
|
173
|
+
# @param repo [String]
|
174
|
+
#
|
175
|
+
# @return ReleasesResult, ReleasesErrorResult
|
176
|
+
def get_the_latest_release(owner, repo, _options)
|
177
|
+
auth = nil
|
178
|
+
body = nil
|
179
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
180
|
+
params = nil
|
181
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/latest"
|
182
|
+
|
183
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
184
|
+
|
185
|
+
if http_call.successful?
|
186
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
187
|
+
else
|
188
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# get a release by tag name
|
193
|
+
#
|
194
|
+
# @param owner [String]
|
195
|
+
# @param repo [String]
|
196
|
+
# @param tag [String] tag parameter
|
197
|
+
#
|
198
|
+
# @return ReleasesResult, ReleasesErrorResult
|
199
|
+
def get_a_release_by_tag_name(owner, repo, tag, _options)
|
200
|
+
auth = nil
|
201
|
+
body = nil
|
202
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
203
|
+
params = nil
|
204
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/tags/#{tag}"
|
205
|
+
|
206
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
207
|
+
|
208
|
+
if http_call.successful?
|
209
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
210
|
+
else
|
211
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# get a release
|
216
|
+
#
|
217
|
+
# @param owner [String]
|
218
|
+
# @param repo [String]
|
219
|
+
# @param release_id [Integer] release_id parameter
|
220
|
+
#
|
221
|
+
# @return ReleasesResult, ReleasesErrorResult
|
222
|
+
def get_a_release(owner, repo, release_id, _options)
|
223
|
+
auth = nil
|
224
|
+
body = nil
|
225
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
226
|
+
params = nil
|
227
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/#{release_id}"
|
228
|
+
|
229
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
230
|
+
|
231
|
+
if http_call.successful?
|
232
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
233
|
+
else
|
234
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# update a release
|
239
|
+
#
|
240
|
+
# @param owner [String]
|
241
|
+
# @param repo [String]
|
242
|
+
# @param release_id [Integer] release_id parameter
|
243
|
+
# @param tag_name [String] The name of the tag.
|
244
|
+
# @param target_commitish [String] Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually master).
|
245
|
+
# @param name [String] The name of the release.
|
246
|
+
# @param body [String] Text describing the contents of the tag.
|
247
|
+
# @param draft [Boolean] true makes the release a draft, and false publishes the release.
|
248
|
+
# @param prerelease [Boolean] true to identify the release as a prerelease, false to identify the release as a full release.
|
249
|
+
# @param discussion_category_name [String] If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored. For more information, see "Managing categories for discussions in your repository."
|
250
|
+
#
|
251
|
+
# @return ReleasesResult, ReleasesErrorResult
|
252
|
+
def update_a_release(owner, repo, release_id, tag_name, target_commitish, name, body, draft, prerelease, discussion_category_name, _options)
|
253
|
+
auth = nil
|
254
|
+
body = { tag_name: tag_name, target_commitish: target_commitish, name: name, body: body, draft: draft, prerelease: prerelease, discussion_category_name: discussion_category_name }
|
255
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
256
|
+
params = nil
|
257
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/#{release_id}"
|
258
|
+
|
259
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
260
|
+
|
261
|
+
if http_call.successful?
|
262
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
263
|
+
else
|
264
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# delete a release
|
269
|
+
#
|
270
|
+
# @param owner [String]
|
271
|
+
# @param repo [String]
|
272
|
+
# @param release_id [Integer] release_id parameter
|
273
|
+
#
|
274
|
+
# @return ReleasesResult, ReleasesErrorResult
|
275
|
+
def delete_a_release(owner, repo, release_id, _options)
|
276
|
+
auth = nil
|
277
|
+
body = nil
|
278
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
279
|
+
params = nil
|
280
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/#{release_id}"
|
281
|
+
|
282
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
283
|
+
|
284
|
+
if http_call.successful?
|
285
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
286
|
+
else
|
287
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
# get a release asset
|
292
|
+
#
|
293
|
+
# @param owner [String]
|
294
|
+
# @param repo [String]
|
295
|
+
# @param asset_id [Integer] asset_id parameter
|
296
|
+
#
|
297
|
+
# @return ReleasesResult, ReleasesErrorResult
|
298
|
+
def get_a_release_asset(owner, repo, asset_id, _options)
|
299
|
+
auth = nil
|
300
|
+
body = nil
|
301
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
302
|
+
params = nil
|
303
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/assets/#{asset_id}"
|
304
|
+
|
305
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
306
|
+
|
307
|
+
if http_call.successful?
|
308
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
309
|
+
else
|
310
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
# update a release asset
|
315
|
+
#
|
316
|
+
# @param owner [String]
|
317
|
+
# @param repo [String]
|
318
|
+
# @param asset_id [Integer] asset_id parameter
|
319
|
+
# @param name [String] The file name of the asset.
|
320
|
+
# @param label [String] An alternate short description of the asset. Used in place of the filename.
|
321
|
+
# @param state [String]
|
322
|
+
#
|
323
|
+
# @return ReleasesResult, ReleasesErrorResult
|
324
|
+
def update_a_release_asset(owner, repo, asset_id, name, label, state, _options)
|
325
|
+
auth = nil
|
326
|
+
body = { name: name, label: label, state: state }
|
327
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
328
|
+
params = nil
|
329
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/assets/#{asset_id}"
|
330
|
+
|
331
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
332
|
+
|
333
|
+
if http_call.successful?
|
334
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
335
|
+
else
|
336
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
# delete a release asset
|
341
|
+
#
|
342
|
+
# @param owner [String]
|
343
|
+
# @param repo [String]
|
344
|
+
# @param asset_id [Integer] asset_id parameter
|
345
|
+
#
|
346
|
+
# @return ReleasesResult, ReleasesErrorResult
|
347
|
+
def delete_a_release_asset(owner, repo, asset_id, _options)
|
348
|
+
auth = nil
|
349
|
+
body = nil
|
350
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
351
|
+
params = nil
|
352
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/assets/#{asset_id}"
|
353
|
+
|
354
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
355
|
+
|
356
|
+
if http_call.successful?
|
357
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
358
|
+
else
|
359
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
# list release assets
|
364
|
+
#
|
365
|
+
# @param owner [String]
|
366
|
+
# @param repo [String]
|
367
|
+
# @param release_id [Integer] release_id parameter
|
368
|
+
#
|
369
|
+
# @return ReleasesResult, ReleasesErrorResult
|
370
|
+
def list_release_assets(owner, repo, release_id, options)
|
371
|
+
auth = nil
|
372
|
+
body = nil
|
373
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
374
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
375
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/#{release_id}/assets"
|
376
|
+
|
377
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
378
|
+
|
379
|
+
if http_call.successful?
|
380
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
381
|
+
else
|
382
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
# upload a release asset
|
387
|
+
#
|
388
|
+
# @param owner [String]
|
389
|
+
# @param repo [String]
|
390
|
+
# @param release_id [Integer] release_id parameter
|
391
|
+
#
|
392
|
+
# @return ReleasesResult, ReleasesErrorResult
|
393
|
+
def upload_a_release_asset(owner, repo, release_id, options)
|
394
|
+
auth = nil
|
395
|
+
body = nil
|
396
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
397
|
+
params = { name: options[:name], label: options[:label] }
|
398
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/releases/#{release_id}/assets"
|
399
|
+
|
400
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
401
|
+
|
402
|
+
if http_call.successful?
|
403
|
+
ReleasesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
404
|
+
else
|
405
|
+
ReleasesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|