GhEx.Commits (gh_ex v0.3.4)

Copy Markdown View Source

Convenience functions for GitHub's commit-detail REST APIs.

This module covers single commits, comparisons, associated pull requests, and commit comments. Repository-wide commit listing remains available through GhEx.Repositories.list_commits/4 and GhEx.Repositories.stream_commits/4.

These thin wrappers return the same {:ok, body, meta} / {:error, reason} shape as GhEx.REST and pass opts through to Req.

Summary

Functions

Gets a commit by SHA, branch name, or tag name.

Lists pull requests associated with a commit SHA.

Auto-paginates comments on a commit into a lazy Stream.

Auto-paginates pull requests associated with a commit into a lazy Stream.

Types

ref()

@type ref() :: String.t()

Functions

compare(client, owner, repo, base, head, opts \\ [])

@spec compare(GhEx.Client.t(), String.t(), String.t(), ref(), ref(), keyword()) ::
  GhEx.REST.result()

Compares base to head.

Each side may be a SHA, branch, tag, or a cross-fork form such as "octocat:feature". Use params: for page and per_page.

create_comment(client, owner, repo, sha, attrs, opts \\ [])

@spec create_comment(GhEx.Client.t(), String.t(), String.t(), ref(), map(), keyword()) ::
  GhEx.REST.result()

Creates a comment on a commit.

attrs requires body. To anchor it to a diff, also provide path and position; GitHub is closing down the older line parameter.

get(client, owner, repo, ref, opts \\ [])

@spec get(GhEx.Client.t(), String.t(), String.t(), ref(), keyword()) ::
  GhEx.REST.result()

Gets a commit by SHA, branch name, or tag name.

list_comments(client, owner, repo, ref, opts \\ [])

@spec list_comments(GhEx.Client.t(), String.t(), String.t(), ref(), keyword()) ::
  GhEx.REST.result()

Lists comments on a commit.

list_pulls(client, owner, repo, sha, opts \\ [])

@spec list_pulls(GhEx.Client.t(), String.t(), String.t(), ref(), keyword()) ::
  GhEx.REST.result()

Lists pull requests associated with a commit SHA.

stream_comments(client, owner, repo, ref, opts \\ [])

@spec stream_comments(GhEx.Client.t(), String.t(), String.t(), ref(), keyword()) ::
  Enumerable.t()

Auto-paginates comments on a commit into a lazy Stream.

stream_pulls(client, owner, repo, sha, opts \\ [])

@spec stream_pulls(GhEx.Client.t(), String.t(), String.t(), ref(), keyword()) ::
  Enumerable.t()

Auto-paginates pull requests associated with a commit into a lazy Stream.