GhEx.Issues (gh_ex v0.1.0)

Copy Markdown View Source

Convenience functions for the GitHub Issues REST API.

Each function is a thin wrapper over GhEx.REST that fills in the endpoint path. They return the same {:ok, body, meta} / {:error, reason} shape as GhEx.REST and pass opts 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

Adds labels to an issue. labels is a list of label names.

Creates an issue. attrs is the JSON body (title, body, labels, assignees, ...).

Gets a single issue by number.

Lists issues in a repository. Use params: for state, labels, per_page, and the other query options.

Updates an issue. attrs may set title, body, state, labels, and so on.

Types

number_ref()

@type number_ref() :: integer() | String.t()

Functions

add_labels(client, owner, repo, number, labels, opts \\ [])

@spec add_labels(
  GhEx.Client.t(),
  String.t(),
  String.t(),
  number_ref(),
  [String.t()],
  keyword()
) ::
  GhEx.REST.result()

Adds labels to an issue. labels is a list of label names.

create(client, owner, repo, attrs, opts \\ [])

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

Creates an issue. attrs is the JSON body (title, body, labels, assignees, ...).

create_comment(client, owner, repo, number, body, opts \\ [])

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

Adds a comment to an issue.

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

Gets a single issue by number.

list(client, owner, repo, opts \\ [])

Lists issues in a repository. Use params: for state, labels, per_page, and the other query options.

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

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

Lists the comments on an issue.

update(client, owner, repo, number, attrs, opts \\ [])

@spec update(GhEx.Client.t(), String.t(), String.t(), number_ref(), map(), keyword()) ::
  GhEx.REST.result()

Updates an issue. attrs may set title, body, state, labels, and so on.