revert 4a94c9a31ef11f63ea71ad9c1f085c18cf8ef083
[akkoma] / lib / pleroma / web / mastodon_api / controllers / mastodon_api_controller.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
6 @moduledoc """
7 Contains stubs for unimplemented Mastodon API endpoints.
8
9 Note: instead of routing directly to this controller's action,
10 it's preferable to define an action in relevant (non-generic) controller,
11 set up OAuth rules for it and call this controller's function from it.
12 """
13
14 use Pleroma.Web, :controller
15
16 require Logger
17
18 plug(:skip_auth when action in [:empty_array, :empty_object])
19
20 action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
21
22 def empty_array(conn, _) do
23 Logger.debug("Unimplemented, returning an empty array (list)")
24 json(conn, [])
25 end
26
27 def empty_object(conn, _) do
28 Logger.debug("Unimplemented, returning an empty object (map)")
29 json(conn, %{})
30 end
31 end