Convenience functions for the GitHub Repositories REST API.
Thin wrappers over GhEx.REST that fill in the endpoint path and return the
same {:ok, body, meta} / {:error, reason} shape; opts pass through to
Req (so :params, headers, and a Req.Test plug all work). For an endpoint
without a wrapper, call GhEx.REST directly.
Summary
Functions
Creates a repository in an organization. attrs is the JSON body (name, private, ...).
Deletes a repository.
Lists activity events for a repository.
Gets a repository.
Gets a user's effective repository permission and role.
Checks whether username is a repository collaborator.
Lists branches on a repository.
Lists commits on a repository. Use params: for sha, path, since, until.
Lists repositories for an organization. Use params: for type, sort, per_page.
Lists public repositories for a user.
Auto-paginates a repository's branches into a lazy Stream.
Auto-paginates a repository's commits into a lazy Stream.
Auto-paginates a repository's activity events into a lazy Stream.
Auto-paginates an organization's repositories into a lazy Stream.
Auto-paginates a user's public repositories into a lazy Stream.
Updates a repository.
Functions
@spec create_in_org(GhEx.Client.t(), String.t(), map(), keyword()) :: GhEx.REST.result()
Creates a repository in an organization. attrs is the JSON body (name, private, ...).
@spec delete(GhEx.Client.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Deletes a repository.
@spec events(GhEx.Client.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Lists activity events for a repository.
GitHub optimizes event feeds for conditional polling. Store meta.etag from a
successful response and send it back with
headers: [{"if-none-match", etag}]; an unchanged feed returns
{:ok, :not_modified, meta} without consuming the primary rate limit. The
current polling interval remains available in meta.headers["x-poll-interval"].
@spec get(GhEx.Client.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Gets a repository.
@spec get_collaborator_permission( GhEx.Client.t(), String.t(), String.t(), String.t(), keyword() ) :: GhEx.REST.result()
Gets a user's effective repository permission and role.
The response includes the legacy base "permission", the assigned
"role_name" (including custom roles), and a nested "user" object.
@spec is_collaborator(GhEx.Client.t(), String.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Checks whether username is a repository collaborator.
Returns {:ok, true, meta} for GitHub's 204 collaborator response and
{:ok, false, meta} for 404. Other failures retain the usual
{:error, reason} shape.
@spec list_branches(GhEx.Client.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Lists branches on a repository.
@spec list_commits(GhEx.Client.t(), String.t(), String.t(), keyword()) :: GhEx.REST.result()
Lists commits on a repository. Use params: for sha, path, since, until.
@spec list_for_org(GhEx.Client.t(), String.t(), keyword()) :: GhEx.REST.result()
Lists repositories for an organization. Use params: for type, sort, per_page.
@spec list_for_user(GhEx.Client.t(), String.t(), keyword()) :: GhEx.REST.result()
Lists public repositories for a user.
@spec stream_branches(GhEx.Client.t(), String.t(), String.t(), keyword()) :: Enumerable.t()
Auto-paginates a repository's branches into a lazy Stream.
@spec stream_commits(GhEx.Client.t(), String.t(), String.t(), keyword()) :: Enumerable.t()
Auto-paginates a repository's commits into a lazy Stream.
@spec stream_events(GhEx.Client.t(), String.t(), String.t(), keyword()) :: Enumerable.t()
Auto-paginates a repository's activity events into a lazy Stream.
Use events/4 instead when implementing an ETag-conditional polling loop,
because a stream yields events rather than response metadata.
@spec stream_for_org(GhEx.Client.t(), String.t(), keyword()) :: Enumerable.t()
Auto-paginates an organization's repositories into a lazy Stream.
@spec stream_for_user(GhEx.Client.t(), String.t(), keyword()) :: Enumerable.t()
Auto-paginates a user's public repositories into a lazy Stream.
@spec update(GhEx.Client.t(), String.t(), String.t(), map(), keyword()) :: GhEx.REST.result()
Updates a repository.