octokit 4.14.0 → 4.21.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/CONTRIBUTING.md +14 -13
- data/README.md +20 -17
- data/lib/octokit/authentication.rb +2 -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 +43 -30
- data/lib/octokit/client/authorizations.rb +2 -70
- data/lib/octokit/client/checks.rb +0 -20
- data/lib/octokit/client/commit_branches.rb +20 -0
- data/lib/octokit/client/commit_pulls.rb +20 -0
- data/lib/octokit/client/contents.rb +4 -0
- data/lib/octokit/client/deployments.rb +10 -0
- data/lib/octokit/client/events.rb +1 -0
- data/lib/octokit/client/issues.rb +7 -2
- data/lib/octokit/client/oauth_applications.rb +122 -0
- data/lib/octokit/client/organizations.rb +39 -11
- data/lib/octokit/client/pull_requests.rb +1 -1
- data/lib/octokit/client/refs.rb +19 -3
- data/lib/octokit/client/repositories.rb +106 -8
- data/lib/octokit/client/repository_invitations.rb +1 -1
- data/lib/octokit/client/reviews.rb +18 -0
- data/lib/octokit/client/search.rb +1 -1
- data/lib/octokit/client/users.rb +86 -0
- data/lib/octokit/client.rb +12 -0
- data/lib/octokit/connection.rb +11 -8
- data/lib/octokit/error.rb +54 -2
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/preview.rb +7 -3
- data/lib/octokit/rate_limit.rb +1 -1
- 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 +1 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4c54d083639a915bef0eb235748b93351f17f2a98e204b7b9f2899c156f2f6
|
4
|
+
data.tar.gz: 21998779cea8f95e63b1814dc264102c1ac69c9d66fef6694ef6442554419bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14221c5912859f6fa1a9f3dce7d7ee1cb6b5730bc1a95c997e84ff2972f23a3e8eaad723acbabd57982afadc1f4bb1538af510bd10583e21e0f208c7712ce1e6
|
7
|
+
data.tar.gz: 23300ee9b4e73fc660a391018efbc969742dbdc9740faa57ed7609853830689cc1edcca8d445df2d939f2d7353056f828b53ad44b33269573ed06a8e93b8dbd4
|
data/CONTRIBUTING.md
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
## Submitting a Pull Request
|
2
2
|
|
3
|
-
0.
|
4
|
-
|
5
|
-
|
6
|
-
2. [
|
7
|
-
3.
|
8
|
-
4.
|
9
|
-
5.
|
10
|
-
6.
|
11
|
-
7. Run `
|
3
|
+
0. Read our [Code of Conduct](CODE_OF_CONDUCT.md).
|
4
|
+
1. Check out [Hacking on Octokit](README.md#hacking-on-octokitrb) in the
|
5
|
+
README for bootstrapping the project for local development.
|
6
|
+
2. [Fork the repository.][fork]
|
7
|
+
3. [Create a topic branch.][branch]
|
8
|
+
4. Add specs for your unimplemented feature or bug fix.
|
9
|
+
5. Run `script/test`. If your specs pass, return to step 3.
|
10
|
+
6. Implement your feature or bug fix.
|
11
|
+
7. Run `script/test`. If your specs fail, return to step 5.
|
12
|
+
8. Run `open coverage/index.html`. If your changes are not completely covered
|
12
13
|
by your tests, return to step 4.
|
13
|
-
|
14
|
-
|
14
|
+
9. Add documentation for your feature or bug fix.
|
15
|
+
10. Run `bundle exec rake doc:yard`. If your changes are not 100% documented, go
|
15
16
|
back to step 8.
|
16
|
-
|
17
|
+
11. Add, commit, and push your changes. For documentation-only fixes, please
|
17
18
|
add "[ci skip]" to your commit message to avoid needless CI builds.
|
18
|
-
|
19
|
+
12. [Submit a pull request.][pr]
|
19
20
|
|
20
21
|
[fork]: https://help.github.com/articles/fork-a-repo
|
21
22
|
[branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Ruby toolkit for the GitHub API.
|
4
4
|
|
5
|
-

|
6
6
|
|
7
7
|
Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
8
8
|
[major version][semver].
|
@@ -41,7 +41,8 @@ Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
|
41
41
|
1. [Debugging](#debugging)
|
42
42
|
2. [Caching](#caching)
|
43
43
|
14. [Hacking on Octokit.rb](#hacking-on-octokitrb)
|
44
|
-
1. [
|
44
|
+
1. [Code of Conduct](#code-of-conduct)
|
45
|
+
2. [Running and writing new tests](#running-and-writing-new-tests)
|
45
46
|
15. [Supported Ruby Versions](#supported-ruby-versions)
|
46
47
|
16. [Versioning](#versioning)
|
47
48
|
17. [Making Repeating Requests](#making-repeating-requests)
|
@@ -63,7 +64,7 @@ client.readme 'al3x/sovereign', :accept => 'application/vnd.github.html'
|
|
63
64
|
```
|
64
65
|
|
65
66
|
[wrappers]: http://wynnnetherland.com/journal/what-makes-a-good-api-wrapper
|
66
|
-
[github-api]:
|
67
|
+
[github-api]: https://developer.github.com/v3/
|
67
68
|
|
68
69
|
## Quick start
|
69
70
|
|
@@ -85,10 +86,10 @@ Access the library in Ruby:
|
|
85
86
|
|
86
87
|
```ruby
|
87
88
|
# Provide authentication credentials
|
88
|
-
client = Octokit::Client.new(:
|
89
|
+
client = Octokit::Client.new(:access_token => 'personal_access_token')
|
89
90
|
|
90
|
-
#
|
91
|
-
# client = Octokit::Client.new(:
|
91
|
+
# You can still use the username/password syntax by replacing the password value with your PAT.
|
92
|
+
# client = Octokit::Client.new(:login => 'defunkt', :password => 'personal_access_token')
|
92
93
|
|
93
94
|
# Fetch the current user
|
94
95
|
client.user
|
@@ -289,7 +290,7 @@ link relations](#hypermedia-agent).
|
|
289
290
|
|
290
291
|
```ruby
|
291
292
|
issues = client.issues 'rails/rails'
|
292
|
-
issues.concat client.last_response.rels[:next].
|
293
|
+
issues.concat client.get(client.last_response.rels[:next].href)
|
293
294
|
```
|
294
295
|
|
295
296
|
### Auto pagination
|
@@ -322,7 +323,7 @@ custom pattern for traversing large lists.
|
|
322
323
|
|
323
324
|
## Working with GitHub Enterprise
|
324
325
|
|
325
|
-
With a bit of setup, you can also use Octokit with your
|
326
|
+
With a bit of setup, you can also use Octokit with your GitHub Enterprise instance.
|
326
327
|
|
327
328
|
### Interacting with the GitHub.com APIs in GitHub Enterprise
|
328
329
|
|
@@ -650,9 +651,15 @@ to run a Ruby console to poke on Octokit, you can crank one up with:
|
|
650
651
|
|
651
652
|
script/console
|
652
653
|
|
653
|
-
Using the scripts in `./
|
654
|
+
Using the scripts in `./script` instead of `bundle exec rspec`, `bundle
|
654
655
|
console`, etc. ensures your dependencies are up-to-date.
|
655
656
|
|
657
|
+
### Code of Conduct
|
658
|
+
|
659
|
+
We want both the Octokit.rb and larger Octokit communities to be an open
|
660
|
+
and welcoming environments. Please read and follow both in spirit and
|
661
|
+
letter [Code of Conduct](CODE_OF_CONDUCT.md).
|
662
|
+
|
656
663
|
### Running and writing new tests
|
657
664
|
|
658
665
|
Octokit uses [VCR][] for recording and playing back API fixtures during test
|
@@ -706,16 +713,12 @@ when writing new specs.
|
|
706
713
|
|
707
714
|
## Supported Ruby Versions
|
708
715
|
|
709
|
-
This library aims to support and is [tested against][
|
716
|
+
This library aims to support and is [tested against][actions] the following Ruby
|
710
717
|
implementations:
|
711
718
|
|
712
|
-
* Ruby 2.0
|
713
|
-
* Ruby 2.1
|
714
|
-
* Ruby 2.2
|
715
|
-
* Ruby 2.3
|
716
|
-
* Ruby 2.4
|
717
719
|
* Ruby 2.5
|
718
720
|
* Ruby 2.6
|
721
|
+
* Ruby 2.7
|
719
722
|
|
720
723
|
If something doesn't work on one of these Ruby versions, it's a bug.
|
721
724
|
|
@@ -730,7 +733,7 @@ implementation, you will be responsible for providing patches in a timely
|
|
730
733
|
fashion. If critical issues for a particular implementation exist at the time
|
731
734
|
of a major release, support for that Ruby version may be dropped.
|
732
735
|
|
733
|
-
[
|
736
|
+
[actions]: https://github.com/octokit/octokit.rb/actions
|
734
737
|
|
735
738
|
## Versioning
|
736
739
|
|
@@ -752,7 +755,7 @@ The changes made between versions can be seen on the [project releases page][rel
|
|
752
755
|
[releases]: https://github.com/octokit/octokit.rb/releases
|
753
756
|
|
754
757
|
## Making Repeating Requests
|
755
|
-
In most cases it would be best to use a [webhooks](https://developer.github.com/webhooks/), but sometimes webhooks don't provide all of the information needed. In those cases where one might need to poll for progress or retry a request on failure, we designed [Octopoller](https://github.com/octokit/octopoller.rb). Octopoller is a micro gem perfect for making repeating requests.
|
758
|
+
In most cases it would be best to use a [webhooks](https://developer.github.com/webhooks/), but sometimes webhooks don't provide all of the information needed. In those cases where one might need to poll for progress or retry a request on failure, we designed [Octopoller](https://github.com/octokit/octopoller.rb). Octopoller is a micro gem perfect for making repeating requests.
|
756
759
|
|
757
760
|
```ruby
|
758
761
|
Octopoller.poll(timeout: 15.seconds) do
|
@@ -43,22 +43,13 @@ module Octokit
|
|
43
43
|
# requests at a higher rate limit
|
44
44
|
#
|
45
45
|
# @see https://developer.github.com/v3/#unauthenticated-rate-limited-requests
|
46
|
-
# @return Boolean
|
46
|
+
# @return [Boolean]
|
47
47
|
def application_authenticated?
|
48
|
-
!!
|
48
|
+
!!(@client_id && @client_secret)
|
49
49
|
end
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
-
def application_authentication
|
54
|
-
if @client_id && @client_secret
|
55
|
-
{
|
56
|
-
:client_id => @client_id,
|
57
|
-
:client_secret => @client_secret
|
58
|
-
}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
53
|
def login_from_netrc
|
63
54
|
return unless netrc?
|
64
55
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Actions Secrets API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/actions/secrets/
|
7
|
+
module ActionsSecrets
|
8
|
+
|
9
|
+
# Get public key for secrets encryption
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @return [Hash] key_id and key
|
13
|
+
# @see https://developer.github.com/v3/actions/secrets/#get-your-public-key
|
14
|
+
def get_public_key(repo)
|
15
|
+
get "#{Repository.path repo}/actions/secrets/public-key"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
# List secrets
|
20
|
+
#
|
21
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
22
|
+
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
23
|
+
# @see https://developer.github.com/v3/actions/secrets/#list-secrets-for-a-repository
|
24
|
+
def list_secrets(repo)
|
25
|
+
paginate "#{Repository.path repo}/actions/secrets"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get a secret
|
29
|
+
#
|
30
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
31
|
+
# @param name [String] Name of secret
|
32
|
+
# @return [Hash] name, created_at and updated_at
|
33
|
+
# @see https://developer.github.com/v3/actions/secrets/#get-a-secret
|
34
|
+
def get_secret(repo, name)
|
35
|
+
get "#{Repository.path repo}/actions/secrets/#{name}"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create or update secrets
|
39
|
+
#
|
40
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
41
|
+
# @param name [String] Name of secret
|
42
|
+
# @param options [Hash] encrypted_value and key_id
|
43
|
+
# @see https://developer.github.com/v3/actions/secrets/#create-or-update-a-secret-for-a-repository
|
44
|
+
def create_or_update_secret(repo, name, options)
|
45
|
+
put "#{Repository.path repo}/actions/secrets/#{name}", options
|
46
|
+
end
|
47
|
+
|
48
|
+
# Delete a secret
|
49
|
+
#
|
50
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
51
|
+
# @param name [String] Name of secret
|
52
|
+
# @see https://developer.github.com/v3/actions/secrets/#delete-a-secret-from-a-repository
|
53
|
+
def delete_secret(repo, name)
|
54
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/secrets/#{name}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
module ActionsWorkflowRuns
|
4
|
+
# List all runs for a repository workflow
|
5
|
+
#
|
6
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
7
|
+
# @param workflow [Integer, String] Id or file name of the workflow
|
8
|
+
# @option options [String] :actor Optional filtering by a user
|
9
|
+
# @option options [String] :branch Optional filtering by a branch
|
10
|
+
# @option options [String] :event Optional filtering by the event type
|
11
|
+
# @option options [String] :status Optional filtering by a status or conclusion
|
12
|
+
#
|
13
|
+
# @return [Sawyer::Resource] the total count and an array of workflows
|
14
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
15
|
+
def workflow_runs(repo, workflow, options = {})
|
16
|
+
paginate "#{Repository.path repo}/actions/workflows/#{workflow}/runs", options
|
17
|
+
end
|
18
|
+
alias list_workflow_runs workflow_runs
|
19
|
+
|
20
|
+
# List all workflow runs for a repository
|
21
|
+
#
|
22
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
23
|
+
# @option options [String] :actor Optional filtering by the login of a user
|
24
|
+
# @option options [String] :branch Optional filtering by a branch
|
25
|
+
# @option options [String] :event Optional filtering by the event type (e.g. push, pull_request, issue)
|
26
|
+
# @option options [String] :status Optional filtering by a status or conclusion (e.g. success, completed...)
|
27
|
+
#
|
28
|
+
# @return [Sawyer::Resource] the total count and an array of workflows
|
29
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#list-repository-workflow-runs
|
30
|
+
def repository_workflow_runs(repo, options = {})
|
31
|
+
paginate "#{Repository.path repo}/actions/runs", options
|
32
|
+
end
|
33
|
+
alias list_repository_workflow_runs repository_workflow_runs
|
34
|
+
|
35
|
+
# Get a workflow run
|
36
|
+
#
|
37
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
38
|
+
# @param id [Integer] Id of a workflow run
|
39
|
+
#
|
40
|
+
# @return [Sawyer::Resource] Run information
|
41
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#get-a-workflow-run
|
42
|
+
def workflow_run(repo, id, options = {})
|
43
|
+
get "#{Repository.path repo}/actions/runs/#{id}", options
|
44
|
+
end
|
45
|
+
|
46
|
+
# Re-runs a workflow run
|
47
|
+
#
|
48
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
49
|
+
# @param id [Integer] Id of a workflow run
|
50
|
+
#
|
51
|
+
# @return [Boolean] Returns true if the re-run request was accepted
|
52
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#re-run-a-workflow
|
53
|
+
def rerun_workflow_run(repo, id, options = {})
|
54
|
+
boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/rerun", options
|
55
|
+
end
|
56
|
+
|
57
|
+
# Cancels a workflow run
|
58
|
+
#
|
59
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
60
|
+
# @param id [Integer] Id of a workflow run
|
61
|
+
#
|
62
|
+
# @return [Boolean] Returns true if the cancellation was accepted
|
63
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#cancel-a-workflow-run
|
64
|
+
def cancel_workflow_run(repo, id, options = {})
|
65
|
+
boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/cancel", options
|
66
|
+
end
|
67
|
+
|
68
|
+
# Deletes a workflow run
|
69
|
+
#
|
70
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
71
|
+
# @param id [Integer] Id of a workflow run
|
72
|
+
#
|
73
|
+
# @return [Boolean] Returns true if the run is deleted
|
74
|
+
# @see https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
|
75
|
+
def delete_workflow_run(repo, id, options = {})
|
76
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}", options
|
77
|
+
end
|
78
|
+
|
79
|
+
# Get a download url for archived log files of a workflow run
|
80
|
+
#
|
81
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
82
|
+
# @param id [Integer] Id of a workflow run
|
83
|
+
#
|
84
|
+
# @return [String] URL to the archived log files of the run
|
85
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#download-workflow-run-logs
|
86
|
+
def workflow_run_logs(repo, id, options = {})
|
87
|
+
url = "#{Repository.path repo}/actions/runs/#{id}/logs"
|
88
|
+
|
89
|
+
response = client_without_redirects.head(url, options)
|
90
|
+
response.headers['Location']
|
91
|
+
end
|
92
|
+
|
93
|
+
# Delets all log files of a workflow run
|
94
|
+
#
|
95
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
96
|
+
# @param id [Integer] Id of a workflow run
|
97
|
+
#
|
98
|
+
# @return [Boolean] Returns true if the logs are deleted
|
99
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#delete-workflow-run-logs
|
100
|
+
def delete_workflow_run_logs(repo, id, options = {})
|
101
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
# Methods for the Actions Workflows API
|
4
|
+
#
|
5
|
+
# @see https://developer.github.com/v3/actions/workflows
|
6
|
+
module ActionsWorkflows
|
7
|
+
|
8
|
+
# Get the workflows in a repository
|
9
|
+
#
|
10
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
11
|
+
#
|
12
|
+
# @return [Sawyer::Resource] the total count and an array of workflows
|
13
|
+
# @see https://developer.github.com/v3/actions/workflows/#list-repository-workflows
|
14
|
+
def workflows(repo, options = {})
|
15
|
+
paginate "#{Repository.path repo}/actions/workflows", options
|
16
|
+
end
|
17
|
+
alias list_workflows workflows
|
18
|
+
|
19
|
+
# Get single workflow in a repository
|
20
|
+
#
|
21
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
22
|
+
# @param id [Integer, String] Id or file name of the workflow
|
23
|
+
#
|
24
|
+
# @return [Sawyer::Resource] A single workflow
|
25
|
+
# @see https://developer.github.com/v3/actions/workflows/#get-a-workflow
|
26
|
+
def workflow(repo, id, options = {})
|
27
|
+
get "#{Repository.path repo}/actions/workflows/#{id}", options
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a workflow dispatch event
|
31
|
+
#
|
32
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
33
|
+
# @param id [Integer, String] Id or file name of the workflow
|
34
|
+
# @param ref [String] A SHA, branch name, or tag name
|
35
|
+
#
|
36
|
+
# @return [Boolean] True if event was dispatched, false otherwise
|
37
|
+
# @see https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event
|
38
|
+
def workflow_dispatch(repo, id, ref, options = {})
|
39
|
+
boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/octokit/client/apps.rb
CHANGED
@@ -4,16 +4,26 @@ module Octokit
|
|
4
4
|
# Methods for the Apps API
|
5
5
|
module Apps
|
6
6
|
|
7
|
+
# Get the authenticated App
|
8
|
+
#
|
9
|
+
# @param options [Hash] A customizable set of options
|
10
|
+
#
|
11
|
+
# @see https://developer.github.com/v3/apps/#get-the-authenticated-app
|
12
|
+
#
|
13
|
+
# @return [Sawyer::Resource] App information
|
14
|
+
def app(options = {})
|
15
|
+
get "app", options
|
16
|
+
end
|
17
|
+
|
7
18
|
# Find all installations that belong to an App
|
8
19
|
#
|
9
20
|
# @param options [Hash] A customizable set of options
|
10
21
|
#
|
11
|
-
# @see https://developer.github.com/v3/apps/#
|
22
|
+
# @see https://developer.github.com/v3/apps/#list-installations
|
12
23
|
#
|
13
24
|
# @return [Array<Sawyer::Resource>] the total_count and an array of installations
|
14
25
|
def find_app_installations(options = {})
|
15
|
-
|
16
|
-
paginate "app/installations", opts
|
26
|
+
paginate "app/installations", options
|
17
27
|
end
|
18
28
|
alias find_installations find_app_installations
|
19
29
|
|
@@ -31,12 +41,11 @@ module Octokit
|
|
31
41
|
#
|
32
42
|
# @param options [Hash] A customizable set of options
|
33
43
|
#
|
34
|
-
# @see https://developer.github.com/v3/apps/#list-installations-for-user
|
44
|
+
# @see https://developer.github.com/v3/apps/installations/#list-installations-for-a-user
|
35
45
|
#
|
36
46
|
# @return [Sawyer::Resource] the total_count and an array of installations
|
37
47
|
def find_user_installations(options = {})
|
38
|
-
|
39
|
-
paginate("user/installations", opts) do |data, last_response|
|
48
|
+
paginate("user/installations", options) do |data, last_response|
|
40
49
|
data.installations.concat last_response.data.installations
|
41
50
|
end
|
42
51
|
end
|
@@ -45,12 +54,11 @@ module Octokit
|
|
45
54
|
#
|
46
55
|
# @param id [Integer] Installation id
|
47
56
|
#
|
48
|
-
# @see https://developer.github.com/v3/apps/#get-
|
57
|
+
# @see https://developer.github.com/v3/apps/#get-an-installation
|
49
58
|
#
|
50
59
|
# @return [Sawyer::Resource] Installation information
|
51
60
|
def installation(id, options = {})
|
52
|
-
|
53
|
-
get "app/installations/#{id}", opts
|
61
|
+
get "app/installations/#{id}", options
|
54
62
|
end
|
55
63
|
|
56
64
|
# Create a new installation token
|
@@ -58,12 +66,11 @@ module Octokit
|
|
58
66
|
# @param installation [Integer] The id of a GitHub App Installation
|
59
67
|
# @param options [Hash] A customizable set of options
|
60
68
|
#
|
61
|
-
# @see https://developer.github.com/v3/apps/#
|
69
|
+
# @see https://developer.github.com/v3/apps/#create-a-new-installation-token
|
62
70
|
#
|
63
71
|
# @return [<Sawyer::Resource>] An installation token
|
64
72
|
def create_app_installation_access_token(installation, options = {})
|
65
|
-
|
66
|
-
post "app/installations/#{installation}/access_tokens", opts
|
73
|
+
post "app/installations/#{installation}/access_tokens", options
|
67
74
|
end
|
68
75
|
alias create_installation_access_token create_app_installation_access_token
|
69
76
|
|
@@ -82,12 +89,11 @@ module Octokit
|
|
82
89
|
# @param organization [String] Organization GitHub login
|
83
90
|
# @param options [Hash] A customizable set of options
|
84
91
|
#
|
85
|
-
# @see https://developer.github.com/v3/apps/#
|
92
|
+
# @see https://developer.github.com/v3/apps/#get-an-organization-installation
|
86
93
|
#
|
87
94
|
# @return [Sawyer::Resource] Installation information
|
88
95
|
def find_organization_installation(organization, options = {})
|
89
|
-
|
90
|
-
get "#{Organization.path(organization)}/installation", opts
|
96
|
+
get "#{Organization.path(organization)}/installation", options
|
91
97
|
end
|
92
98
|
|
93
99
|
# Enables an app to find the repository's installation information.
|
@@ -95,12 +101,11 @@ module Octokit
|
|
95
101
|
# @param repo [String] A GitHub repository
|
96
102
|
# @param options [Hash] A customizable set of options
|
97
103
|
#
|
98
|
-
# @see https://developer.github.com/v3/apps/#
|
104
|
+
# @see https://developer.github.com/v3/apps/#get-a-repository-installation
|
99
105
|
#
|
100
106
|
# @return [Sawyer::Resource] Installation information
|
101
107
|
def find_repository_installation(repo, options = {})
|
102
|
-
|
103
|
-
get "#{Repository.path(repo)}/installation", opts
|
108
|
+
get "#{Repository.path(repo)}/installation", options
|
104
109
|
end
|
105
110
|
|
106
111
|
# Enables an app to find the user's installation information.
|
@@ -108,23 +113,22 @@ module Octokit
|
|
108
113
|
# @param user [String] GitHub user login
|
109
114
|
# @param options [Hash] A customizable set of options
|
110
115
|
#
|
111
|
-
# @see https://developer.github.com/v3/apps/#
|
116
|
+
# @see https://developer.github.com/v3/apps/#get-a-user-installation
|
112
117
|
#
|
113
118
|
# @return [Sawyer::Resource] Installation information
|
114
119
|
def find_user_installation(user, options = {})
|
115
|
-
|
116
|
-
get "#{User.path(user)}/installation", opts
|
120
|
+
get "#{User.path(user)}/installation", options
|
117
121
|
end
|
118
122
|
|
119
123
|
# List repositories that are accessible to the authenticated installation
|
120
124
|
#
|
121
125
|
# @param options [Hash] A customizable set of options
|
126
|
+
#
|
122
127
|
# @see https://developer.github.com/v3/apps/installations/#list-repositories
|
123
128
|
#
|
124
129
|
# @return [Sawyer::Resource] the total_count and an array of repositories
|
125
130
|
def list_app_installation_repositories(options = {})
|
126
|
-
|
127
|
-
paginate("installation/repositories", opts) do |data, last_response|
|
131
|
+
paginate("installation/repositories", options) do |data, last_response|
|
128
132
|
data.repositories.concat last_response.data.repositories
|
129
133
|
end
|
130
134
|
end
|
@@ -150,8 +154,7 @@ module Octokit
|
|
150
154
|
#
|
151
155
|
# @return [Boolean] Success
|
152
156
|
def add_repository_to_app_installation(installation, repo, options = {})
|
153
|
-
|
154
|
-
boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", opts
|
157
|
+
boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", options
|
155
158
|
end
|
156
159
|
alias add_repo_to_installation add_repository_to_app_installation
|
157
160
|
|
@@ -175,8 +178,7 @@ module Octokit
|
|
175
178
|
#
|
176
179
|
# @return [Boolean] Success
|
177
180
|
def remove_repository_from_app_installation(installation, repo, options = {})
|
178
|
-
|
179
|
-
boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", opts
|
181
|
+
boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", options
|
180
182
|
end
|
181
183
|
alias remove_repo_from_installation remove_repository_from_app_installation
|
182
184
|
|
@@ -195,15 +197,26 @@ module Octokit
|
|
195
197
|
# @param installation [Integer] The id of a GitHub App Installation
|
196
198
|
# @param options [Hash] A customizable set of options
|
197
199
|
#
|
198
|
-
# @see https://developer.github.com/apps/
|
200
|
+
# @see https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
|
199
201
|
#
|
200
202
|
# @return [Sawyer::Resource] the total_count and an array of repositories
|
201
203
|
def find_installation_repositories_for_user(installation, options = {})
|
202
|
-
|
203
|
-
paginate("user/installations/#{installation}/repositories", opts) do |data, last_response|
|
204
|
+
paginate("user/installations/#{installation}/repositories", options) do |data, last_response|
|
204
205
|
data.repositories.concat last_response.data.repositories
|
205
206
|
end
|
206
207
|
end
|
208
|
+
|
209
|
+
# Delete an installation and uninstall a GitHub App
|
210
|
+
#
|
211
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
212
|
+
# @param options [Hash] A customizable set of options
|
213
|
+
#
|
214
|
+
# @see https://developer.github.com/v3/apps/#delete-an-installation
|
215
|
+
#
|
216
|
+
# @return [Boolean] Success
|
217
|
+
def delete_installation(installation, options = {})
|
218
|
+
boolean_from_response :delete, "app/installations/#{installation}", options
|
219
|
+
end
|
207
220
|
end
|
208
221
|
end
|
209
222
|
end
|