2020-10-15 17:13:52 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 13:38:50 -07:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-10-15 17:13:52 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ApiSpec.PleromaInstancesOperation do
|
|
|
|
alias OpenApiSpex.Operation
|
|
|
|
alias OpenApiSpex.Schema
|
|
|
|
|
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_operation do
|
|
|
|
%Operation{
|
2023-01-15 16:31:37 -07:00
|
|
|
tags: ["Instance misc"],
|
2021-02-03 05:38:59 -07:00
|
|
|
summary: "Retrieve federation status",
|
2020-10-15 17:13:52 -06:00
|
|
|
description: "Information about instances deemed unreachable by the server",
|
|
|
|
operationId: "PleromaInstances.show",
|
|
|
|
responses: %{
|
|
|
|
200 => Operation.response("PleromaInstances", "application/json", pleroma_instances())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def pleroma_instances do
|
|
|
|
%Schema{
|
|
|
|
type: :object,
|
|
|
|
properties: %{
|
|
|
|
unreachable: %Schema{
|
|
|
|
type: :object,
|
|
|
|
properties: %{hostname: %Schema{type: :string, format: :"date-time"}}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
example: %{
|
|
|
|
"unreachable" => %{"consistently-unreachable.name" => "2020-10-14 22:07:58.216473"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|