mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 07:09:31 +00:00
Cleanup
This commit is contained in:
parent
886f2d2a45
commit
6b655cddd8
3 changed files with 1 additions and 57 deletions
|
|
@ -72,21 +72,3 @@ proc parseHook*(s: string; i: var int; v: var User) =
|
|||
var u: RawUser
|
||||
parseHook(s, i, u)
|
||||
v = toUser u
|
||||
|
||||
proc parseUser*(json: string; username=""): User =
|
||||
handleErrors:
|
||||
case error.code
|
||||
of suspended: return User(username: username, suspended: true)
|
||||
of userNotFound: return
|
||||
else: echo "[error - parseUser]: ", error
|
||||
|
||||
result = json.fromJson(User)
|
||||
|
||||
proc parseUsers*(json: string; after=""): Result[User] =
|
||||
result = Result[User](beginning: after.len == 0)
|
||||
|
||||
# starting with '{' means it's an error
|
||||
if json[0] == '[':
|
||||
let raw = json.fromJson(seq[RawUser])
|
||||
for user in raw:
|
||||
result.content.add user.toUser
|
||||
|
|
|
|||
Loading…
Reference in a new issue