GhEx.Stacks (gh_ex v0.3.4)

Copy Markdown View Source

Convenience functions for GitHub's Stacks REST API.

A stack is addressed by its repository-scoped stack number. Pull request numbers passed to create/5 and add/6 must be ordered from the bottom of the stack to the top.

Stacked pull requests are in public preview. GitHub returns 404 Not Found when the feature is not yet available for a repository.

Each function is a thin wrapper over GhEx.REST and returns the same {:ok, body, meta} / {:error, reason} shape.

Summary

Functions

Adds pull requests to the top of a stack. attrs must contain pull_requests, ordered from the stack's current top upward.

Creates a stack. attrs must contain pull_requests, an ordered list of pull request numbers from bottom to top (minimum 2, maximum 100).

Gets a stack by its repository-scoped stack number.

Lists stacks in a repository. Use params: [pull_request: number] to find the stack containing a particular pull request.

Auto-paginates repository stacks into a lazy Stream.

Removes the unmerged pull requests from a stack.

Types

number_ref()

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

Functions

add(client, owner, repo, stack_number, attrs, opts \\ [])

Adds pull requests to the top of a stack. attrs must contain pull_requests, ordered from the stack's current top upward.

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

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

Creates a stack. attrs must contain pull_requests, an ordered list of pull request numbers from bottom to top (minimum 2, maximum 100).

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

Gets a stack by its repository-scoped stack number.

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

Lists stacks in a repository. Use params: [pull_request: number] to find the stack containing a particular pull request.

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

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

Auto-paginates repository stacks into a lazy Stream.

unstack(client, owner, repo, stack_number, opts \\ [])

Removes the unmerged pull requests from a stack.

Pull requests that are merged, merging, or queued for merge remain. GitHub returns the remaining stack with 200, or 204 No Content when the stack is fully dissolved.