rockbox/saved_playlists

Persisted playlists and their folders.

Builders make optional fields ergonomic:

let input =
  saved_playlists.new("Workout Mix")
  |> saved_playlists.with_description("Tracks I run to")
  |> saved_playlists.with_tracks(["track-id-1", "track-id-2"])

let assert Ok(playlist) = saved_playlists.create(client, input)

Types

pub opaque type CreateInput
pub opaque type UpdateInput

Values

pub fn add_tracks(
  client: rockbox.Client,
  playlist_id: String,
  track_ids: List(String),
) -> Result(Nil, error.Error)
pub fn create(
  client: rockbox.Client,
  input: CreateInput,
) -> Result(types.SavedPlaylist, error.Error)
pub fn create_folder(
  client: rockbox.Client,
  name: String,
) -> Result(types.SavedPlaylistFolder, error.Error)
pub fn delete(
  client: rockbox.Client,
  id: String,
) -> Result(Nil, error.Error)
pub fn delete_folder(
  client: rockbox.Client,
  id: String,
) -> Result(Nil, error.Error)
pub fn folders(
  client: rockbox.Client,
) -> Result(List(types.SavedPlaylistFolder), error.Error)
pub fn get(
  client: rockbox.Client,
  id: String,
) -> Result(option.Option(types.SavedPlaylist), error.Error)
pub fn list(
  client: rockbox.Client,
  folder_id: option.Option(String),
) -> Result(List(types.SavedPlaylist), error.Error)

List all saved playlists, optionally scoped to a single folder.

pub fn new(name: String) -> CreateInput

Start a new create-input with just a name.

pub fn play(
  client: rockbox.Client,
  playlist_id: String,
) -> Result(Nil, error.Error)
pub fn remove_track(
  client: rockbox.Client,
  playlist_id: String,
  track_id: String,
) -> Result(Nil, error.Error)
pub fn save(
  client: rockbox.Client,
  id: String,
  input: UpdateInput,
) -> Result(Nil, error.Error)
pub fn track_ids(
  client: rockbox.Client,
  playlist_id: String,
) -> Result(List(String), error.Error)
pub fn update(name: String) -> UpdateInput

Build an update payload — name is required by the GraphQL schema even when only changing other fields, so it lives in the constructor.

pub fn update_description(
  input: UpdateInput,
  value: String,
) -> UpdateInput
pub fn update_folder(
  input: UpdateInput,
  folder_id: String,
) -> UpdateInput
pub fn update_image(
  input: UpdateInput,
  value: String,
) -> UpdateInput
pub fn with_description(
  input: CreateInput,
  value: String,
) -> CreateInput
pub fn with_folder(
  input: CreateInput,
  folder_id: String,
) -> CreateInput
pub fn with_image(
  input: CreateInput,
  value: String,
) -> CreateInput
pub fn with_tracks(
  input: CreateInput,
  track_ids: List(String),
) -> CreateInput
Search Document