code_corps v0.0.1 CodeCorps.GitHub View Source

Link to this section Summary

Types

Potential errors which can happen when retrieving data from a paginated endpoint

Functions

A low level utility function to make an authenticated request to a GitHub API endpoint which supports pagination, and fetch all the pages from that endpoint at once, by making parallel requests to each page and aggregating the results

A low level utility function to make an authenticated request to the GitHub API on behalf of a GitHub App or integration

A low level utility function to make a direct request to the GitHub API

A low level utility function to fetch a GitHub user’s OAuth access token

Link to this section Types

Link to this type body() View Source
body() :: {:multipart, list()} | map()
Link to this type headers() View Source
headers() :: %{optional(String.t()) => String.t()} | %{}
Link to this type method() View Source
method() :: :get | :post | :put | :delete | :patch | :head

Potential errors which can happen when retrieving data from a paginated endpoint.

If a new access token is required, then it is regenerated and stored into an installation, which can result in any of

  • Ecto.Changeset.t
  • CodeCorps.GitHub.APIError.t
  • CodeCorps.GitHub.HTTPClientError.t

Once that is done, the actual request is made, which can error out with

  • CodeCorps.GitHub.Errors.PaginationError.t
Link to this type response() View Source
response() :: {:ok, map()} | {:error, api_error_struct()}

Link to this section Functions

Link to this function get_all(endpoint, headers, options) View Source
get_all(String.t(), headers(), list()) ::
  {:ok, [map()]} |
  {:error, CodeCorps.GitHub.API.Errors.PaginationError.t()} |
  {:error, api_error_struct()}

A low level utility function to make an authenticated request to a GitHub API endpoint which supports pagination, and fetch all the pages from that endpoint at once, by making parallel requests to each page and aggregating the results.

Link to this function integration_request(method, endpoint, body, headers, options) View Source
integration_request(method(), String.t(), body(), headers(), list()) :: response()

A low level utility function to make an authenticated request to the GitHub API on behalf of a GitHub App or integration

Link to this function request(method, endpoint, body, headers, options) View Source
request(method(), String.t(), body(), headers(), list()) :: response()

A low level utility function to make a direct request to the GitHub API.

Link to this function user_access_token_request(code, state) View Source
user_access_token_request(String.t(), String.t()) :: response()

A low level utility function to fetch a GitHub user’s OAuth access token