graphuser.nim 786 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import options, strutils
  2. from ../../types import User, VerifiedType
  3. type
  4. GraphUser* = object
  5. data*: tuple[userResult: UserData]
  6. UserData* = object
  7. result*: UserResult
  8. UserCore* = object
  9. name*: string
  10. screenName*: string
  11. createdAt*: string
  12. UserBio* = object
  13. description*: string
  14. UserAvatar* = object
  15. imageUrl*: string
  16. Verification* = object
  17. verifiedType*: VerifiedType
  18. UserResult* = object
  19. legacy*: User
  20. restId*: string
  21. isBlueVerified*: bool
  22. unavailableReason*: Option[string]
  23. core*: UserCore
  24. avatar*: UserAvatar
  25. profileBio*: Option[UserBio]
  26. verification*: Option[Verification]
  27. proc enumHook*(s: string; v: var VerifiedType) =
  28. v = try:
  29. parseEnum[VerifiedType](s)
  30. except:
  31. VerifiedType.none