aboutsummaryrefslogblamecommitdiff
path: root/lib/listenbrainz.atd
blob: ede37f5e52d97db9fe0f6833e43afaaa72ec569c (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                  
                                                                  

                                                                                                                 


                                   

                                    























                                            


                     

 



                                  
 





                                
                             
              
 
 





                                                                


                   














                                                               
                            




                                                                 
                           




                                                             

 

                           
 
type mbid = string <ocaml valid="Listenbrainz_util.validate_mbid">
type isrc = string <ocaml valid="Listenbrainz_util.validate_isrc">
type unixtime = float <json repr="int">
type tm = unixtime wrap <ocaml module="Unix" t="Unix.tm" wrap="Unix.gmtime" unwrap="Listenbrainz_util.tm_unwrap">

type additional_info = {
  ?artist_mbids : mbid list option;
  ?release_group_mbid : mbid option;
  ?release_mbid : mbid option;
  ?recording_mbid : mbid option;
  ?track_mbid : mbid option;
  ?work_mbids : mbid list option;
  ?tracknumber : int option;
  ?isrc : isrc option;
  ?spotify_id : string option;
  ?tags : string list option;
  ?listening_from : string option;
}

type track_metadata = {
  artist_name : string;
  track_name : string;
  ?listened_at : int option;
  ?additional_info : additional_info option;
  ?release_name : string option;
}

type listen_type = [
    Single <json name="single">
  | Playing_now <json name="playing_now">
  | Import <json name="import">
]

type similar_user = {
  user_name : string;
  similarity : float;
}

type payload_listen = {
  ?listened_at : tm option;
  track_metadata : track_metadata;
}

type payload_listens = {
  count : int;
  user_id : mbid;
  listens : payload_listen list;
}

type payload_listen_count = {
  count : int;
}

type post_submit_listens = {
  listen_type : listen_type;
  payload : payload_listen list;
} <ocaml valid="Listenbrainz_util.validate_post_submit_listens">

type get_validate_token = {
  code : int;
  message : string;
  valid : bool;
  ?user: string option;
} <ocaml valid="Listenbrainz_util.validate_get_validate_token">

type post_delete_listen = {
  listened_at : tm;
  recording_msid : mbid;
}

type get_user_similar_users = similar_user list

type get_user_listen_count = {
  payload : payload_listen_count;
}

type get_user_playing_now = {
  payload : payload_listens;
} <ocaml valid="Listenbrainz_util.validate_get_user_playing_now">

type get_user_similar_to = similar_user

type get_user_listens = {
  payload : payload_listens
} <ocaml valid="Listenbrainz_util.validate_get_user_listens">

type get_latest_import = {
  musicbrainz_id : mbid;
  latest_import : tm;
}

type post_latest_import = {
  ts : tm;
}