From 2157ffb8298afe8a5d1d0bdf71d2ad256c90fceb Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Tue, 26 Oct 2021 23:02:08 -0400 Subject: Initial json parsing and validation --- lib/listenbrainz.atd | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lib/listenbrainz.atd (limited to 'lib/listenbrainz.atd') diff --git a/lib/listenbrainz.atd b/lib/listenbrainz.atd new file mode 100644 index 0000000..d45136d --- /dev/null +++ b/lib/listenbrainz.atd @@ -0,0 +1,58 @@ +type mbid = string +type isrc = string + +type additional_info = { + ?artist_mbids : mbid list option; + ?release_group_mbid : mbid list option; + ?release_mid : 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 + | Playing_now + | Import +] + +type listen_payload = { + listened_at : int; + track_metadata : track_metadata; +} + +type submission = { + listen_type : listen_type; + payload : listen_payload list; +} + +type response = { + count : int; + user_id : mbid; + listens : listen_payload list; +} + +type validate_token = { + code : int; + message : string; + valid : bool; + user: string; +} + +type delete_listen = { + listened_at : int; + recording_msid : string; +} -- cgit v1.2.3