octokit 4.21.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +120 -96
- data/Rakefile +20 -14
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +3 -3
- data/lib/octokit/authentication.rb +10 -3
- data/lib/octokit/client/actions_artifacts.rb +71 -0
- data/lib/octokit/client/actions_secrets.rb +111 -8
- data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
- data/lib/octokit/client/actions_workflow_runs.rb +23 -3
- data/lib/octokit/client/actions_workflows.rb +27 -2
- data/lib/octokit/client/apps.rb +63 -74
- data/lib/octokit/client/checks.rb +18 -9
- data/lib/octokit/client/code_scanning.rb +190 -0
- data/lib/octokit/client/codespaces_secrets.rb +108 -0
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +31 -34
- data/lib/octokit/client/community_profile.rb +2 -3
- data/lib/octokit/client/contents.rb +19 -22
- data/lib/octokit/client/dependabot_secrets.rb +108 -0
- data/lib/octokit/client/deployments.rb +8 -8
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/environments.rb +58 -0
- data/lib/octokit/client/events.rb +4 -5
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +9 -19
- data/lib/octokit/client/issues.rb +14 -15
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -6
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +1 -7
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +106 -62
- data/lib/octokit/client/pages.rb +5 -7
- data/lib/octokit/client/projects.rb +44 -64
- data/lib/octokit/client/pull_requests.rb +66 -45
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +78 -16
- data/lib/octokit/client/refs.rb +15 -18
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +92 -69
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +8 -8
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +24 -10
- data/lib/octokit/client/service_status.rb +19 -9
- data/lib/octokit/client/source_import.rb +7 -12
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/tokens.rb +31 -0
- data/lib/octokit/client/traffic.rb +6 -11
- data/lib/octokit/client/users.rb +54 -33
- data/lib/octokit/client.rb +44 -20
- data/lib/octokit/configurable.rb +51 -31
- data/lib/octokit/connection.rb +33 -24
- data/lib/octokit/default.rb +66 -35
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +51 -33
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +53 -34
- data/lib/octokit/gist.rb +3 -4
- data/lib/octokit/manage_ghes_client/manage_ghes.rb +178 -0
- data/lib/octokit/manage_ghes_client.rb +64 -0
- data/lib/octokit/middleware/follow_redirects.rb +16 -12
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/rate_limit.rb +8 -6
- data/lib/octokit/repo_arguments.rb +3 -4
- data/lib/octokit/repository.rb +32 -25
- data/lib/octokit/response/base_middleware.rb +10 -0
- data/lib/octokit/response/feed_parser.rb +5 -7
- data/lib/octokit/response/raise_error.rb +4 -4
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +4 -2
- data/lib/octokit/warnable.rb +4 -5
- data/lib/octokit.rb +30 -8
- data/octokit.gemspec +12 -11
- metadata +22 -34
- data/lib/octokit/client/authorizations.rb +0 -182
- data/lib/octokit/client/pub_sub_hubbub.rb +0 -111
- data/lib/octokit/preview.rb +0 -46
data/lib/octokit/client/feeds.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Feeds API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/activity/feeds/
|
7
8
|
module Feeds
|
8
|
-
|
9
9
|
# List Feeds
|
10
10
|
#
|
11
11
|
# The feeds returned depend on authentication, see the GitHub API docs
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# @return [Array<Sawyer::Resource>] list of feeds
|
15
15
|
# @see https://developer.github.com/v3/activity/feeds/#list-feeds
|
16
16
|
def feeds
|
17
|
-
get
|
17
|
+
get 'feeds'
|
18
18
|
end
|
19
19
|
|
20
20
|
# Get a Feed by name
|
@@ -24,10 +24,9 @@ module Octokit
|
|
24
24
|
# parser.
|
25
25
|
def feed(name, options = {})
|
26
26
|
if rel = feeds._links[name]
|
27
|
-
get rel.href, :
|
27
|
+
get rel.href, accept: rel.type, options: options
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
data/lib/octokit/client/gists.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Gists API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/gists/
|
7
8
|
module Gists
|
8
|
-
|
9
9
|
# List gists for a user or all public gists
|
10
10
|
#
|
11
11
|
# @param user [String] An optional user to filter listing
|
@@ -15,14 +15,14 @@ module Octokit
|
|
15
15
|
# @example Fetch all public gists
|
16
16
|
# Octokit.gists
|
17
17
|
# @see https://developer.github.com/v3/gists/#list-gists
|
18
|
-
def gists(user=nil, options = {})
|
18
|
+
def gists(user = nil, options = {})
|
19
19
|
if user.nil?
|
20
20
|
paginate 'gists', options
|
21
21
|
else
|
22
22
|
paginate "#{User.path user}/gists", options
|
23
23
|
end
|
24
24
|
end
|
25
|
-
alias
|
25
|
+
alias list_gists gists
|
26
26
|
|
27
27
|
# List public gists
|
28
28
|
#
|
@@ -196,7 +196,7 @@ module Octokit
|
|
196
196
|
# @example
|
197
197
|
# @client.create_gist_comment('3528645', 'This is very helpful.')
|
198
198
|
def create_gist_comment(gist_id, comment, options = {})
|
199
|
-
options = options.merge({:
|
199
|
+
options = options.merge({ body: comment })
|
200
200
|
post "gists/#{gist_id}/comments", options
|
201
201
|
end
|
202
202
|
|
@@ -212,7 +212,7 @@ module Octokit
|
|
212
212
|
# @example
|
213
213
|
# @client.update_gist_comment('208sdaz3', '3528645', ':heart:')
|
214
214
|
def update_gist_comment(gist_id, gist_comment_id, comment, options = {})
|
215
|
-
options = options.merge({:
|
215
|
+
options = options.merge({ body: comment })
|
216
216
|
patch "gists/#{gist_id}/comments/#{gist_comment_id}", options
|
217
217
|
end
|
218
218
|
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Gitignore API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/gitignore/
|
7
8
|
module Gitignore
|
8
|
-
|
9
9
|
# Listing available gitignore templates.
|
10
10
|
#
|
11
11
|
# These templates can be passed option when creating a repository.
|
@@ -17,7 +17,7 @@ module Octokit
|
|
17
17
|
# @example Git all the gitignore templates
|
18
18
|
# @client.gitignore_templates
|
19
19
|
def gitignore_templates(options = {})
|
20
|
-
get
|
20
|
+
get 'gitignore/templates', options
|
21
21
|
end
|
22
22
|
|
23
23
|
# Get a gitignore template.
|
data/lib/octokit/client/hooks.rb
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Hooks API
|
5
6
|
module Hooks
|
6
|
-
|
7
|
-
# List all Service Hooks supported by GitHub
|
8
|
-
#
|
9
|
-
# @return [Sawyer::Resource] A list of all hooks on GitHub
|
10
|
-
# @see https://developer.github.com/v3/repos/hooks/#services
|
11
|
-
# @example List all hooks
|
12
|
-
# Octokit.available_hooks
|
13
|
-
def available_hooks(options = {})
|
14
|
-
get "hooks", options
|
15
|
-
end
|
16
|
-
|
17
7
|
# List repo hooks
|
18
8
|
#
|
19
9
|
# Requires authenticated client.
|
@@ -73,7 +63,7 @@ module Octokit
|
|
73
63
|
# }
|
74
64
|
# )
|
75
65
|
def create_hook(repo, name, config, options = {})
|
76
|
-
options = {:
|
66
|
+
options = { name: name, config: config, events: ['push'], active: true }.merge(options)
|
77
67
|
post "#{Repository.path repo}/hooks", options
|
78
68
|
end
|
79
69
|
|
@@ -116,7 +106,7 @@ module Octokit
|
|
116
106
|
# }
|
117
107
|
# )
|
118
108
|
def edit_hook(repo, id, name, config, options = {})
|
119
|
-
options = {:
|
109
|
+
options = { name: name, config: config }.merge(options)
|
120
110
|
patch "#{Repository.path repo}/hooks/#{id}", options
|
121
111
|
end
|
122
112
|
|
@@ -158,7 +148,7 @@ module Octokit
|
|
158
148
|
# @see https://developer.github.com/v3/repos/hooks/#ping-a-hook
|
159
149
|
# @example
|
160
150
|
# @client.ping_hook('octokit/octokit.rb', 1000000)
|
161
|
-
def ping_hook(repo, id, options={})
|
151
|
+
def ping_hook(repo, id, options = {})
|
162
152
|
boolean_from_response :post, "#{Repository.path repo}/hooks/#{id}/pings", options
|
163
153
|
end
|
164
154
|
|
@@ -174,7 +164,7 @@ module Octokit
|
|
174
164
|
def org_hooks(org, options = {})
|
175
165
|
paginate "#{Organization.path org}/hooks", options
|
176
166
|
end
|
177
|
-
alias
|
167
|
+
alias list_org_hooks org_hooks
|
178
168
|
|
179
169
|
# Get an org hook
|
180
170
|
#
|
@@ -217,7 +207,7 @@ module Octokit
|
|
217
207
|
# }
|
218
208
|
# )
|
219
209
|
def create_org_hook(org, config, options = {})
|
220
|
-
options = { :
|
210
|
+
options = { name: 'web', config: config }.merge(options)
|
221
211
|
post "#{Organization.path org}/hooks", options
|
222
212
|
end
|
223
213
|
|
@@ -250,10 +240,10 @@ module Octokit
|
|
250
240
|
# }
|
251
241
|
# )
|
252
242
|
def edit_org_hook(org, id, config, options = {})
|
253
|
-
options = { :
|
243
|
+
options = { config: config }.merge(options)
|
254
244
|
patch "#{Organization.path org}/hooks/#{id}", options
|
255
245
|
end
|
256
|
-
alias
|
246
|
+
alias update_org_hook edit_org_hook
|
257
247
|
|
258
248
|
# Ping org hook
|
259
249
|
#
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Issues API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/issues/
|
7
8
|
module Issues
|
8
|
-
|
9
9
|
# List issues for the authenticated user or repository
|
10
10
|
#
|
11
11
|
# @param repository [Integer, String, Repository, Hash] A GitHub repository.
|
@@ -28,10 +28,10 @@ module Octokit
|
|
28
28
|
# @client = Octokit::Client.new(:login => 'foo', :password => 'bar')
|
29
29
|
# @client.list_issues
|
30
30
|
def list_issues(repository = nil, options = {})
|
31
|
-
path = repository ? "#{Repository.new(repository).path}/issues" :
|
31
|
+
path = repository ? "#{Repository.new(repository).path}/issues" : 'issues'
|
32
32
|
paginate path, options
|
33
33
|
end
|
34
|
-
alias
|
34
|
+
alias issues list_issues
|
35
35
|
|
36
36
|
# List all issues across owned and member repositories for the authenticated user
|
37
37
|
#
|
@@ -91,17 +91,17 @@ module Octokit
|
|
91
91
|
def create_issue(repo, title, body = nil, options = {})
|
92
92
|
options[:labels] = case options[:labels]
|
93
93
|
when String
|
94
|
-
options[:labels].split(
|
94
|
+
options[:labels].split(',').map(&:strip)
|
95
95
|
when Array
|
96
96
|
options[:labels]
|
97
97
|
else
|
98
98
|
[]
|
99
99
|
end
|
100
|
-
parameters = { :
|
100
|
+
parameters = { title: title }
|
101
101
|
parameters[:body] = body unless body.nil?
|
102
102
|
post "#{Repository.path repo}/issues", options.merge(parameters)
|
103
103
|
end
|
104
|
-
alias
|
104
|
+
alias open_issue create_issue
|
105
105
|
|
106
106
|
# Get a single issue from a repository
|
107
107
|
#
|
@@ -129,7 +129,7 @@ module Octokit
|
|
129
129
|
# @example Close Issue #25 from octokit/octokit.rb
|
130
130
|
# Octokit.close_issue("octokit/octokit.rb", "25")
|
131
131
|
def close_issue(repo, number, options = {})
|
132
|
-
patch "#{Repository.path repo}/issues/#{number}", options.merge({:
|
132
|
+
patch "#{Repository.path repo}/issues/#{number}", options.merge({ state: 'closed' })
|
133
133
|
end
|
134
134
|
|
135
135
|
# Reopen an issue
|
@@ -146,7 +146,7 @@ module Octokit
|
|
146
146
|
# @example Reopen Issue #25 from octokit/octokit.rb
|
147
147
|
# Octokit.reopen_issue("octokit/octokit.rb", "25")
|
148
148
|
def reopen_issue(repo, number, options = {})
|
149
|
-
patch "#{Repository.path repo}/issues/#{number}", options.merge({:
|
149
|
+
patch "#{Repository.path repo}/issues/#{number}", options.merge({ state: 'open' })
|
150
150
|
end
|
151
151
|
|
152
152
|
# Lock an issue's conversation, limiting it to collaborators
|
@@ -210,7 +210,7 @@ module Octokit
|
|
210
210
|
arguments = Arguments.new(args)
|
211
211
|
opts = arguments.options
|
212
212
|
|
213
|
-
|
213
|
+
unless arguments.empty?
|
214
214
|
opts[:title] = arguments.shift
|
215
215
|
opts[:body] = arguments.shift
|
216
216
|
end
|
@@ -281,7 +281,7 @@ module Octokit
|
|
281
281
|
# @example Add the comment "Almost to v1" to Issue #23 on octokit/octokit.rb
|
282
282
|
# Octokit.add_comment("octokit/octokit.rb", 23, "Almost to v1")
|
283
283
|
def add_comment(repo, number, comment, options = {})
|
284
|
-
post "#{Repository.path repo}/issues/#{number}/comments", options.merge({:
|
284
|
+
post "#{Repository.path repo}/issues/#{number}/comments", options.merge({ body: comment })
|
285
285
|
end
|
286
286
|
|
287
287
|
# Update a single comment on an issue
|
@@ -294,7 +294,7 @@ module Octokit
|
|
294
294
|
# @example Update the comment #1194549 with body "I've started this on my 25-issue-comments-v3 fork" on an issue on octokit/octokit.rb
|
295
295
|
# Octokit.update_comment("octokit/octokit.rb", 1194549, "Almost to v1, added this on my fork")
|
296
296
|
def update_comment(repo, number, comment, options = {})
|
297
|
-
patch "#{Repository.path repo}/issues/comments/#{number}", options.merge({:
|
297
|
+
patch "#{Repository.path repo}/issues/comments/#{number}", options.merge({ body: comment })
|
298
298
|
end
|
299
299
|
|
300
300
|
# Delete a single comment
|
@@ -318,7 +318,6 @@ module Octokit
|
|
318
318
|
# @example Get timeline for issue #1435 on octokit/octokit.rb
|
319
319
|
# Octokit.issue_timeline("octokit/octokit.rb", 1435)
|
320
320
|
def issue_timeline(repo, number, options = {})
|
321
|
-
options = ensure_api_media_type(:issue_timelines, options)
|
322
321
|
paginate "#{Repository.path repo}/issues/#{number}/timeline", options
|
323
322
|
end
|
324
323
|
|
@@ -343,7 +342,7 @@ module Octokit
|
|
343
342
|
# @example Add assignees "pengwynn" and "joeyw" to Issue #23 on octokit/octokit.rb
|
344
343
|
# Octokit.add_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
|
345
344
|
def add_assignees(repo, number, assignees, options = {})
|
346
|
-
post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees
|
345
|
+
post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({ assignees: assignees })
|
347
346
|
end
|
348
347
|
|
349
348
|
# Remove assignees from an issue
|
@@ -361,7 +360,7 @@ module Octokit
|
|
361
360
|
# Octokit.remove_assignees("octokit/octokit.rb", 23, ["pengwynn"],
|
362
361
|
# :accept => "application/vnd.github.v3+json")
|
363
362
|
def remove_assignees(repo, number, assignees, options = {})
|
364
|
-
delete "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees
|
363
|
+
delete "#{Repository.path repo}/issues/#{number}/assignees", options.merge({ assignees: assignees })
|
365
364
|
end
|
366
365
|
end
|
367
366
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
2
4
|
|
3
5
|
module Octokit
|
4
6
|
class Client
|
5
|
-
|
6
7
|
# Methods for the Issue Labels API
|
7
8
|
#
|
8
9
|
# @see https://developer.github.com/v3/issues/labels/
|
9
10
|
module Labels
|
10
|
-
|
11
11
|
# List available labels for a repository
|
12
12
|
#
|
13
13
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# @example Get the "V3 Addition" label from octokit/octokit.rb
|
29
29
|
# Octokit.label("octokit/octokit.rb", "V3 Addition")
|
30
30
|
def label(repo, name, options = {})
|
31
|
-
get "#{Repository.path repo}/labels/#{name}", options
|
31
|
+
get "#{Repository.path repo}/labels/#{ERB::Util.url_encode(name)}", options
|
32
32
|
end
|
33
33
|
|
34
34
|
# Add a label to a repository
|
@@ -40,8 +40,8 @@ module Octokit
|
|
40
40
|
# @see https://developer.github.com/v3/issues/labels/#create-a-label
|
41
41
|
# @example Add a new label "Version 1.0" with color "#cccccc"
|
42
42
|
# Octokit.add_label("octokit/octokit.rb", "Version 1.0", "cccccc")
|
43
|
-
def add_label(repo, label, color=
|
44
|
-
post "#{Repository.path repo}/labels", options.merge({:
|
43
|
+
def add_label(repo, label, color = 'ffffff', options = {})
|
44
|
+
post "#{Repository.path repo}/labels", options.merge({ name: label, color: color })
|
45
45
|
end
|
46
46
|
|
47
47
|
# Update a label
|
@@ -56,7 +56,7 @@ module Octokit
|
|
56
56
|
# @example Update the label "Version 1.0" with new color "#cceeaa"
|
57
57
|
# Octokit.update_label("octokit/octokit.rb", "Version 1.0", {:color => "cceeaa"})
|
58
58
|
def update_label(repo, label, options = {})
|
59
|
-
patch "#{Repository.path repo}/labels/#{label}", options
|
59
|
+
patch "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", options
|
60
60
|
end
|
61
61
|
|
62
62
|
# Delete a label from a repository.
|
@@ -70,7 +70,7 @@ module Octokit
|
|
70
70
|
# @example Delete the label "Version 1.0" from the repository.
|
71
71
|
# Octokit.delete_label!("octokit/octokit.rb", "Version 1.0")
|
72
72
|
def delete_label!(repo, label, options = {})
|
73
|
-
boolean_from_response :delete, "#{Repository.path repo}/labels/#{label}", options
|
73
|
+
boolean_from_response :delete, "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", options
|
74
74
|
end
|
75
75
|
|
76
76
|
# Remove a label from an Issue
|
@@ -85,7 +85,7 @@ module Octokit
|
|
85
85
|
# @example Remove the label "Version 1.0" from the repository.
|
86
86
|
# Octokit.remove_label("octokit/octokit.rb", 23, "Version 1.0")
|
87
87
|
def remove_label(repo, number, label, options = {})
|
88
|
-
delete "#{Repository.path repo}/issues/#{number}/labels/#{label}", options
|
88
|
+
delete "#{Repository.path repo}/issues/#{number}/labels/#{ERB::Util.url_encode(label)}", options
|
89
89
|
end
|
90
90
|
|
91
91
|
# Remove all label from an Issue
|
@@ -136,7 +136,7 @@ module Octokit
|
|
136
136
|
# @see https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
137
137
|
# @example Replace labels for octokit/octokit.rb Issue #10
|
138
138
|
# Octokit.replace_all_labels("octokit/octokit.rb", 10, ['V3 Transition', 'Improvement'])
|
139
|
-
def replace_all_labels(repo, number, labels,
|
139
|
+
def replace_all_labels(repo, number, labels, _options = {})
|
140
140
|
put "#{Repository.path repo}/issues/#{number}/labels", labels
|
141
141
|
end
|
142
142
|
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Legacy Search API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/search/
|
7
8
|
module LegacySearch
|
8
|
-
|
9
9
|
# Legacy repository search
|
10
10
|
#
|
11
11
|
# @see https://developer.github.com/v3/search/#search-repositories
|
@@ -23,7 +23,7 @@ module Octokit
|
|
23
23
|
# @return [Array<Sawyer::Resource>] A list of issues matching the search term and state
|
24
24
|
# @example Search for 'test' in the open issues for sferik/rails_admin
|
25
25
|
# Octokit.search_issues("sferik/rails_admin", 'test', 'open')
|
26
|
-
def legacy_search_issues(repo, search_term, state='open', options = {})
|
26
|
+
def legacy_search_issues(repo, search_term, state = 'open', options = {})
|
27
27
|
get("legacy/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options)['issues']
|
28
28
|
end
|
29
29
|
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for licenses API
|
5
6
|
#
|
6
7
|
module Licenses
|
7
|
-
|
8
8
|
# List all licenses
|
9
9
|
#
|
10
10
|
# @see https://developer.github.com/v3/licenses/#list-all-licenses
|
@@ -12,8 +12,7 @@ module Octokit
|
|
12
12
|
# @example
|
13
13
|
# Octokit.licenses
|
14
14
|
def licenses(options = {})
|
15
|
-
|
16
|
-
paginate "licenses", options
|
15
|
+
paginate 'licenses', options
|
17
16
|
end
|
18
17
|
|
19
18
|
# List an individual license
|
@@ -24,7 +23,6 @@ module Octokit
|
|
24
23
|
# @example
|
25
24
|
# Octokit.license 'mit'
|
26
25
|
def license(license_name, options = {})
|
27
|
-
options = ensure_api_media_type(:licenses, options)
|
28
26
|
get "licenses/#{license_name}", options
|
29
27
|
end
|
30
28
|
|
@@ -37,7 +35,6 @@ module Octokit
|
|
37
35
|
# @example
|
38
36
|
# Octokit.repository_license_contents 'benbalter/licensee'
|
39
37
|
def repository_license_contents(repo, options = {})
|
40
|
-
options = ensure_api_media_type(:licenses, options)
|
41
38
|
get "#{Repository.path repo}/license", options
|
42
39
|
end
|
43
40
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Markdown API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/markdown/
|
7
8
|
module Markdown
|
8
|
-
|
9
9
|
# Render an arbitrary Markdown document
|
10
10
|
#
|
11
11
|
# @param text [String] Markdown source
|
@@ -20,7 +20,7 @@ module Octokit
|
|
20
20
|
options[:repo] = Repository.new(options[:repo]) if options[:repo]
|
21
21
|
options[:accept] = 'application/vnd.github.raw'
|
22
22
|
|
23
|
-
post
|
23
|
+
post 'markdown', options
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Marketplace Listing API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/apps/marketplace/
|
7
8
|
module Marketplace
|
8
|
-
|
9
9
|
# List all plans for an app's marketplace listing
|
10
10
|
#
|
11
11
|
# @param options [Hash] A customizable set of options
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
#
|
15
15
|
# @return [Array<Sawyer::Resource>] A list of plans
|
16
16
|
def list_plans(options = {})
|
17
|
-
paginate
|
17
|
+
paginate '/marketplace_listing/plans', options
|
18
18
|
end
|
19
19
|
|
20
20
|
# List all GitHub accounts on a specific plan
|
@@ -49,7 +49,7 @@ module Octokit
|
|
49
49
|
#
|
50
50
|
# @return [Array<Sawyer::Resource>] A list of Marketplace purchases
|
51
51
|
def marketplace_purchases(options = {})
|
52
|
-
get
|
52
|
+
get '/user/marketplace_purchases', options
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/octokit/client/meta.rb
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Meta API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/meta/
|
7
8
|
module Meta
|
8
|
-
|
9
9
|
# Get meta information about GitHub.com, the service.
|
10
10
|
# @see https://developer.github.com/v3/meta/#meta
|
11
11
|
# @return [Sawyer::Resource] Hash with meta information.
|
12
12
|
# @example Get GitHub meta information
|
13
13
|
# @client.github_meta
|
14
14
|
def meta(options = {})
|
15
|
-
get
|
15
|
+
get 'meta', options
|
16
16
|
end
|
17
|
-
alias
|
18
|
-
|
17
|
+
alias github_meta meta
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Issues Milestones API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/issues/milestones/
|
7
8
|
module Milestones
|
8
|
-
|
9
9
|
# List milestones for a repository
|
10
10
|
#
|
11
11
|
# @param repository [Integer, String, Repository, Hash] A GitHub repository
|
@@ -21,7 +21,7 @@ module Octokit
|
|
21
21
|
def list_milestones(repository, options = {})
|
22
22
|
paginate "#{Repository.path repository}/milestones", options
|
23
23
|
end
|
24
|
-
alias
|
24
|
+
alias milestones list_milestones
|
25
25
|
|
26
26
|
# Get a single milestone for a repository
|
27
27
|
#
|
@@ -49,7 +49,7 @@ module Octokit
|
|
49
49
|
# @example Create a milestone for a repository
|
50
50
|
# Octokit.create_milestone("octokit/octokit.rb", "0.7.0", {:description => 'Add support for v3 of Github API'})
|
51
51
|
def create_milestone(repository, title, options = {})
|
52
|
-
post "#{Repository.path repository}/milestones", options.merge({:title
|
52
|
+
post "#{Repository.path repository}/milestones", options.merge({ title: title })
|
53
53
|
end
|
54
54
|
|
55
55
|
# Update a milestone for a repository
|
@@ -68,7 +68,7 @@ module Octokit
|
|
68
68
|
def update_milestone(repository, number, options = {})
|
69
69
|
patch "#{Repository.path repository}/milestones/#{number}", options
|
70
70
|
end
|
71
|
-
alias
|
71
|
+
alias edit_milestone update_milestone
|
72
72
|
|
73
73
|
# Delete a single milestone for a repository
|
74
74
|
#
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Notifications API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/activity/notifications/
|
7
8
|
module Notifications
|
8
|
-
|
9
9
|
# List your notifications
|
10
10
|
#
|
11
11
|
# @param options [Hash] Optional parameters
|
@@ -24,7 +24,7 @@ module Octokit
|
|
24
24
|
# @example Get all notifications since a certain time.
|
25
25
|
# @client.notifications({all: true, since: '2012-10-09T23:39:01Z'})
|
26
26
|
def notifications(options = {})
|
27
|
-
paginate
|
27
|
+
paginate 'notifications', options
|
28
28
|
end
|
29
29
|
|
30
30
|
# List your notifications in a repository
|
@@ -48,7 +48,7 @@ module Octokit
|
|
48
48
|
def repository_notifications(repo, options = {})
|
49
49
|
paginate "#{Repository.path repo}/notifications", options
|
50
50
|
end
|
51
|
-
alias
|
51
|
+
alias repo_notifications repository_notifications
|
52
52
|
|
53
53
|
# Mark notifications as read
|
54
54
|
#
|
@@ -66,7 +66,7 @@ module Octokit
|
|
66
66
|
# @example
|
67
67
|
# @client.mark_notifications_as_read
|
68
68
|
def mark_notifications_as_read(options = {})
|
69
|
-
request :put,
|
69
|
+
request :put, 'notifications', options
|
70
70
|
|
71
71
|
last_response.status == 205
|
72
72
|
end
|
@@ -91,7 +91,7 @@ module Octokit
|
|
91
91
|
|
92
92
|
last_response.status == 205
|
93
93
|
end
|
94
|
-
alias
|
94
|
+
alias mark_repo_notifications_as_read mark_repository_notifications_as_read
|
95
95
|
|
96
96
|
# List notifications for a specific thread
|
97
97
|
#
|
@@ -2,12 +2,10 @@
|
|
2
2
|
|
3
3
|
module Octokit
|
4
4
|
class Client
|
5
|
-
|
6
5
|
# Methods for the OauthApplications API
|
7
6
|
#
|
8
7
|
# @see https://developer.github.com/v3/apps/oauth_applications
|
9
8
|
module OauthApplications
|
10
|
-
|
11
9
|
# Check if a token is valid.
|
12
10
|
#
|
13
11
|
# Applications can check if a token is valid without rate limits.
|
@@ -21,7 +19,6 @@ module Octokit
|
|
21
19
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
22
20
|
# client.check_token('deadbeef1234567890deadbeef987654321')
|
23
21
|
def check_token(access_token, options = {})
|
24
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
25
22
|
options[:access_token] = access_token
|
26
23
|
|
27
24
|
key = options.delete(:client_id) || client_id
|
@@ -46,7 +43,6 @@ module Octokit
|
|
46
43
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
47
44
|
# client.reset_token('deadbeef1234567890deadbeef987654321')
|
48
45
|
def reset_token(access_token, options = {})
|
49
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
50
46
|
options[:access_token] = access_token
|
51
47
|
|
52
48
|
key = options.delete(:client_id) || client_id
|
@@ -69,9 +65,8 @@ module Octokit
|
|
69
65
|
#
|
70
66
|
# @example
|
71
67
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
72
|
-
# client.
|
68
|
+
# client.delete_app_token('deadbeef1234567890deadbeef987654321')
|
73
69
|
def delete_app_token(access_token, options = {})
|
74
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
75
70
|
options[:access_token] = access_token
|
76
71
|
|
77
72
|
key = options.delete(:client_id) || client_id
|
@@ -102,7 +97,6 @@ module Octokit
|
|
102
97
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
103
98
|
# client.delete_app_authorization('deadbeef1234567890deadbeef987654321')
|
104
99
|
def delete_app_authorization(access_token, options = {})
|
105
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
106
100
|
options[:access_token] = access_token
|
107
101
|
|
108
102
|
key = options.delete(:client_id) || client_id
|