Rocksky (Rocksky v0.5.1)

Copy Markdown View Source

Official Elixir SDK for Rocksky.

A thin wrapper over the :rocksky_erl Rustler NIF (the shared Rust core, rocksky-sdk): AppView reads, AT Protocol PDS writes (scrobble fan-out, like, follow, shout) and the identity hashes — the same engine behind every Rocksky SDK.

Reads/writes return {:ok, value} | {:error, message} with binary-keyed maps (the wire shape). Records passed to the write verbs are maps with camelCase binary keys — "title", "artist", "album", "albumArtist", "durationMs", …

{:ok, stats} = Rocksky.global_stats()
Rocksky.song_hash("Chaser", "Calibro 35", "Jazzploitation")

Summary

Functions

Follow an account by DID.

Universal read escape hatch — call any app.rocksky.* query by nsid.

Platform-wide totals.

Keep the local dedup index hydrated from Jetstream in the background.

Like a record by strong reference.

Log in with an app password, persisting the session at session_path. Returns an opaque agent handle (a NIF resource freed by GC).

Resolve full canonical metadata for a bare title + artist (matchSong).

An actor's detailed profile.

Proactively refresh the session (keep-alive).

Scrobble a play (fans out to artist/album/song/scrobble). Returns the URIs.

Scrobble from just a title + artist (album optional): resolve full metadata via matchSong, then fan out.

An actor's scrobbles, newest first.

Identity hash of a song — identical across every Rocksky SDK.

Download the caller's repo and (re)build the local dedup index (needs a dedup_path at login).

Platform-wide top tracks chart.

Functions

follow(agent, did)

Follow an account by DID.

get(nsid, params \\ %{}, base \\ "", token \\ "")

Universal read escape hatch — call any app.rocksky.* query by nsid.

params is a map of string params; the whole read-query catalog is reachable.

Rocksky.get("app.rocksky.album.getAlbum", %{"uri" => uri})
Rocksky.get("app.rocksky.charts.getScrobblesChart", %{"did" => did})

global_stats(base \\ "")

Platform-wide totals.

hydrate_from_jetstream(agent)

Keep the local dedup index hydrated from Jetstream in the background.

like(agent, uri, cid)

Like a record by strong reference.

login(session_path, identifier, password, appview \\ "", dedup_path \\ "")

Log in with an app password, persisting the session at session_path. Returns an opaque agent handle (a NIF resource freed by GC).

match_song(title, artist, mb_id \\ "", isrc \\ "", base \\ "")

Resolve full canonical metadata for a bare title + artist (matchSong).

profile(actor, base \\ "")

An actor's detailed profile.

refresh_session(agent)

Proactively refresh the session (keep-alive).

scrobble(agent, track)

Scrobble a play (fans out to artist/album/song/scrobble). Returns the URIs.

scrobble_match(agent, title, artist, album \\ "", mb_id \\ "", isrc \\ "")

Scrobble from just a title + artist (album optional): resolve full metadata via matchSong, then fan out.

scrobbles(actor, limit \\ 50, offset \\ 0, base \\ "")

An actor's scrobbles, newest first.

shout(agent, subject_uri, subject_cid, message)

Post a shout on a subject.

song_hash(title, artist, album)

Identity hash of a song — identical across every Rocksky SDK.

sync_repo(agent)

Download the caller's repo and (re)build the local dedup index (needs a dedup_path at login).

top_artists_interval(limit \\ 50, offset \\ 0, interval \\ :all, base \\ "")

Top artists chart over a typed date window (see top_tracks_interval/4).

top_tracks(limit \\ 50, offset \\ 0, base \\ "")

Platform-wide top tracks chart.

top_tracks_interval(limit \\ 50, offset \\ 0, interval \\ :all, base \\ "")

Top tracks chart over a typed date window.

interval is :all | {:days, n} | {:weeks, n} | {:months, n} | {:years, n} | {:range, start_rfc3339, end_rfc3339}.

Rocksky.top_tracks_interval(10, 0, {:days, 7})