From 01949c23f629444f1667ce22e5a3bc0d48c0040f Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Wed, 27 Oct 2021 17:24:55 -0400 Subject: json parsing for the core API endpoints --- lib/listenbrainz.atd | 68 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'lib/listenbrainz.atd') diff --git a/lib/listenbrainz.atd b/lib/listenbrainz.atd index d45136d..cf4e09a 100644 --- a/lib/listenbrainz.atd +++ b/lib/listenbrainz.atd @@ -1,5 +1,7 @@ -type mbid = string +type mbid = string type isrc = string +type unixtime = float +type tm = unixtime wrap type additional_info = { ?artist_mbids : mbid list option; @@ -29,30 +31,62 @@ type listen_type = [ | Import ] -type listen_payload = { - listened_at : int; - track_metadata : track_metadata; +type similar_user = { + user_name : string; + similarity : float; } -type submission = { - listen_type : listen_type; - payload : listen_payload list; -} +type payload_listen = { + ?listened_at : tm option; + track_metadata : track_metadata; +} -type response = { +type payload_listen_count = { count : int; - user_id : mbid; - listens : listen_payload list; -} +} -type validate_token = { +type post_submit_listens = { + listen_type : listen_type; + payload : payload_listen list; +} + +type get_validate_token = { code : int; message : string; valid : bool; - user: string; + ?user: string option; +} + +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 = { + count : int; + user_id : mbid; + listens : payload_listen list; +} + +type get_user_similar_to = similar_user + +type get_user_listens = { + count : int; + user_id : mbid; + listens : payload_listen list; +} + +type get_latest_import = { + musicbrainz_id : mbid; + latest_import : tm; } -type delete_listen = { - listened_at : int; - recording_msid : string; +type post_latest_import = { + ts : tm; } -- cgit v1.2.3