Rocksky.HTTP (Rocksky v0.1.0)

Copy Markdown View Source

Low-level XRPC transport. Most users should call the namespace modules (Rocksky.Actor, Rocksky.Scrobble, etc.) instead.

All XRPC endpoints live under /xrpc/<nsid>. Queries are GET with query parameters; procedures are POST with a JSON body.

Summary

Functions

Issue a procedure (POST) against nsid.

Issue a query (GET) against nsid with the given params.

Types

nsid()

@type nsid() :: String.t()

params()

@type params() :: keyword() | map()

Functions

procedure(client, nsid, params \\ [], body \\ nil)

@spec procedure(Rocksky.Client.t(), nsid(), params(), term()) ::
  {:ok, term()} | {:error, Rocksky.Error.t()}

Issue a procedure (POST) against nsid.

body is encoded as JSON. params are sent as query string parameters (some lexicons declare both, e.g. app.rocksky.player.next).

query(client, nsid, params \\ [])

@spec query(Rocksky.Client.t(), nsid(), params()) ::
  {:ok, term()} | {:error, Rocksky.Error.t()}

Issue a query (GET) against nsid with the given params.