mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 18:36:21 +00:00
21 lines
506 B
Elixir
21 lines
506 B
Elixir
defmodule Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter do
|
|
use Pleroma.Web.TwitterAPI.Representers.BaseRepresenter
|
|
alias Pleroma.Object
|
|
|
|
def to_map(%Object{} = object, _opts) do
|
|
data = object.data
|
|
url = List.first(data["url"])
|
|
%{
|
|
url: url["href"],
|
|
mimetype: url["mediaType"],
|
|
id: data["uuid"],
|
|
oembed: false
|
|
}
|
|
end
|
|
|
|
# If we only get the naked data, wrap in an object
|
|
def to_map(%{} = data, opts) do
|
|
to_map(%Object{data: data}, opts)
|
|
end
|
|
end
|