b941849f55a07f29d7258696a2b3499b4a2a559f
[akkoma] / lib / pleroma / web / mastodon_api / controllers / suggestion_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.SuggestionController do
6 use Pleroma.Web, :controller
7
8 require Logger
9
10 plug(Pleroma.Web.ApiSpec.CastAndValidate)
11 plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["read"]} when action in [:index, :index2])
12
13 def open_api_operation(action) do
14 operation = String.to_existing_atom("#{action}_operation")
15 apply(__MODULE__, operation, [])
16 end
17
18 def index_operation do
19 %OpenApiSpex.Operation{
20 tags: ["Suggestions"],
21 summary: "Follow suggestions (Not implemented)",
22 operationId: "SuggestionController.index",
23 responses: %{
24 200 => Pleroma.Web.ApiSpec.Helpers.empty_array_response()
25 }
26 }
27 end
28
29 def index2_operation do
30 %OpenApiSpex.Operation{
31 tags: ["Suggestions"],
32 summary: "Follow suggestions (Not implemented)",
33 operationId: "SuggestionController.index2",
34 responses: %{
35 200 => Pleroma.Web.ApiSpec.Helpers.empty_array_response()
36 }
37 }
38 end
39
40 @doc "GET /api/v1/suggestions"
41 def index(conn, params),
42 do: Pleroma.Web.MastodonAPI.MastodonAPIController.empty_array(conn, params)
43
44 @doc "GET /api/v2/suggestions"
45 def index2(conn, params),
46 do: Pleroma.Web.MastodonAPI.MastodonAPIController.empty_array(conn, params)
47 end