summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan B <greenbigfrog@gmail.com>2021-10-09 15:42:31 +0200
committerJonathan B <greenbigfrog@gmail.com>2021-10-09 15:42:31 +0200
commitb7d53f734709eaa82460b0de5b19e41e69ecf43c (patch)
treed783f33b09e47839a864e93842b58368a7da085f /src
parent4f935e65c79a7b3bd55138cd49902b55c420f446 (diff)
downloadtwitcr-b7d53f734709eaa82460b0de5b19e41e69ecf43c.tar.gz
twitcr-b7d53f734709eaa82460b0de5b19e41e69ecf43c.zip
Switch to JSON::Serializable
Diffstat (limited to 'src')
-rw-r--r--src/twitcr/mappings/token.cr10
-rw-r--r--src/twitcr/mappings/user.cr16
2 files changed, 15 insertions, 11 deletions
diff --git a/src/twitcr/mappings/token.cr b/src/twitcr/mappings/token.cr
index a141a68..3b9fcd8 100644
--- a/src/twitcr/mappings/token.cr
+++ b/src/twitcr/mappings/token.cr
@@ -1,7 +1,7 @@
struct Twitcr::Token
- JSON.mapping({
- access_token: String,
- expires_in: Int64,
- token_type: String
- })
+ include JSON::Serializable
+
+ property access_token : String
+ property expires_in : Int64
+ property token_type : String
end
diff --git a/src/twitcr/mappings/user.cr b/src/twitcr/mappings/user.cr
index 6ddd08b..c072549 100644
--- a/src/twitcr/mappings/user.cr
+++ b/src/twitcr/mappings/user.cr
@@ -2,15 +2,19 @@ require "./converters"
module Twitcr
struct UserList
- JSON.mapping({data: Array(User)})
+ include JSON::Serializable
+
+ property data : Array(User)
end
struct User
- JSON.mapping({
- id: {type: UInt64, converter: ID::Converter},
- login: String,
- display_name: String,
- })
+ include JSON::Serializable
+
+ @[JSON::Field(converter: ID::Converter)]
+ property id : UInt64
+
+ property login : String
+ property display_name : String
end
end