Exgit.CloudflareArtifacts.Token (exgit v0.1.0)

Copy Markdown View Source

Cloudflare Artifacts repo-scoped token.

This struct represents both shapes the API can return:

  • POST /tokens (CreateTokenResult) — populates id, plaintext, scope, expires_at. Listing fields (state, created_at) stay nil.
  • GET /repos/:name/tokens (TokenInfo) — populates id, scope, state, created_at, expires_at. The actual token bytes are not returned — plaintext stays nil.

Field names match upstream verbatim (plaintext, not secret or value).

The plaintext value is opaque — pass it through to git wire auth via Exgit.Credentials.Artifacts.auth/1 (bearer header) without modification. The expiration is already exposed as the expires_at ISO timestamp on the struct, so callers don't need to parse the embedded ?expires=<unix> suffix.

Summary

Types

scope()

@type scope() :: :read | :write

state()

@type state() :: :active | :expired | :revoked

t()

@type t() :: %Exgit.CloudflareArtifacts.Token{
  created_at: String.t() | nil,
  expires_at: String.t() | nil,
  id: String.t() | nil,
  plaintext: String.t() | nil,
  scope: scope() | nil,
  state: state() | nil
}

Functions

from_map(map)

@spec from_map(map()) :: t()