aboutsummaryrefslogtreecommitdiff
path: root/lib/listenbrainz.atd
blob: d45136d141367c8f4d690afb21d61f2edfd5239b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 <json name="single">
  | Playing_now <json name="playing_now">
  | Import <json name="import">
]

type listen_payload = {
  listened_at : int;
  track_metadata : track_metadata;
}

type submission = {
  listen_type : listen_type;
  payload : listen_payload list;
} <ocaml valid="Listenbrainz_util.validate_submission">

type response = {
  count : int;
  user_id : mbid;
  listens : listen_payload list;
} <ocaml valid="Listenbrainz_util.validate_response">

type validate_token = {
  code : int;
  message : string;
  valid : bool;
  user: string;
}

type delete_listen = {
  listened_at : int;
  recording_msid : string;
}