GhEx.Gists (gh_ex v0.3.2)

Copy Markdown View Source

Convenience functions for the GitHub Gists REST API.

Thin wrappers over GhEx.REST that return the same {:ok, body, meta} / {:error, reason} shape; opts pass through to Req.

Summary

Functions

Creates a gist. attrs is the JSON body (files, description, public, ...).

Lists gists for the authenticated user.

Auto-paginates the authenticated user's gists into a lazy Stream (see GhEx.REST.stream/3).

Types

id()

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

Functions

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

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

Creates a gist. attrs is the JSON body (files, description, public, ...).

delete(client, gist_id, opts \\ [])

@spec delete(GhEx.Client.t(), id(), keyword()) :: GhEx.REST.result()

Deletes a gist.

get(client, gist_id, opts \\ [])

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

Gets a gist by id.

list(client, opts \\ [])

@spec list(
  GhEx.Client.t(),
  keyword()
) :: GhEx.REST.result()

Lists gists for the authenticated user.

stream(client, opts \\ [])

@spec stream(
  GhEx.Client.t(),
  keyword()
) :: Enumerable.t()

Auto-paginates the authenticated user's gists into a lazy Stream (see GhEx.REST.stream/3).

update(client, gist_id, attrs, opts \\ [])

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

Updates a gist.