atradio_gleam

Official Gleam SDK for atradio.fm.

Typed bindings over the atradio_erl NIF package (the shared Rust core), so the auth / record / reconcile logic is identical to the Rust, Go, TypeScript, Python, Ruby, Clojure, and Erlang SDKs. atradio_erl downloads the matching native library from the GitHub release on first load.

Types

An opaque authenticated-agent handle (a NIF resource freed by the BEAM GC).

pub type Agent =
  dynamic.Dynamic

A radio station.

pub type Station {
  Station(
    id: String,
    name: String,
    stream_url: String,
    source: String,
  )
}

Constructors

  • Station(
      id: String,
      name: String,
      stream_url: String,
      source: String,
    )

Values

pub fn comment(
  agent: dynamic.Dynamic,
  station: Station,
  text: String,
) -> Nil

Post a comment on a station.

pub fn favorite(agent: dynamic.Dynamic, station: Station) -> Nil

Favorite a station (idempotent; deterministic record key).

pub fn favorite_rkey(station_id: String) -> String

The deterministic favorite record key — identical across every atradio SDK.

pub fn favorites(actor: String, limit: Int) -> List(Station)

An actor’s favorited stations.

pub fn global_recently_played(limit: Int) -> List(Station)

Platform-wide who’s-listening feed.

pub fn login(
  session_path: String,
  identifier: String,
  password: String,
  appview: String,
) -> dynamic.Dynamic

Log in with an app password, persisting the session at session_path.

pub fn popular_stations(limit: Int) -> List(Station)

Most-favorited stations platform-wide.

pub fn recent_stations(limit: Int) -> List(Station)

Newest stations platform-wide.

pub fn set_play_status(
  agent: dynamic.Dynamic,
  station: Station,
) -> Nil

Update the actor’s play-status singleton.

pub fn unfavorite(
  agent: dynamic.Dynamic,
  station: Station,
) -> Nil

Unfavorite a station (removes every record for its stationId).

Search Document