diff options
author | Ryan Kavanagh <rak@rak.ac> | 2021-10-26 23:02:08 -0400 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2021-10-26 23:03:41 -0400 |
commit | 2157ffb8298afe8a5d1d0bdf71d2ad256c90fceb (patch) | |
tree | 260d07c28803d55a82cad5b1f71773188358ac6c /lib/listenbrainz_util.ml | |
parent | Initial import (diff) |
Initial json parsing and validation
Diffstat (limited to 'lib/listenbrainz_util.ml')
-rw-r--r-- | lib/listenbrainz_util.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/listenbrainz_util.ml b/lib/listenbrainz_util.ml new file mode 100644 index 0000000..35a7af8 --- /dev/null +++ b/lib/listenbrainz_util.ml @@ -0,0 +1,9 @@ +open Listenbrainz_t + +let validate_submission s = + match s.listen_type with + | `Single -> List.length s.payload = 1 + | _ -> true + +let validate_response r = + List.length r.listens = r.count |