+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write:statuses"]} when action in [:post_chat_message, :create, :mark_as_read]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["read:statuses"]} when action in [:messages, :index, :show]
+ )
+
+ plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError)
+
+ defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.ChatOperation
+
+ def post_chat_message(
+ %{body_params: %{content: content} = params, assigns: %{user: %{id: user_id} = user}} =
+ conn,
+ %{
+ id: id
+ }
+ ) do