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,1119 @@
|
|
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 Issues result
|
17
|
+
class IssuesResult
|
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 IssuesErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Issues endpoints.
|
37
|
+
class Issues
|
38
|
+
def self.list_issues_assigned_to_the_authenticated_user(options: nil)
|
39
|
+
new.list_issues_assigned_to_the_authenticated_user(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.list_organization_issues_assigned_to_the_authenticated_user(org: nil, options: nil)
|
43
|
+
new.list_organization_issues_assigned_to_the_authenticated_user(org, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.list_repository_issues(owner: nil, repo: nil, options: nil)
|
47
|
+
new.list_repository_issues(owner, repo, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.create_an_issue(owner: nil, repo: nil, title: nil, body: nil, assignee: nil, milestone: nil, labels: nil, assignees: nil, options: nil)
|
51
|
+
new.create_an_issue(owner, repo, title, body, assignee, milestone, labels, assignees, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_an_issue(owner: nil, repo: nil, issue_number: nil, options: nil)
|
55
|
+
new.get_an_issue(owner, repo, issue_number, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.update_an_issue(owner: nil, repo: nil, issue_number: nil, title: nil, body: nil, assignee: nil, state: nil, milestone: nil, labels: nil, assignees: nil, options: nil)
|
59
|
+
new.update_an_issue(owner, repo, issue_number, title, body, assignee, state, milestone, labels, assignees, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.lock_an_issue(owner: nil, repo: nil, issue_number: nil, lock_reason: nil, options: nil)
|
63
|
+
new.lock_an_issue(owner, repo, issue_number, lock_reason, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.unlock_an_issue(owner: nil, repo: nil, issue_number: nil, options: nil)
|
67
|
+
new.unlock_an_issue(owner, repo, issue_number, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_user_account_issues_assigned_to_the_authenticated_user(options: nil)
|
71
|
+
new.list_user_account_issues_assigned_to_the_authenticated_user(options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.list_assignees(owner: nil, repo: nil, options: nil)
|
75
|
+
new.list_assignees(owner, repo, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.check_if_a_user_can_be_assigned(owner: nil, repo: nil, assignee: nil, options: nil)
|
79
|
+
new.check_if_a_user_can_be_assigned(owner, repo, assignee, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.add_assignees_to_an_issue(owner: nil, repo: nil, issue_number: nil, assignees: nil, options: nil)
|
83
|
+
new.add_assignees_to_an_issue(owner, repo, issue_number, assignees, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.remove_assignees_from_an_issue(owner: nil, repo: nil, issue_number: nil, assignees: nil, options: nil)
|
87
|
+
new.remove_assignees_from_an_issue(owner, repo, issue_number, assignees, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.list_issue_comments_for_a_repository(owner: nil, repo: nil, options: nil)
|
91
|
+
new.list_issue_comments_for_a_repository(owner, repo, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.get_an_issue_comment(owner: nil, repo: nil, comment_id: nil, options: nil)
|
95
|
+
new.get_an_issue_comment(owner, repo, comment_id, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.update_an_issue_comment(owner: nil, repo: nil, comment_id: nil, body: nil, options: nil)
|
99
|
+
new.update_an_issue_comment(owner, repo, comment_id, body, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.delete_an_issue_comment(owner: nil, repo: nil, comment_id: nil, options: nil)
|
103
|
+
new.delete_an_issue_comment(owner, repo, comment_id, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.list_issue_comments(owner: nil, repo: nil, issue_number: nil, options: nil)
|
107
|
+
new.list_issue_comments(owner, repo, issue_number, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.create_an_issue_comment(owner: nil, repo: nil, issue_number: nil, body: nil, options: nil)
|
111
|
+
new.create_an_issue_comment(owner, repo, issue_number, body, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.list_issue_events_for_a_repository(owner: nil, repo: nil, options: nil)
|
115
|
+
new.list_issue_events_for_a_repository(owner, repo, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.get_an_issue_event(owner: nil, repo: nil, event_id: nil, options: nil)
|
119
|
+
new.get_an_issue_event(owner, repo, event_id, options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.list_issue_events(owner: nil, repo: nil, issue_number: nil, options: nil)
|
123
|
+
new.list_issue_events(owner, repo, issue_number, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.list_labels_for_an_issue(owner: nil, repo: nil, issue_number: nil, options: nil)
|
127
|
+
new.list_labels_for_an_issue(owner, repo, issue_number, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.add_labels_to_an_issue(owner: nil, repo: nil, issue_number: nil, labels: nil, options: nil)
|
131
|
+
new.add_labels_to_an_issue(owner, repo, issue_number, labels, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.set_labels_for_an_issue(owner: nil, repo: nil, issue_number: nil, labels: nil, options: nil)
|
135
|
+
new.set_labels_for_an_issue(owner, repo, issue_number, labels, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.remove_all_labels_from_an_issue(owner: nil, repo: nil, issue_number: nil, options: nil)
|
139
|
+
new.remove_all_labels_from_an_issue(owner, repo, issue_number, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.remove_a_label_from_an_issue(owner: nil, repo: nil, issue_number: nil, name: nil, options: nil)
|
143
|
+
new.remove_a_label_from_an_issue(owner, repo, issue_number, name, options)
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.list_labels_for_a_repository(owner: nil, repo: nil, options: nil)
|
147
|
+
new.list_labels_for_a_repository(owner, repo, options)
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.create_a_label(owner: nil, repo: nil, name: nil, color: nil, description: nil, options: nil)
|
151
|
+
new.create_a_label(owner, repo, name, color, description, options)
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.get_a_label(owner: nil, repo: nil, name: nil, options: nil)
|
155
|
+
new.get_a_label(owner, repo, name, options)
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.update_a_label(owner: nil, repo: nil, name: nil, new_name: nil, color: nil, description: nil, options: nil)
|
159
|
+
new.update_a_label(owner, repo, name, new_name, color, description, options)
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.delete_a_label(owner: nil, repo: nil, name: nil, options: nil)
|
163
|
+
new.delete_a_label(owner, repo, name, options)
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.list_labels_for_issues_in_a_milestone(owner: nil, repo: nil, milestone_number: nil, options: nil)
|
167
|
+
new.list_labels_for_issues_in_a_milestone(owner, repo, milestone_number, options)
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.list_milestones(owner: nil, repo: nil, options: nil)
|
171
|
+
new.list_milestones(owner, repo, options)
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.create_a_milestone(owner: nil, repo: nil, title: nil, state: nil, description: nil, due_on: nil, options: nil)
|
175
|
+
new.create_a_milestone(owner, repo, title, state, description, due_on, options)
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.get_a_milestone(owner: nil, repo: nil, milestone_number: nil, options: nil)
|
179
|
+
new.get_a_milestone(owner, repo, milestone_number, options)
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.update_a_milestone(owner: nil, repo: nil, milestone_number: nil, title: nil, state: nil, description: nil, due_on: nil, options: nil)
|
183
|
+
new.update_a_milestone(owner, repo, milestone_number, title, state, description, due_on, options)
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.delete_a_milestone(owner: nil, repo: nil, milestone_number: nil, options: nil)
|
187
|
+
new.delete_a_milestone(owner, repo, milestone_number, options)
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.list_timeline_events_for_an_issue(owner: nil, repo: nil, issue_number: nil, options: nil)
|
191
|
+
new.list_timeline_events_for_an_issue(owner, repo, issue_number, options)
|
192
|
+
end
|
193
|
+
|
194
|
+
private
|
195
|
+
|
196
|
+
# list issues assigned to the authenticated user
|
197
|
+
#
|
198
|
+
# @params options [Hash]
|
199
|
+
#
|
200
|
+
# @return IssuesResult, IssuesErrorResult
|
201
|
+
def list_issues_assigned_to_the_authenticated_user(options)
|
202
|
+
auth = nil
|
203
|
+
body = nil
|
204
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
205
|
+
params = { filter: options[:filter], state: options[:state], labels: options[:labels], sort: options[:sort], direction: options[:direction], since: options[:since], collab: options[:collab], orgs: options[:orgs], owned: options[:owned], pulls: options[:pulls], per_page: options[:per_page], page: options[:page] }
|
206
|
+
uri = "#{Gitabu::BASE_URL}/issues"
|
207
|
+
|
208
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
209
|
+
|
210
|
+
if http_call.successful?
|
211
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
212
|
+
else
|
213
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# list organization issues assigned to the authenticated user
|
218
|
+
#
|
219
|
+
# @param org [String]
|
220
|
+
#
|
221
|
+
# @return IssuesResult, IssuesErrorResult
|
222
|
+
def list_organization_issues_assigned_to_the_authenticated_user(org, options)
|
223
|
+
auth = nil
|
224
|
+
body = nil
|
225
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
226
|
+
params = { filter: options[:filter], state: options[:state], labels: options[:labels], sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
227
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/issues"
|
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
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
233
|
+
else
|
234
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# list repository issues
|
239
|
+
#
|
240
|
+
# @param owner [String]
|
241
|
+
# @param repo [String]
|
242
|
+
#
|
243
|
+
# @return IssuesResult, IssuesErrorResult
|
244
|
+
def list_repository_issues(owner, repo, options)
|
245
|
+
auth = nil
|
246
|
+
body = nil
|
247
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
248
|
+
params = { milestone: options[:milestone], state: options[:state], assignee: options[:assignee], creator: options[:creator], mentioned: options[:mentioned], labels: options[:labels], sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
249
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues"
|
250
|
+
|
251
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
252
|
+
|
253
|
+
if http_call.successful?
|
254
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
255
|
+
else
|
256
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
# create an issue
|
261
|
+
#
|
262
|
+
# @param owner [String]
|
263
|
+
# @param repo [String]
|
264
|
+
# @param title [String or integer or ] Required. The title of the issue.
|
265
|
+
# @param body [String] The contents of the issue.
|
266
|
+
# @param assignee [String or null] Login for the user that this issue should be assigned to. NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. This field is deprecated.
|
267
|
+
# @param milestone [String or integer or null or string or integer] The number of the milestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.
|
268
|
+
# @param labels [Array of strings or array of objects] Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
|
269
|
+
# @param assignees [Array of strings] Logins for Users to assign to this issue. NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise.
|
270
|
+
#
|
271
|
+
# @return IssuesResult, IssuesErrorResult
|
272
|
+
def create_an_issue(owner, repo, title, body, assignee, milestone, labels, assignees, _options)
|
273
|
+
auth = nil
|
274
|
+
body = { title: title, body: body, assignee: assignee, milestone: milestone, labels: labels, assignees: assignees }
|
275
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
276
|
+
params = nil
|
277
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues"
|
278
|
+
|
279
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
280
|
+
|
281
|
+
if http_call.successful?
|
282
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
283
|
+
else
|
284
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# get an issue
|
289
|
+
#
|
290
|
+
# @param owner [String]
|
291
|
+
# @param repo [String]
|
292
|
+
# @param issue_number [Integer] issue_number parameter
|
293
|
+
#
|
294
|
+
# @return IssuesResult, IssuesErrorResult
|
295
|
+
def get_an_issue(owner, repo, issue_number, _options)
|
296
|
+
auth = nil
|
297
|
+
body = nil
|
298
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
299
|
+
params = nil
|
300
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}"
|
301
|
+
|
302
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
303
|
+
|
304
|
+
if http_call.successful?
|
305
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
306
|
+
else
|
307
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
# update an issue
|
312
|
+
#
|
313
|
+
# @param owner [String]
|
314
|
+
# @param repo [String]
|
315
|
+
# @param issue_number [Integer] issue_number parameter
|
316
|
+
# @param title [String or integer or null or string or integer] The title of the issue.
|
317
|
+
# @param body [String or null] The contents of the issue.
|
318
|
+
# @param assignee [String or null] Login for the user that this issue should be assigned to. This field is deprecated.
|
319
|
+
# @param state [String] State of the issue. Either open or closed.
|
320
|
+
# @param milestone [String or integer or null or string or integer] The number of the milestone to associate this issue with or null to remove current. NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise.
|
321
|
+
# @param labels [Array of strings or array of objects] Labels to associate with this issue. Pass one or more Labels to replace the set of Labels on this Issue. Send an empty array ([]) to clear all Labels from the Issue. NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise.
|
322
|
+
# @param assignees [Array of strings] Logins for Users to assign to this issue. Pass one or more user logins to replace the set of assignees on this Issue. Send an empty array ([]) to clear all assignees from the Issue. NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise.
|
323
|
+
#
|
324
|
+
# @return IssuesResult, IssuesErrorResult
|
325
|
+
def update_an_issue(owner, repo, issue_number, title, body, assignee, state, milestone, labels, assignees, _options)
|
326
|
+
auth = nil
|
327
|
+
body = { title: title, body: body, assignee: assignee, state: state, milestone: milestone, labels: labels, assignees: assignees }
|
328
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
329
|
+
params = nil
|
330
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}"
|
331
|
+
|
332
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
333
|
+
|
334
|
+
if http_call.successful?
|
335
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
336
|
+
else
|
337
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
# lock an issue
|
342
|
+
#
|
343
|
+
# @param owner [String]
|
344
|
+
# @param repo [String]
|
345
|
+
# @param issue_number [Integer] issue_number parameter
|
346
|
+
# @param lock_reason [String] The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons:
|
347
|
+
# * off-topic
|
348
|
+
# * too heated
|
349
|
+
# * resolved
|
350
|
+
# * spam
|
351
|
+
#
|
352
|
+
# @return IssuesResult, IssuesErrorResult
|
353
|
+
def lock_an_issue(owner, repo, issue_number, lock_reason, _options)
|
354
|
+
auth = nil
|
355
|
+
body = { lock_reason: lock_reason }
|
356
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
357
|
+
params = nil
|
358
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/lock"
|
359
|
+
|
360
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
361
|
+
|
362
|
+
if http_call.successful?
|
363
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
364
|
+
else
|
365
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
# unlock an issue
|
370
|
+
#
|
371
|
+
# @param owner [String]
|
372
|
+
# @param repo [String]
|
373
|
+
# @param issue_number [Integer] issue_number parameter
|
374
|
+
#
|
375
|
+
# @return IssuesResult, IssuesErrorResult
|
376
|
+
def unlock_an_issue(owner, repo, issue_number, _options)
|
377
|
+
auth = nil
|
378
|
+
body = nil
|
379
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
380
|
+
params = nil
|
381
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/lock"
|
382
|
+
|
383
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
384
|
+
|
385
|
+
if http_call.successful?
|
386
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
387
|
+
else
|
388
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
# list user account issues assigned to the authenticated user
|
393
|
+
#
|
394
|
+
# @params options [Hash]
|
395
|
+
#
|
396
|
+
# @return IssuesResult, IssuesErrorResult
|
397
|
+
def list_user_account_issues_assigned_to_the_authenticated_user(options)
|
398
|
+
auth = nil
|
399
|
+
body = nil
|
400
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
401
|
+
params = { filter: options[:filter], state: options[:state], labels: options[:labels], sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
402
|
+
uri = "#{Gitabu::BASE_URL}/user/issues"
|
403
|
+
|
404
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
405
|
+
|
406
|
+
if http_call.successful?
|
407
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
408
|
+
else
|
409
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
# list assignees
|
414
|
+
#
|
415
|
+
# @param owner [String]
|
416
|
+
# @param repo [String]
|
417
|
+
#
|
418
|
+
# @return IssuesResult, IssuesErrorResult
|
419
|
+
def list_assignees(owner, repo, options)
|
420
|
+
auth = nil
|
421
|
+
body = nil
|
422
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
423
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
424
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/assignees"
|
425
|
+
|
426
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
427
|
+
|
428
|
+
if http_call.successful?
|
429
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
430
|
+
else
|
431
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
# check if a user can be assigned
|
436
|
+
#
|
437
|
+
# @param owner [String]
|
438
|
+
# @param repo [String]
|
439
|
+
# @param assignee [String]
|
440
|
+
#
|
441
|
+
# @return IssuesResult, IssuesErrorResult
|
442
|
+
def check_if_a_user_can_be_assigned(owner, repo, assignee, _options)
|
443
|
+
auth = nil
|
444
|
+
body = nil
|
445
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
446
|
+
params = nil
|
447
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/assignees/#{assignee}"
|
448
|
+
|
449
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
450
|
+
|
451
|
+
if http_call.successful?
|
452
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
453
|
+
else
|
454
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
# add assignees to an issue
|
459
|
+
#
|
460
|
+
# @param owner [String]
|
461
|
+
# @param repo [String]
|
462
|
+
# @param issue_number [Integer] issue_number parameter
|
463
|
+
# @param assignees [Array of strings] Usernames of people to assign this issue to. NOTE: Only users with push access can add assignees to an issue. Assignees are silently ignored otherwise.
|
464
|
+
#
|
465
|
+
# @return IssuesResult, IssuesErrorResult
|
466
|
+
def add_assignees_to_an_issue(owner, repo, issue_number, assignees, _options)
|
467
|
+
auth = nil
|
468
|
+
body = { assignees: assignees }
|
469
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
470
|
+
params = nil
|
471
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/assignees"
|
472
|
+
|
473
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
474
|
+
|
475
|
+
if http_call.successful?
|
476
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
477
|
+
else
|
478
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
# remove assignees from an issue
|
483
|
+
#
|
484
|
+
# @param owner [String]
|
485
|
+
# @param repo [String]
|
486
|
+
# @param issue_number [Integer] issue_number parameter
|
487
|
+
# @param assignees [Array of strings] Usernames of assignees to remove from an issue. NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise.
|
488
|
+
#
|
489
|
+
# @return IssuesResult, IssuesErrorResult
|
490
|
+
def remove_assignees_from_an_issue(owner, repo, issue_number, assignees, _options)
|
491
|
+
auth = nil
|
492
|
+
body = { assignees: assignees }
|
493
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
494
|
+
params = nil
|
495
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/assignees"
|
496
|
+
|
497
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
498
|
+
|
499
|
+
if http_call.successful?
|
500
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
501
|
+
else
|
502
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
# list issue comments for a repository
|
507
|
+
#
|
508
|
+
# @param owner [String]
|
509
|
+
# @param repo [String]
|
510
|
+
#
|
511
|
+
# @return IssuesResult, IssuesErrorResult
|
512
|
+
def list_issue_comments_for_a_repository(owner, repo, options)
|
513
|
+
auth = nil
|
514
|
+
body = nil
|
515
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
516
|
+
params = { sort: options[:sort], direction: options[:direction], since: options[:since], per_page: options[:per_page], page: options[:page] }
|
517
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/comments"
|
518
|
+
|
519
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
520
|
+
|
521
|
+
if http_call.successful?
|
522
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
523
|
+
else
|
524
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
528
|
+
# get an issue comment
|
529
|
+
#
|
530
|
+
# @param owner [String]
|
531
|
+
# @param repo [String]
|
532
|
+
# @param comment_id [Integer] comment_id parameter
|
533
|
+
#
|
534
|
+
# @return IssuesResult, IssuesErrorResult
|
535
|
+
def get_an_issue_comment(owner, repo, comment_id, _options)
|
536
|
+
auth = nil
|
537
|
+
body = nil
|
538
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
539
|
+
params = nil
|
540
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/comments/#{comment_id}"
|
541
|
+
|
542
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
543
|
+
|
544
|
+
if http_call.successful?
|
545
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
546
|
+
else
|
547
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
# update an issue comment
|
552
|
+
#
|
553
|
+
# @param owner [String]
|
554
|
+
# @param repo [String]
|
555
|
+
# @param comment_id [Integer] comment_id parameter
|
556
|
+
# @param body [String] Required. The contents of the comment.
|
557
|
+
#
|
558
|
+
# @return IssuesResult, IssuesErrorResult
|
559
|
+
def update_an_issue_comment(owner, repo, comment_id, body, _options)
|
560
|
+
auth = nil
|
561
|
+
body = { body: body }
|
562
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
563
|
+
params = nil
|
564
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/comments/#{comment_id}"
|
565
|
+
|
566
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
567
|
+
|
568
|
+
if http_call.successful?
|
569
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
570
|
+
else
|
571
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
# delete an issue comment
|
576
|
+
#
|
577
|
+
# @param owner [String]
|
578
|
+
# @param repo [String]
|
579
|
+
# @param comment_id [Integer] comment_id parameter
|
580
|
+
#
|
581
|
+
# @return IssuesResult, IssuesErrorResult
|
582
|
+
def delete_an_issue_comment(owner, repo, comment_id, _options)
|
583
|
+
auth = nil
|
584
|
+
body = nil
|
585
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
586
|
+
params = nil
|
587
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/comments/#{comment_id}"
|
588
|
+
|
589
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
590
|
+
|
591
|
+
if http_call.successful?
|
592
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
593
|
+
else
|
594
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
# list issue comments
|
599
|
+
#
|
600
|
+
# @param owner [String]
|
601
|
+
# @param repo [String]
|
602
|
+
# @param issue_number [Integer] issue_number parameter
|
603
|
+
#
|
604
|
+
# @return IssuesResult, IssuesErrorResult
|
605
|
+
def list_issue_comments(owner, repo, issue_number, options)
|
606
|
+
auth = nil
|
607
|
+
body = nil
|
608
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
609
|
+
params = { since: options[:since], per_page: options[:per_page], page: options[:page] }
|
610
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/comments"
|
611
|
+
|
612
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
613
|
+
|
614
|
+
if http_call.successful?
|
615
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
616
|
+
else
|
617
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
# create an issue comment
|
622
|
+
#
|
623
|
+
# @param owner [String]
|
624
|
+
# @param repo [String]
|
625
|
+
# @param issue_number [Integer] issue_number parameter
|
626
|
+
# @param body [String] Required. The contents of the comment.
|
627
|
+
#
|
628
|
+
# @return IssuesResult, IssuesErrorResult
|
629
|
+
def create_an_issue_comment(owner, repo, issue_number, body, _options)
|
630
|
+
auth = nil
|
631
|
+
body = { body: body }
|
632
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
633
|
+
params = nil
|
634
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/comments"
|
635
|
+
|
636
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
637
|
+
|
638
|
+
if http_call.successful?
|
639
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
640
|
+
else
|
641
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
# list issue events for a repository
|
646
|
+
#
|
647
|
+
# @param owner [String]
|
648
|
+
# @param repo [String]
|
649
|
+
#
|
650
|
+
# @return IssuesResult, IssuesErrorResult
|
651
|
+
def list_issue_events_for_a_repository(owner, repo, options)
|
652
|
+
auth = nil
|
653
|
+
body = nil
|
654
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
655
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
656
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/events"
|
657
|
+
|
658
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
659
|
+
|
660
|
+
if http_call.successful?
|
661
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
662
|
+
else
|
663
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
664
|
+
end
|
665
|
+
end
|
666
|
+
|
667
|
+
# get an issue event
|
668
|
+
#
|
669
|
+
# @param owner [String]
|
670
|
+
# @param repo [String]
|
671
|
+
# @param event_id [Integer]
|
672
|
+
#
|
673
|
+
# @return IssuesResult, IssuesErrorResult
|
674
|
+
def get_an_issue_event(owner, repo, event_id, _options)
|
675
|
+
auth = nil
|
676
|
+
body = nil
|
677
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
678
|
+
params = nil
|
679
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/events/#{event_id}"
|
680
|
+
|
681
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
682
|
+
|
683
|
+
if http_call.successful?
|
684
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
685
|
+
else
|
686
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
687
|
+
end
|
688
|
+
end
|
689
|
+
|
690
|
+
# list issue events
|
691
|
+
#
|
692
|
+
# @param owner [String]
|
693
|
+
# @param repo [String]
|
694
|
+
# @param issue_number [Integer] issue_number parameter
|
695
|
+
#
|
696
|
+
# @return IssuesResult, IssuesErrorResult
|
697
|
+
def list_issue_events(owner, repo, issue_number, options)
|
698
|
+
auth = nil
|
699
|
+
body = nil
|
700
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
701
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
702
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/events"
|
703
|
+
|
704
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
705
|
+
|
706
|
+
if http_call.successful?
|
707
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
708
|
+
else
|
709
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
# list labels for an issue
|
714
|
+
#
|
715
|
+
# @param owner [String]
|
716
|
+
# @param repo [String]
|
717
|
+
# @param issue_number [Integer] issue_number parameter
|
718
|
+
#
|
719
|
+
# @return IssuesResult, IssuesErrorResult
|
720
|
+
def list_labels_for_an_issue(owner, repo, issue_number, options)
|
721
|
+
auth = nil
|
722
|
+
body = nil
|
723
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
724
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
725
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/labels"
|
726
|
+
|
727
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
728
|
+
|
729
|
+
if http_call.successful?
|
730
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
731
|
+
else
|
732
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
# add labels to an issue
|
737
|
+
#
|
738
|
+
# @param owner [String]
|
739
|
+
# @param repo [String]
|
740
|
+
# @param issue_number [Integer] issue_number parameter
|
741
|
+
# @param labels [Array of strings] The names of the labels to add to the issue's existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also replace all of the labels for an issue. For more information, see "Set labels for an issue."
|
742
|
+
#
|
743
|
+
# @return IssuesResult, IssuesErrorResult
|
744
|
+
def add_labels_to_an_issue(owner, repo, issue_number, labels, _options)
|
745
|
+
auth = nil
|
746
|
+
body = { labels: labels }
|
747
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
748
|
+
params = nil
|
749
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/labels"
|
750
|
+
|
751
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
752
|
+
|
753
|
+
if http_call.successful?
|
754
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
755
|
+
else
|
756
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
760
|
+
# set labels for an issue
|
761
|
+
#
|
762
|
+
# @param owner [String]
|
763
|
+
# @param repo [String]
|
764
|
+
# @param issue_number [Integer] issue_number parameter
|
765
|
+
# @param labels [Array of strings] The names of the labels to set for the issue. The labels you set replace any existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also add labels to the existing labels for an issue. For more information, see "Add labels to an issue."
|
766
|
+
#
|
767
|
+
# @return IssuesResult, IssuesErrorResult
|
768
|
+
def set_labels_for_an_issue(owner, repo, issue_number, labels, _options)
|
769
|
+
auth = nil
|
770
|
+
body = { labels: labels }
|
771
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
772
|
+
params = nil
|
773
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/labels"
|
774
|
+
|
775
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
776
|
+
|
777
|
+
if http_call.successful?
|
778
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
779
|
+
else
|
780
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
781
|
+
end
|
782
|
+
end
|
783
|
+
|
784
|
+
# remove all labels from an issue
|
785
|
+
#
|
786
|
+
# @param owner [String]
|
787
|
+
# @param repo [String]
|
788
|
+
# @param issue_number [Integer] issue_number parameter
|
789
|
+
#
|
790
|
+
# @return IssuesResult, IssuesErrorResult
|
791
|
+
def remove_all_labels_from_an_issue(owner, repo, issue_number, _options)
|
792
|
+
auth = nil
|
793
|
+
body = nil
|
794
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
795
|
+
params = nil
|
796
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/labels"
|
797
|
+
|
798
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
799
|
+
|
800
|
+
if http_call.successful?
|
801
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
802
|
+
else
|
803
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
807
|
+
# remove a label from an issue
|
808
|
+
#
|
809
|
+
# @param owner [String]
|
810
|
+
# @param repo [String]
|
811
|
+
# @param issue_number [Integer] issue_number parameter
|
812
|
+
# @param name [String]
|
813
|
+
#
|
814
|
+
# @return IssuesResult, IssuesErrorResult
|
815
|
+
def remove_a_label_from_an_issue(owner, repo, issue_number, name, _options)
|
816
|
+
auth = nil
|
817
|
+
body = nil
|
818
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
819
|
+
params = nil
|
820
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/labels/#{name}"
|
821
|
+
|
822
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
823
|
+
|
824
|
+
if http_call.successful?
|
825
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
826
|
+
else
|
827
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
828
|
+
end
|
829
|
+
end
|
830
|
+
|
831
|
+
# list labels for a repository
|
832
|
+
#
|
833
|
+
# @param owner [String]
|
834
|
+
# @param repo [String]
|
835
|
+
#
|
836
|
+
# @return IssuesResult, IssuesErrorResult
|
837
|
+
def list_labels_for_a_repository(owner, repo, options)
|
838
|
+
auth = nil
|
839
|
+
body = nil
|
840
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
841
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
842
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/labels"
|
843
|
+
|
844
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
845
|
+
|
846
|
+
if http_call.successful?
|
847
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
848
|
+
else
|
849
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
850
|
+
end
|
851
|
+
end
|
852
|
+
|
853
|
+
# create a label
|
854
|
+
#
|
855
|
+
# @param owner [String]
|
856
|
+
# @param repo [String]
|
857
|
+
# @param name [String] Required. The name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing :strawberry: will render the emoji . For a full list of available emoji and codes, see "Emoji cheat sheet."
|
858
|
+
# @param color [String] The hexadecimal color code for the label, without the leading #.
|
859
|
+
# @param description [String] A short description of the label. Must be 100 characters or fewer.
|
860
|
+
#
|
861
|
+
# @return IssuesResult, IssuesErrorResult
|
862
|
+
def create_a_label(owner, repo, name, color, description, _options)
|
863
|
+
auth = nil
|
864
|
+
body = { name: name, color: color, description: description }
|
865
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
866
|
+
params = nil
|
867
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/labels"
|
868
|
+
|
869
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
870
|
+
|
871
|
+
if http_call.successful?
|
872
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
873
|
+
else
|
874
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
875
|
+
end
|
876
|
+
end
|
877
|
+
|
878
|
+
# get a label
|
879
|
+
#
|
880
|
+
# @param owner [String]
|
881
|
+
# @param repo [String]
|
882
|
+
# @param name [String]
|
883
|
+
#
|
884
|
+
# @return IssuesResult, IssuesErrorResult
|
885
|
+
def get_a_label(owner, repo, name, _options)
|
886
|
+
auth = nil
|
887
|
+
body = nil
|
888
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
889
|
+
params = nil
|
890
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/labels/#{name}"
|
891
|
+
|
892
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
893
|
+
|
894
|
+
if http_call.successful?
|
895
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
896
|
+
else
|
897
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
898
|
+
end
|
899
|
+
end
|
900
|
+
|
901
|
+
# update a label
|
902
|
+
#
|
903
|
+
# @param owner [String]
|
904
|
+
# @param repo [String]
|
905
|
+
# @param name [String]
|
906
|
+
# @param new_name [String] The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing :strawberry: will render the emoji . For a full list of available emoji and codes, see "Emoji cheat sheet."
|
907
|
+
# @param color [String] The hexadecimal color code for the label, without the leading #.
|
908
|
+
# @param description [String] A short description of the label. Must be 100 characters or fewer.
|
909
|
+
#
|
910
|
+
# @return IssuesResult, IssuesErrorResult
|
911
|
+
def update_a_label(owner, repo, name, new_name, color, description, _options)
|
912
|
+
auth = nil
|
913
|
+
body = { new_name: new_name, color: color, description: description }
|
914
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
915
|
+
params = nil
|
916
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/labels/#{name}"
|
917
|
+
|
918
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
919
|
+
|
920
|
+
if http_call.successful?
|
921
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
922
|
+
else
|
923
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
924
|
+
end
|
925
|
+
end
|
926
|
+
|
927
|
+
# delete a label
|
928
|
+
#
|
929
|
+
# @param owner [String]
|
930
|
+
# @param repo [String]
|
931
|
+
# @param name [String]
|
932
|
+
#
|
933
|
+
# @return IssuesResult, IssuesErrorResult
|
934
|
+
def delete_a_label(owner, repo, name, _options)
|
935
|
+
auth = nil
|
936
|
+
body = nil
|
937
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
938
|
+
params = nil
|
939
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/labels/#{name}"
|
940
|
+
|
941
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
942
|
+
|
943
|
+
if http_call.successful?
|
944
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
945
|
+
else
|
946
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
947
|
+
end
|
948
|
+
end
|
949
|
+
|
950
|
+
# list labels for issues in a milestone
|
951
|
+
#
|
952
|
+
# @param owner [String]
|
953
|
+
# @param repo [String]
|
954
|
+
# @param milestone_number [Integer] milestone_number parameter
|
955
|
+
#
|
956
|
+
# @return IssuesResult, IssuesErrorResult
|
957
|
+
def list_labels_for_issues_in_a_milestone(owner, repo, milestone_number, options)
|
958
|
+
auth = nil
|
959
|
+
body = nil
|
960
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
961
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
962
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones/#{milestone_number}/labels"
|
963
|
+
|
964
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
965
|
+
|
966
|
+
if http_call.successful?
|
967
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
968
|
+
else
|
969
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
970
|
+
end
|
971
|
+
end
|
972
|
+
|
973
|
+
# list milestones
|
974
|
+
#
|
975
|
+
# @param owner [String]
|
976
|
+
# @param repo [String]
|
977
|
+
#
|
978
|
+
# @return IssuesResult, IssuesErrorResult
|
979
|
+
def list_milestones(owner, repo, options)
|
980
|
+
auth = nil
|
981
|
+
body = nil
|
982
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
983
|
+
params = { state: options[:state], sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
984
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones"
|
985
|
+
|
986
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
987
|
+
|
988
|
+
if http_call.successful?
|
989
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
990
|
+
else
|
991
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
992
|
+
end
|
993
|
+
end
|
994
|
+
|
995
|
+
# create a milestone
|
996
|
+
#
|
997
|
+
# @param owner [String]
|
998
|
+
# @param repo [String]
|
999
|
+
# @param title [String] Required. The title of the milestone.
|
1000
|
+
# @param state [String] The state of the milestone. Either open or closed.Default: open
|
1001
|
+
# @param description [String] A description of the milestone.
|
1002
|
+
# @param due_on [String] The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
1003
|
+
#
|
1004
|
+
# @return IssuesResult, IssuesErrorResult
|
1005
|
+
def create_a_milestone(owner, repo, title, state, description, due_on, _options)
|
1006
|
+
auth = nil
|
1007
|
+
body = { title: title, state: state, description: description, due_on: due_on }
|
1008
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1009
|
+
params = nil
|
1010
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones"
|
1011
|
+
|
1012
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
1013
|
+
|
1014
|
+
if http_call.successful?
|
1015
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1016
|
+
else
|
1017
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
# get a milestone
|
1022
|
+
#
|
1023
|
+
# @param owner [String]
|
1024
|
+
# @param repo [String]
|
1025
|
+
# @param milestone_number [Integer] milestone_number parameter
|
1026
|
+
#
|
1027
|
+
# @return IssuesResult, IssuesErrorResult
|
1028
|
+
def get_a_milestone(owner, repo, milestone_number, _options)
|
1029
|
+
auth = nil
|
1030
|
+
body = nil
|
1031
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1032
|
+
params = nil
|
1033
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones/#{milestone_number}"
|
1034
|
+
|
1035
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
1036
|
+
|
1037
|
+
if http_call.successful?
|
1038
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1039
|
+
else
|
1040
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1041
|
+
end
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
# update a milestone
|
1045
|
+
#
|
1046
|
+
# @param owner [String]
|
1047
|
+
# @param repo [String]
|
1048
|
+
# @param milestone_number [Integer] milestone_number parameter
|
1049
|
+
# @param title [String] The title of the milestone.
|
1050
|
+
# @param state [String] The state of the milestone. Either open or closed.Default: open
|
1051
|
+
# @param description [String] A description of the milestone.
|
1052
|
+
# @param due_on [String] The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
1053
|
+
#
|
1054
|
+
# @return IssuesResult, IssuesErrorResult
|
1055
|
+
def update_a_milestone(owner, repo, milestone_number, title, state, description, due_on, _options)
|
1056
|
+
auth = nil
|
1057
|
+
body = { title: title, state: state, description: description, due_on: due_on }
|
1058
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1059
|
+
params = nil
|
1060
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones/#{milestone_number}"
|
1061
|
+
|
1062
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
1063
|
+
|
1064
|
+
if http_call.successful?
|
1065
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1066
|
+
else
|
1067
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1068
|
+
end
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
# delete a milestone
|
1072
|
+
#
|
1073
|
+
# @param owner [String]
|
1074
|
+
# @param repo [String]
|
1075
|
+
# @param milestone_number [Integer] milestone_number parameter
|
1076
|
+
#
|
1077
|
+
# @return IssuesResult, IssuesErrorResult
|
1078
|
+
def delete_a_milestone(owner, repo, milestone_number, _options)
|
1079
|
+
auth = nil
|
1080
|
+
body = nil
|
1081
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1082
|
+
params = nil
|
1083
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/milestones/#{milestone_number}"
|
1084
|
+
|
1085
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
1086
|
+
|
1087
|
+
if http_call.successful?
|
1088
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1089
|
+
else
|
1090
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1091
|
+
end
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
# list timeline events for an issue
|
1095
|
+
#
|
1096
|
+
# @param owner [String]
|
1097
|
+
# @param repo [String]
|
1098
|
+
# @param issue_number [Integer] issue_number parameter
|
1099
|
+
#
|
1100
|
+
# @return IssuesResult, IssuesErrorResult
|
1101
|
+
def list_timeline_events_for_an_issue(owner, repo, issue_number, options)
|
1102
|
+
auth = nil
|
1103
|
+
body = nil
|
1104
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1105
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
1106
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/issues/#{issue_number}/timeline"
|
1107
|
+
|
1108
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
1109
|
+
|
1110
|
+
if http_call.successful?
|
1111
|
+
IssuesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1112
|
+
else
|
1113
|
+
IssuesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1114
|
+
end
|
1115
|
+
end
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
end
|
1119
|
+
end
|