1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.InstanceOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
9 def open_api_operation(action) do
10 operation = String.to_existing_atom("#{action}_operation")
11 apply(__MODULE__, operation, [])
16 tags: ["Instance misc"],
17 summary: "Retrieve instance information",
18 description: "Information about the server",
19 operationId: "InstanceController.show",
21 200 => Operation.response("Instance", "application/json", instance())
26 def show2_operation do
28 tags: ["Instance misc"],
29 summary: "Retrieve instance information",
30 description: "Information about the server",
31 operationId: "InstanceController.show2",
33 200 => Operation.response("Instance", "application/json", instance2())
38 def peers_operation do
40 tags: ["Instance misc"],
41 summary: "Retrieve list of known instances",
42 operationId: "InstanceController.peers",
44 200 => Operation.response("Array of domains", "application/json", array_of_domains())
56 max_featured_tags: %Schema{
58 description: "The maximum number of featured tags allowed for each account."
62 uri: %Schema{type: :string, description: "The domain name of the instance"},
63 title: %Schema{type: :string, description: "The title of the website"},
66 description: "Admin-defined description of the Pleroma site"
70 description: "The version of Pleroma installed on the instance"
74 description: "An email that may be contacted for any inquiries",
79 description: "URLs of interest for clients apps",
81 streaming_api: %Schema{
83 description: "Websockets address for push streaming"
89 description: "Statistics about how much information the instance contains",
93 description: "Users registered on this instance"
95 status_count: %Schema{
97 description: "Statuses authored by users on instance"
99 domain_count: %Schema{
101 description: "Domains federated with this instance"
107 description: "Banner image for the website",
112 items: %Schema{type: :string},
113 description: "Primary languages of the website and its staff"
115 registrations: %Schema{type: :boolean, description: "Whether registrations are enabled"},
116 # Extra (not present in Mastodon):
117 max_toot_chars: %Schema{
119 description: ": Posts character limit (CW/Subject included in the counter)"
121 poll_limits: %Schema{
123 description: "A map with poll limits for local polls",
125 max_options: %Schema{
127 description: "Maximum number of options."
129 max_option_chars: %Schema{
131 description: "Maximum number of characters per option."
133 min_expiration: %Schema{
135 description: "Minimum expiration time (in seconds)."
137 max_expiration: %Schema{
139 description: "Maximum expiration time (in seconds)."
143 upload_limit: %Schema{
145 description: "File size limit of uploads (except for avatar, background, banner)"
147 avatar_upload_limit: %Schema{type: :integer, description: "The title of the website"},
148 background_upload_limit: %Schema{type: :integer, description: "The title of the website"},
149 banner_upload_limit: %Schema{type: :integer, description: "The title of the website"},
150 background_image: %Schema{
153 description: "The background image for the website"
157 "avatar_upload_limit" => 2_000_000,
158 "background_upload_limit" => 4_000_000,
159 "background_image" => "/static/image.png",
160 "banner_upload_limit" => 4_000_000,
161 "description" => "Pleroma: An efficient and flexible fediverse server",
162 "email" => "lain@lain.com",
163 "languages" => ["en"],
164 "max_toot_chars" => 5000,
166 "max_expiration" => 31_536_000,
167 "max_option_chars" => 200,
169 "min_expiration" => 0
171 "registrations" => false,
173 "domain_count" => 2996,
174 "status_count" => 15_802,
177 "thumbnail" => "https://lain.com/instance/thumbnail.jpeg",
178 "title" => "lain.com",
179 "upload_limit" => 16_000_000,
180 "uri" => "https://lain.com",
182 "streaming_api" => "wss://lain.com"
184 "version" => "2.7.2 (compatible; Pleroma 2.0.50-536-g25eec6d7-develop)"
193 domain: %Schema{type: :string, description: "The domain name of the instance"},
194 title: %Schema{type: :string, description: "The title of the website"},
197 description: "The version of Pleroma installed on the instance"
201 description: "The version of Pleroma installed on the instance"
203 description: %Schema{
205 description: "Admin-defined description of the Pleroma site"
209 description: "Instance usage statistics",
213 description: "User count statistics",
215 active_month: %Schema{
217 description: "Monthly active users"
225 description: "An email that may be contacted for any inquiries",
230 description: "URLs of interest for clients apps",
235 description: "Statistics about how much information the instance contains",
239 description: "Users registered on this instance"
241 status_count: %Schema{
243 description: "Statuses authored by users on instance"
245 domain_count: %Schema{
247 description: "Domains federated with this instance"
256 description: "Banner image for the website",
263 items: %Schema{type: :string},
264 description: "Primary languages of the website and its staff"
266 registrations: %Schema{
268 description: "Registrations-related configuration",
272 description: "Whether registrations are enabled"
274 approval_required: %Schema{
276 description: "Whether users need to be manually approved by admin"
280 configuration: %Schema{
282 description: "Instance configuration",
287 max_featured_tags: %Schema{
289 description: "The maximum number of featured tags allowed for each account."
291 max_pinned_statuses: %Schema{
293 description: "The maximum number of pinned statuses for each account."
302 description: "Websockets address for push streaming"
308 description: "A map with poll limits for local statuses",
310 characters_reserved_per_url: %Schema{
313 "Each URL in a status will be assumed to be exactly this many characters."
315 max_characters: %Schema{
317 description: "Posts character limit (CW/Subject included in the counter)"
319 max_media_attachments: %Schema{
321 description: "Media attachment limit"
325 media_attachments: %Schema{
327 description: "A map with poll limits for media attachments",
329 image_size_limit: %Schema{
331 description: "File size limit of uploaded images"
333 video_size_limit: %Schema{
335 description: "File size limit of uploaded videos"
341 description: "A map with poll limits for local polls",
343 max_options: %Schema{
345 description: "Maximum number of options."
347 max_characters_per_option: %Schema{
349 description: "Maximum number of characters per option."
351 min_expiration: %Schema{
353 description: "Minimum expiration time (in seconds)."
355 max_expiration: %Schema{
357 description: "Maximum expiration time (in seconds)."
367 defp array_of_domains do
370 items: %Schema{type: :string},
371 example: ["pleroma.site", "lain.com", "bikeshed.party"]