octokit 4.6.0 → 4.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +14 -13
- data/LICENSE.md +1 -1
- data/README.md +141 -60
- data/lib/ext/sawyer/relation.rb +10 -0
- data/lib/octokit/authentication.rb +10 -11
- data/lib/octokit/client/actions_secrets.rb +58 -0
- data/lib/octokit/client/actions_workflow_runs.rb +105 -0
- data/lib/octokit/client/actions_workflows.rb +43 -0
- data/lib/octokit/client/apps.rb +222 -0
- data/lib/octokit/client/authorizations.rb +12 -74
- data/lib/octokit/client/checks.rb +191 -0
- data/lib/octokit/client/commit_branches.rb +20 -0
- data/lib/octokit/client/commit_pulls.rb +20 -0
- data/lib/octokit/client/community_profile.rb +22 -0
- data/lib/octokit/client/contents.rb +6 -0
- data/lib/octokit/client/deployments.rb +20 -0
- data/lib/octokit/client/events.rb +1 -0
- data/lib/octokit/client/gists.rb +3 -2
- data/lib/octokit/client/issues.rb +48 -1
- data/lib/octokit/client/labels.rb +7 -7
- data/lib/octokit/client/licenses.rb +1 -1
- data/lib/octokit/client/marketplace.rb +56 -0
- data/lib/octokit/client/notifications.rb +0 -4
- data/lib/octokit/client/oauth_applications.rb +122 -0
- data/lib/octokit/client/organizations.rb +149 -16
- data/lib/octokit/client/projects.rb +7 -7
- data/lib/octokit/client/pull_requests.rb +7 -5
- data/lib/octokit/client/rate_limit.rb +2 -2
- data/lib/octokit/client/refs.rb +19 -3
- data/lib/octokit/client/releases.rb +1 -0
- data/lib/octokit/client/repositories.rb +169 -8
- data/lib/octokit/client/repository_invitations.rb +1 -8
- data/lib/octokit/client/reviews.rb +227 -0
- data/lib/octokit/client/search.rb +24 -9
- data/lib/octokit/client/source_import.rb +1 -1
- data/lib/octokit/client/stats.rb +2 -0
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +88 -1
- data/lib/octokit/client.rb +41 -9
- data/lib/octokit/configurable.rb +10 -2
- data/lib/octokit/connection.rb +19 -4
- data/lib/octokit/default.rb +17 -1
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +1 -1
- data/lib/octokit/enterprise_admin_client/license.rb +1 -1
- data/lib/octokit/enterprise_admin_client/orgs.rb +2 -2
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +1 -1
- data/lib/octokit/enterprise_admin_client/users.rb +12 -12
- data/lib/octokit/enterprise_management_console_client/management_console.rb +1 -1
- data/lib/octokit/enterprise_management_console_client.rb +1 -1
- data/lib/octokit/error.rb +74 -4
- data/lib/octokit/gist.rb +1 -1
- data/lib/octokit/middleware/follow_redirects.rb +2 -2
- data/lib/octokit/preview.rb +14 -3
- data/lib/octokit/rate_limit.rb +4 -4
- data/lib/octokit/repository.rb +10 -8
- data/lib/octokit/response/feed_parser.rb +0 -2
- data/lib/octokit/response/raise_error.rb +0 -2
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- metadata +39 -9
@@ -0,0 +1,191 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Checks API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/checks/
|
7
|
+
module Checks
|
8
|
+
|
9
|
+
# Methods for Check Runs
|
10
|
+
#
|
11
|
+
# @see https://developer.github.com/v3/checks/runs/
|
12
|
+
|
13
|
+
# Create a check run
|
14
|
+
#
|
15
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
16
|
+
# @param name [String] The name of the check
|
17
|
+
# @param head_sha [String] The SHA of the commit to check
|
18
|
+
# @return [Sawyer::Resource] A hash representing the new check run
|
19
|
+
# @see https://developer.github.com/v3/checks/runs/#create-a-check-run
|
20
|
+
# @example Create a check run
|
21
|
+
# check_run = @client.create_check_run("octocat/Hello-World", "my-check", "7638417db6d59f3c431d3e1f261cc637155684cd")
|
22
|
+
# check_run.name # => "my-check"
|
23
|
+
# check_run.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
24
|
+
# check_run.status # => "queued"
|
25
|
+
def create_check_run(repo, name, head_sha, options = {})
|
26
|
+
options[:name] = name
|
27
|
+
options[:head_sha] = head_sha
|
28
|
+
|
29
|
+
post "#{Repository.path repo}/check-runs", options
|
30
|
+
end
|
31
|
+
|
32
|
+
# Update a check run
|
33
|
+
#
|
34
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
35
|
+
# @param id [Integer] The ID of the check run
|
36
|
+
# @return [Sawyer::Resource] A hash representing the updated check run
|
37
|
+
# @see https://developer.github.com/v3/checks/runs/#update-a-check-run
|
38
|
+
# @example Update a check run
|
39
|
+
# check_run = @client.update_check_run("octocat/Hello-World", 51295429, status: "in_progress")
|
40
|
+
# check_run.id # => 51295429
|
41
|
+
# check_run.status # => "in_progress"
|
42
|
+
def update_check_run(repo, id, options = {})
|
43
|
+
patch "#{Repository.path repo}/check-runs/#{id}", options
|
44
|
+
end
|
45
|
+
|
46
|
+
# List check runs for a specific ref
|
47
|
+
#
|
48
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
49
|
+
# @param ref [String] A SHA, branch name, or tag name
|
50
|
+
# @param options [Hash] A set of optional filters
|
51
|
+
# @option options [String] :check_name Returns check runs with the specified <tt>name</tt>
|
52
|
+
# @option options [String] :status Returns check runs with the specified <tt>status</tt>
|
53
|
+
# @option options [String] :filter Filters check runs by their <tt>completed_at</tt> timestamp
|
54
|
+
# @return [Sawyer::Resource] A hash representing a collection of check runs
|
55
|
+
# @see https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref
|
56
|
+
# @example List check runs for a specific ref
|
57
|
+
# result = @client.check_runs_for_ref("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd", status: "in_progress")
|
58
|
+
# result.total_count # => 1
|
59
|
+
# result.check_runs.count # => 1
|
60
|
+
# result.check_runs[0].id # => 51295429
|
61
|
+
# result.check_runs[0].status # => "in_progress"
|
62
|
+
def check_runs_for_ref(repo, ref, options = {})
|
63
|
+
get "#{Repository.path repo}/commits/#{ref}/check-runs", options
|
64
|
+
end
|
65
|
+
alias :list_check_runs_for_ref :check_runs_for_ref
|
66
|
+
|
67
|
+
# List check runs in a check suite
|
68
|
+
#
|
69
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
70
|
+
# @param id [Integer] The ID of the check suite
|
71
|
+
# @param options [Hash] A set of optional filters
|
72
|
+
# @option options [String] :check_name Returns check runs with the specified <tt>name</tt>
|
73
|
+
# @option options [String] :status Returns check runs with the specified <tt>status</tt>
|
74
|
+
# @option options [String] :filter Filters check runs by their <tt>completed_at</tt> timestamp
|
75
|
+
# @return [Sawyer::Resource] A hash representing a collection of check runs
|
76
|
+
# @see https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite
|
77
|
+
# @example List check runs in a check suite
|
78
|
+
# result = @client.check_runs_for_check_suite("octocat/Hello-World", 50440400, status: "in_progress")
|
79
|
+
# result.total_count # => 1
|
80
|
+
# result.check_runs.count # => 1
|
81
|
+
# result.check_runs[0].check_suite.id # => 50440400
|
82
|
+
# result.check_runs[0].status # => "in_progress"
|
83
|
+
def check_runs_for_check_suite(repo, id, options = {})
|
84
|
+
get "#{Repository.path repo}/check-suites/#{id}/check-runs", options
|
85
|
+
end
|
86
|
+
alias :list_check_runs_for_check_suite :check_runs_for_check_suite
|
87
|
+
|
88
|
+
# Get a single check run
|
89
|
+
#
|
90
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
91
|
+
# @param id [Integer] The ID of the check run
|
92
|
+
# @return [Sawyer::Resource] A hash representing the check run
|
93
|
+
# @see https://developer.github.com/v3/checks/runs/#get-a-single-check-run
|
94
|
+
def check_run(repo, id, options = {})
|
95
|
+
get "#{Repository.path repo}/check-runs/#{id}", options
|
96
|
+
end
|
97
|
+
|
98
|
+
# List annotations for a check run
|
99
|
+
#
|
100
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
101
|
+
# @param id [Integer] The ID of the check run
|
102
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing check run annotations
|
103
|
+
# @see https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run
|
104
|
+
# @example List annotations for a check run
|
105
|
+
# annotations = @client.check_run_annotations("octocat/Hello-World", 51295429)
|
106
|
+
# annotations.count # => 1
|
107
|
+
# annotations[0].path # => "README.md"
|
108
|
+
# annotations[0].message # => "Looks good!"
|
109
|
+
def check_run_annotations(repo, id, options = {})
|
110
|
+
get "#{Repository.path repo}/check-runs/#{id}/annotations", options
|
111
|
+
end
|
112
|
+
|
113
|
+
# Methods for Check Suites
|
114
|
+
#
|
115
|
+
# @see https://developer.github.com/v3/checks/suites/
|
116
|
+
|
117
|
+
# Get a single check suite
|
118
|
+
#
|
119
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
120
|
+
# @param id [Integer] The ID of the check suite
|
121
|
+
# @return [Sawyer::Resource] A hash representing the check suite
|
122
|
+
# @see https://developer.github.com/v3/checks/suites/#get-a-single-check-suite
|
123
|
+
def check_suite(repo, id, options = {})
|
124
|
+
get "#{Repository.path repo}/check-suites/#{id}", options
|
125
|
+
end
|
126
|
+
|
127
|
+
# List check suites for a specific ref
|
128
|
+
#
|
129
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
130
|
+
# @param ref [String] A SHA, branch name, or tag name
|
131
|
+
# @param options [Hash] A set of optional filters
|
132
|
+
# @option options [Integer] :app_id Filters check suites by GitHub App <tt>id</tt>
|
133
|
+
# @option options [String] :check_name Filters checks suites by the <tt>name</tt> of the check run
|
134
|
+
# @return [Sawyer::Resource] A hash representing a collection of check suites
|
135
|
+
# @see https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref
|
136
|
+
# @example List check suites for a specific ref
|
137
|
+
# result = @client.check_suites_for_ref("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd", app_id: 76765)
|
138
|
+
# result.total_count # => 1
|
139
|
+
# result.check_suites.count # => 1
|
140
|
+
# result.check_suites[0].id # => 50440400
|
141
|
+
# result.check_suites[0].app.id # => 76765
|
142
|
+
def check_suites_for_ref(repo, ref, options = {})
|
143
|
+
get "#{Repository.path repo}/commits/#{ref}/check-suites", options
|
144
|
+
end
|
145
|
+
alias :list_check_suites_for_ref :check_suites_for_ref
|
146
|
+
|
147
|
+
# Set preferences for check suites on a repository
|
148
|
+
#
|
149
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
150
|
+
# @param options [Hash] Preferences to set
|
151
|
+
# @return [Sawyer::Resource] A hash representing the repository's check suite preferences
|
152
|
+
# @see https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository
|
153
|
+
# @example Set preferences for check suites on a repository
|
154
|
+
# result = @client.set_check_suite_preferences("octocat/Hello-World", auto_trigger_checks: [{ app_id: 76765, setting: false }])
|
155
|
+
# result.preferences.auto_trigger_checks.count # => 1
|
156
|
+
# result.preferences.auto_trigger_checks[0].app_id # => 76765
|
157
|
+
# result.preferences.auto_trigger_checks[0].setting # => false
|
158
|
+
# result.repository.full_name # => "octocat/Hello-World"
|
159
|
+
def set_check_suite_preferences(repo, options = {})
|
160
|
+
patch "#{Repository.path repo}/check-suites/preferences", options
|
161
|
+
end
|
162
|
+
|
163
|
+
# Create a check suite
|
164
|
+
#
|
165
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
166
|
+
# @param head_sha [String] The SHA of the commit to check
|
167
|
+
# @return [Sawyer::Resource] A hash representing the new check suite
|
168
|
+
# @see https://developer.github.com/v3/checks/suites/#create-a-check-suite
|
169
|
+
# @example Create a check suite
|
170
|
+
# check_suite = @client.create_check_suite("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd")
|
171
|
+
# check_suite.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
172
|
+
# check_suite.status # => "queued"
|
173
|
+
def create_check_suite(repo, head_sha, options = {})
|
174
|
+
options[:head_sha] = head_sha
|
175
|
+
|
176
|
+
post "#{Repository.path repo}/check-suites", options
|
177
|
+
end
|
178
|
+
|
179
|
+
# Rerequest check suite
|
180
|
+
#
|
181
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
182
|
+
# @param id [Integer] The ID of the check suite
|
183
|
+
# @return [Boolean] True if successful, raises an error otherwise
|
184
|
+
# @see https://developer.github.com/v3/checks/suites/#rerequest-check-suite
|
185
|
+
def rerequest_check_suite(repo, id, options = {})
|
186
|
+
post "#{Repository.path repo}/check-suites/#{id}/rerequest", options
|
187
|
+
true
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Branches for HEAD API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/commits/
|
7
|
+
module CommitBranches
|
8
|
+
|
9
|
+
# List branches for a single HEAD commit
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @param sha [String] The SHA of the commit whose branches will be fetched
|
13
|
+
# @return [Array] List of branches
|
14
|
+
# @see https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit
|
15
|
+
def commit_branches(repo, sha, options = {})
|
16
|
+
paginate "#{Repository.path repo}/commits/#{sha}/branches-where-head", options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Commit Pulls API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/comments/
|
7
|
+
module CommitPulls
|
8
|
+
|
9
|
+
# List pulls for a single commit
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @param sha [String] The SHA of the commit whose pulls will be fetched
|
13
|
+
# @return [Array] List of commit pulls
|
14
|
+
# @see https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-commit
|
15
|
+
def commit_pulls(repo, sha, options = {})
|
16
|
+
paginate "#{Repository.path repo}/commits/#{sha}/pulls", options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Community Profile API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/community/
|
7
|
+
module CommunityProfile
|
8
|
+
|
9
|
+
# Get community profile metrics for a repository
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @return [Sawyer::Resource] Community profile metrics
|
13
|
+
# @see https://developer.github.com/v3/repos/community/#retrieve-community-profile-metrics
|
14
|
+
# @example Get community profile metrics for octokit/octokit.rb
|
15
|
+
# @client.community_profile('octokit/octokit.rb')
|
16
|
+
def community_profile(repo, options = {})
|
17
|
+
options = ensure_api_media_type(:community_profile, options)
|
18
|
+
get "#{Repository.path repo}/community/profile", options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -16,6 +16,8 @@ module Octokit
|
|
16
16
|
# @see https://developer.github.com/v3/repos/contents/#get-the-readme
|
17
17
|
# @example Get the readme file for a repo
|
18
18
|
# Octokit.readme("octokit/octokit.rb")
|
19
|
+
# @example Get the readme file for a particular branch of the repo
|
20
|
+
# Octokit.readme("octokit/octokit.rb", :query => {:ref => 'some-other-branch'})
|
19
21
|
def readme(repo, options={})
|
20
22
|
get "#{Repository.path repo}/readme", options
|
21
23
|
end
|
@@ -29,7 +31,10 @@ module Octokit
|
|
29
31
|
# @see https://developer.github.com/v3/repos/contents/#get-contents
|
30
32
|
# @example List the contents of lib/octokit.rb
|
31
33
|
# Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb')
|
34
|
+
# @example Lists the contents of lib /octokit.rb on a particular branch
|
35
|
+
# Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb', :query => {:ref => 'some-other-branch'})
|
32
36
|
def contents(repo, options={})
|
37
|
+
options = options.dup
|
33
38
|
repo_path = options.delete :path
|
34
39
|
url = "#{Repository.path repo}/contents/#{repo_path}"
|
35
40
|
get url, options
|
@@ -54,6 +59,7 @@ module Octokit
|
|
54
59
|
# "File content",
|
55
60
|
# :branch => "my-new-feature")
|
56
61
|
def create_contents(*args)
|
62
|
+
args = args.map { |item| item && item.dup }
|
57
63
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
58
64
|
repo = args.shift
|
59
65
|
path = args.shift
|
@@ -6,6 +6,16 @@ module Octokit
|
|
6
6
|
# @see https://developer.github.com/v3/repos/commits/deployments/
|
7
7
|
module Deployments
|
8
8
|
|
9
|
+
# Fetch a single deployment for a repository
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
12
|
+
# @param deployment_id [Integer, String, Repository, Hash] A GitHub repository
|
13
|
+
# @return <Sawyer::Resource> A single deployment
|
14
|
+
# @see https://developer.github.com/v3/repos/deployments/#get-a-single-deployment
|
15
|
+
def deployment(repo, deployment_id, options = {})
|
16
|
+
get("#{Repository.path repo}/deployments/#{deployment_id}", options)
|
17
|
+
end
|
18
|
+
|
9
19
|
# List all deployments for a repository
|
10
20
|
#
|
11
21
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -33,6 +43,16 @@ module Octokit
|
|
33
43
|
post("#{Repository.path repo}/deployments", options)
|
34
44
|
end
|
35
45
|
|
46
|
+
# Delete a Deployment
|
47
|
+
#
|
48
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
49
|
+
# @param deployment_id [Integer, String, Repository, Hash] A GitHub repository
|
50
|
+
# @return [No Content]
|
51
|
+
# @see https://developer.github.com/v3/repos/deployments/#delete-a-deployment
|
52
|
+
def delete_deployment(repo, deployment_id, options = {})
|
53
|
+
delete("#{Repository.path repo}/deployments/#{deployment_id}", options)
|
54
|
+
end
|
55
|
+
|
36
56
|
# List all statuses for a Deployment
|
37
57
|
#
|
38
58
|
# @param deployment_url [String] A URL for a deployment resource
|
@@ -131,6 +131,7 @@ module Octokit
|
|
131
131
|
# @example List all issues events for issue #38 on octokit/octokit.rb
|
132
132
|
# Octokit.issue_events("octokit/octokit.rb", 38)
|
133
133
|
def issue_events(repo, number, options = {})
|
134
|
+
options = ensure_api_media_type(:project_card_events, options)
|
134
135
|
paginate "#{Repository.path repo}/issues/#{number}/events", options
|
135
136
|
end
|
136
137
|
|
data/lib/octokit/client/gists.rb
CHANGED
@@ -50,6 +50,7 @@ module Octokit
|
|
50
50
|
# @see https://developer.github.com/v3/gists/#get-a-single-gist
|
51
51
|
# @see https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
|
52
52
|
def gist(gist, options = {})
|
53
|
+
options = options.dup
|
53
54
|
if sha = options.delete(:sha)
|
54
55
|
get "gists/#{Gist.new(gist)}/#{sha}", options
|
55
56
|
else
|
@@ -195,7 +196,7 @@ module Octokit
|
|
195
196
|
# @example
|
196
197
|
# @client.create_gist_comment('3528645', 'This is very helpful.')
|
197
198
|
def create_gist_comment(gist_id, comment, options = {})
|
198
|
-
options.merge
|
199
|
+
options = options.merge({:body => comment})
|
199
200
|
post "gists/#{gist_id}/comments", options
|
200
201
|
end
|
201
202
|
|
@@ -211,7 +212,7 @@ module Octokit
|
|
211
212
|
# @example
|
212
213
|
# @client.update_gist_comment('208sdaz3', '3528645', ':heart:')
|
213
214
|
def update_gist_comment(gist_id, gist_comment_id, comment, options = {})
|
214
|
-
options.merge
|
215
|
+
options = options.merge({:body => comment})
|
215
216
|
patch "gists/#{gist_id}/comments/#{gist_comment_id}", options
|
216
217
|
end
|
217
218
|
|
@@ -81,6 +81,7 @@ module Octokit
|
|
81
81
|
# @param body [String] An optional concise description
|
82
82
|
# @param options [Hash] A customizable set of options.
|
83
83
|
# @option options [String] :assignee User login.
|
84
|
+
# @option options [Array<String>] :assignees User login.
|
84
85
|
# @option options [Integer] :milestone Milestone number.
|
85
86
|
# @option options [String] :labels List of comma separated Label names. Example: <tt>bug,ui,@high</tt>.
|
86
87
|
# @return [Sawyer::Resource] Your newly created issue
|
@@ -120,6 +121,7 @@ module Octokit
|
|
120
121
|
# @param number [Integer] Number ID of the issue
|
121
122
|
# @param options [Hash] A customizable set of options.
|
122
123
|
# @option options [String] :assignee User login.
|
124
|
+
# @option options [Array<String>] :assignees User login.
|
123
125
|
# @option options [Integer] :milestone Milestone number.
|
124
126
|
# @option options [Array<String>] :labels List of Label names. Example: <tt>['bug', 'ui', '@high']</tt>.
|
125
127
|
# @return [Sawyer::Resource] The updated Issue
|
@@ -136,6 +138,7 @@ module Octokit
|
|
136
138
|
# @param number [Integer] Number ID of the issue
|
137
139
|
# @param options [Hash] A customizable set of options.
|
138
140
|
# @option options [String] :assignee User login.
|
141
|
+
# @option options [Array<String>] :assignees User login.
|
139
142
|
# @option options [Integer] :milestone Milestone number.
|
140
143
|
# @option options [Array<String>] :labels List of Label names. Example: <tt>['bug', 'ui', '@high']</tt>.
|
141
144
|
# @return [Sawyer::Resource] The updated Issue
|
@@ -179,6 +182,7 @@ module Octokit
|
|
179
182
|
# @param body [String] Updated body of the issue
|
180
183
|
# @param options [Hash] A customizable set of options.
|
181
184
|
# @option options [String] :assignee User login.
|
185
|
+
# @option options [Array<String>] :assignees User login.
|
182
186
|
# @option options [Integer] :milestone Milestone number.
|
183
187
|
# @option options [String] :labels List of comma separated Label names. Example: <tt>bug,ui,@high</tt>.
|
184
188
|
# @option options [String] :state State of the issue. <tt>open</tt> or <tt>closed</tt>
|
@@ -190,6 +194,7 @@ module Octokit
|
|
190
194
|
# @option options [String] :title Updated title for the issue
|
191
195
|
# @option options [String] :body Updated body of the issue
|
192
196
|
# @option options [String] :assignee User login.
|
197
|
+
# @option options [Array<String>] :assignees User login.
|
193
198
|
# @option options [Integer] :milestone Milestone number.
|
194
199
|
# @option options [Array<String>] :labels List of Label names. Example: <tt>['bug', 'ui', '@high']</tt>.
|
195
200
|
# @option options [String] :state State of the issue. <tt>open</tt> or <tt>closed</tt>
|
@@ -261,7 +266,7 @@ module Octokit
|
|
261
266
|
# @return [Sawyer::Resource] The specific comment in question
|
262
267
|
# @see https://developer.github.com/v3/issues/comments/#get-a-single-comment
|
263
268
|
# @example Get comment #1194549 from an issue on octokit/octokit.rb
|
264
|
-
# Octokit.
|
269
|
+
# Octokit.issue_comment("octokit/octokit.rb", 1194549)
|
265
270
|
def issue_comment(repo, number, options = {})
|
266
271
|
paginate "#{Repository.path repo}/issues/comments/#{number}", options
|
267
272
|
end
|
@@ -316,6 +321,48 @@ module Octokit
|
|
316
321
|
options = ensure_api_media_type(:issue_timelines, options)
|
317
322
|
paginate "#{Repository.path repo}/issues/#{number}/timeline", options
|
318
323
|
end
|
324
|
+
|
325
|
+
# Lists the available assignees for issues in a repository.
|
326
|
+
#
|
327
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
328
|
+
# @return [Array<Sawyer::Resource>] List of GitHub users.
|
329
|
+
# @see https://developer.github.com/v3/issues/assignees/#list-assignees
|
330
|
+
# @example Get available assignees on repository octokit/octokit.rb
|
331
|
+
# Octokit.list_assignees("octokit/octokit.rb")
|
332
|
+
def list_assignees(repo, options = {})
|
333
|
+
paginate "#{Repository.path repo}/assignees", options
|
334
|
+
end
|
335
|
+
|
336
|
+
# Add assignees to an issue
|
337
|
+
#
|
338
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
339
|
+
# @param number [Integer] Issue number
|
340
|
+
# @param assignees [Array<String>] Assignees to be added
|
341
|
+
# @return [Sawyer::Resource] Issue
|
342
|
+
# @see https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
|
343
|
+
# @example Add assignees "pengwynn" and "joeyw" to Issue #23 on octokit/octokit.rb
|
344
|
+
# Octokit.add_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
|
345
|
+
def add_assignees(repo, number, assignees, options = {})
|
346
|
+
post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
|
347
|
+
end
|
348
|
+
|
349
|
+
# Remove assignees from an issue
|
350
|
+
#
|
351
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
352
|
+
# @param number [Integer] Issue number
|
353
|
+
# @param assignees [Array<String>] Assignees to be removed
|
354
|
+
# @param options [Hash] Header params for request
|
355
|
+
# @return [Sawyer::Resource] Issue
|
356
|
+
# @see https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
|
357
|
+
# @example Remove assignees "pengwynn" and "joeyw" from Issue #23 on octokit/octokit.rb
|
358
|
+
# Octokit.remove_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
|
359
|
+
#
|
360
|
+
# @example Remove assignees "pengwynn" from Issue #23 on octokit/octokit.rb
|
361
|
+
# Octokit.remove_assignees("octokit/octokit.rb", 23, ["pengwynn"],
|
362
|
+
# :accept => "application/vnd.github.v3+json")
|
363
|
+
def remove_assignees(repo, number, assignees, options = {})
|
364
|
+
delete "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
|
365
|
+
end
|
319
366
|
end
|
320
367
|
end
|
321
368
|
end
|
@@ -26,7 +26,7 @@ module Octokit
|
|
26
26
|
# @return [Sawyer::Resource] A single label from the repository
|
27
27
|
# @see https://developer.github.com/v3/issues/labels/#get-a-single-label
|
28
28
|
# @example Get the "V3 Addition" label from octokit/octokit.rb
|
29
|
-
# Octokit.
|
29
|
+
# Octokit.label("octokit/octokit.rb", "V3 Addition")
|
30
30
|
def label(repo, name, options = {})
|
31
31
|
get "#{Repository.path repo}/labels/#{name}", options
|
32
32
|
end
|
@@ -78,7 +78,7 @@ module Octokit
|
|
78
78
|
# This removes the label from the Issue
|
79
79
|
#
|
80
80
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
81
|
-
# @param number [
|
81
|
+
# @param number [Integer] Number ID of the issue
|
82
82
|
# @param label [String] String name of the label
|
83
83
|
# @return [Array<Sawyer::Resource>] A list of the labels currently on the issue
|
84
84
|
# @see https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
@@ -93,7 +93,7 @@ module Octokit
|
|
93
93
|
# This removes the label from the Issue
|
94
94
|
#
|
95
95
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
96
|
-
# @param number [
|
96
|
+
# @param number [Integer] Number ID of the issue
|
97
97
|
# @return [Boolean] Success of operation
|
98
98
|
# @see https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue
|
99
99
|
# @example Remove all labels from Issue #23
|
@@ -105,7 +105,7 @@ module Octokit
|
|
105
105
|
# List labels for a given issue
|
106
106
|
#
|
107
107
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
108
|
-
# @param number [
|
108
|
+
# @param number [Integer] Number ID of the issue
|
109
109
|
# @return [Array<Sawyer::Resource>] A list of the labels currently on the issue
|
110
110
|
# @see https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
|
111
111
|
# @example List labels for octokit/octokit.rb, issue # 1
|
@@ -117,7 +117,7 @@ module Octokit
|
|
117
117
|
# Add label(s) to an Issue
|
118
118
|
#
|
119
119
|
# @param repo [Integer, String, Repository, Hash] A Github repository
|
120
|
-
# @param number [
|
120
|
+
# @param number [Integer] Number ID of the issue
|
121
121
|
# @param labels [Array] An array of labels to apply to this Issue
|
122
122
|
# @return [Array<Sawyer::Resource>] A list of the labels currently on the issue
|
123
123
|
# @see https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
|
@@ -130,7 +130,7 @@ module Octokit
|
|
130
130
|
# Replace all labels on an Issue
|
131
131
|
#
|
132
132
|
# @param repo [Integer, String, Repository, Hash] A Github repository
|
133
|
-
# @param number [
|
133
|
+
# @param number [Integer] Number ID of the issue
|
134
134
|
# @param labels [Array] An array of labels to use as replacement
|
135
135
|
# @return [Array<Sawyer::Resource>] A list of the labels currently on the issue
|
136
136
|
# @see https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
@@ -143,7 +143,7 @@ module Octokit
|
|
143
143
|
# Get labels for every issue in a milestone
|
144
144
|
#
|
145
145
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
146
|
-
# @param number [
|
146
|
+
# @param number [Integer] Number ID of the milestone
|
147
147
|
# @return [Array<Sawyer::Resource>] A list of the labels across the milestone
|
148
148
|
# @see http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
|
149
149
|
# @example List all labels for milestone #2 on octokit/octokit.rb
|
@@ -35,7 +35,7 @@ module Octokit
|
|
35
35
|
# @option options [String] :ref name of the Commit/Branch/Tag. Defaults to 'master'.
|
36
36
|
# @return [Sawyer::Resource] The detail of the license file
|
37
37
|
# @example
|
38
|
-
# Octokit.
|
38
|
+
# Octokit.repository_license_contents 'benbalter/licensee'
|
39
39
|
def repository_license_contents(repo, options = {})
|
40
40
|
options = ensure_api_media_type(:licenses, options)
|
41
41
|
get "#{Repository.path repo}/license", options
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Marketplace Listing API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/apps/marketplace/
|
7
|
+
module Marketplace
|
8
|
+
|
9
|
+
# List all plans for an app's marketplace listing
|
10
|
+
#
|
11
|
+
# @param options [Hash] A customizable set of options
|
12
|
+
#
|
13
|
+
# @see https://developer.github.com/v3/apps/marketplace/#list-all-plans-for-your-marketplace-listing
|
14
|
+
#
|
15
|
+
# @return [Array<Sawyer::Resource>] A list of plans
|
16
|
+
def list_plans(options = {})
|
17
|
+
paginate "/marketplace_listing/plans", options
|
18
|
+
end
|
19
|
+
|
20
|
+
# List all GitHub accounts on a specific plan
|
21
|
+
#
|
22
|
+
# @param plan_id [Integer] The id of the GitHub plan
|
23
|
+
# @param options [Hash] A customizable set of options
|
24
|
+
#
|
25
|
+
# @see https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan
|
26
|
+
#
|
27
|
+
# @return [Array<Sawyer::Resource>] A list of accounts
|
28
|
+
def list_accounts_for_plan(plan_id, options = {})
|
29
|
+
paginate "/marketplace_listing/plans/#{plan_id}/accounts", options
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get the plan associated with a given GitHub account
|
33
|
+
#
|
34
|
+
# @param account_id [Integer] The id of the GitHub account
|
35
|
+
# @param options [Hash] A customizable set of options
|
36
|
+
#
|
37
|
+
# @see https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing
|
38
|
+
#
|
39
|
+
# @return <Sawyer::Resource> Account with plan details, or nil
|
40
|
+
def plan_for_account(account_id, options = {})
|
41
|
+
get "/marketplace_listing/accounts/#{account_id}", options
|
42
|
+
end
|
43
|
+
|
44
|
+
# Get user's Marketplace purchases
|
45
|
+
#
|
46
|
+
# @param options [Hash] A customizable set of options
|
47
|
+
#
|
48
|
+
# @see https://developer.github.com/v3/apps/marketplace/#get-a-users-marketplace-purchases
|
49
|
+
#
|
50
|
+
# @return [Array<Sawyer::Resource>] A list of Marketplace purchases
|
51
|
+
def marketplace_purchases(options = {})
|
52
|
+
get "/user/marketplace_purchases", options
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -108,10 +108,6 @@ module Octokit
|
|
108
108
|
# Mark thread as read
|
109
109
|
#
|
110
110
|
# @param thread_id [Integer] Id of the thread to update.
|
111
|
-
# @param options [Hash] Optional parameters.
|
112
|
-
# @option options [Boolean] :unread Changes the unread status of the
|
113
|
-
# threads.
|
114
|
-
# @option options [Boolean] :read Inverse of 'unread'.
|
115
111
|
# @return [Boolean] True if updated, false otherwise.
|
116
112
|
# @see https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
117
113
|
# @example
|