module Octokit::Client::Apps

Methods for the Apps API

Public Instance Methods

add_repo_to_installation(installation, repo, options = {})
add_repository_to_app_installation(installation, repo, options = {}) click to toggle source

Add a single repository to an installation

@param installation [Integer] The id of a GitHub App Installation @param repo [Integer] The id of the GitHub repository @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/installations/#add-repository-to-installation

@return [Boolean] Success

# File lib/octokit/client/apps.rb, line 156
def add_repository_to_app_installation(installation, repo, options = {})
  boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", options
end
Also aliased as: add_repo_to_installation
add_repository_to_integration_installation(installation, repo, options = {}) click to toggle source
# File lib/octokit/client/apps.rb, line 161
def add_repository_to_integration_installation(installation, repo, options = {})
  octokit_warn(
    'Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation ' \
    'method is deprecated. Please update your call to use ' \
    'Octokit::Client::Apps#add_repository_to_app_installation before the next major ' \
    'Octokit version update.'
  )
  add_repository_to_app_installation(installation, repo, options)
end
app(options = {}) click to toggle source

Get the authenticated App

@param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#get-the-authenticated-app

@return [Sawyer::Resource] App information

# File lib/octokit/client/apps.rb, line 14
def app(options = {})
  get 'app', options
end
app_hook_delivery(delivery_id, options = {}) click to toggle source

Returns a delivery for the webhook configured for a GitHub App.

@param delivery_id [String] The id of a GitHub App Hook Delivery @param options [Hash] A customizable set of options

@see docs.github.com/en/rest/apps/webhooks#get-a-delivery-for-an-app-webhook

@return [<Sawyer::Resource>] The webhook delivery

# File lib/octokit/client/apps.rb, line 242
def app_hook_delivery(delivery_id, options = {})
  get "/app/hook/deliveries/#{delivery_id}", options
end
create_app_installation_access_token(installation, options = {}) click to toggle source

Create a new installation token

@param installation [Integer] The id of a GitHub App Installation @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#create-a-new-installation-token

@return [<Sawyer::Resource>] An installation token

# File lib/octokit/client/apps.rb, line 72
def create_app_installation_access_token(installation, options = {})
  post "app/installations/#{installation}/access_tokens", options
end
create_installation_access_token(installation, options = {})
create_integration_installation_access_token(installation, options = {}) click to toggle source
# File lib/octokit/client/apps.rb, line 77
def create_integration_installation_access_token(installation, options = {})
  octokit_warn(
    'Deprecated: Octokit::Client::Apps#create_integration_installation_access_token ' \
    'method is deprecated. Please update your call to use ' \
    'Octokit::Client::Apps#create_app_installation_access_token before the next major ' \
    'Octokit version update.'
  )
  create_app_installation_access_token(installation, options)
end
delete_installation(installation, options = {}) click to toggle source

Delete an installation and uninstall a GitHub App

@param installation [Integer] The id of a GitHub App Installation @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#delete-an-installation

@return [Boolean] Success

# File lib/octokit/client/apps.rb, line 217
def delete_installation(installation, options = {})
  boolean_from_response :delete, "app/installations/#{installation}", options
end
deliver_app_hook(delivery_id, options = {}) click to toggle source

Redeliver a delivery for the webhook configured for a GitHub App.

@param delivery_id [Integer] The id of a GitHub App Hook Delivery @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#redeliver-a-delivery-for-an-app-webhook

@return [Boolean] Success

# File lib/octokit/client/apps.rb, line 254
def deliver_app_hook(delivery_id, options = {})
  boolean_from_response :post, "app/hook/deliveries/#{delivery_id}/attempts", options
end
find_app_installations(options = {}) click to toggle source

Find all installations that belong to an App

@param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#list-installations

@return [Array<Sawyer::Resource>] the total_count and an array of installations

# File lib/octokit/client/apps.rb, line 25
def find_app_installations(options = {})
  paginate 'app/installations', options
end
Also aliased as: find_installations
find_installation_repositories_for_user(installation, options = {}) click to toggle source

List repositories accessible to the user for an installation

@param installation [Integer] The id of a GitHub App Installation @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation

@return [Sawyer::Resource] the total_count and an array of repositories

# File lib/octokit/client/apps.rb, line 203
def find_installation_repositories_for_user(installation, options = {})
  paginate("user/installations/#{installation}/repositories", options) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end
