-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea9066b
commit 21001ad
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
require "../models/apps" | ||
|
||
module Octokit | ||
class Client | ||
# Methods for the Apps API | ||
module Apps | ||
# :nodoc: | ||
alias App = Models::App | ||
|
||
# Get the authenticated App | ||
# | ||
# @param options [Hash] A customizable set of options | ||
# | ||
# @see https://developer.github.com/v3/apps/#get-the-authenticated-app | ||
# | ||
# **Example:** | ||
# ``` | ||
# @client = Octokit.client(bearer_token: <jwt>) | ||
# @client.app | ||
# ``` | ||
def app(**options) | ||
get("app", options) | ||
end | ||
|
||
# Find all installations that belong to an App | ||
# | ||
# @param options [Hash] A customizable set of options | ||
# | ||
# @see https://developer.github.com/v3/apps/#list-installations | ||
# | ||
# @return the total_count and an array of installations | ||
def find_app_installations(**options) : Paginator(Octokit::Models::Installation) | ||
paginate( | ||
Octokit::Models::Installation, | ||
"app/installations", | ||
start_page: options[:page]?, | ||
per_page: options[:per_page]?, | ||
options: options | ||
) | ||
end | ||
|
||
# alias for `find_app_installations` | ||
def find_installations(**options) : Paginator(Octokit::Models::Installation) | ||
find_app_installations(**options) | ||
end | ||
|
||
# Create a new installation token | ||
# | ||
# @param installation [Integer] The id of a GitHub App Installation | ||
# @param options [Hash] A customizable set of options | ||
# | ||
# @see https://developer.github.com/v3/apps/#create-a-new-installation-token | ||
# | ||
# @return [<Sawyer::Resource>] An installation token | ||
def create_app_installation_access_token(installation : Int32, **options) | ||
post("app/installations/#{installation}/access_tokens", options) | ||
end | ||
|
||
# alias for `create_app_installation_access_token` | ||
def create_installation_access_token(installation : Int32, **options) | ||
create_app_installation_access_token(installation, **options) | ||
end | ||
end | ||
end | ||
end |