logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

account.ex (8579B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.ApiSpec.Schemas.Account do
  5. alias OpenApiSpex.Schema
  6. alias Pleroma.Web.ApiSpec.Schemas.AccountField
  7. alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
  8. alias Pleroma.Web.ApiSpec.Schemas.ActorType
  9. alias Pleroma.Web.ApiSpec.Schemas.Emoji
  10. alias Pleroma.Web.ApiSpec.Schemas.FlakeID
  11. alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
  12. require OpenApiSpex
  13. OpenApiSpex.schema(%{
  14. title: "Account",
  15. description: "Response schema for an account",
  16. type: :object,
  17. properties: %{
  18. acct: %Schema{type: :string},
  19. avatar_static: %Schema{type: :string, format: :uri},
  20. avatar: %Schema{type: :string, format: :uri},
  21. bot: %Schema{type: :boolean},
  22. created_at: %Schema{type: :string, format: "date-time"},
  23. display_name: %Schema{type: :string},
  24. emojis: %Schema{type: :array, items: Emoji},
  25. fields: %Schema{type: :array, items: AccountField},
  26. follow_requests_count: %Schema{type: :integer},
  27. followers_count: %Schema{type: :integer},
  28. following_count: %Schema{type: :integer},
  29. header_static: %Schema{type: :string, format: :uri},
  30. header: %Schema{type: :string, format: :uri},
  31. id: FlakeID,
  32. locked: %Schema{type: :boolean},
  33. mute_expires_at: %Schema{type: :string, format: "date-time", nullable: true},
  34. note: %Schema{type: :string, format: :html},
  35. statuses_count: %Schema{type: :integer},
  36. url: %Schema{type: :string, format: :uri},
  37. username: %Schema{type: :string},
  38. pleroma: %Schema{
  39. type: :object,
  40. properties: %{
  41. ap_id: %Schema{type: :string},
  42. also_known_as: %Schema{type: :array, items: %Schema{type: :string}},
  43. allow_following_move: %Schema{
  44. type: :boolean,
  45. description: "whether the user allows automatically follow moved following accounts"
  46. },
  47. background_image: %Schema{type: :string, nullable: true, format: :uri},
  48. birthday: %Schema{type: :string, nullable: true, format: :date},
  49. chat_token: %Schema{type: :string},
  50. is_confirmed: %Schema{
  51. type: :boolean,
  52. description:
  53. "whether the user account is waiting on email confirmation to be activated"
  54. },
  55. show_birthday: %Schema{type: :boolean, nullable: true},
  56. hide_favorites: %Schema{type: :boolean},
  57. hide_followers_count: %Schema{
  58. type: :boolean,
  59. description: "whether the user has follower stat hiding enabled"
  60. },
  61. hide_followers: %Schema{
  62. type: :boolean,
  63. description: "whether the user has follower hiding enabled"
  64. },
  65. hide_follows_count: %Schema{
  66. type: :boolean,
  67. description: "whether the user has follow stat hiding enabled"
  68. },
  69. hide_follows: %Schema{
  70. type: :boolean,
  71. description: "whether the user has follow hiding enabled"
  72. },
  73. is_admin: %Schema{
  74. type: :boolean,
  75. description: "whether the user is an admin of the local instance"
  76. },
  77. is_moderator: %Schema{
  78. type: :boolean,
  79. description: "whether the user is a moderator of the local instance"
  80. },
  81. skip_thread_containment: %Schema{type: :boolean},
  82. tags: %Schema{
  83. type: :array,
  84. items: %Schema{type: :string},
  85. description:
  86. "List of tags being used for things like extra roles or moderation(ie. marking all media as nsfw all)."
  87. },
  88. unread_conversation_count: %Schema{
  89. type: :integer,
  90. description: "The count of unread conversations. Only returned to the account owner."
  91. },
  92. notification_settings: %Schema{
  93. type: :object,
  94. properties: %{
  95. block_from_strangers: %Schema{type: :boolean},
  96. hide_notification_contents: %Schema{type: :boolean}
  97. }
  98. },
  99. relationship: %Schema{allOf: [AccountRelationship], nullable: true},
  100. settings_store: %Schema{
  101. type: :object,
  102. description:
  103. "A generic map of settings for frontends. Opaque to the backend. Only returned in `verify_credentials` and `update_credentials`"
  104. },
  105. accepts_chat_messages: %Schema{type: :boolean, nullable: true},
  106. favicon: %Schema{
  107. type: :string,
  108. format: :uri,
  109. nullable: true,
  110. description: "Favicon image of the user's instance"
  111. }
  112. }
  113. },
  114. source: %Schema{
  115. type: :object,
  116. properties: %{
  117. fields: %Schema{type: :array, items: AccountField},
  118. note: %Schema{
  119. type: :string,
  120. description:
  121. "Plaintext version of the bio without formatting applied by the backend, used for editing the bio."
  122. },
  123. privacy: VisibilityScope,
  124. sensitive: %Schema{type: :boolean},
  125. pleroma: %Schema{
  126. type: :object,
  127. properties: %{
  128. actor_type: ActorType,
  129. discoverable: %Schema{
  130. type: :boolean,
  131. description:
  132. "whether the user allows indexing / listing of the account by external services (search engines etc.)."
  133. },
  134. no_rich_text: %Schema{
  135. type: :boolean,
  136. description:
  137. "whether the HTML tags for rich-text formatting are stripped from all statuses requested from the API."
  138. },
  139. show_role: %Schema{
  140. type: :boolean,
  141. description:
  142. "whether the user wants their role (e.g admin, moderator) to be shown"
  143. }
  144. }
  145. }
  146. }
  147. }
  148. },
  149. example: %{
  150. "acct" => "foobar",
  151. "avatar" => "https://mypleroma.com/images/avi.png",
  152. "avatar_static" => "https://mypleroma.com/images/avi.png",
  153. "bot" => false,
  154. "created_at" => "2020-03-24T13:05:58.000Z",
  155. "display_name" => "foobar",
  156. "emojis" => [],
  157. "fields" => [],
  158. "follow_requests_count" => 0,
  159. "followers_count" => 0,
  160. "following_count" => 1,
  161. "header" => "https://mypleroma.com/images/banner.png",
  162. "header_static" => "https://mypleroma.com/images/banner.png",
  163. "id" => "9tKi3esbG7OQgZ2920",
  164. "locked" => false,
  165. "note" => "cofe",
  166. "pleroma" => %{
  167. "allow_following_move" => true,
  168. "background_image" => nil,
  169. "is_confirmed" => false,
  170. "hide_favorites" => true,
  171. "hide_followers" => false,
  172. "hide_followers_count" => false,
  173. "hide_follows" => false,
  174. "hide_follows_count" => false,
  175. "is_admin" => false,
  176. "is_moderator" => false,
  177. "skip_thread_containment" => false,
  178. "accepts_chat_messages" => true,
  179. "chat_token" =>
  180. "SFMyNTY.g3QAAAACZAAEZGF0YW0AAAASOXRLaTNlc2JHN09RZ1oyOTIwZAAGc2lnbmVkbgYARNplS3EB.Mb_Iaqew2bN1I1o79B_iP7encmVCpTKC4OtHZRxdjKc",
  181. "unread_conversation_count" => 0,
  182. "tags" => [],
  183. "notification_settings" => %{
  184. "block_from_strangers" => false,
  185. "hide_notification_contents" => false
  186. },
  187. "relationship" => %{
  188. "blocked_by" => false,
  189. "blocking" => false,
  190. "domain_blocking" => false,
  191. "endorsed" => false,
  192. "followed_by" => false,
  193. "following" => false,
  194. "id" => "9tKi3esbG7OQgZ2920",
  195. "muting" => false,
  196. "muting_notifications" => false,
  197. "note" => "",
  198. "requested" => false,
  199. "showing_reblogs" => true,
  200. "subscribing" => false,
  201. "notifying" => false
  202. },
  203. "settings_store" => %{
  204. "pleroma-fe" => %{}
  205. },
  206. "birthday" => "2001-02-12"
  207. },
  208. "source" => %{
  209. "fields" => [],
  210. "note" => "foobar",
  211. "pleroma" => %{
  212. "actor_type" => "Person",
  213. "discoverable" => false,
  214. "no_rich_text" => false,
  215. "show_role" => true
  216. },
  217. "privacy" => "public",
  218. "sensitive" => false
  219. },
  220. "statuses_count" => 0,
  221. "url" => "https://mypleroma.com/users/foobar",
  222. "username" => "foobar"
  223. }
  224. })
  225. end