summaryrefslogtreecommitdiff
path: root/src/twitch/mappings/user.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/twitch/mappings/user.cr')
-rw-r--r--src/twitch/mappings/user.cr21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/twitch/mappings/user.cr b/src/twitch/mappings/user.cr
new file mode 100644
index 0000000..6ddd08b
--- /dev/null
+++ b/src/twitch/mappings/user.cr
@@ -0,0 +1,21 @@
+require "./converters"
+
+module Twitcr
+ struct UserList
+ JSON.mapping({data: Array(User)})
+ end
+
+ struct User
+ JSON.mapping({
+ id: {type: UInt64, converter: ID::Converter},
+ login: String,
+ display_name: String,
+ })
+ end
+end
+
+module ID::Converter
+ def self.from_json(value : JSON::PullParser) : UInt64
+ UInt64.new(value.read_string)
+ end
+end