mastodon_v2_types.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. from typing import Optional, List, Dict
  2. from dataclasses import dataclass
  3. Url = str
  4. Date = str
  5. Html = str
  6. StatusId = str
  7. AccountId = str
  8. @dataclass
  9. class Account:
  10. id: AccountId
  11. username: str
  12. acct: str
  13. url: Url
  14. display_name: str
  15. note: Html
  16. avatar: Url
  17. avatar_static: Url
  18. header: Url
  19. header_static: Url
  20. locked: bool
  21. fields: List[Dict]
  22. emojis: List[Dict]
  23. bot: bool
  24. group: bool
  25. created_at: Date
  26. statuses_count: int
  27. followers_count: int
  28. following_count: int
  29. last_status_at: Optional[Date] = None
  30. discoverable: Optional[bool] = None
  31. noindex: Optional[bool] = None
  32. moved: Optional[bool] = None
  33. suspended: Optional[bool] = None
  34. limited: Optional[bool] = None
  35. Card = Dict
  36. MediaId = str
  37. BlurHash = str
  38. @dataclass
  39. class MediaAttachment:
  40. """
  41. https://docs.joinmastodon.org/entities/MediaAttachment/
  42. """
  43. id: MediaId
  44. type: str
  45. url: Url
  46. preview_url: Url
  47. meta: Dict # Description: Metadata returned by Paperclip.
  48. blurhash: BlurHash
  49. description: Optional[str] = None # HACK: API doc doesn't say it can be null
  50. text_url: Optional[str] = None
  51. remote_url: Optional[Url] = None
  52. @dataclass
  53. class Status:
  54. id: StatusId
  55. uri: Url
  56. created_at: Date
  57. account: Account
  58. content: Html
  59. visibility: str
  60. sensitive: bool
  61. spoiler_text: str
  62. media_attachments: List[MediaAttachment]
  63. reblogs_count: int
  64. favourites_count: int
  65. replies_count: int
  66. url: Optional[Url] = None
  67. in_reply_to_id: Optional[StatusId] = None
  68. in_reply_to_account_id: Optional[AccountId] = None
  69. reblog: Optional['Status'] = None
  70. card: Optional[Card] = None
  71. text: Optional[str] = None
  72. edited_at: Optional[Date] = None
  73. favourited: Optional[bool] = None
  74. reblogged: Optional[bool] = None
  75. muted: Optional[bool] = None
  76. bookmarked: Optional[bool] = None
  77. pinned: Optional[bool] = None
  78. filtered: Optional[bool] = None
  79. @dataclass
  80. class Context:
  81. ancestors: List[Status]
  82. descendants: List[Status]
  83. ConversationId = str
  84. @dataclass
  85. class Conversation:
  86. id: ConversationId
  87. unread: bool
  88. accounts: List[Account]
  89. last_status: Optional[Status] = None
  90. Tag = Dict
  91. @dataclass
  92. class Search:
  93. accounts: List[Account]
  94. statuses: List[Status]
  95. hashtags: List[Tag]