models/decoders

This contains all decoders needed to parse responses into models. Adapted from Gleam’s stdlib dynamic decoders.

Abandon all hope, ye who enter.

Types

pub type ApplicationDecoder(app) =
  fn(Dynamic) -> Result(app, DecodeErrors)
pub type InstallParamsDecoder(install_params) =
  fn(Dynamic) -> Result(install_params, DecodeErrors)
pub type MemberDecoder(member) =
  fn(Dynamic) -> Result(member, DecodeErrors)
pub type TeamDecoder(team) =
  fn(Dynamic) -> Result(team, DecodeErrors)
pub type UserDecoder(user) =
  fn(Dynamic) -> Result(user, DecodeErrors)

Functions

pub fn application(
  constructor: fn(
    a,
    b,
    c,
    d,
    e,
    f,
    g,
    h,
    i,
    j,
    k,
    l,
    m,
    n,
    o,
    p,
    q,
    r,
    s,
    t,
    u,
    v,
    w,
    x,
    y,
    z,
  ) -> Application,
  id: fn(Dynamic) -> Result(a, List(DecodeError)),
  name: fn(Dynamic) -> Result(b, List(DecodeError)),
  icon: fn(Dynamic) -> Result(c, List(DecodeError)),
  description: fn(Dynamic) -> Result(d, List(DecodeError)),
  rpc_origins: fn(Dynamic) -> Result(e, List(DecodeError)),
  bot_public: fn(Dynamic) -> Result(f, List(DecodeError)),
  bot_require_code_grant: fn(Dynamic) ->
    Result(g, List(DecodeError)),
  bot: fn(Dynamic) -> Result(h, List(DecodeError)),
  terms_of_service_url: fn(Dynamic) ->
    Result(i, List(DecodeError)),
  privacy_policy_url: fn(Dynamic) -> Result(j, List(DecodeError)),
  owner: fn(Dynamic) -> Result(k, List(DecodeError)),
  summary: fn(Dynamic) -> Result(l, List(DecodeError)),
  verify_key: fn(Dynamic) -> Result(m, List(DecodeError)),
  team: fn(Dynamic) -> Result(n, List(DecodeError)),
  guild_id: fn(Dynamic) -> Result(o, List(DecodeError)),
  primary_sku_id: fn(Dynamic) -> Result(p, List(DecodeError)),
  slug: fn(Dynamic) -> Result(q, List(DecodeError)),
  cover_image: fn(Dynamic) -> Result(r, List(DecodeError)),
  flags: fn(Dynamic) -> Result(s, List(DecodeError)),
  approximate_guild_count: fn(Dynamic) ->
    Result(t, List(DecodeError)),
  redirect_uris: fn(Dynamic) -> Result(u, List(DecodeError)),
  interactions_endpoint_url: fn(Dynamic) ->
    Result(v, List(DecodeError)),
  role_connections_verification_url: fn(Dynamic) ->
    Result(w, List(DecodeError)),
  tags: fn(Dynamic) -> Result(x, List(DecodeError)),
  install_params: fn(Dynamic) -> Result(y, List(DecodeError)),
  custom_install_url: fn(Dynamic) -> Result(z, List(DecodeError)),
) -> fn(Dynamic) -> Result(Application, List(DecodeError))
pub fn install_params(
  constructor: fn(a, b) -> InstallParams,
  scopes: fn(Dynamic) -> Result(a, List(DecodeError)),
  permissions: fn(Dynamic) -> Result(b, List(DecodeError)),
) -> fn(Dynamic) -> Result(InstallParams, List(DecodeError))
pub fn member(
  constructor: fn(a, b, c, d) -> Member,
  membership_state: fn(Dynamic) -> Result(a, List(DecodeError)),
  team_id: fn(Dynamic) -> Result(b, List(DecodeError)),
  user: fn(Dynamic) -> Result(c, List(DecodeError)),
  role: fn(Dynamic) -> Result(d, List(DecodeError)),
) -> fn(Dynamic) -> Result(Member, List(DecodeError))
pub fn team(
  constructor: fn(a, b, c, d, e) -> Team,
  id: fn(Dynamic) -> Result(a, List(DecodeError)),
  icon: fn(Dynamic) -> Result(b, List(DecodeError)),
  members: fn(Dynamic) -> Result(c, List(DecodeError)),
  name: fn(Dynamic) -> Result(d, List(DecodeError)),
  owner_user_id: fn(Dynamic) -> Result(e, List(DecodeError)),
) -> fn(Dynamic) -> Result(Team, List(DecodeError))
pub fn user(
  constructor: fn(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) ->
    User,
  id: fn(Dynamic) -> Result(a, List(DecodeError)),
  username: fn(Dynamic) -> Result(b, List(DecodeError)),
  discriminator: fn(Dynamic) -> Result(c, List(DecodeError)),
  global_name: fn(Dynamic) -> Result(d, List(DecodeError)),
  avatar: fn(Dynamic) -> Result(e, List(DecodeError)),
  bot: fn(Dynamic) -> Result(f, List(DecodeError)),
  system: fn(Dynamic) -> Result(g, List(DecodeError)),
  mfa_enabled: fn(Dynamic) -> Result(h, List(DecodeError)),
  banner: fn(Dynamic) -> Result(i, List(DecodeError)),
  accent_color: fn(Dynamic) -> Result(j, List(DecodeError)),
  locale: fn(Dynamic) -> Result(k, List(DecodeError)),
  email: fn(Dynamic) -> Result(l, List(DecodeError)),
  flags: fn(Dynamic) -> Result(m, List(DecodeError)),
  premium_type: fn(Dynamic) -> Result(n, List(DecodeError)),
  public_flags: fn(Dynamic) -> Result(o, List(DecodeError)),
  avatar_decoration: fn(Dynamic) -> Result(p, List(DecodeError)),
) -> fn(Dynamic) -> Result(User, List(DecodeError))
Search Document