package spotify_ml

  1. Overview
  2. Docs

Module Spotify_ml.ApiSource

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.

Sourcetype imageObject = {
  1. url : string;
  2. height : int option;
  3. width : int option;
}
Sourcetype externalUrl = {
  1. spotify : string;
}
Sourcetype followers = {
  1. href : string option;
  2. total : int;
}
Sourcetype restrictions = {
  1. reason : string;
}
Sourcetype simplifiedArtist = {
  1. external_urls : externalUrl;
  2. href : string;
  3. id : string;
  4. name : string;
  5. item_type : string;
  6. uri : string;
}
Sourcetype 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;
}
Sourcetype 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;
}
Sourcetype external_ids = {
  1. isrc : string;
  2. ean : string option;
  3. upc : string option;
}
Sourcetype linked_from = {
  1. anything : string option;
}
Sourcetype 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;
}
Sourcetype 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;
}
Sourcetype 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;
}
Sourcetype 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.

    *)

Returns the users' top tracks.