Move GET /api/v1/apps to GET /api/v1/pleroma/apps
[akkoma] / lib / pleroma / web / pleroma_api / controllers / app_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.PleromaAPI.AppController do
6 use Pleroma.Web, :controller
7
8 alias Pleroma.Web.OAuth.App
9 alias Pleroma.Web.Plugs.OAuthScopesPlug
10
11 plug(OAuthScopesPlug, %{scopes: ["follow", "read"]} when action in [:index])
12
13 plug(Pleroma.Web.ApiSpec.CastAndValidate)
14
15 defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaAppOperation
16
17 @doc "GET /api/v1/pleroma/apps"
18 def index(%{assigns: %{user: user}} = conn, _params) do
19 with apps <- App.get_user_apps(user) do
20 render(conn, "index.json", %{apps: apps})
21 end
22 end
23 end