octodoggy 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/CONTRIBUTING.md +22 -0
  4. data/LICENSE.md +20 -0
  5. data/README.md +714 -0
  6. data/Rakefile +22 -0
  7. data/lib/ext/sawyer/relation.rb +10 -0
  8. data/lib/octokit.rb +59 -0
  9. data/lib/octokit/arguments.rb +14 -0
  10. data/lib/octokit/authentication.rb +82 -0
  11. data/lib/octokit/client.rb +238 -0
  12. data/lib/octokit/client/authorizations.rb +244 -0
  13. data/lib/octokit/client/commit_comments.rb +95 -0
  14. data/lib/octokit/client/commits.rb +239 -0
  15. data/lib/octokit/client/contents.rb +162 -0
  16. data/lib/octokit/client/deployments.rb +62 -0
  17. data/lib/octokit/client/downloads.rb +50 -0
  18. data/lib/octokit/client/emojis.rb +18 -0
  19. data/lib/octokit/client/events.rb +151 -0
  20. data/lib/octokit/client/feeds.rb +33 -0
  21. data/lib/octokit/client/gists.rb +233 -0
  22. data/lib/octokit/client/gitignore.rb +43 -0
  23. data/lib/octokit/client/hooks.rb +297 -0
  24. data/lib/octokit/client/integrations.rb +77 -0
  25. data/lib/octokit/client/issues.rb +321 -0
  26. data/lib/octokit/client/labels.rb +156 -0
  27. data/lib/octokit/client/legacy_search.rb +42 -0
  28. data/lib/octokit/client/licenses.rb +45 -0
  29. data/lib/octokit/client/markdown.rb +27 -0
  30. data/lib/octokit/client/meta.rb +21 -0
  31. data/lib/octokit/client/milestones.rb +87 -0
  32. data/lib/octokit/client/notifications.rb +171 -0
  33. data/lib/octokit/client/objects.rb +141 -0
  34. data/lib/octokit/client/organizations.rb +768 -0
  35. data/lib/octokit/client/pages.rb +63 -0
  36. data/lib/octokit/client/projects.rb +314 -0
  37. data/lib/octokit/client/pub_sub_hubbub.rb +111 -0
  38. data/lib/octokit/client/pull_requests.rb +301 -0
  39. data/lib/octokit/client/rate_limit.rb +54 -0
  40. data/lib/octokit/client/reactions.rb +158 -0
  41. data/lib/octokit/client/refs.rb +118 -0
  42. data/lib/octokit/client/releases.rb +163 -0
  43. data/lib/octokit/client/repositories.rb +654 -0
  44. data/lib/octokit/client/repository_invitations.rb +103 -0
  45. data/lib/octokit/client/reviews.rb +174 -0
  46. data/lib/octokit/client/say.rb +19 -0
  47. data/lib/octokit/client/search.rb +76 -0
  48. data/lib/octokit/client/service_status.rb +38 -0
  49. data/lib/octokit/client/source_import.rb +161 -0
  50. data/lib/octokit/client/stats.rb +105 -0
  51. data/lib/octokit/client/statuses.rb +47 -0
  52. data/lib/octokit/client/traffic.rb +69 -0
  53. data/lib/octokit/client/users.rb +354 -0
  54. data/lib/octokit/configurable.rb +147 -0
  55. data/lib/octokit/connection.rb +199 -0
  56. data/lib/octokit/default.rb +166 -0
  57. data/lib/octokit/enterprise_admin_client.rb +40 -0
  58. data/lib/octokit/enterprise_admin_client/admin_stats.rb +120 -0
  59. data/lib/octokit/enterprise_admin_client/license.rb +18 -0
  60. data/lib/octokit/enterprise_admin_client/orgs.rb +27 -0
  61. data/lib/octokit/enterprise_admin_client/search_indexing.rb +83 -0
  62. data/lib/octokit/enterprise_admin_client/users.rb +128 -0
  63. data/lib/octokit/enterprise_management_console_client.rb +50 -0
  64. data/lib/octokit/enterprise_management_console_client/management_console.rb +176 -0
  65. data/lib/octokit/error.rb +286 -0
  66. data/lib/octokit/gist.rb +36 -0
  67. data/lib/octokit/middleware/follow_redirects.rb +131 -0
  68. data/lib/octokit/organization.rb +17 -0
  69. data/lib/octokit/preview.rb +38 -0
  70. data/lib/octokit/rate_limit.rb +33 -0
  71. data/lib/octokit/repo_arguments.rb +19 -0
  72. data/lib/octokit/repository.rb +93 -0
  73. data/lib/octokit/response/feed_parser.rb +21 -0
  74. data/lib/octokit/response/raise_error.rb +21 -0
  75. data/lib/octokit/user.rb +19 -0
  76. data/lib/octokit/version.rb +17 -0
  77. data/lib/octokit/warnable.rb +17 -0
  78. data/octokit.gemspec +22 -0
  79. metadata +160 -0
