gitabu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,851 @@
|
|
|
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 Users result
|
|
17
|
+
class UsersResult
|
|
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 UsersErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Users endpoints.
|
|
37
|
+
class Users
|
|
38
|
+
def self.get_the_authenticated_user(options: nil)
|
|
39
|
+
new.get_the_authenticated_user(options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.update_the_authenticated_user(name: nil, email: nil, blog: nil, twitter_username: nil, company: nil, location: nil, hireable: nil, bio: nil, options: nil)
|
|
43
|
+
new.update_the_authenticated_user(name, email, blog, twitter_username, company, location, hireable, bio, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.list_users(options: nil)
|
|
47
|
+
new.list_users(options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.get_a_user(username: nil, options: nil)
|
|
51
|
+
new.get_a_user(username, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.get_contextual_information_for_a_user(username: nil, options: nil)
|
|
55
|
+
new.get_contextual_information_for_a_user(username, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.list_users_blocked_by_the_authenticated_user(options: nil)
|
|
59
|
+
new.list_users_blocked_by_the_authenticated_user(options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.check_if_a_user_is_blocked_by_the_authenticated_user(username: nil, options: nil)
|
|
63
|
+
new.check_if_a_user_is_blocked_by_the_authenticated_user(username, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.block_a_user(username: nil, options: nil)
|
|
67
|
+
new.block_a_user(username, options)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.unblock_a_user(username: nil, options: nil)
|
|
71
|
+
new.unblock_a_user(username, options)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.set_primary_email_visibility_for_the_authenticated_user(visibility: nil, options: nil)
|
|
75
|
+
new.set_primary_email_visibility_for_the_authenticated_user(visibility, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.list_email_addresses_for_the_authenticated_user(options: nil)
|
|
79
|
+
new.list_email_addresses_for_the_authenticated_user(options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.add_an_email_address_for_the_authenticated_user(emails: nil, options: nil)
|
|
83
|
+
new.add_an_email_address_for_the_authenticated_user(emails, options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.delete_an_email_address_for_the_authenticated_user(emails: nil, options: nil)
|
|
87
|
+
new.delete_an_email_address_for_the_authenticated_user(emails, options)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.list_public_email_addresses_for_the_authenticated_user(options: nil)
|
|
91
|
+
new.list_public_email_addresses_for_the_authenticated_user(options)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.list_followers_of_the_authenticated_user(options: nil)
|
|
95
|
+
new.list_followers_of_the_authenticated_user(options)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.list_the_people_the_authenticated_user_follows(options: nil)
|
|
99
|
+
new.list_the_people_the_authenticated_user_follows(options)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.check_if_a_person_is_followed_by_the_authenticated_user(username: nil, options: nil)
|
|
103
|
+
new.check_if_a_person_is_followed_by_the_authenticated_user(username, options)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.follow_a_user(username: nil, options: nil)
|
|
107
|
+
new.follow_a_user(username, options)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.unfollow_a_user(username: nil, options: nil)
|
|
111
|
+
new.unfollow_a_user(username, options)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.list_followers_of_a_user(username: nil, options: nil)
|
|
115
|
+
new.list_followers_of_a_user(username, options)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.list_the_people_a_user_follows(username: nil, options: nil)
|
|
119
|
+
new.list_the_people_a_user_follows(username, options)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.check_if_a_user_follows_another_user(username: nil, target_user: nil, options: nil)
|
|
123
|
+
new.check_if_a_user_follows_another_user(username, target_user, options)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.list_gpg_keys_for_the_authenticated_user(options: nil)
|
|
127
|
+
new.list_gpg_keys_for_the_authenticated_user(options)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.create_a_gpg_key_for_the_authenticated_user(armored_public_key: nil, options: nil)
|
|
131
|
+
new.create_a_gpg_key_for_the_authenticated_user(armored_public_key, options)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self.get_a_gpg_key_for_the_authenticated_user(gpg_key_id: nil, options: nil)
|
|
135
|
+
new.get_a_gpg_key_for_the_authenticated_user(gpg_key_id, options)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.delete_a_gpg_key_for_the_authenticated_user(gpg_key_id: nil, options: nil)
|
|
139
|
+
new.delete_a_gpg_key_for_the_authenticated_user(gpg_key_id, options)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def self.list_gpg_keys_for_a_user(username: nil, options: nil)
|
|
143
|
+
new.list_gpg_keys_for_a_user(username, options)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def self.list_public_ssh_keys_for_the_authenticated_user(options: nil)
|
|
147
|
+
new.list_public_ssh_keys_for_the_authenticated_user(options)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def self.create_a_public_ssh_key_for_the_authenticated_user(title: nil, key: nil, options: nil)
|
|
151
|
+
new.create_a_public_ssh_key_for_the_authenticated_user(title, key, options)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def self.get_a_public_ssh_key_for_the_authenticated_user(key_id: nil, options: nil)
|
|
155
|
+
new.get_a_public_ssh_key_for_the_authenticated_user(key_id, options)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def self.delete_a_public_ssh_key_for_the_authenticated_user(key_id: nil, options: nil)
|
|
159
|
+
new.delete_a_public_ssh_key_for_the_authenticated_user(key_id, options)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def self.list_public_keys_for_a_user(username: nil, options: nil)
|
|
163
|
+
new.list_public_keys_for_a_user(username, options)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
private
|
|
167
|
+
|
|
168
|
+
# get the authenticated user
|
|
169
|
+
#
|
|
170
|
+
# @params options [Hash]
|
|
171
|
+
#
|
|
172
|
+
# @return UsersResult, UsersErrorResult
|
|
173
|
+
def get_the_authenticated_user(_options)
|
|
174
|
+
auth = nil
|
|
175
|
+
body = nil
|
|
176
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
177
|
+
params = nil
|
|
178
|
+
uri = "#{Gitabu::BASE_URL}/user"
|
|
179
|
+
|
|
180
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
181
|
+
|
|
182
|
+
if http_call.successful?
|
|
183
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
184
|
+
else
|
|
185
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# update the authenticated user
|
|
190
|
+
#
|
|
191
|
+
# @param name [String] The new name of the user.
|
|
192
|
+
# @param email [String] The publicly visible email address of the user.
|
|
193
|
+
# @param blog [String] The new blog URL of the user.
|
|
194
|
+
# @param twitter_username [String or null] The new Twitter username of the user.
|
|
195
|
+
# @param company [String] The new company of the user.
|
|
196
|
+
# @param location [String] The new location of the user.
|
|
197
|
+
# @param hireable [Boolean] The new hiring availability of the user.
|
|
198
|
+
# @param bio [String] The new short biography of the user.
|
|
199
|
+
#
|
|
200
|
+
# @return UsersResult, UsersErrorResult
|
|
201
|
+
def update_the_authenticated_user(name, email, blog, twitter_username, company, location, hireable, bio, _options)
|
|
202
|
+
auth = nil
|
|
203
|
+
body = { name: name, email: email, blog: blog, twitter_username: twitter_username, company: company, location: location, hireable: hireable, bio: bio }
|
|
204
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
205
|
+
params = nil
|
|
206
|
+
uri = "#{Gitabu::BASE_URL}/user"
|
|
207
|
+
|
|
208
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
209
|
+
|
|
210
|
+
if http_call.successful?
|
|
211
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
212
|
+
else
|
|
213
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# list users
|
|
218
|
+
#
|
|
219
|
+
# @params options [Hash]
|
|
220
|
+
#
|
|
221
|
+
# @return UsersResult, UsersErrorResult
|
|
222
|
+
def list_users(options)
|
|
223
|
+
auth = nil
|
|
224
|
+
body = nil
|
|
225
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
226
|
+
params = { since: options[:since], per_page: options[:per_page] }
|
|
227
|
+
uri = "#{Gitabu::BASE_URL}/users"
|
|
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
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
233
|
+
else
|
|
234
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# get a user
|
|
239
|
+
#
|
|
240
|
+
# @param username [String]
|
|
241
|
+
#
|
|
242
|
+
# @return UsersResult, UsersErrorResult
|
|
243
|
+
def get_a_user(username, _options)
|
|
244
|
+
auth = nil
|
|
245
|
+
body = nil
|
|
246
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
247
|
+
params = nil
|
|
248
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}"
|
|
249
|
+
|
|
250
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
251
|
+
|
|
252
|
+
if http_call.successful?
|
|
253
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
254
|
+
else
|
|
255
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# get contextual information for a user
|
|
260
|
+
#
|
|
261
|
+
# @param username [String]
|
|
262
|
+
#
|
|
263
|
+
# @return UsersResult, UsersErrorResult
|
|
264
|
+
def get_contextual_information_for_a_user(username, options)
|
|
265
|
+
auth = nil
|
|
266
|
+
body = nil
|
|
267
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
268
|
+
params = { subject_type: options[:subject_type], subject_id: options[:subject_id] }
|
|
269
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/hovercard"
|
|
270
|
+
|
|
271
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
272
|
+
|
|
273
|
+
if http_call.successful?
|
|
274
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
275
|
+
else
|
|
276
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# list users blocked by the authenticated user
|
|
281
|
+
#
|
|
282
|
+
# @params options [Hash]
|
|
283
|
+
#
|
|
284
|
+
# @return UsersResult, UsersErrorResult
|
|
285
|
+
def list_users_blocked_by_the_authenticated_user(_options)
|
|
286
|
+
auth = nil
|
|
287
|
+
body = nil
|
|
288
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
289
|
+
params = nil
|
|
290
|
+
uri = "#{Gitabu::BASE_URL}/user/blocks"
|
|
291
|
+
|
|
292
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
293
|
+
|
|
294
|
+
if http_call.successful?
|
|
295
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
296
|
+
else
|
|
297
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# check if a user is blocked by the authenticated user
|
|
302
|
+
#
|
|
303
|
+
# @param username [String]
|
|
304
|
+
#
|
|
305
|
+
# @return UsersResult, UsersErrorResult
|
|
306
|
+
def check_if_a_user_is_blocked_by_the_authenticated_user(username, _options)
|
|
307
|
+
auth = nil
|
|
308
|
+
body = nil
|
|
309
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
310
|
+
params = nil
|
|
311
|
+
uri = "#{Gitabu::BASE_URL}/user/blocks/#{username}"
|
|
312
|
+
|
|
313
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
314
|
+
|
|
315
|
+
if http_call.successful?
|
|
316
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
317
|
+
else
|
|
318
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# block a user
|
|
323
|
+
#
|
|
324
|
+
# @param username [String]
|
|
325
|
+
#
|
|
326
|
+
# @return UsersResult, UsersErrorResult
|
|
327
|
+
def block_a_user(username, _options)
|
|
328
|
+
auth = nil
|
|
329
|
+
body = nil
|
|
330
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
331
|
+
params = nil
|
|
332
|
+
uri = "#{Gitabu::BASE_URL}/user/blocks/#{username}"
|
|
333
|
+
|
|
334
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
335
|
+
|
|
336
|
+
if http_call.successful?
|
|
337
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
338
|
+
else
|
|
339
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# unblock a user
|
|
344
|
+
#
|
|
345
|
+
# @param username [String]
|
|
346
|
+
#
|
|
347
|
+
# @return UsersResult, UsersErrorResult
|
|
348
|
+
def unblock_a_user(username, _options)
|
|
349
|
+
auth = nil
|
|
350
|
+
body = nil
|
|
351
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
352
|
+
params = nil
|
|
353
|
+
uri = "#{Gitabu::BASE_URL}/user/blocks/#{username}"
|
|
354
|
+
|
|
355
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
356
|
+
|
|
357
|
+
if http_call.successful?
|
|
358
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
359
|
+
else
|
|
360
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
# set primary email visibility for the authenticated user
|
|
365
|
+
#
|
|
366
|
+
# @param visibility [String] Required. Denotes whether an email is publicly visible.
|
|
367
|
+
#
|
|
368
|
+
# @return UsersResult, UsersErrorResult
|
|
369
|
+
def set_primary_email_visibility_for_the_authenticated_user(visibility, _options)
|
|
370
|
+
auth = nil
|
|
371
|
+
body = { visibility: visibility }
|
|
372
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
373
|
+
params = nil
|
|
374
|
+
uri = "#{Gitabu::BASE_URL}/user/email/visibility"
|
|
375
|
+
|
|
376
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
|
377
|
+
|
|
378
|
+
if http_call.successful?
|
|
379
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
380
|
+
else
|
|
381
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
382
|
+
end
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
# list email addresses for the authenticated user
|
|
386
|
+
#
|
|
387
|
+
# @params options [Hash]
|
|
388
|
+
#
|
|
389
|
+
# @return UsersResult, UsersErrorResult
|
|
390
|
+
def list_email_addresses_for_the_authenticated_user(options)
|
|
391
|
+
auth = nil
|
|
392
|
+
body = nil
|
|
393
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
394
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
395
|
+
uri = "#{Gitabu::BASE_URL}/user/emails"
|
|
396
|
+
|
|
397
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
398
|
+
|
|
399
|
+
if http_call.successful?
|
|
400
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
401
|
+
else
|
|
402
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# add an email address for the authenticated user
|
|
407
|
+
#
|
|
408
|
+
# @param emails [Array of strings] Required. Adds one or more email addresses to your GitHub account. Must contain at least one email address. Note: Alternatively, you can pass a single email address or an array of emails addresses directly, but we recommend that you pass an object using the emails key.
|
|
409
|
+
#
|
|
410
|
+
# @return UsersResult, UsersErrorResult
|
|
411
|
+
def add_an_email_address_for_the_authenticated_user(emails, _options)
|
|
412
|
+
auth = nil
|
|
413
|
+
body = { emails: emails }
|
|
414
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
415
|
+
params = nil
|
|
416
|
+
uri = "#{Gitabu::BASE_URL}/user/emails"
|
|
417
|
+
|
|
418
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
419
|
+
|
|
420
|
+
if http_call.successful?
|
|
421
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
422
|
+
else
|
|
423
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
# delete an email address for the authenticated user
|
|
428
|
+
#
|
|
429
|
+
# @param emails [Array of strings] Required. Email addresses associated with the GitHub user account.
|
|
430
|
+
#
|
|
431
|
+
# @return UsersResult, UsersErrorResult
|
|
432
|
+
def delete_an_email_address_for_the_authenticated_user(emails, _options)
|
|
433
|
+
auth = nil
|
|
434
|
+
body = { emails: emails }
|
|
435
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
436
|
+
params = nil
|
|
437
|
+
uri = "#{Gitabu::BASE_URL}/user/emails"
|
|
438
|
+
|
|
439
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
440
|
+
|
|
441
|
+
if http_call.successful?
|
|
442
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
443
|
+
else
|
|
444
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# list public email addresses for the authenticated user
|
|
449
|
+
#
|
|
450
|
+
# @params options [Hash]
|
|
451
|
+
#
|
|
452
|
+
# @return UsersResult, UsersErrorResult
|
|
453
|
+
def list_public_email_addresses_for_the_authenticated_user(options)
|
|
454
|
+
auth = nil
|
|
455
|
+
body = nil
|
|
456
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
457
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
458
|
+
uri = "#{Gitabu::BASE_URL}/user/public_emails"
|
|
459
|
+
|
|
460
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
461
|
+
|
|
462
|
+
if http_call.successful?
|
|
463
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
464
|
+
else
|
|
465
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
# list followers of the authenticated user
|
|
470
|
+
#
|
|
471
|
+
# @params options [Hash]
|
|
472
|
+
#
|
|
473
|
+
# @return UsersResult, UsersErrorResult
|
|
474
|
+
def list_followers_of_the_authenticated_user(options)
|
|
475
|
+
auth = nil
|
|
476
|
+
body = nil
|
|
477
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
478
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
479
|
+
uri = "#{Gitabu::BASE_URL}/user/followers"
|
|
480
|
+
|
|
481
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
482
|
+
|
|
483
|
+
if http_call.successful?
|
|
484
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
485
|
+
else
|
|
486
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
# list the people the authenticated user follows
|
|
491
|
+
#
|
|
492
|
+
# @params options [Hash]
|
|
493
|
+
#
|
|
494
|
+
# @return UsersResult, UsersErrorResult
|
|
495
|
+
def list_the_people_the_authenticated_user_follows(options)
|
|
496
|
+
auth = nil
|
|
497
|
+
body = nil
|
|
498
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
499
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
500
|
+
uri = "#{Gitabu::BASE_URL}/user/following"
|
|
501
|
+
|
|
502
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
503
|
+
|
|
504
|
+
if http_call.successful?
|
|
505
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
506
|
+
else
|
|
507
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
508
|
+
end
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
# check if a person is followed by the authenticated user
|
|
512
|
+
#
|
|
513
|
+
# @param username [String]
|
|
514
|
+
#
|
|
515
|
+
# @return UsersResult, UsersErrorResult
|
|
516
|
+
def check_if_a_person_is_followed_by_the_authenticated_user(username, _options)
|
|
517
|
+
auth = nil
|
|
518
|
+
body = nil
|
|
519
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
520
|
+
params = nil
|
|
521
|
+
uri = "#{Gitabu::BASE_URL}/user/following/#{username}"
|
|
522
|
+
|
|
523
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
524
|
+
|
|
525
|
+
if http_call.successful?
|
|
526
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
527
|
+
else
|
|
528
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
# follow a user
|
|
533
|
+
#
|
|
534
|
+
# @param username [String]
|
|
535
|
+
#
|
|
536
|
+
# @return UsersResult, UsersErrorResult
|
|
537
|
+
def follow_a_user(username, _options)
|
|
538
|
+
auth = nil
|
|
539
|
+
body = nil
|
|
540
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
541
|
+
params = nil
|
|
542
|
+
uri = "#{Gitabu::BASE_URL}/user/following/#{username}"
|
|
543
|
+
|
|
544
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
|
545
|
+
|
|
546
|
+
if http_call.successful?
|
|
547
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
548
|
+
else
|
|
549
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
550
|
+
end
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
# unfollow a user
|
|
554
|
+
#
|
|
555
|
+
# @param username [String]
|
|
556
|
+
#
|
|
557
|
+
# @return UsersResult, UsersErrorResult
|
|
558
|
+
def unfollow_a_user(username, _options)
|
|
559
|
+
auth = nil
|
|
560
|
+
body = nil
|
|
561
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
562
|
+
params = nil
|
|
563
|
+
uri = "#{Gitabu::BASE_URL}/user/following/#{username}"
|
|
564
|
+
|
|
565
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
566
|
+
|
|
567
|
+
if http_call.successful?
|
|
568
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
569
|
+
else
|
|
570
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
571
|
+
end
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
# list followers of a user
|
|
575
|
+
#
|
|
576
|
+
# @param username [String]
|
|
577
|
+
#
|
|
578
|
+
# @return UsersResult, UsersErrorResult
|
|
579
|
+
def list_followers_of_a_user(username, options)
|
|
580
|
+
auth = nil
|
|
581
|
+
body = nil
|
|
582
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
583
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
584
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/followers"
|
|
585
|
+
|
|
586
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
587
|
+
|
|
588
|
+
if http_call.successful?
|
|
589
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
590
|
+
else
|
|
591
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
# list the people a user follows
|
|
596
|
+
#
|
|
597
|
+
# @param username [String]
|
|
598
|
+
#
|
|
599
|
+
# @return UsersResult, UsersErrorResult
|
|
600
|
+
def list_the_people_a_user_follows(username, options)
|
|
601
|
+
auth = nil
|
|
602
|
+
body = nil
|
|
603
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
604
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
605
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/following"
|
|
606
|
+
|
|
607
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
608
|
+
|
|
609
|
+
if http_call.successful?
|
|
610
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
611
|
+
else
|
|
612
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
# check if a user follows another user
|
|
617
|
+
#
|
|
618
|
+
# @param username [String]
|
|
619
|
+
# @param target_user [String]
|
|
620
|
+
#
|
|
621
|
+
# @return UsersResult, UsersErrorResult
|
|
622
|
+
def check_if_a_user_follows_another_user(username, target_user, _options)
|
|
623
|
+
auth = nil
|
|
624
|
+
body = nil
|
|
625
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
626
|
+
params = nil
|
|
627
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/following/#{target_user}"
|
|
628
|
+
|
|
629
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
630
|
+
|
|
631
|
+
if http_call.successful?
|
|
632
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
633
|
+
else
|
|
634
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
635
|
+
end
|
|
636
|
+
end
|
|
637
|
+
|
|
638
|
+
# list gpg keys for the authenticated user
|
|
639
|
+
#
|
|
640
|
+
# @params options [Hash]
|
|
641
|
+
#
|
|
642
|
+
# @return UsersResult, UsersErrorResult
|
|
643
|
+
def list_gpg_keys_for_the_authenticated_user(options)
|
|
644
|
+
auth = nil
|
|
645
|
+
body = nil
|
|
646
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
647
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
648
|
+
uri = "#{Gitabu::BASE_URL}/user/gpg_keys"
|
|
649
|
+
|
|
650
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
651
|
+
|
|
652
|
+
if http_call.successful?
|
|
653
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
654
|
+
else
|
|
655
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
656
|
+
end
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
# create a gpg key for the authenticated user
|
|
660
|
+
#
|
|
661
|
+
# @param armored_public_key [String] Required. A GPG key in ASCII-armored format.
|
|
662
|
+
#
|
|
663
|
+
# @return UsersResult, UsersErrorResult
|
|
664
|
+
def create_a_gpg_key_for_the_authenticated_user(armored_public_key, _options)
|
|
665
|
+
auth = nil
|
|
666
|
+
body = { armored_public_key: armored_public_key }
|
|
667
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
668
|
+
params = nil
|
|
669
|
+
uri = "#{Gitabu::BASE_URL}/user/gpg_keys"
|
|
670
|
+
|
|
671
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
672
|
+
|
|
673
|
+
if http_call.successful?
|
|
674
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
675
|
+
else
|
|
676
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
677
|
+
end
|
|
678
|
+
end
|
|
679
|
+
|
|
680
|
+
# get a gpg key for the authenticated user
|
|
681
|
+
#
|
|
682
|
+
# @param gpg_key_id [Integer] gpg_key_id parameter
|
|
683
|
+
#
|
|
684
|
+
# @return UsersResult, UsersErrorResult
|
|
685
|
+
def get_a_gpg_key_for_the_authenticated_user(gpg_key_id, _options)
|
|
686
|
+
auth = nil
|
|
687
|
+
body = nil
|
|
688
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
689
|
+
params = nil
|
|
690
|
+
uri = "#{Gitabu::BASE_URL}/user/gpg_keys/#{gpg_key_id}"
|
|
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
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
696
|
+
else
|
|
697
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
698
|
+
end
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
# delete a gpg key for the authenticated user
|
|
702
|
+
#
|
|
703
|
+
# @param gpg_key_id [Integer] gpg_key_id parameter
|
|
704
|
+
#
|
|
705
|
+
# @return UsersResult, UsersErrorResult
|
|
706
|
+
def delete_a_gpg_key_for_the_authenticated_user(gpg_key_id, _options)
|
|
707
|
+
auth = nil
|
|
708
|
+
body = nil
|
|
709
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
710
|
+
params = nil
|
|
711
|
+
uri = "#{Gitabu::BASE_URL}/user/gpg_keys/#{gpg_key_id}"
|
|
712
|
+
|
|
713
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
714
|
+
|
|
715
|
+
if http_call.successful?
|
|
716
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
717
|
+
else
|
|
718
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
719
|
+
end
|
|
720
|
+
end
|
|
721
|
+
|
|
722
|
+
# list gpg keys for a user
|
|
723
|
+
#
|
|
724
|
+
# @param username [String]
|
|
725
|
+
#
|
|
726
|
+
# @return UsersResult, UsersErrorResult
|
|
727
|
+
def list_gpg_keys_for_a_user(username, options)
|
|
728
|
+
auth = nil
|
|
729
|
+
body = nil
|
|
730
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
731
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
732
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/gpg_keys"
|
|
733
|
+
|
|
734
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
735
|
+
|
|
736
|
+
if http_call.successful?
|
|
737
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
738
|
+
else
|
|
739
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
740
|
+
end
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
# list public ssh keys for the authenticated user
|
|
744
|
+
#
|
|
745
|
+
# @params options [Hash]
|
|
746
|
+
#
|
|
747
|
+
# @return UsersResult, UsersErrorResult
|
|
748
|
+
def list_public_ssh_keys_for_the_authenticated_user(options)
|
|
749
|
+
auth = nil
|
|
750
|
+
body = nil
|
|
751
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
752
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
753
|
+
uri = "#{Gitabu::BASE_URL}/user/keys"
|
|
754
|
+
|
|
755
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
756
|
+
|
|
757
|
+
if http_call.successful?
|
|
758
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
759
|
+
else
|
|
760
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
761
|
+
end
|
|
762
|
+
end
|
|
763
|
+
|
|
764
|
+
# create a public ssh key for the authenticated user
|
|
765
|
+
#
|
|
766
|
+
# @param title [String] A descriptive name for the new key.
|
|
767
|
+
# @param key [String] Required. The public SSH key to add to your GitHub account.
|
|
768
|
+
#
|
|
769
|
+
# @return UsersResult, UsersErrorResult
|
|
770
|
+
def create_a_public_ssh_key_for_the_authenticated_user(title, key, _options)
|
|
771
|
+
auth = nil
|
|
772
|
+
body = { title: title, key: key }
|
|
773
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
774
|
+
params = nil
|
|
775
|
+
uri = "#{Gitabu::BASE_URL}/user/keys"
|
|
776
|
+
|
|
777
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
|
778
|
+
|
|
779
|
+
if http_call.successful?
|
|
780
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
781
|
+
else
|
|
782
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
783
|
+
end
|
|
784
|
+
end
|
|
785
|
+
|
|
786
|
+
# get a public ssh key for the authenticated user
|
|
787
|
+
#
|
|
788
|
+
# @param key_id [Integer] key_id parameter
|
|
789
|
+
#
|
|
790
|
+
# @return UsersResult, UsersErrorResult
|
|
791
|
+
def get_a_public_ssh_key_for_the_authenticated_user(key_id, _options)
|
|
792
|
+
auth = nil
|
|
793
|
+
body = nil
|
|
794
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
795
|
+
params = nil
|
|
796
|
+
uri = "#{Gitabu::BASE_URL}/user/keys/#{key_id}"
|
|
797
|
+
|
|
798
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
799
|
+
|
|
800
|
+
if http_call.successful?
|
|
801
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
802
|
+
else
|
|
803
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
804
|
+
end
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
# delete a public ssh key for the authenticated user
|
|
808
|
+
#
|
|
809
|
+
# @param key_id [Integer] key_id parameter
|
|
810
|
+
#
|
|
811
|
+
# @return UsersResult, UsersErrorResult
|
|
812
|
+
def delete_a_public_ssh_key_for_the_authenticated_user(key_id, _options)
|
|
813
|
+
auth = nil
|
|
814
|
+
body = nil
|
|
815
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
816
|
+
params = nil
|
|
817
|
+
uri = "#{Gitabu::BASE_URL}/user/keys/#{key_id}"
|
|
818
|
+
|
|
819
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
|
820
|
+
|
|
821
|
+
if http_call.successful?
|
|
822
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
823
|
+
else
|
|
824
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
825
|
+
end
|
|
826
|
+
end
|
|
827
|
+
|
|
828
|
+
# list public keys for a user
|
|
829
|
+
#
|
|
830
|
+
# @param username [String]
|
|
831
|
+
#
|
|
832
|
+
# @return UsersResult, UsersErrorResult
|
|
833
|
+
def list_public_keys_for_a_user(username, options)
|
|
834
|
+
auth = nil
|
|
835
|
+
body = nil
|
|
836
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
837
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
838
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/keys"
|
|
839
|
+
|
|
840
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
841
|
+
|
|
842
|
+
if http_call.successful?
|
|
843
|
+
UsersResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
844
|
+
else
|
|
845
|
+
UsersErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
846
|
+
end
|
|
847
|
+
end
|
|
848
|
+
end
|
|
849
|
+
end
|
|
850
|
+
end
|
|
851
|
+
end
|