move to 2.5.5
[anni] / lib / pleroma / web / twitter_api / views / token_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.TwitterAPI.TokenView do
6   use Pleroma.Web, :view
7
8   def render("index.json", %{tokens: tokens}) do
9     tokens
10     |> render_many(Pleroma.Web.TwitterAPI.TokenView, "show.json")
11     |> Enum.filter(&Enum.any?/1)
12   end
13
14   def render("show.json", %{token: token_entry}) do
15     %{
16       id: token_entry.id,
17       valid_until: token_entry.valid_until,
18       app_name: token_entry.app.client_name
19     }
20   end
21 end