package spotify_ml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Api includes functions that map to the Spotify Web REST API. See here for an up to date reference.

All functions will also automatically refresh the Client.User object and return an updated one alongside the normal API response.

type imageObject = {
  1. url : string;
  2. height : int option;
  3. width : int option;
}
type externalUrl = {
  1. spotify : string;
}
type followers = {
  1. href : string option;
  2. total : int;
}
type restrictions = {
  1. reason : string;
}
type simplifiedArtist = {
  1. external_urls : externalUrl;
  2. href : string;
  3. id : string;
  4. name : string;
  5. item_type : string;
  6. uri : string;
}
type album = {
  1. album_type : string;
  2. total_tracks : int;
  3. available_markets : string list;
  4. external_urls : externalUrl;
  5. href : string;
  6. id : string;
  7. images : imageObject list;
  8. name : string;
  9. release_date : string;
  10. release_date_precision : string;
  11. restrictions : restrictions option;
  12. item_type : string;
  13. uri : string;
  14. artists : simplifiedArtist list;
}
type artist = {
  1. external_urls : externalUrl;
  2. followers : followers option;
  3. genres : string list option;
  4. href : string;
  5. id : string;
  6. images : imageObject list option;
  7. name : string;
  8. popularity : int option;
  9. item_type : string;
  10. uri : string;
}
type external_ids = {
  1. isrc : string;
  2. ean : string option;
  3. upc : string option;
}
type linked_from = {
  1. anything : string option;
}
type track = {
  1. album : album;
  2. artists : artist list;
  3. available_markets : string list;
  4. disc_number : int;
  5. duration_ms : int;
  6. explicit : bool;
  7. external_ids : external_ids;
  8. external_urls : externalUrl;
  9. href : string;
  10. id : string;
  11. is_playable : bool option;
  12. linked_from : linked_from option;
  13. restrictions : restrictions option;
  14. name : string;
  15. popularity : int;
  16. preview_url : string option;
  17. track_number : int;
  18. track_type : string;
  19. uri : string;
  20. is_local : bool;
}
type userTopTracksResponse = {
  1. href : string;
  2. limit : int;
  3. next : string option;
  4. offset : int;
  5. previous : string option;
  6. total : int;
  7. items : track list;
}
type userTopArtistsResponse = {
  1. href : string;
  2. limit : int;
  3. next : string option;
  4. offset : int;
  5. previous : string option;
  6. total : int;
  7. items : artist list;
}
type apiError =
  1. | ClientError of Client.requestError
  2. | SerializationError of Serde.error
    (*

    This happens when the response returned by Spotify doesn't match the declared types.

    *)
val user_top_tracks : user:Client.User.t -> (userTopTracksResponse, apiError) Stdlib.result Lwt.t

Returns the users' top tracks.

OCaml

Innovation. Community. Security.