rocksky/decoders

Reusable gleam/dynamic/decode decoders for the public types in rocksky/types. These are exposed so callers can also decode raw Dynamic payloads themselves (e.g. embedded in custom responses).

Values

pub fn list_in_field(
  key: String,
  inner: decode.Decoder(a),
) -> decode.Decoder(List(a))

Convenience: decode an object whose key field is a list of inner.

pub fn unwrap(
  field_name: String,
  inner: decode.Decoder(a),
) -> decode.Decoder(List(a))

Decode { items: [...] }-shaped responses into a list of items. Many Rocksky list endpoints wrap their array in a single object field (e.g. { "scrobbles": [...] }, { "songs": [...] }). This helper hides that detail from callers that just want the list.

Search Document