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,552 @@
|
|
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 Gists result
|
17
|
+
class GistsResult
|
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 GistsErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Gists endpoints.
|
37
|
+
class Gists
|
38
|
+
def self.list_gists_for_the_authenticated_user(options: nil)
|
39
|
+
new.list_gists_for_the_authenticated_user(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_a_gist(description: nil, files: nil, public: nil, options: nil)
|
43
|
+
new.create_a_gist(description, files, public, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.list_public_gists(options: nil)
|
47
|
+
new.list_public_gists(options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.list_starred_gists(options: nil)
|
51
|
+
new.list_starred_gists(options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_a_gist(gist_id: nil, options: nil)
|
55
|
+
new.get_a_gist(gist_id, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.update_a_gist(gist_id: nil, description: nil, files: nil, options: nil)
|
59
|
+
new.update_a_gist(gist_id, description, files, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.delete_a_gist(gist_id: nil, options: nil)
|
63
|
+
new.delete_a_gist(gist_id, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.list_gist_commits(gist_id: nil, options: nil)
|
67
|
+
new.list_gist_commits(gist_id, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_gist_forks(gist_id: nil, options: nil)
|
71
|
+
new.list_gist_forks(gist_id, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.fork_a_gist(gist_id: nil, options: nil)
|
75
|
+
new.fork_a_gist(gist_id, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.check_if_a_gist_is_starred(gist_id: nil, options: nil)
|
79
|
+
new.check_if_a_gist_is_starred(gist_id, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.star_a_gist(gist_id: nil, options: nil)
|
83
|
+
new.star_a_gist(gist_id, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.unstar_a_gist(gist_id: nil, options: nil)
|
87
|
+
new.unstar_a_gist(gist_id, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.get_a_gist_revision(gist_id: nil, sha: nil, options: nil)
|
91
|
+
new.get_a_gist_revision(gist_id, sha, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.list_gists_for_a_user(username: nil, options: nil)
|
95
|
+
new.list_gists_for_a_user(username, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.list_gist_comments(gist_id: nil, options: nil)
|
99
|
+
new.list_gist_comments(gist_id, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.create_a_gist_comment(gist_id: nil, body: nil, options: nil)
|
103
|
+
new.create_a_gist_comment(gist_id, body, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.get_a_gist_comment(gist_id: nil, comment_id: nil, options: nil)
|
107
|
+
new.get_a_gist_comment(gist_id, comment_id, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.update_a_gist_comment(gist_id: nil, comment_id: nil, body: nil, options: nil)
|
111
|
+
new.update_a_gist_comment(gist_id, comment_id, body, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.delete_a_gist_comment(gist_id: nil, comment_id: nil, options: nil)
|
115
|
+
new.delete_a_gist_comment(gist_id, comment_id, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
# list gists for the authenticated user
|
121
|
+
#
|
122
|
+
# @params options [Hash]
|
123
|
+
#
|
124
|
+
# @return GistsResult, GistsErrorResult
|
125
|
+
def list_gists_for_the_authenticated_user(options)
|
126
|
+
auth = nil
|
127
|
+
body = nil
|
128
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
129
|
+
params = { since: options[:since], per_page: options[:per_page], page: options[:page] }
|
130
|
+
uri = "#{Gitabu::BASE_URL}/gists"
|
131
|
+
|
132
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
133
|
+
|
134
|
+
if http_call.successful?
|
135
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
136
|
+
else
|
137
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# create a gist
|
142
|
+
#
|
143
|
+
# @param description [String] Description of the gist
|
144
|
+
# @param files [Object] Required. Names and content for the files that make up the gist
|
145
|
+
# @param public [Boolean or string or ] Flag indicating whether the gist is public
|
146
|
+
#
|
147
|
+
# @return GistsResult, GistsErrorResult
|
148
|
+
def create_a_gist(description, files, public, _options)
|
149
|
+
auth = nil
|
150
|
+
body = { description: description, files: files, public: public }
|
151
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
152
|
+
params = nil
|
153
|
+
uri = "#{Gitabu::BASE_URL}/gists"
|
154
|
+
|
155
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
156
|
+
|
157
|
+
if http_call.successful?
|
158
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
159
|
+
else
|
160
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# list public gists
|
165
|
+
#
|
166
|
+
# @params options [Hash]
|
167
|
+
#
|
168
|
+
# @return GistsResult, GistsErrorResult
|
169
|
+
def list_public_gists(options)
|
170
|
+
auth = nil
|
171
|
+
body = nil
|
172
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
173
|
+
params = { since: options[:since], per_page: options[:per_page], page: options[:page] }
|
174
|
+
uri = "#{Gitabu::BASE_URL}/gists/public"
|
175
|
+
|
176
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
177
|
+
|
178
|
+
if http_call.successful?
|
179
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
180
|
+
else
|
181
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# list starred gists
|
186
|
+
#
|
187
|
+
# @params options [Hash]
|
188
|
+
#
|
189
|
+
# @return GistsResult, GistsErrorResult
|
190
|
+
def list_starred_gists(options)
|
191
|
+
auth = nil
|
192
|
+
body = nil
|
193
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
194
|
+
params = { since: options[:since], per_page: options[:per_page], page: options[:page] }
|
195
|
+
uri = "#{Gitabu::BASE_URL}/gists/starred"
|
196
|
+
|
197
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
198
|
+
|
199
|
+
if http_call.successful?
|
200
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
201
|
+
else
|
202
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# get a gist
|
207
|
+
#
|
208
|
+
# @param gist_id [String] gist_id parameter
|
209
|
+
#
|
210
|
+
# @return GistsResult, GistsErrorResult
|
211
|
+
def get_a_gist(gist_id, _options)
|
212
|
+
auth = nil
|
213
|
+
body = nil
|
214
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
215
|
+
params = nil
|
216
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}"
|
217
|
+
|
218
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
219
|
+
|
220
|
+
if http_call.successful?
|
221
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
222
|
+
else
|
223
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# update a gist
|
228
|
+
#
|
229
|
+
# @param gist_id [String] gist_id parameter
|
230
|
+
# @param description [String] Description of the gist
|
231
|
+
# @param files [Object] Names of files to be updated
|
232
|
+
#
|
233
|
+
# @return GistsResult, GistsErrorResult
|
234
|
+
def update_a_gist(gist_id, description, files, _options)
|
235
|
+
auth = nil
|
236
|
+
body = { description: description, files: files }
|
237
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
238
|
+
params = nil
|
239
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}"
|
240
|
+
|
241
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
242
|
+
|
243
|
+
if http_call.successful?
|
244
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
245
|
+
else
|
246
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# delete a gist
|
251
|
+
#
|
252
|
+
# @param gist_id [String] gist_id parameter
|
253
|
+
#
|
254
|
+
# @return GistsResult, GistsErrorResult
|
255
|
+
def delete_a_gist(gist_id, _options)
|
256
|
+
auth = nil
|
257
|
+
body = nil
|
258
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
259
|
+
params = nil
|
260
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}"
|
261
|
+
|
262
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
263
|
+
|
264
|
+
if http_call.successful?
|
265
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
266
|
+
else
|
267
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# list gist commits
|
272
|
+
#
|
273
|
+
# @param gist_id [String] gist_id parameter
|
274
|
+
#
|
275
|
+
# @return GistsResult, GistsErrorResult
|
276
|
+
def list_gist_commits(gist_id, options)
|
277
|
+
auth = nil
|
278
|
+
body = nil
|
279
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
280
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
281
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/commits"
|
282
|
+
|
283
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
284
|
+
|
285
|
+
if http_call.successful?
|
286
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
287
|
+
else
|
288
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
# list gist forks
|
293
|
+
#
|
294
|
+
# @param gist_id [String] gist_id parameter
|
295
|
+
#
|
296
|
+
# @return GistsResult, GistsErrorResult
|
297
|
+
def list_gist_forks(gist_id, options)
|
298
|
+
auth = nil
|
299
|
+
body = nil
|
300
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
301
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
302
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/forks"
|
303
|
+
|
304
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
305
|
+
|
306
|
+
if http_call.successful?
|
307
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
308
|
+
else
|
309
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
# fork a gist
|
314
|
+
#
|
315
|
+
# @param gist_id [String] gist_id parameter
|
316
|
+
#
|
317
|
+
# @return GistsResult, GistsErrorResult
|
318
|
+
def fork_a_gist(gist_id, _options)
|
319
|
+
auth = nil
|
320
|
+
body = nil
|
321
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
322
|
+
params = nil
|
323
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/forks"
|
324
|
+
|
325
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
326
|
+
|
327
|
+
if http_call.successful?
|
328
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
329
|
+
else
|
330
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# check if a gist is starred
|
335
|
+
#
|
336
|
+
# @param gist_id [String] gist_id parameter
|
337
|
+
#
|
338
|
+
# @return GistsResult, GistsErrorResult
|
339
|
+
def check_if_a_gist_is_starred(gist_id, _options)
|
340
|
+
auth = nil
|
341
|
+
body = nil
|
342
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
343
|
+
params = nil
|
344
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/star"
|
345
|
+
|
346
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
347
|
+
|
348
|
+
if http_call.successful?
|
349
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
350
|
+
else
|
351
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# star a gist
|
356
|
+
#
|
357
|
+
# @param gist_id [String] gist_id parameter
|
358
|
+
#
|
359
|
+
# @return GistsResult, GistsErrorResult
|
360
|
+
def star_a_gist(gist_id, _options)
|
361
|
+
auth = nil
|
362
|
+
body = nil
|
363
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
364
|
+
params = nil
|
365
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/star"
|
366
|
+
|
367
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
368
|
+
|
369
|
+
if http_call.successful?
|
370
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
371
|
+
else
|
372
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
# unstar a gist
|
377
|
+
#
|
378
|
+
# @param gist_id [String] gist_id parameter
|
379
|
+
#
|
380
|
+
# @return GistsResult, GistsErrorResult
|
381
|
+
def unstar_a_gist(gist_id, _options)
|
382
|
+
auth = nil
|
383
|
+
body = nil
|
384
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
385
|
+
params = nil
|
386
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/star"
|
387
|
+
|
388
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
389
|
+
|
390
|
+
if http_call.successful?
|
391
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
392
|
+
else
|
393
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
# get a gist revision
|
398
|
+
#
|
399
|
+
# @param gist_id [String] gist_id parameter
|
400
|
+
# @param sha [String]
|
401
|
+
#
|
402
|
+
# @return GistsResult, GistsErrorResult
|
403
|
+
def get_a_gist_revision(gist_id, sha, _options)
|
404
|
+
auth = nil
|
405
|
+
body = nil
|
406
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
407
|
+
params = nil
|
408
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/#{sha}"
|
409
|
+
|
410
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
411
|
+
|
412
|
+
if http_call.successful?
|
413
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
414
|
+
else
|
415
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
# list gists for a user
|
420
|
+
#
|
421
|
+
# @param username [String]
|
422
|
+
#
|
423
|
+
# @return GistsResult, GistsErrorResult
|
424
|
+
def list_gists_for_a_user(username, options)
|
425
|
+
auth = nil
|
426
|
+
body = nil
|
427
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
428
|
+
params = { since: options[:since], per_page: options[:per_page], page: options[:page] }
|
429
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/gists"
|
430
|
+
|
431
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
432
|
+
|
433
|
+
if http_call.successful?
|
434
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
435
|
+
else
|
436
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
# list gist comments
|
441
|
+
#
|
442
|
+
# @param gist_id [String] gist_id parameter
|
443
|
+
#
|
444
|
+
# @return GistsResult, GistsErrorResult
|
445
|
+
def list_gist_comments(gist_id, options)
|
446
|
+
auth = nil
|
447
|
+
body = nil
|
448
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
449
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
450
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/comments"
|
451
|
+
|
452
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
453
|
+
|
454
|
+
if http_call.successful?
|
455
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
456
|
+
else
|
457
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
# create a gist comment
|
462
|
+
#
|
463
|
+
# @param gist_id [String] gist_id parameter
|
464
|
+
# @param body [String] Required. The comment text.
|
465
|
+
#
|
466
|
+
# @return GistsResult, GistsErrorResult
|
467
|
+
def create_a_gist_comment(gist_id, body, _options)
|
468
|
+
auth = nil
|
469
|
+
body = { body: body }
|
470
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
471
|
+
params = nil
|
472
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/comments"
|
473
|
+
|
474
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
475
|
+
|
476
|
+
if http_call.successful?
|
477
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
478
|
+
else
|
479
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
# get a gist comment
|
484
|
+
#
|
485
|
+
# @param gist_id [String] gist_id parameter
|
486
|
+
# @param comment_id [Integer] comment_id parameter
|
487
|
+
#
|
488
|
+
# @return GistsResult, GistsErrorResult
|
489
|
+
def get_a_gist_comment(gist_id, comment_id, _options)
|
490
|
+
auth = nil
|
491
|
+
body = nil
|
492
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
493
|
+
params = nil
|
494
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/comments/#{comment_id}"
|
495
|
+
|
496
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
497
|
+
|
498
|
+
if http_call.successful?
|
499
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
500
|
+
else
|
501
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
# update a gist comment
|
506
|
+
#
|
507
|
+
# @param gist_id [String] gist_id parameter
|
508
|
+
# @param comment_id [Integer] comment_id parameter
|
509
|
+
# @param body [String] Required. The comment text.
|
510
|
+
#
|
511
|
+
# @return GistsResult, GistsErrorResult
|
512
|
+
def update_a_gist_comment(gist_id, comment_id, body, _options)
|
513
|
+
auth = nil
|
514
|
+
body = { body: body }
|
515
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
516
|
+
params = nil
|
517
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/comments/#{comment_id}"
|
518
|
+
|
519
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
520
|
+
|
521
|
+
if http_call.successful?
|
522
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
523
|
+
else
|
524
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
528
|
+
# delete a gist comment
|
529
|
+
#
|
530
|
+
# @param gist_id [String] gist_id parameter
|
531
|
+
# @param comment_id [Integer] comment_id parameter
|
532
|
+
#
|
533
|
+
# @return GistsResult, GistsErrorResult
|
534
|
+
def delete_a_gist_comment(gist_id, comment_id, _options)
|
535
|
+
auth = nil
|
536
|
+
body = nil
|
537
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
538
|
+
params = nil
|
539
|
+
uri = "#{Gitabu::BASE_URL}/gists/#{gist_id}/comments/#{comment_id}"
|
540
|
+
|
541
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
542
|
+
|
543
|
+
if http_call.successful?
|
544
|
+
GistsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
545
|
+
else
|
546
|
+
GistsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
547
|
+
end
|
548
|
+
end
|
549
|
+
end
|
550
|
+
end
|
551
|
+
end
|
552
|
+
end
|