Merge remote-tracking branch 'upstream/develop' into aliases
[akkoma] / lib / pleroma / web / api_spec / operations / pleroma_instances_operation.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.PleromaInstancesOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8
9 def open_api_operation(action) do
10 operation = String.to_existing_atom("#{action}_operation")
11 apply(__MODULE__, operation, [])
12 end
13
14 def show_operation do
15 %Operation{
16 tags: ["PleromaInstances"],
17 summary: "Instances federation status",
18 description: "Information about instances deemed unreachable by the server",
19 operationId: "PleromaInstances.show",
20 responses: %{
21 200 => Operation.response("PleromaInstances", "application/json", pleroma_instances())
22 }
23 }
24 end
25
26 def pleroma_instances do
27 %Schema{
28 type: :object,
29 properties: %{
30 unreachable: %Schema{
31 type: :object,
32 properties: %{hostname: %Schema{type: :string, format: :"date-time"}}
33 }
34 },
35 example: %{
36 "unreachable" => %{"consistently-unreachable.name" => "2020-10-14 22:07:58.216473"}
37 }
38 }
39 end
40 end