code_corps v0.0.1 CodeCorps.GitHub.API.Installation View Source

Functions for performing installation actions on the GitHub API.

Link to this section Summary

Functions

Get the access token for the installation

Refreshes the access token for the installation

List repositories that are accessible to the authenticated installation

Link to this section Functions

Link to this function get_access_token(installation) View Source
get_access_token(CodeCorps.GithubAppInstallation.t()) ::
  {:ok, String.t()} |
  {:error, CodeCorps.GitHub.api_error_struct()} |
  {:error, Ecto.Changeset.t()}

Get the access token for the installation.

Returns either the current access token stored in the database because it has not yet expired, or makes a request to the GitHub API for a new access token using the GitHub App’s JWT.

https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/about-authentication-options-for-github-apps/#authenticating-as-an-installation

Link to this function refresh_token(installation) View Source
refresh_token(CodeCorps.GithubAppInstallation.t()) ::
  {:ok, String.t()} |
  {:error, CodeCorps.GitHub.api_error_struct()} |
  {:error, Ecto.Changeset.t()}

Refreshes the access token for the installation.

Makes a request to the GitHub API for a new access token using the GitHub App’s JWT.

https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/about-authentication-options-for-github-apps/#authenticating-as-an-installation

Link to this function repositories(installation) View Source
repositories(CodeCorps.GithubAppInstallation.t()) ::
  {:ok, [map()]} |
  {:error, CodeCorps.GitHub.paginated_endpoint_error()}

List repositories that are accessible to the authenticated installation.

All pages of records are retrieved.

https://developer.github.com/v3/apps/installations/#list-repositories