Skip to main content
rocksky_ex wraps the shared Rocksky Rust core through a Rustler NIF: AppView reads, AT Protocol PDS writes, and the identity hashes — the same engine behind every Rocksky SDK. The same NIF powers the Erlang and Gleam SDKs.

Install

rocksky_ex 0.6.0 pulls in rocksky_erl 0.3.0, whose loader fetches the native library from the GitHub release on first use.

Quickstart

Using Erlang directly? The same NIF ships as rocksky_erl with a friendly rocksky module — see the Erlang SDK page.

API

Reads/writes return {:ok, value} | {:error, message} with binary-keyed maps. Reads — Rocksky: named reads profile, scrobbles, top_tracks, global_stats (each takes a trailing base). The universal get(nsid, params \\ %{}, base \\ "", token \\ "") escape hatch reaches the whole app.rocksky.* read catalog by NSID (e.g. Rocksky.get("app.rocksky.album.getAlbums", %{"limit" => 20}), "app.rocksky.album.getAlbumTracks", "app.rocksky.graph.getFollows", "app.rocksky.stats.getStats"); pass a bearer token for auth-gated queries. Typed date-window charts: top_tracks_interval(5, 0, {:days, 7}) / top_artists_interval(5, 0, :all) where the interval is :all | {:days, n} | {:weeks, n} | {:months, n} | {:years, n} | {:range, start, end}. match_song(title, artist) resolves a bare title + artist into full canonical metadata. Writes — Rocksky: login(session, id, pw, appview \\ "", dedup_path \\ ""), then scrobble (full metadata) or scrobble_match(agent, input)input is a map with camelCase string keys, required "title"/"artist", optional "album", "mbId", "isrc" (match anchors) and "timestamp" (scrobbled-at Unix seconds), e.g. Rocksky.scrobble_match(agent, %{"title" => "Chaser", "artist" => "Calibro 35"}) — then like, follow, shout, refresh_session. Pass a dedup_path at login to enable dedup + realtime, then sync_repo(agent) / hydrate_from_jetstream(agent). Identity hashes: Rocksky.song_hash(title, artist, album).