diff options
author | Jonathan B <greenbigfrog@gmail.com> | 2019-08-14 21:25:02 +0200 |
---|---|---|
committer | Jonathan B <greenbigfrog@gmail.com> | 2019-08-14 21:25:02 +0200 |
commit | 99b3d7287bd0ac36ee82129ad38bd88c5b5af625 (patch) | |
tree | 461ba1e96425d62a60d4fdb1fd9d892264b146f2 /src/twitch/mappings/user.cr | |
download | twitcr-99b3d7287bd0ac36ee82129ad38bd88c5b5af625.tar.gz twitcr-99b3d7287bd0ac36ee82129ad38bd88c5b5af625.zip |
Initial release
Diffstat (limited to 'src/twitch/mappings/user.cr')
-rw-r--r-- | src/twitch/mappings/user.cr | 21 |
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 |