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,693 @@
|
|
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 Projects result
|
17
|
+
class ProjectsResult
|
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 ProjectsErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Projects endpoints.
|
37
|
+
class Projects
|
38
|
+
def self.list_organization_projects(org: nil, options: nil)
|
39
|
+
new.list_organization_projects(org, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_an_organization_project(org: nil, name: nil, body: nil, options: nil)
|
43
|
+
new.create_an_organization_project(org, name, body, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_a_project(project_id: nil, options: nil)
|
47
|
+
new.get_a_project(project_id, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.update_a_project(project_id: nil, name: nil, body: nil, state: nil, organization_permission: nil, private: nil, options: nil)
|
51
|
+
new.update_a_project(project_id, name, body, state, organization_permission, private, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.delete_a_project(project_id: nil, options: nil)
|
55
|
+
new.delete_a_project(project_id, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.list_repository_projects(owner: nil, repo: nil, options: nil)
|
59
|
+
new.list_repository_projects(owner, repo, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.create_a_repository_project(owner: nil, repo: nil, name: nil, body: nil, options: nil)
|
63
|
+
new.create_a_repository_project(owner, repo, name, body, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.create_a_user_project(name: nil, body: nil, options: nil)
|
67
|
+
new.create_a_user_project(name, body, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_user_projects(username: nil, options: nil)
|
71
|
+
new.list_user_projects(username, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_a_project_card(card_id: nil, options: nil)
|
75
|
+
new.get_a_project_card(card_id, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.update_an_existing_project_card(card_id: nil, note: nil, archived: nil, options: nil)
|
79
|
+
new.update_an_existing_project_card(card_id, note, archived, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.delete_a_project_card(card_id: nil, options: nil)
|
83
|
+
new.delete_a_project_card(card_id, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.move_a_project_card(card_id: nil, position: nil, column_id: nil, options: nil)
|
87
|
+
new.move_a_project_card(card_id, position, column_id, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.list_project_cards(column_id: nil, options: nil)
|
91
|
+
new.list_project_cards(column_id, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.create_a_project_card(column_id: nil, note: nil, content_id: nil, content_type: nil, options: nil)
|
95
|
+
new.create_a_project_card(column_id, note, content_id, content_type, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.list_project_collaborators(project_id: nil, options: nil)
|
99
|
+
new.list_project_collaborators(project_id, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.add_project_collaborator(project_id: nil, username: nil, permission: nil, options: nil)
|
103
|
+
new.add_project_collaborator(project_id, username, permission, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.remove_user_as_a_collaborator(project_id: nil, username: nil, options: nil)
|
107
|
+
new.remove_user_as_a_collaborator(project_id, username, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.get_project_permission_for_a_user(project_id: nil, username: nil, options: nil)
|
111
|
+
new.get_project_permission_for_a_user(project_id, username, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.get_a_project_column(column_id: nil, options: nil)
|
115
|
+
new.get_a_project_column(column_id, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.update_an_existing_project_column(column_id: nil, name: nil, options: nil)
|
119
|
+
new.update_an_existing_project_column(column_id, name, options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.delete_a_project_column(column_id: nil, options: nil)
|
123
|
+
new.delete_a_project_column(column_id, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.move_a_project_column(column_id: nil, position: nil, options: nil)
|
127
|
+
new.move_a_project_column(column_id, position, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.list_project_columns(project_id: nil, options: nil)
|
131
|
+
new.list_project_columns(project_id, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.create_a_project_column(project_id: nil, name: nil, options: nil)
|
135
|
+
new.create_a_project_column(project_id, name, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
# list organization projects
|
141
|
+
#
|
142
|
+
# @param org [String]
|
143
|
+
#
|
144
|
+
# @return ProjectsResult, ProjectsErrorResult
|
145
|
+
def list_organization_projects(org, options)
|
146
|
+
auth = nil
|
147
|
+
body = nil
|
148
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
149
|
+
params = { state: options[:state], per_page: options[:per_page], page: options[:page] }
|
150
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/projects"
|
151
|
+
|
152
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
153
|
+
|
154
|
+
if http_call.successful?
|
155
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
156
|
+
else
|
157
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# create an organization project
|
162
|
+
#
|
163
|
+
# @param org [String]
|
164
|
+
# @param name [String] Required. The name of the project.
|
165
|
+
# @param body [String] The description of the project.
|
166
|
+
#
|
167
|
+
# @return ProjectsResult, ProjectsErrorResult
|
168
|
+
def create_an_organization_project(org, name, body, _options)
|
169
|
+
auth = nil
|
170
|
+
body = { name: name, body: body }
|
171
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
172
|
+
params = nil
|
173
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/projects"
|
174
|
+
|
175
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
176
|
+
|
177
|
+
if http_call.successful?
|
178
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
179
|
+
else
|
180
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# get a project
|
185
|
+
#
|
186
|
+
# @param project_id [Integer]
|
187
|
+
#
|
188
|
+
# @return ProjectsResult, ProjectsErrorResult
|
189
|
+
def get_a_project(project_id, _options)
|
190
|
+
auth = nil
|
191
|
+
body = nil
|
192
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
193
|
+
params = nil
|
194
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}"
|
195
|
+
|
196
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
197
|
+
|
198
|
+
if http_call.successful?
|
199
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
200
|
+
else
|
201
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# update a project
|
206
|
+
#
|
207
|
+
# @param project_id [Integer]
|
208
|
+
# @param name [String] Name of the project
|
209
|
+
# @param body [String or null] Body of the project
|
210
|
+
# @param state [String] State of the project; either 'open' or 'closed'
|
211
|
+
# @param organization_permission [String] The baseline permission that all organization members have on this project
|
212
|
+
# @param private [Boolean] Whether or not this project can be seen by everyone.
|
213
|
+
#
|
214
|
+
# @return ProjectsResult, ProjectsErrorResult
|
215
|
+
def update_a_project(project_id, name, body, state, organization_permission, private, _options)
|
216
|
+
auth = nil
|
217
|
+
body = { name: name, body: body, state: state, organization_permission: organization_permission, private: private }
|
218
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
219
|
+
params = nil
|
220
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}"
|
221
|
+
|
222
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
223
|
+
|
224
|
+
if http_call.successful?
|
225
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
226
|
+
else
|
227
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# delete a project
|
232
|
+
#
|
233
|
+
# @param project_id [Integer]
|
234
|
+
#
|
235
|
+
# @return ProjectsResult, ProjectsErrorResult
|
236
|
+
def delete_a_project(project_id, _options)
|
237
|
+
auth = nil
|
238
|
+
body = nil
|
239
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
240
|
+
params = nil
|
241
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}"
|
242
|
+
|
243
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
244
|
+
|
245
|
+
if http_call.successful?
|
246
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
247
|
+
else
|
248
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# list repository projects
|
253
|
+
#
|
254
|
+
# @param owner [String]
|
255
|
+
# @param repo [String]
|
256
|
+
#
|
257
|
+
# @return ProjectsResult, ProjectsErrorResult
|
258
|
+
def list_repository_projects(owner, repo, options)
|
259
|
+
auth = nil
|
260
|
+
body = nil
|
261
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
262
|
+
params = { state: options[:state], per_page: options[:per_page], page: options[:page] }
|
263
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/projects"
|
264
|
+
|
265
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
266
|
+
|
267
|
+
if http_call.successful?
|
268
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
269
|
+
else
|
270
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
# create a repository project
|
275
|
+
#
|
276
|
+
# @param owner [String]
|
277
|
+
# @param repo [String]
|
278
|
+
# @param name [String] Required. The name of the project.
|
279
|
+
# @param body [String] The description of the project.
|
280
|
+
#
|
281
|
+
# @return ProjectsResult, ProjectsErrorResult
|
282
|
+
def create_a_repository_project(owner, repo, name, body, _options)
|
283
|
+
auth = nil
|
284
|
+
body = { name: name, body: body }
|
285
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
286
|
+
params = nil
|
287
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/projects"
|
288
|
+
|
289
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
290
|
+
|
291
|
+
if http_call.successful?
|
292
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
293
|
+
else
|
294
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
# create a user project
|
299
|
+
#
|
300
|
+
# @param name [String] Required. Name of the project
|
301
|
+
# @param body [String or null] Body of the project
|
302
|
+
#
|
303
|
+
# @return ProjectsResult, ProjectsErrorResult
|
304
|
+
def create_a_user_project(name, body, _options)
|
305
|
+
auth = nil
|
306
|
+
body = { name: name, body: body }
|
307
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
308
|
+
params = nil
|
309
|
+
uri = "#{Gitabu::BASE_URL}/user/projects"
|
310
|
+
|
311
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
312
|
+
|
313
|
+
if http_call.successful?
|
314
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
315
|
+
else
|
316
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
# list user projects
|
321
|
+
#
|
322
|
+
# @param username [String]
|
323
|
+
#
|
324
|
+
# @return ProjectsResult, ProjectsErrorResult
|
325
|
+
def list_user_projects(username, options)
|
326
|
+
auth = nil
|
327
|
+
body = nil
|
328
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
329
|
+
params = { state: options[:state], per_page: options[:per_page], page: options[:page] }
|
330
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/projects"
|
331
|
+
|
332
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
333
|
+
|
334
|
+
if http_call.successful?
|
335
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
336
|
+
else
|
337
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
# get a project card
|
342
|
+
#
|
343
|
+
# @param card_id [Integer] card_id parameter
|
344
|
+
#
|
345
|
+
# @return ProjectsResult, ProjectsErrorResult
|
346
|
+
def get_a_project_card(card_id, _options)
|
347
|
+
auth = nil
|
348
|
+
body = nil
|
349
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
350
|
+
params = nil
|
351
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/cards/#{card_id}"
|
352
|
+
|
353
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
354
|
+
|
355
|
+
if http_call.successful?
|
356
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
357
|
+
else
|
358
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# update an existing project card
|
363
|
+
#
|
364
|
+
# @param card_id [Integer] card_id parameter
|
365
|
+
# @param note [String or null] The project card's note
|
366
|
+
# @param archived [Boolean] Whether or not the card is archived
|
367
|
+
#
|
368
|
+
# @return ProjectsResult, ProjectsErrorResult
|
369
|
+
def update_an_existing_project_card(card_id, note, archived, _options)
|
370
|
+
auth = nil
|
371
|
+
body = { note: note, archived: archived }
|
372
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
373
|
+
params = nil
|
374
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/cards/#{card_id}"
|
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
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
380
|
+
else
|
381
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
# delete a project card
|
386
|
+
#
|
387
|
+
# @param card_id [Integer] card_id parameter
|
388
|
+
#
|
389
|
+
# @return ProjectsResult, ProjectsErrorResult
|
390
|
+
def delete_a_project_card(card_id, _options)
|
391
|
+
auth = nil
|
392
|
+
body = nil
|
393
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
394
|
+
params = nil
|
395
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/cards/#{card_id}"
|
396
|
+
|
397
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
398
|
+
|
399
|
+
if http_call.successful?
|
400
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
401
|
+
else
|
402
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
# move a project card
|
407
|
+
#
|
408
|
+
# @param card_id [Integer] card_id parameter
|
409
|
+
# @param position [String] Required. The position of the card in a column. Can be one of: top, bottom, or after:<card_id> to place after the specified card.
|
410
|
+
# @param column_id [Integer] The unique identifier of the column the card should be moved to
|
411
|
+
#
|
412
|
+
# @return ProjectsResult, ProjectsErrorResult
|
413
|
+
def move_a_project_card(card_id, position, column_id, _options)
|
414
|
+
auth = nil
|
415
|
+
body = { position: position, column_id: column_id }
|
416
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
417
|
+
params = nil
|
418
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/cards/#{card_id}/moves"
|
419
|
+
|
420
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
421
|
+
|
422
|
+
if http_call.successful?
|
423
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
424
|
+
else
|
425
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
# list project cards
|
430
|
+
#
|
431
|
+
# @param column_id [Integer] column_id parameter
|
432
|
+
#
|
433
|
+
# @return ProjectsResult, ProjectsErrorResult
|
434
|
+
def list_project_cards(column_id, options)
|
435
|
+
auth = nil
|
436
|
+
body = nil
|
437
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
438
|
+
params = { archived_state: options[:archived_state], per_page: options[:per_page], page: options[:page] }
|
439
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}/cards"
|
440
|
+
|
441
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
442
|
+
|
443
|
+
if http_call.successful?
|
444
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
445
|
+
else
|
446
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
# create a project card
|
451
|
+
#
|
452
|
+
# @param column_id [Integer] column_id parameter
|
453
|
+
# @param note [String or null] Required. The project card's note
|
454
|
+
# @param content_id [Integer] Required. The unique identifier of the content associated with the card
|
455
|
+
# @param content_type [String] Required. The piece of content associated with the card
|
456
|
+
#
|
457
|
+
# @return ProjectsResult, ProjectsErrorResult
|
458
|
+
def create_a_project_card(column_id, note, content_id, content_type, _options)
|
459
|
+
auth = nil
|
460
|
+
body = { note: note, content_id: content_id, content_type: content_type }
|
461
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
462
|
+
params = nil
|
463
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}/cards"
|
464
|
+
|
465
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
466
|
+
|
467
|
+
if http_call.successful?
|
468
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
469
|
+
else
|
470
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
# list project collaborators
|
475
|
+
#
|
476
|
+
# @param project_id [Integer]
|
477
|
+
#
|
478
|
+
# @return ProjectsResult, ProjectsErrorResult
|
479
|
+
def list_project_collaborators(project_id, options)
|
480
|
+
auth = nil
|
481
|
+
body = nil
|
482
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
483
|
+
params = { affiliation: options[:affiliation], per_page: options[:per_page], page: options[:page] }
|
484
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/collaborators"
|
485
|
+
|
486
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
487
|
+
|
488
|
+
if http_call.successful?
|
489
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
490
|
+
else
|
491
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
# add project collaborator
|
496
|
+
#
|
497
|
+
# @param project_id [Integer]
|
498
|
+
# @param username [String]
|
499
|
+
# @param permission [String] The permission to grant the collaborator.Default: write
|
500
|
+
#
|
501
|
+
# @return ProjectsResult, ProjectsErrorResult
|
502
|
+
def add_project_collaborator(project_id, username, permission, _options)
|
503
|
+
auth = nil
|
504
|
+
body = { permission: permission }
|
505
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
506
|
+
params = nil
|
507
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/collaborators/#{username}"
|
508
|
+
|
509
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
510
|
+
|
511
|
+
if http_call.successful?
|
512
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
513
|
+
else
|
514
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
# remove user as a collaborator
|
519
|
+
#
|
520
|
+
# @param project_id [Integer]
|
521
|
+
# @param username [String]
|
522
|
+
#
|
523
|
+
# @return ProjectsResult, ProjectsErrorResult
|
524
|
+
def remove_user_as_a_collaborator(project_id, username, _options)
|
525
|
+
auth = nil
|
526
|
+
body = nil
|
527
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
528
|
+
params = nil
|
529
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/collaborators/#{username}"
|
530
|
+
|
531
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
532
|
+
|
533
|
+
if http_call.successful?
|
534
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
535
|
+
else
|
536
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
# get project permission for a user
|
541
|
+
#
|
542
|
+
# @param project_id [Integer]
|
543
|
+
# @param username [String]
|
544
|
+
#
|
545
|
+
# @return ProjectsResult, ProjectsErrorResult
|
546
|
+
def get_project_permission_for_a_user(project_id, username, _options)
|
547
|
+
auth = nil
|
548
|
+
body = nil
|
549
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
550
|
+
params = nil
|
551
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/collaborators/#{username}/permission"
|
552
|
+
|
553
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
554
|
+
|
555
|
+
if http_call.successful?
|
556
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
557
|
+
else
|
558
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
562
|
+
# get a project column
|
563
|
+
#
|
564
|
+
# @param column_id [Integer] column_id parameter
|
565
|
+
#
|
566
|
+
# @return ProjectsResult, ProjectsErrorResult
|
567
|
+
def get_a_project_column(column_id, _options)
|
568
|
+
auth = nil
|
569
|
+
body = nil
|
570
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
571
|
+
params = nil
|
572
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}"
|
573
|
+
|
574
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
575
|
+
|
576
|
+
if http_call.successful?
|
577
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
578
|
+
else
|
579
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
# update an existing project column
|
584
|
+
#
|
585
|
+
# @param column_id [Integer] column_id parameter
|
586
|
+
# @param name [String] Required. Name of the project column
|
587
|
+
#
|
588
|
+
# @return ProjectsResult, ProjectsErrorResult
|
589
|
+
def update_an_existing_project_column(column_id, name, _options)
|
590
|
+
auth = nil
|
591
|
+
body = { name: name }
|
592
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
593
|
+
params = nil
|
594
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}"
|
595
|
+
|
596
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
597
|
+
|
598
|
+
if http_call.successful?
|
599
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
600
|
+
else
|
601
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
# delete a project column
|
606
|
+
#
|
607
|
+
# @param column_id [Integer] column_id parameter
|
608
|
+
#
|
609
|
+
# @return ProjectsResult, ProjectsErrorResult
|
610
|
+
def delete_a_project_column(column_id, _options)
|
611
|
+
auth = nil
|
612
|
+
body = nil
|
613
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
614
|
+
params = nil
|
615
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}"
|
616
|
+
|
617
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
618
|
+
|
619
|
+
if http_call.successful?
|
620
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
621
|
+
else
|
622
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
626
|
+
# move a project column
|
627
|
+
#
|
628
|
+
# @param column_id [Integer] column_id parameter
|
629
|
+
# @param position [String] Required. The position of the column in a project. Can be one of: first, last, or after:<column_id> to place after the specified column.
|
630
|
+
#
|
631
|
+
# @return ProjectsResult, ProjectsErrorResult
|
632
|
+
def move_a_project_column(column_id, position, _options)
|
633
|
+
auth = nil
|
634
|
+
body = { position: position }
|
635
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
636
|
+
params = nil
|
637
|
+
uri = "#{Gitabu::BASE_URL}/projects/columns/#{column_id}/moves"
|
638
|
+
|
639
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
640
|
+
|
641
|
+
if http_call.successful?
|
642
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
643
|
+
else
|
644
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
# list project columns
|
649
|
+
#
|
650
|
+
# @param project_id [Integer]
|
651
|
+
#
|
652
|
+
# @return ProjectsResult, ProjectsErrorResult
|
653
|
+
def list_project_columns(project_id, options)
|
654
|
+
auth = nil
|
655
|
+
body = nil
|
656
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
657
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
658
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/columns"
|
659
|
+
|
660
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
661
|
+
|
662
|
+
if http_call.successful?
|
663
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
664
|
+
else
|
665
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
666
|
+
end
|
667
|
+
end
|
668
|
+
|
669
|
+
# create a project column
|
670
|
+
#
|
671
|
+
# @param project_id [Integer]
|
672
|
+
# @param name [String] Required. Name of the project column
|
673
|
+
#
|
674
|
+
# @return ProjectsResult, ProjectsErrorResult
|
675
|
+
def create_a_project_column(project_id, name, _options)
|
676
|
+
auth = nil
|
677
|
+
body = { name: name }
|
678
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
679
|
+
params = nil
|
680
|
+
uri = "#{Gitabu::BASE_URL}/projects/#{project_id}/columns"
|
681
|
+
|
682
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
683
|
+
|
684
|
+
if http_call.successful?
|
685
|
+
ProjectsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
686
|
+
else
|
687
|
+
ProjectsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
688
|
+
end
|
689
|
+
end
|
690
|
+
end
|
691
|
+
end
|
692
|
+
end
|
693
|
+
end
|