@@ -0,0 +1,301 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Pull Requests API
5
+ #
6
+ # @see https://developer.github.com/v3/pulls/
7
+ module PullRequests
8
+
9
+ # List pull requests for a repository
10
+ #
11
+ # @overload pull_requests(repo, options)
12
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
13
+ # @param options [Hash] Method options
14
+ # @option options [String] :state `open` or `closed`.
15
+ # @return [Array<Sawyer::Resource>] Array of pulls
16
+ # @see https://developer.github.com/v3/pulls/#list-pull-requests
17
+ # @example
18
+ # Octokit.pull_requests('rails/rails', :state => 'closed')
19
+ def pull_requests(repo, options = {})
20
+ paginate "#{Repository.path repo}/pulls", options
21
+ end
22
+ alias :pulls :pull_requests
23
+
24
+ # Get a pull request
25
+ #
26
+ # @see https://developer.github.com/v3/pulls/#get-a-single-pull-request
27
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
28
+ # @param number [Integer] Number of the pull request to fetch
29
+ # @return [Sawyer::Resource] Pull request info
30
+ def pull_request(repo, number, options = {})
31
+ get "#{Repository.path repo}/pulls/#{number}", options
32
+ end
33
+ alias :pull :pull_request
34
+
35
+ # Create a pull request
36
+ #
37
+ # @see https://developer.github.com/v3/pulls/#create-a-pull-request
38
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
39
+ # @param base [String] The branch (or git ref) you want your changes
40
+ # pulled into. This should be an existing branch on the current
41
+ # repository. You cannot submit a pull request to one repo that requests
42
+ # a merge to a base of another repo.
43
+ # @param head [String] The branch (or git ref) where your changes are implemented.
44
+ # @param title [String] Title for the pull request
45
+ # @param body [String] The body for the pull request (optional). Supports GFM.
46
+ # @return [Sawyer::Resource] The newly created pull request
47
+ # @example
48
+ # @client.create_pull_request("octokit/octokit.rb", "master", "feature-branch",
49
+ # "Pull Request title", "Pull Request body")
50
+ def create_pull_request(repo, base, head, title, body = nil, options = {})
51
+ pull = {
52
+ :base => base,
53
+ :head => head,
54
+ :title => title,
55
+ }
56
+ pull[:body] = body unless body.nil?
57
+ post "#{Repository.path repo}/pulls", options.merge(pull)
58
+ end
59
+
60
+ # Create a pull request from existing issue
61
+ #
62
+ # @see https://developer.github.com/v3/pulls/#alternative-input
63
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
64
+ # @param base [String] The branch (or git ref) you want your changes
65
+ # pulled into. This should be an existing branch on the current
66
+ # repository. You cannot submit a pull request to one repo that requests
67
+ # a merge to a base of another repo.
68
+ # @param head [String] The branch (or git ref) where your changes are implemented.
69
+ # @param issue [Integer] Number of Issue on which to base this pull request
70
+ # @return [Sawyer::Resource] The newly created pull request
71
+ def create_pull_request_for_issue(repo, base, head, issue, options = {})
72
+ pull = {
73
+ :base => base,
74
+ :head => head,
75
+ :issue => issue
76
+ }
77
+ post "#{Repository.path repo}/pulls", options.merge(pull)
78
+ end
79
+
80
+ # Update a pull request
81
+ # @overload update_pull_request(repo, number, title=nil, body=nil, state=nil, options = {})
82
+ # @deprecated
83
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
84
+ # @param number [Integer] Number of pull request to update.
85
+ # @param title [String] Title for the pull request.
86
+ # @param body [String] Body content for pull request. Supports GFM.
87
+ # @param state [String] State of the pull request. `open` or `closed`.
88
+ # @overload update_pull_request(repo, number, options = {})
89
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
90
+ # @param number [Integer] Number of pull request to update.
91
+ # @option options [String] :title Title for the pull request.
92
+ # @option options [String] :body Body for the pull request.
93
+ # @option options [String] :state State for the pull request.
94
+ # @return [Sawyer::Resource] Hash representing updated pull request.
95
+ # @see https://developer.github.com/v3/pulls/#update-a-pull-request
96
+ # @example
97
+ # @client.update_pull_request('octokit/octokit.rb', 67, 'new title', 'updated body', 'closed')
98
+ # @example Passing nil for optional attributes to update specific attributes.
99
+ # @client.update_pull_request('octokit/octokit.rb', 67, nil, nil, 'open')
100
+ # @example Empty body by passing empty string
101
+ # @client.update_pull_request('octokit/octokit.rb', 67, nil, '')
102
+ def update_pull_request(*args)
103
+ arguments = Octokit::Arguments.new(args)
104
+ repo = arguments.shift
105
+ number = arguments.shift
106
+ patch "#{Repository.path repo}/pulls/#{number}", arguments.options
107
+ end
108
+
109
+ # Close a pull request
110
+ #
111
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
112
+ # @param number [Integer] Number of pull request to update.
113
+ # @return [Sawyer::Resource] Hash representing updated pull request.
114
+ # @see https://developer.github.com/v3/pulls/#update-a-pull-request
115
+ # @example
116
+ # @client.close_pull_request('octokit/octokit.rb', 67)
117
+ def close_pull_request(repo, number, options = {})
118
+ options.merge! :state => 'closed'
119
+ update_pull_request(repo, number, options)
120
+ end
121
+
122
+ # List commits on a pull request
123
+ #
124
+ # @see https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
125
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
126
+ # @param number [Integer] Number of pull request
127
+ # @return [Array<Sawyer::Resource>] List of commits
128
+ def pull_request_commits(repo, number, options = {})
129
+ paginate "#{Repository.path repo}/pulls/#{number}/commits", options
130
+ end
131
+ alias :pull_commits :pull_request_commits
132
+
133
+ # List pull request comments for a repository
134
+ #
135
+ # By default, Review Comments are ordered by ascending ID.
136
+ #
137
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
138
+ # @param options [Hash] Optional parameters
139
+ # @option options [String] :sort created or updated
140
+ # @option options [String] :direction asc or desc. Ignored without sort
141
+ # parameter.
142
+ # @option options [String] :since Timestamp in ISO 8601
143
+ # format: YYYY-MM-DDTHH:MM:SSZ
144
+ #
145
+ # @return [Array] List of pull request review comments.
146
+ #
147
+ # @see https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
148
+ #
149
+ # @example Get the pull request review comments in the octokit repository
150
+ # @client.issues_comments("octokit/octokit.rb")
151
+ #
152
+ # @example Get review comments, sort by updated asc since a time
153
+ # @client.pull_requests_comments("octokit/octokit.rb", {
154
+ # :sort => 'asc',
155
+ # :direction => 'down',
156
+ # :since => '2010-05-04T23:45:02Z'
157
+ # })
158
+ def pull_requests_comments(repo, options = {})
159
+ paginate("#{Repository.path repo}/pulls/comments", options)
160
+ end
161
+ alias :pulls_comments :pull_requests_comments
162
+ alias :reviews_comments :pull_requests_comments
163
+
164
+ # List comments on a pull request
165
+ #
166
+ # @see https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
167
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
168
+ # @param number [Integer] Number of pull request
169
+ # @return [Array<Sawyer::Resource>] List of comments
170
+ def pull_request_comments(repo, number, options = {})
171
+ # return the comments for a pull request
172
+ paginate("#{Repository.path repo}/pulls/#{number}/comments", options)
173
+ end
174
+ alias :pull_comments :pull_request_comments
175
+ alias :review_comments :pull_request_comments
176
+
177
+ # Get a pull request comment
178
+ #
179
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
180
+ # @param comment_id [Integer] Id of comment to get
181
+ # @return [Sawyer::Resource] Hash representing the comment
182
+ # @see https://developer.github.com/v3/pulls/comments/#get-a-single-comment
183
+ # @example
184
+ # @client.pull_request_comment("pengwynn/octkit", 1903950)
185
+ def pull_request_comment(repo, comment_id, options = {})
186
+ get "#{Repository.path repo}/pulls/comments/#{comment_id}", options
187
+ end
188
+ alias :pull_comment :pull_request_comment
189
+ alias :review_comment :pull_request_comment
190
+
191
+ # Create a pull request comment
192
+ #
193
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
194
+ # @param pull_id [Integer] Pull request id
195
+ # @param body [String] Comment content
196
+ # @param commit_id [String] Sha of the commit to comment on.
197
+ # @param path [String] Relative path of the file to comment on.
198
+ # @param position [Integer] Line index in the diff to comment on.
199
+ # @return [Sawyer::Resource] Hash representing the new comment
200
+ # @see https://developer.github.com/v3/pulls/comments/#create-a-comment
201
+ # @example
202
+ # @client.create_pull_request_comment("octokit/octokit.rb", 163, ":shipit:",
203
+ # "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
204
+ def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})
205
+ options.merge!({
206
+ :body => body,
207
+ :commit_id => commit_id,
208
+ :path => path,
209
+ :position => position
210
+ })
211
+ post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
212
+ end
213
+ alias :create_pull_comment :create_pull_request_comment
214
+ alias :create_view_comment :create_pull_request_comment
215
+
216
+ # Create reply to a pull request comment
217
+ #
218
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
219
+ # @param pull_id [Integer] Pull request id
220
+ # @param body [String] Comment contents
221
+ # @param comment_id [Integer] Comment id to reply to
222
+ # @return [Sawyer::Resource] Hash representing new comment
223
+ # @see https://developer.github.com/v3/pulls/comments/#create-a-comment
224
+ # @example
225
+ # @client.create_pull_request_comment_reply("octokit/octokit.rb", 163, "done.", 1903950)
226
+ def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})
227
+ options.merge!({
228
+ :body => body,
229
+ :in_reply_to => comment_id
230
+ })
231
+ post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
232
+ end
233
+ alias :create_pull_reply :create_pull_request_comment_reply
234
+ alias :create_review_reply :create_pull_request_comment_reply
235
+
236
+ # Update pull request comment
237
+ #
238
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
239
+ # @param comment_id [Integer] Id of the comment to update
240
+ # @param body [String] Updated comment content
241
+ # @return [Sawyer::Resource] Hash representing the updated comment
242
+ # @see https://developer.github.com/v3/pulls/comments/#edit-a-comment
243
+ # @example
244
+ # @client.update_pull_request_comment("octokit/octokit.rb", 1903950, ":shipit:")
245
+ def update_pull_request_comment(repo, comment_id, body, options = {})
246
+ options.merge! :body => body
247
+ patch("#{Repository.path repo}/pulls/comments/#{comment_id}", options)
248
+ end
249
+ alias :update_pull_comment :update_pull_request_comment
250
+ alias :update_review_comment :update_pull_request_comment
251
+
252
+ # Delete pull request comment
253
+ #
254
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
255
+ # @param comment_id [Integer] Id of the comment to delete
256
+ # @return [Boolean] True if deleted, false otherwise
257
+ # @see https://developer.github.com/v3/pulls/comments/#delete-a-comment
258
+ # @example
259
+ # @client.delete_pull_request_comment("octokit/octokit.rb", 1902707)
260
+ def delete_pull_request_comment(repo, comment_id, options = {})
261
+ boolean_from_response(:delete, "#{Repository.path repo}/pulls/comments/#{comment_id}", options)
262
+ end
263
+ alias :delete_pull_comment :delete_pull_request_comment
264
+ alias :delete_review_comment :delete_pull_request_comment
265
+
266
+ # List files on a pull request
267
+ #
268
+ # @see https://developer.github.com/v3/pulls/#list-pull-requests-files
269
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
270
+ # @param number [Integer] Number of pull request
271
+ # @return [Array<Sawyer::Resource>] List of files
272
+ def pull_request_files(repo, number, options = {})
273
+ paginate "#{Repository.path repo}/pulls/#{number}/files", options
274
+ end
275
+ alias :pull_files :pull_request_files
276
+
277
+ # Merge a pull request
278
+ #
279
+ # @see https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
280
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
281
+ # @param number [Integer] Number of pull request
282
+ # @param commit_message [String] Optional commit message for the merge commit
283
+ # @return [Array<Sawyer::Resource>] Merge commit info if successful
284
+ def merge_pull_request(repo, number, commit_message='', options = {})
285
+ put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({:commit_message => commit_message})
286
+ end
287
+
288
+ # Check pull request merge status
289
+ #
290
+ # @see https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
291
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
292
+ # @param number [Integer] Number of pull request
293
+ # @return [Boolean] True if the pull request has been merged
294
+ def pull_merged?(repo, number, options = {})
295
+ boolean_from_response :get, "#{Repository.path repo}/pulls/#{number}/merge", options
296
+ end
297
+ alias :pull_request_merged? :pull_merged?
298
+
299
+ end
300
+ end
301
+ end
@@ -0,0 +1,54 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for API rate limiting info
5
+ #
6
+ # @see https://developer.github.com/v3/#rate-limiting
7
+ module RateLimit
8
+
9
+ # Get rate limit info from last response if available
10
+ # or make a new request to fetch rate limit
11
+ #
12
+ # @see https://developer.github.com/v3/rate_limit/#rate-limit
13
+ # @return [Octokit::RateLimit] Rate limit info
14
+ def rate_limit(options = {})
15
+ return rate_limit! if last_response.nil?
16
+
17
+ Octokit::RateLimit.from_response(last_response)
18
+ end
19
+ alias ratelimit rate_limit
20
+
21
+ # Get number of rate limted requests remaining
22
+ #
23
+ # @see https://developer.github.com/v3/rate_limit/#rate-limit
24
+ # @return [Integer] Number of requests remaining in this period
25
+ def rate_limit_remaining(options = {})
26
+ octokit_warn "Deprecated: Please use .rate_limit.remaining"
27
+ rate_limit.remaining
28
+ end
29
+ alias ratelimit_remaining rate_limit_remaining
30
+
31
+ # Refresh rate limit info by making a new request
32
+ #
33
+ # @see https://developer.github.com/v3/rate_limit/#rate-limit
34
+ # @return [Octokit::RateLimit] Rate limit info
35
+ def rate_limit!(options = {})
36
+ get "rate_limit"
37
+ Octokit::RateLimit.from_response(last_response)
38
+ end
39
+ alias ratelimit! rate_limit!
40
+
41
+ # Refresh rate limit info and get number of rate limted requests remaining
42
+ #
43
+ # @see https://developer.github.com/v3/rate_limit/#rate-limit
44
+ # @return [Integer] Number of requests remaining in this period
45
+ def rate_limit_remaining!(options = {})
46
+ octokit_warn "Deprecated: Please use .rate_limit!.remaining"
47
+ rate_limit!.remaining
48
+ end
49
+ alias ratelimit_remaining! rate_limit_remaining!
50
+
51
+ end
52
+ end
53
+ end
54
+
@@ -0,0 +1,158 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Reacions API
5
+ #
6
+ # @see https://developer.github.com/v3/reactions/
7
+ module Reactions
8
+
9
+ # List reactions for a commit comment
10
+ #
11
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
12
+ # @param id [Integer] The id of the commit comment
13
+ # @see https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
14
+ #
15
+ # @example
16
+ # @client.commit_comment_reactions("octokit/octokit.rb", 1)
17
+ #
18
+ # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
19
+ def commit_comment_reactions(repo, id, options = {})
20
+ options = ensure_api_media_type(:reactions, options)
21
+ get "#{Repository.path repo}/comments/#{id}/reactions", options
22
+ end
23
+
24
+ # Create a reaction for a commit comment
25
+ #
26
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
27
+ # @param id [Integer] The id of the commit comment
28
+ # @param reaction [String] The Reaction
29
+ # @see https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
30
+ # @see https://developer.github.com/v3/reactions/#reaction-types
31
+ #
32
+ # @example
33
+ # @client.create_commit_comment_reactions("octokit/octokit.rb", 1)
34
+ #
35
+ # @return [<Sawyer::Resource>] Hash representing the reaction
36
+ def create_commit_comment_reaction(repo, id, reaction, options = {})
37
+ options = ensure_api_media_type(:reactions, options.merge(:content => reaction))
38
+ post "#{Repository.path repo}/comments/#{id}/reactions", options
39
+ end
40
+
41
+ # List reactions for an issue
42
+ #
43
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
44
+ # @param number [Integer] The Issue number
45
+ # @see https://developer.github.com/v3/reactions/#list-reactions-for-an-issue
46
+ #
47
+ # @example
48
+ # @client.issue_reactions("octokit/octokit.rb", 1)
49
+ #
50
+ # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
51
+ def issue_reactions(repo, number, options = {})
52
+ options = ensure_api_media_type(:reactions, options)
53
+ get "#{Repository.path repo}/issues/#{number}/reactions", options
54
+ end
55
+
56
+ # Create reaction for an issue
57
+ #
58
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
59
+ # @param number [Integer] The Issue number
60
+ # @param reaction [String] The Reaction
61
+ #
62
+ # @see https://developer.github.com/v3/reactions/#create-reaction-for-an-issue
63
+ # @see https://developer.github.com/v3/reactions/#reaction-types
64
+ #
65
+ # @example
66
+ # @client.create_issue_reaction("octokit/octokit.rb", 1)
67
+ #
68
+ # @return [<Sawyer::Resource>] Hash representing the reaction.
69
+ def create_issue_reaction(repo, number, reaction, options = {})
70
+ options = ensure_api_media_type(:reactions, options.merge(:content => reaction))
71
+ post "#{Repository.path repo}/issues/#{number}/reactions", options
72
+ end
73
+
74
+ # List reactions for an issue comment
75
+ #
76
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
77
+ # @param id [Integer] The Issue comment id
78
+ #
79
+ # @see https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
80
+ #
81
+ # @example
82
+ # @client.issue_comment_reactions("octokit/octokit.rb", 1)
83
+ #
84
+ # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
85
+ def issue_comment_reactions(repo, id, options = {})
86
+ options = ensure_api_media_type(:reactions, options)
87
+ get "#{Repository.path repo}/issues/comments/#{id}/reactions", options
88
+ end
89
+
90
+ # Create reaction for an issue comment
91
+ #
92
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
93
+ # @param id [Integer] The Issue comment id
94
+ # @param reaction [String] The Reaction
95
+ #
96
+ # @see https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
97
+ # @see https://developer.github.com/v3/reactions/#reaction-types
98
+ #
99
+ # @example
100
+ # @client.create_issue_comment_reaction("octokit/octokit.rb", 1)
101
+ #
102
+ # @return [<Sawyer::Resource>] Hashes representing the reaction.
103
+ def create_issue_comment_reaction(repo, id, reaction, options = {})
104
+ options = ensure_api_media_type(:reactions, options.merge(:content => reaction))
105
+ post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
106
+ end
107
+
108
+ # List reactions for a pull request review comment
109
+ #
110
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
111
+ # @param id [Integer] The Issue comment id
112
+ #
113
+ # @see https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment
114
+ #
115
+ # @example
116
+ # @client.pull_request_review_comment_reactions("octokit/octokit.rb", 1)
117
+ #
118
+ # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
119
+ def pull_request_review_comment_reactions(repo, id, options = {})
120
+ options = ensure_api_media_type(:reactions, options)
121
+ get "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
122
+ end
123
+
124
+ # Create reaction for a pull request review comment
125
+ #
126
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
127
+ # @param id [Integer] The Issue comment id
128
+ # @param reaction [String] The Reaction
129
+ #
130
+ # @see https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment
131
+ # @see https://developer.github.com/v3/reactions/#reaction-types
132
+ #
133
+ # @example
134
+ # @client.create_pull_request_reiew_comment_reaction("octokit/octokit.rb", 1)
135
+ #
136
+ # @return [<Sawyer::Resource>] Hash representing the reaction.
137
+ def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
138
+ options = ensure_api_media_type(:reactions, options.merge(:content => reaction))
139
+ post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
140
+ end
141
+
142
+ # Delete a reaction
143
+ #
144
+ # @param id [Integer] Reaction id
145
+ #
146
+ # @see https://developer.github.com/v3/reactions/#delete-a-reaction
147
+ #
148
+ # @example
149
+ # @client.delete_reaction(1)
150
+ #
151
+ # @return [Boolean] Return true if reaction was deleted, false otherwise.
152
+ def delete_reaction(id, options = {})
153
+ options = ensure_api_media_type(:reactions, options)
154
+ boolean_from_response :delete, "reactions/#{id}", options
155
+ end
156
+ end
157
+ end
158
+ end