aboutsummaryrefslogtreecommitdiff
path: root/lib/listenbrainz_util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/listenbrainz_util.ml')
-rw-r--r--lib/listenbrainz_util.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/listenbrainz_util.ml b/lib/listenbrainz_util.ml
index 5056c09..f0b90dd 100644
--- a/lib/listenbrainz_util.ml
+++ b/lib/listenbrainz_util.ml
@@ -14,6 +14,8 @@ let tm_unwrap tm =
let validate_mbid mbid = Str.string_match uuid_v4_re mbid 0
+let validate_isrc isrc = Str.string_match uuid_v4_re isrc 0
+
let validate_post_submit_listens s =
match s.listen_type with
| `Single -> List.length s.payload = 1
@@ -22,11 +24,11 @@ let validate_post_submit_listens s =
let validate_get_validate_token r =
r.code = 200 || r.code = 400
-let validate_get_user_playing_now r =
- match r.listens with
+let validate_get_user_playing_now (r : get_user_playing_now) =
+ match r.payload.listens with
| [] -> true
| [l] -> l.listened_at = None
| _ -> false
-let validate_get_user_listens r =
- List.length r.listens = r.count
+let validate_get_user_listens (r : get_user_listens) =
+ List.length r.payload.listens = r.payload.count