find_installations(options = {})
find_integration_installations(options = {}) click to toggle source
# File lib/octokit/client/apps.rb, line 30
def find_integration_installations(options = {})
  octokit_warn(
    'Deprecated: Octokit::Client::Apps#find_integration_installations ' \
    'method is deprecated. Please update your call to use ' \
    'Octokit::Client::Apps#find_app_installations before the next major ' \
    'Octokit version update.'
  )
  find_app_installations(options)
end
find_organization_installation(organization, options = {}) click to toggle source

Enables an app to find the organization’s installation information.

@param organization [String] Organization GitHub login @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#get-an-organization-installation

@return [Sawyer::Resource] Installation information

# File lib/octokit/client/apps.rb, line 95
def find_organization_installation(organization, options = {})
  get "#{Organization.path(organization)}/installation", options
end
find_repository_installation(repo, options = {}) click to toggle source

Enables an app to find the repository’s installation information.

@param repo [String] A GitHub repository @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#get-a-repository-installation

@return [Sawyer::Resource] Installation information

# File lib/octokit/client/apps.rb, line 107
def find_repository_installation(repo, options = {})
  get "#{Repository.path(repo)}/installation", options
end
find_user_installation(user, options = {}) click to toggle source

Enables an app to find the user’s installation information.

@param user [String] GitHub user login @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/#get-a-user-installation

@return [Sawyer::Resource] Installation information

# File lib/octokit/client/apps.rb, line 119
def find_user_installation(user, options = {})
  get "#{User.path(user)}/installation", options
end
find_user_installations(options = {}) click to toggle source

Find all installations that are accessible to the authenticated user

@param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/installations/#list-installations-for-a-user

@return [Sawyer::Resource] the total_count and an array of installations

# File lib/octokit/client/apps.rb, line 47
def find_user_installations(options = {})
  paginate('user/installations', options) do |data, last_response|
    data.installations.concat last_response.data.installations
  end
end
installation(id, options = {}) click to toggle source

Get a single installation

@param id [Integer] Installation id

@see developer.github.com/v3/apps/#get-an-installation

@return [Sawyer::Resource] Installation information

# File lib/octokit/client/apps.rb, line 60
def installation(id, options = {})
  get "app/installations/#{id}", options
end
list_app_hook_deliveries(options = {}) click to toggle source

Returns a list of webhook deliveries for the webhook configured for a GitHub App.

@param options [Hash] A customizable set of options

@see docs.github.com/en/rest/apps/webhooks#list-deliveries-for-an-app-webhook

@return [Array<Hash>] an array of hook deliveries

# File lib/octokit/client/apps.rb, line 228
def list_app_hook_deliveries(options = {})
  paginate('app/hook/deliveries', options) do |data, last_response|
    data.concat last_response.data
  end
end
list_app_installation_repositories(options = {}) click to toggle source

List repositories that are accessible to the authenticated installation

@param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/installations/#list-repositories

@return [Sawyer::Resource] the total_count and an array of repositories

# File lib/octokit/client/apps.rb, line 130
def list_app_installation_repositories(options = {})
  paginate('installation/repositories', options) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end
Also aliased as: list_installation_repos
list_installation_repos(options = {})
list_integration_installation_repositories(options = {}) click to toggle source
# File lib/octokit/client/apps.rb, line 137
def list_integration_installation_repositories(options = {})
  octokit_warn(
    'Deprecated: Octokit::Client::Apps#list_integration_installation_repositories ' \
    'method is deprecated. Please update your call to use ' \
    'Octokit::Client::Apps#list_app_installation_repositories before the next major ' \
    'Octokit version update.'
  )
  list_app_installation_repositories(options)
end
remove_repo_from_installation(installation, repo, options = {})
remove_repository_from_app_installation(installation, repo, options = {}) click to toggle source

Remove a single repository to an installation

@param installation [Integer] The id of a GitHub App Installation @param repo [Integer] The id of the GitHub repository @param options [Hash] A customizable set of options

@see developer.github.com/v3/apps/installations/#remove-repository-from-installation

@return [Boolean] Success

# File lib/octokit/client/apps.rb, line 180
def remove_repository_from_app_installation(installation, repo, options = {})
  boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", options
end
remove_repository_from_integration_installation(installation, repo, options = {}) click to toggle source
# File lib/octokit/client/apps.rb, line 185
def remove_repository_from_integration_installation(installation, repo, options = {})
  octokit_warn(
    'Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation ' \
    'method is deprecated. Please update your call to use ' \
    'Octokit::Client::Apps#remove_repository_from_app_installation before the next major ' \
    'Octokit version update.'
  )
  remove_repository_from_app_installation(installation, repo, options)
end