2019-02-10 12:41:06 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-12 23:49:20 -07:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2019-02-10 12:41:06 -07:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.TwitterAPI.TokenView do
|
|
|
|
use Pleroma.Web, :view
|
|
|
|
|
|
|
|
def render("index.json", %{tokens: tokens}) do
|
|
|
|
tokens
|
|
|
|
|> render_many(Pleroma.Web.TwitterAPI.TokenView, "show.json")
|
|
|
|
|> Enum.filter(&Enum.any?/1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{token: token_entry}) do
|
|
|
|
%{
|
|
|
|
id: token_entry.id,
|
2019-02-17 13:57:35 -07:00
|
|
|
valid_until: token_entry.valid_until,
|
|
|
|
app_name: token_entry.app.client_name
|
2019-02-10 12:41:06 -07:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|