akkoma/lib/pleroma/web/pleroma_api/controllers/app_controller.ex
marcin mikołajczak 10886eeaa2 Bump copyright year
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-01-01 12:13:06 +01:00

23 lines
728 B
Elixir

# Pleroma: A lightweight social networking server
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.AppController do
use Pleroma.Web, :controller
alias Pleroma.Web.OAuth.App
alias Pleroma.Web.Plugs.OAuthScopesPlug
plug(OAuthScopesPlug, %{scopes: ["follow", "read"]} when action in [:index])
plug(Pleroma.Web.ApiSpec.CastAndValidate)
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaAppOperation
@doc "GET /api/v1/pleroma/apps"
def index(%{assigns: %{user: user}} = conn, _params) do
with apps <- App.get_user_apps(user) do
render(conn, "index.json", %{apps: apps})
end
end
end