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,835 @@
|
|
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 Activity result
|
17
|
+
class ActivityResult
|
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 ActivityErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Activity endpoints.
|
37
|
+
class Activity
|
38
|
+
def self.list_public_events(options: nil)
|
39
|
+
new.list_public_events(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.list_public_events_for_a_network_of_repositories(owner: nil, repo: nil, options: nil)
|
43
|
+
new.list_public_events_for_a_network_of_repositories(owner, repo, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.list_public_organization_events(org: nil, options: nil)
|
47
|
+
new.list_public_organization_events(org, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.list_repository_events(owner: nil, repo: nil, options: nil)
|
51
|
+
new.list_repository_events(owner, repo, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_events_for_the_authenticated_user(username: nil, options: nil)
|
55
|
+
new.list_events_for_the_authenticated_user(username, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.list_organization_events_for_the_authenticated_user(username: nil, org: nil, options: nil)
|
59
|
+
new.list_organization_events_for_the_authenticated_user(username, org, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.list_public_events_for_a_user(username: nil, options: nil)
|
63
|
+
new.list_public_events_for_a_user(username, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.list_events_received_by_the_authenticated_user(username: nil, options: nil)
|
67
|
+
new.list_events_received_by_the_authenticated_user(username, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_public_events_received_by_a_user(username: nil, options: nil)
|
71
|
+
new.list_public_events_received_by_a_user(username, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_feeds(options: nil)
|
75
|
+
new.get_feeds(options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.list_notifications_for_the_authenticated_user(options: nil)
|
79
|
+
new.list_notifications_for_the_authenticated_user(options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.mark_notifications_as_read(last_read_at: nil, read: nil, options: nil)
|
83
|
+
new.mark_notifications_as_read(last_read_at, read, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.get_a_thread(thread_id: nil, options: nil)
|
87
|
+
new.get_a_thread(thread_id, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.mark_a_thread_as_read(thread_id: nil, options: nil)
|
91
|
+
new.mark_a_thread_as_read(thread_id, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.get_a_thread_subscription_for_the_authenticated_user(thread_id: nil, options: nil)
|
95
|
+
new.get_a_thread_subscription_for_the_authenticated_user(thread_id, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.set_a_thread_subscription(thread_id: nil, ignored: nil, options: nil)
|
99
|
+
new.set_a_thread_subscription(thread_id, ignored, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.delete_a_thread_subscription(thread_id: nil, options: nil)
|
103
|
+
new.delete_a_thread_subscription(thread_id, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.list_repository_notifications_for_the_authenticated_user(owner: nil, repo: nil, options: nil)
|
107
|
+
new.list_repository_notifications_for_the_authenticated_user(owner, repo, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.mark_repository_notifications_as_read(owner: nil, repo: nil, last_read_at: nil, options: nil)
|
111
|
+
new.mark_repository_notifications_as_read(owner, repo, last_read_at, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.list_stargazers(owner: nil, repo: nil, options: nil)
|
115
|
+
new.list_stargazers(owner, repo, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.list_repositories_starred_by_the_authenticated_user(options: nil)
|
119
|
+
new.list_repositories_starred_by_the_authenticated_user(options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.check_if_a_repository_is_starred_by_the_authenticated_user(owner: nil, repo: nil, options: nil)
|
123
|
+
new.check_if_a_repository_is_starred_by_the_authenticated_user(owner, repo, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.star_a_repository_for_the_authenticated_user(owner: nil, repo: nil, options: nil)
|
127
|
+
new.star_a_repository_for_the_authenticated_user(owner, repo, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.unstar_a_repository_for_the_authenticated_user(owner: nil, repo: nil, options: nil)
|
131
|
+
new.unstar_a_repository_for_the_authenticated_user(owner, repo, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.list_repositories_starred_by_a_user(username: nil, options: nil)
|
135
|
+
new.list_repositories_starred_by_a_user(username, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.list_watchers(owner: nil, repo: nil, options: nil)
|
139
|
+
new.list_watchers(owner, repo, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.get_a_repository_subscription(owner: nil, repo: nil, options: nil)
|
143
|
+
new.get_a_repository_subscription(owner, repo, options)
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.set_a_repository_subscription(owner: nil, repo: nil, subscribed: nil, ignored: nil, options: nil)
|
147
|
+
new.set_a_repository_subscription(owner, repo, subscribed, ignored, options)
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.delete_a_repository_subscription(owner: nil, repo: nil, options: nil)
|
151
|
+
new.delete_a_repository_subscription(owner, repo, options)
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.list_repositories_watched_by_the_authenticated_user(options: nil)
|
155
|
+
new.list_repositories_watched_by_the_authenticated_user(options)
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.list_repositories_watched_by_a_user(username: nil, options: nil)
|
159
|
+
new.list_repositories_watched_by_a_user(username, options)
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
# list public events
|
165
|
+
#
|
166
|
+
# @params options [Hash]
|
167
|
+
#
|
168
|
+
# @return ActivityResult, ActivityErrorResult
|
169
|
+
def list_public_events(options)
|
170
|
+
auth = nil
|
171
|
+
body = nil
|
172
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
173
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
174
|
+
uri = "#{Gitabu::BASE_URL}/events"
|
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
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
180
|
+
else
|
181
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# list public events for a network of repositories
|
186
|
+
#
|
187
|
+
# @param owner [String]
|
188
|
+
# @param repo [String]
|
189
|
+
#
|
190
|
+
# @return ActivityResult, ActivityErrorResult
|
191
|
+
def list_public_events_for_a_network_of_repositories(owner, repo, options)
|
192
|
+
auth = nil
|
193
|
+
body = nil
|
194
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
195
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
196
|
+
uri = "#{Gitabu::BASE_URL}/networks/#{owner}/#{repo}/events"
|
197
|
+
|
198
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
199
|
+
|
200
|
+
if http_call.successful?
|
201
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
202
|
+
else
|
203
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# list public organization events
|
208
|
+
#
|
209
|
+
# @param org [String]
|
210
|
+
#
|
211
|
+
# @return ActivityResult, ActivityErrorResult
|
212
|
+
def list_public_organization_events(org, options)
|
213
|
+
auth = nil
|
214
|
+
body = nil
|
215
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
216
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
217
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/events"
|
218
|
+
|
219
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
220
|
+
|
221
|
+
if http_call.successful?
|
222
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
223
|
+
else
|
224
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# list repository events
|
229
|
+
#
|
230
|
+
# @param owner [String]
|
231
|
+
# @param repo [String]
|
232
|
+
#
|
233
|
+
# @return ActivityResult, ActivityErrorResult
|
234
|
+
def list_repository_events(owner, repo, options)
|
235
|
+
auth = nil
|
236
|
+
body = nil
|
237
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
238
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
239
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/events"
|
240
|
+
|
241
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
242
|
+
|
243
|
+
if http_call.successful?
|
244
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
245
|
+
else
|
246
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# list events for the authenticated user
|
251
|
+
#
|
252
|
+
# @param username [String]
|
253
|
+
#
|
254
|
+
# @return ActivityResult, ActivityErrorResult
|
255
|
+
def list_events_for_the_authenticated_user(username, options)
|
256
|
+
auth = nil
|
257
|
+
body = nil
|
258
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
259
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
260
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/events"
|
261
|
+
|
262
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
263
|
+
|
264
|
+
if http_call.successful?
|
265
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
266
|
+
else
|
267
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# list organization events for the authenticated user
|
272
|
+
#
|
273
|
+
# @param username [String]
|
274
|
+
# @param org [String]
|
275
|
+
#
|
276
|
+
# @return ActivityResult, ActivityErrorResult
|
277
|
+
def list_organization_events_for_the_authenticated_user(username, org, options)
|
278
|
+
auth = nil
|
279
|
+
body = nil
|
280
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
281
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
282
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/events/orgs/#{org}"
|
283
|
+
|
284
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
285
|
+
|
286
|
+
if http_call.successful?
|
287
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
288
|
+
else
|
289
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# list public events for a user
|
294
|
+
#
|
295
|
+
# @param username [String]
|
296
|
+
#
|
297
|
+
# @return ActivityResult, ActivityErrorResult
|
298
|
+
def list_public_events_for_a_user(username, options)
|
299
|
+
auth = nil
|
300
|
+
body = nil
|
301
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
302
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
303
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/events/public"
|
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
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
309
|
+
else
|
310
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
# list events received by the authenticated user
|
315
|
+
#
|
316
|
+
# @param username [String]
|
317
|
+
#
|
318
|
+
# @return ActivityResult, ActivityErrorResult
|
319
|
+
def list_events_received_by_the_authenticated_user(username, options)
|
320
|
+
auth = nil
|
321
|
+
body = nil
|
322
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
323
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
324
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/received_events"
|
325
|
+
|
326
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
327
|
+
|
328
|
+
if http_call.successful?
|
329
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
330
|
+
else
|
331
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
# list public events received by a user
|
336
|
+
#
|
337
|
+
# @param username [String]
|
338
|
+
#
|
339
|
+
# @return ActivityResult, ActivityErrorResult
|
340
|
+
def list_public_events_received_by_a_user(username, options)
|
341
|
+
auth = nil
|
342
|
+
body = nil
|
343
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
344
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
345
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/received_events/public"
|
346
|
+
|
347
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
348
|
+
|
349
|
+
if http_call.successful?
|
350
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
351
|
+
else
|
352
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
# get feeds
|
357
|
+
#
|
358
|
+
# @params options [Hash]
|
359
|
+
#
|
360
|
+
# @return ActivityResult, ActivityErrorResult
|
361
|
+
def get_feeds(_options)
|
362
|
+
auth = nil
|
363
|
+
body = nil
|
364
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
365
|
+
params = nil
|
366
|
+
uri = "#{Gitabu::BASE_URL}/feeds"
|
367
|
+
|
368
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
369
|
+
|
370
|
+
if http_call.successful?
|
371
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
372
|
+
else
|
373
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
# list notifications for the authenticated user
|
378
|
+
#
|
379
|
+
# @params options [Hash]
|
380
|
+
#
|
381
|
+
# @return ActivityResult, ActivityErrorResult
|
382
|
+
def list_notifications_for_the_authenticated_user(options)
|
383
|
+
auth = nil
|
384
|
+
body = nil
|
385
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
386
|
+
params = { all: options[:all], participating: options[:participating], since: options[:since], before: options[:before], per_page: options[:per_page], page: options[:page] }
|
387
|
+
uri = "#{Gitabu::BASE_URL}/notifications"
|
388
|
+
|
389
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
390
|
+
|
391
|
+
if http_call.successful?
|
392
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
393
|
+
else
|
394
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
# mark notifications as read
|
399
|
+
#
|
400
|
+
# @param last_read_at [String] Describes the last point that notifications were checked.
|
401
|
+
# @param read [Boolean] Whether the notification has been read.
|
402
|
+
#
|
403
|
+
# @return ActivityResult, ActivityErrorResult
|
404
|
+
def mark_notifications_as_read(last_read_at, read, _options)
|
405
|
+
auth = nil
|
406
|
+
body = { last_read_at: last_read_at, read: read }
|
407
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
408
|
+
params = nil
|
409
|
+
uri = "#{Gitabu::BASE_URL}/notifications"
|
410
|
+
|
411
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
412
|
+
|
413
|
+
if http_call.successful?
|
414
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
415
|
+
else
|
416
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
# get a thread
|
421
|
+
#
|
422
|
+
# @param thread_id [Integer] thread_id parameter
|
423
|
+
#
|
424
|
+
# @return ActivityResult, ActivityErrorResult
|
425
|
+
def get_a_thread(thread_id, _options)
|
426
|
+
auth = nil
|
427
|
+
body = nil
|
428
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
429
|
+
params = nil
|
430
|
+
uri = "#{Gitabu::BASE_URL}/notifications/threads/#{thread_id}"
|
431
|
+
|
432
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
433
|
+
|
434
|
+
if http_call.successful?
|
435
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
436
|
+
else
|
437
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
# mark a thread as read
|
442
|
+
#
|
443
|
+
# @param thread_id [Integer] thread_id parameter
|
444
|
+
#
|
445
|
+
# @return ActivityResult, ActivityErrorResult
|
446
|
+
def mark_a_thread_as_read(thread_id, _options)
|
447
|
+
auth = nil
|
448
|
+
body = nil
|
449
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
450
|
+
params = nil
|
451
|
+
uri = "#{Gitabu::BASE_URL}/notifications/threads/#{thread_id}"
|
452
|
+
|
453
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
454
|
+
|
455
|
+
if http_call.successful?
|
456
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
457
|
+
else
|
458
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
# get a thread subscription for the authenticated user
|
463
|
+
#
|
464
|
+
# @param thread_id [Integer] thread_id parameter
|
465
|
+
#
|
466
|
+
# @return ActivityResult, ActivityErrorResult
|
467
|
+
def get_a_thread_subscription_for_the_authenticated_user(thread_id, _options)
|
468
|
+
auth = nil
|
469
|
+
body = nil
|
470
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
471
|
+
params = nil
|
472
|
+
uri = "#{Gitabu::BASE_URL}/notifications/threads/#{thread_id}/subscription"
|
473
|
+
|
474
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
475
|
+
|
476
|
+
if http_call.successful?
|
477
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
478
|
+
else
|
479
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
# set a thread subscription
|
484
|
+
#
|
485
|
+
# @param thread_id [Integer] thread_id parameter
|
486
|
+
# @param ignored [Boolean] Whether to block all notifications from a thread.
|
487
|
+
#
|
488
|
+
# @return ActivityResult, ActivityErrorResult
|
489
|
+
def set_a_thread_subscription(thread_id, ignored, _options)
|
490
|
+
auth = nil
|
491
|
+
body = { ignored: ignored }
|
492
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
493
|
+
params = nil
|
494
|
+
uri = "#{Gitabu::BASE_URL}/notifications/threads/#{thread_id}/subscription"
|
495
|
+
|
496
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
497
|
+
|
498
|
+
if http_call.successful?
|
499
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
500
|
+
else
|
501
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
# delete a thread subscription
|
506
|
+
#
|
507
|
+
# @param thread_id [Integer] thread_id parameter
|
508
|
+
#
|
509
|
+
# @return ActivityResult, ActivityErrorResult
|
510
|
+
def delete_a_thread_subscription(thread_id, _options)
|
511
|
+
auth = nil
|
512
|
+
body = nil
|
513
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
514
|
+
params = nil
|
515
|
+
uri = "#{Gitabu::BASE_URL}/notifications/threads/#{thread_id}/subscription"
|
516
|
+
|
517
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
518
|
+
|
519
|
+
if http_call.successful?
|
520
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
521
|
+
else
|
522
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
# list repository notifications for the authenticated user
|
527
|
+
#
|
528
|
+
# @param owner [String]
|
529
|
+
# @param repo [String]
|
530
|
+
#
|
531
|
+
# @return ActivityResult, ActivityErrorResult
|
532
|
+
def list_repository_notifications_for_the_authenticated_user(owner, repo, options)
|
533
|
+
auth = nil
|
534
|
+
body = nil
|
535
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
536
|
+
params = { all: options[:all], participating: options[:participating], since: options[:since], before: options[:before], per_page: options[:per_page], page: options[:page] }
|
537
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/notifications"
|
538
|
+
|
539
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
540
|
+
|
541
|
+
if http_call.successful?
|
542
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
543
|
+
else
|
544
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
# mark repository notifications as read
|
549
|
+
#
|
550
|
+
# @param owner [String]
|
551
|
+
# @param repo [String]
|
552
|
+
# @param last_read_at [String] Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.
|
553
|
+
#
|
554
|
+
# @return ActivityResult, ActivityErrorResult
|
555
|
+
def mark_repository_notifications_as_read(owner, repo, last_read_at, _options)
|
556
|
+
auth = nil
|
557
|
+
body = { last_read_at: last_read_at }
|
558
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
559
|
+
params = nil
|
560
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/notifications"
|
561
|
+
|
562
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
563
|
+
|
564
|
+
if http_call.successful?
|
565
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
566
|
+
else
|
567
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
# list stargazers
|
572
|
+
#
|
573
|
+
# @param owner [String]
|
574
|
+
# @param repo [String]
|
575
|
+
#
|
576
|
+
# @return ActivityResult, ActivityErrorResult
|
577
|
+
def list_stargazers(owner, repo, options)
|
578
|
+
auth = nil
|
579
|
+
body = nil
|
580
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
581
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
582
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stargazers"
|
583
|
+
|
584
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
585
|
+
|
586
|
+
if http_call.successful?
|
587
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
588
|
+
else
|
589
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
# list repositories starred by the authenticated user
|
594
|
+
#
|
595
|
+
# @params options [Hash]
|
596
|
+
#
|
597
|
+
# @return ActivityResult, ActivityErrorResult
|
598
|
+
def list_repositories_starred_by_the_authenticated_user(options)
|
599
|
+
auth = nil
|
600
|
+
body = nil
|
601
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
602
|
+
params = { sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
603
|
+
uri = "#{Gitabu::BASE_URL}/user/starred"
|
604
|
+
|
605
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
606
|
+
|
607
|
+
if http_call.successful?
|
608
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
609
|
+
else
|
610
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
# check if a repository is starred by the authenticated user
|
615
|
+
#
|
616
|
+
# @param owner [String]
|
617
|
+
# @param repo [String]
|
618
|
+
#
|
619
|
+
# @return ActivityResult, ActivityErrorResult
|
620
|
+
def check_if_a_repository_is_starred_by_the_authenticated_user(owner, repo, _options)
|
621
|
+
auth = nil
|
622
|
+
body = nil
|
623
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
624
|
+
params = nil
|
625
|
+
uri = "#{Gitabu::BASE_URL}/user/starred/#{owner}/#{repo}"
|
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
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
631
|
+
else
|
632
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
# star a repository for the authenticated user
|
637
|
+
#
|
638
|
+
# @param owner [String]
|
639
|
+
# @param repo [String]
|
640
|
+
#
|
641
|
+
# @return ActivityResult, ActivityErrorResult
|
642
|
+
def star_a_repository_for_the_authenticated_user(owner, repo, _options)
|
643
|
+
auth = nil
|
644
|
+
body = nil
|
645
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
646
|
+
params = nil
|
647
|
+
uri = "#{Gitabu::BASE_URL}/user/starred/#{owner}/#{repo}"
|
648
|
+
|
649
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
650
|
+
|
651
|
+
if http_call.successful?
|
652
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
653
|
+
else
|
654
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
655
|
+
end
|
656
|
+
end
|
657
|
+
|
658
|
+
# unstar a repository for the authenticated user
|
659
|
+
#
|
660
|
+
# @param owner [String]
|
661
|
+
# @param repo [String]
|
662
|
+
#
|
663
|
+
# @return ActivityResult, ActivityErrorResult
|
664
|
+
def unstar_a_repository_for_the_authenticated_user(owner, repo, _options)
|
665
|
+
auth = nil
|
666
|
+
body = nil
|
667
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
668
|
+
params = nil
|
669
|
+
uri = "#{Gitabu::BASE_URL}/user/starred/#{owner}/#{repo}"
|
670
|
+
|
671
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
672
|
+
|
673
|
+
if http_call.successful?
|
674
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
675
|
+
else
|
676
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
# list repositories starred by a user
|
681
|
+
#
|
682
|
+
# @param username [String]
|
683
|
+
#
|
684
|
+
# @return ActivityResult, ActivityErrorResult
|
685
|
+
def list_repositories_starred_by_a_user(username, options)
|
686
|
+
auth = nil
|
687
|
+
body = nil
|
688
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
689
|
+
params = { sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
690
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/starred"
|
691
|
+
|
692
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
693
|
+
|
694
|
+
if http_call.successful?
|
695
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
696
|
+
else
|
697
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
698
|
+
end
|
699
|
+
end
|
700
|
+
|
701
|
+
# list watchers
|
702
|
+
#
|
703
|
+
# @param owner [String]
|
704
|
+
# @param repo [String]
|
705
|
+
#
|
706
|
+
# @return ActivityResult, ActivityErrorResult
|
707
|
+
def list_watchers(owner, repo, options)
|
708
|
+
auth = nil
|
709
|
+
body = nil
|
710
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
711
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
712
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/subscribers"
|
713
|
+
|
714
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
715
|
+
|
716
|
+
if http_call.successful?
|
717
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
718
|
+
else
|
719
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
# get a repository subscription
|
724
|
+
#
|
725
|
+
# @param owner [String]
|
726
|
+
# @param repo [String]
|
727
|
+
#
|
728
|
+
# @return ActivityResult, ActivityErrorResult
|
729
|
+
def get_a_repository_subscription(owner, repo, _options)
|
730
|
+
auth = nil
|
731
|
+
body = nil
|
732
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
733
|
+
params = nil
|
734
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/subscription"
|
735
|
+
|
736
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
737
|
+
|
738
|
+
if http_call.successful?
|
739
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
740
|
+
else
|
741
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
742
|
+
end
|
743
|
+
end
|
744
|
+
|
745
|
+
# set a repository subscription
|
746
|
+
#
|
747
|
+
# @param owner [String]
|
748
|
+
# @param repo [String]
|
749
|
+
# @param subscribed [Boolean] Determines if notifications should be received from this repository.
|
750
|
+
# @param ignored [Boolean] Determines if all notifications should be blocked from this repository.
|
751
|
+
#
|
752
|
+
# @return ActivityResult, ActivityErrorResult
|
753
|
+
def set_a_repository_subscription(owner, repo, subscribed, ignored, _options)
|
754
|
+
auth = nil
|
755
|
+
body = { subscribed: subscribed, ignored: ignored }
|
756
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
757
|
+
params = nil
|
758
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/subscription"
|
759
|
+
|
760
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
761
|
+
|
762
|
+
if http_call.successful?
|
763
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
764
|
+
else
|
765
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
766
|
+
end
|
767
|
+
end
|
768
|
+
|
769
|
+
# delete a repository subscription
|
770
|
+
#
|
771
|
+
# @param owner [String]
|
772
|
+
# @param repo [String]
|
773
|
+
#
|
774
|
+
# @return ActivityResult, ActivityErrorResult
|
775
|
+
def delete_a_repository_subscription(owner, repo, _options)
|
776
|
+
auth = nil
|
777
|
+
body = nil
|
778
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
779
|
+
params = nil
|
780
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/subscription"
|
781
|
+
|
782
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
783
|
+
|
784
|
+
if http_call.successful?
|
785
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
786
|
+
else
|
787
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
788
|
+
end
|
789
|
+
end
|
790
|
+
|
791
|
+
# list repositories watched by the authenticated user
|
792
|
+
#
|
793
|
+
# @params options [Hash]
|
794
|
+
#
|
795
|
+
# @return ActivityResult, ActivityErrorResult
|
796
|
+
def list_repositories_watched_by_the_authenticated_user(options)
|
797
|
+
auth = nil
|
798
|
+
body = nil
|
799
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
800
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
801
|
+
uri = "#{Gitabu::BASE_URL}/user/subscriptions"
|
802
|
+
|
803
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
804
|
+
|
805
|
+
if http_call.successful?
|
806
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
807
|
+
else
|
808
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
809
|
+
end
|
810
|
+
end
|
811
|
+
|
812
|
+
# list repositories watched by a user
|
813
|
+
#
|
814
|
+
# @param username [String]
|
815
|
+
#
|
816
|
+
# @return ActivityResult, ActivityErrorResult
|
817
|
+
def list_repositories_watched_by_a_user(username, options)
|
818
|
+
auth = nil
|
819
|
+
body = nil
|
820
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
821
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
822
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/subscriptions"
|
823
|
+
|
824
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
825
|
+
|
826
|
+
if http_call.successful?
|
827
|
+
ActivityResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
828
|
+
else
|
829
|
+
ActivityErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
830
|
+
end
|
831
|
+
end
|
832
|
+
end
|
833
|
+
end
|
834
|
+
end
|
835
|
+
end
|