GhEx.Request (gh_ex v0.1.0)

Copy Markdown View Source

Builds the Req request shared by every API call.

Injects the headers GitHub expects on every request (Accept, X-GitHub-Api-Version, User-Agent) and the Authorization bearer token resolved from the client's GhEx.Auth credential. Client :req_options and per-call options are merged last, so callers can override anything, including installing a Req.Test plug in tests.

Summary

Functions

Builds a Req.Request for method against path (relative to the client's REST base URL, or an absolute URL).

Builds a POST to the client's GraphQL endpoint with body JSON-encoded.

Functions

build(client, method, path, opts \\ [])

@spec build(GhEx.Client.t(), atom(), String.t(), keyword()) :: Req.Request.t()

Builds a Req.Request for method against path (relative to the client's REST base URL, or an absolute URL).

build_graphql(client, body, opts \\ [])

@spec build_graphql(GhEx.Client.t(), map(), keyword()) :: Req.Request.t()

Builds a POST to the client's GraphQL endpoint with body JSON-encoded.

body is the GraphQL envelope, typically %{query: ..., variables: ...}. Shares the same headers and bearer auth as build/4; client :req_options and per-call opts are merged last so a Req.Test plug can be installed.