Update
This commit is contained in:
parent
188bc08494
commit
4af88f3e1d
44 changed files with 1041 additions and 34 deletions
49
lib/nulla_web/controllers/api/actor_json.ex
Normal file
49
lib/nulla_web/controllers/api/actor_json.ex
Normal file
|
@ -0,0 +1,49 @@
|
|||
defmodule NullaWeb.Api.ActorJSON do
|
||||
alias Nulla.Actors.Actor
|
||||
|
||||
@doc """
|
||||
Renders a list of actors.
|
||||
"""
|
||||
def index(%{actors: actors}) do
|
||||
%{data: for(actor <- actors, do: data(actor))}
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders a single actor.
|
||||
"""
|
||||
def show(%{actor: actor}) do
|
||||
%{data: data(actor)}
|
||||
end
|
||||
|
||||
defp data(%Actor{} = actor) do
|
||||
%{
|
||||
id: actor.id,
|
||||
acct: actor.acct,
|
||||
ap_id: actor.ap_id,
|
||||
type: actor.type,
|
||||
following: actor.following,
|
||||
followers: actor.followers,
|
||||
inbox: actor.inbox,
|
||||
outbox: actor.outbox,
|
||||
featured: actor.featured,
|
||||
featuredTags: actor.featuredTags,
|
||||
preferredUsername: actor.preferredUsername,
|
||||
name: actor.name,
|
||||
summary: actor.summary,
|
||||
url: actor.url,
|
||||
manuallyApprovesFollowers: actor.manuallyApprovesFollowers,
|
||||
discoverable: actor.discoverable,
|
||||
indexable: actor.indexable,
|
||||
published: actor.published,
|
||||
memorial: actor.memorial,
|
||||
publicKey: actor.publicKey,
|
||||
tag: actor.tag,
|
||||
attachment: actor.attachment,
|
||||
endpoints: actor.endpoints,
|
||||
icon: actor.icon,
|
||||
image: actor.image,
|
||||
vcard_bday: actor.vcard_bday,
|
||||
vcard_Address: actor.vcard_Address
|
||||
}
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue