diff options
author | lain <lain@soykaf.club> | 2020-11-04 15:00:52 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-04 15:00:52 +0000 |
commit | 4800ee656bbcd8fe21fe56531123d3a18eccc911 (patch) | |
tree | bddda9d9f46dff6d5ae8dc4ea21ca5b22ab9d781 /lib/pleroma/web/api_spec | |
parent | 5db4c823b2e345155fbed48e7e7d12cab87eca72 (diff) | |
parent | eb1e1e74945a55c37e4b0dc7cea1a7c926ff981a (diff) | |
download | pleroma-4800ee656bbcd8fe21fe56531123d3a18eccc911.tar.gz |
Merge branch 'features/federation-status' into 'develop'
Add a federation_status endpoint showing unreachable instances
See merge request pleroma/pleroma!3086
Diffstat (limited to 'lib/pleroma/web/api_spec')
-rw-r--r-- | lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex new file mode 100644 index 000000000..2c455b0df --- /dev/null +++ b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex @@ -0,0 +1,40 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# 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{ + tags: ["PleromaInstances"], + summary: "Instances federation status", + 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 |