1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 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, [])
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 peers_operation do
29 summary: "Retrieve list of known instances",
30 operationId: "InstanceController.peers",
32 200 => Operation.response("Array of domains", "application/json", array_of_domains())
41 uri: %Schema{type: :string, description: "The domain name of the instance"},
42 title: %Schema{type: :string, description: "The title of the website"},
45 description: "Admin-defined description of the Pleroma site"
49 description: "The version of Pleroma installed on the instance"
53 description: "An email that may be contacted for any inquiries",
58 description: "URLs of interest for clients apps",
60 streaming_api: %Schema{
62 description: "Websockets address for push streaming"
68 description: "Statistics about how much information the instance contains",
72 description: "Users registered on this instance"
74 status_count: %Schema{
76 description: "Statuses authored by users on instance"
78 domain_count: %Schema{
80 description: "Domains federated with this instance"
86 description: "Banner image for the website",
91 items: %Schema{type: :string},
92 description: "Primary langauges of the website and its staff"
94 registrations: %Schema{type: :boolean, description: "Whether registrations are enabled"},
95 # Extra (not present in Mastodon):
96 max_toot_chars: %Schema{
98 description: ": Posts character limit (CW/Subject included in the counter)"
100 poll_limits: %Schema{
102 description: "A map with poll limits for local polls",
104 max_options: %Schema{
106 description: "Maximum number of options."
108 max_option_chars: %Schema{
110 description: "Maximum number of characters per option."
112 min_expiration: %Schema{
114 description: "Minimum expiration time (in seconds)."
116 max_expiration: %Schema{
118 description: "Maximum expiration time (in seconds)."
122 upload_limit: %Schema{
124 description: "File size limit of uploads (except for avatar, background, banner)"
126 avatar_upload_limit: %Schema{type: :integer, description: "The title of the website"},
127 background_upload_limit: %Schema{type: :integer, description: "The title of the website"},
128 banner_upload_limit: %Schema{type: :integer, description: "The title of the website"},
129 background_image: %Schema{
132 description: "The background image for the website"
136 "avatar_upload_limit" => 2_000_000,
137 "background_upload_limit" => 4_000_000,
138 "background_image" => "/static/image.png",
139 "banner_upload_limit" => 4_000_000,
140 "description" => "Pleroma: An efficient and flexible fediverse server",
141 "email" => "lain@lain.com",
142 "languages" => ["en"],
143 "max_toot_chars" => 5000,
145 "max_expiration" => 31_536_000,
146 "max_option_chars" => 200,
148 "min_expiration" => 0
150 "registrations" => false,
152 "domain_count" => 2996,
153 "status_count" => 15_802,
156 "thumbnail" => "https://lain.com/instance/thumbnail.jpeg",
157 "title" => "lain.com",
158 "upload_limit" => 16_000_000,
159 "uri" => "https://lain.com",
161 "streaming_api" => "wss://lain.com"
163 "version" => "2.7.2 (compatible; Pleroma 2.0.50-536-g25eec6d7-develop)"
168 defp array_of_domains do
171 items: %Schema{type: :string},
172 example: ["pleroma.site", "lain.com", "bikeshed.party"]