The Mastodon API entities.
These are JSON-encoded over the wire. Mastodon.EncodeDecode knows how to do that.
Documented at https://docs.joinmastodon.org/api/entities/
Most of the Entity have a v
field, which is the raw JS value from
which it was decoded. This is useful if you want to display what you
got over the wire. Code that creates these can set it to
Json.Encode.null
.
One type to rule them all.
This is mostly to make tests easier to define. Most code will use individual entities explicitly.
String
Alias of String
String
Alias of String
String
Alias of String
String
Alias of String
String
Alias of String
String
Alias of String
{ id : String
, username : String
, acct : String
, display_name : String
, locked : Basics.Bool
, created_at : Datetime
, followers_count : Basics.Int
, following_count : Basics.Int
, statuses_count : Basics.Int
, note : String
, url : UrlString
, avatar : UrlString
, avatar_static : UrlString
, header : UrlString
, header_static : UrlString
, emojis : List Emoji
, moved : Maybe WrappedAccount
, fields : List Field
, bot : Basics.Bool
, source : Maybe Source
, is_pro : Basics.Bool
, is_verified : Basics.Bool
, is_donor : Basics.Bool
, is_investor : Basics.Bool
, v : Json.Encode.Value
}
Account entity
Pleroma servers have an additional field here, not yet supported:
"pleroma":{"tags":[],
"skip_thread_containment":false,
"settings_store":{},
"relationship":{"subscribing":false,
"showing_reblogs":true,
"requested":false,
"muting_notifications":false,
"muting":false,
"id":"9kL2555DTtECY9TEQK",
"following":true,
"followed_by":true,
"endorsed":false,
"domain_blocking":false,
"blocking":false
}
{ privacy : Privacy
, sensitive : Basics.Bool
, language : Maybe ISO6391
, note : String
, fields : List Field
, v : Json.Encode.Value
}
Source entity.
Pleroma servers have an additional field here, not yet supported:
"pleroma":{"show_role":true,"no_rich_text":false}
{ access_token : String
, token_type : String
, scope : String
, created_at : Basics.Int
, v : Json.Encode.Value
}
Token entity.
{ name : String
, website : Maybe UrlString
, v : Json.Encode.Value
}
Application entity.
{ id : String
, name : String
, website : Maybe String
, redirect_uri : String
, client_id : String
, client_secret : String
, vapid_key : Maybe String
, v : Json.Encode.Value
}
App entity.
This is not documented, so I requested one and reverse engineered it.
{ url : UrlString
, title : String
, description : String
, image : Maybe UrlString
, type_ : CardType
, author_name : Maybe String
, author_url : Maybe UrlString
, provider_name : Maybe String
, provider_url : Maybe UrlString
, html : Maybe HtmlString
, width : Maybe Basics.Int
, height : Maybe Basics.Int
, v : Json.Encode.Value
}
Card entity.
{ ancestors : List Status
, descendants : List Status
}
Context entity.
{ httpStatus : String
, error : String
}
Error entity.
{ id : String
, phrase : String
, context : List FilterContext
, expires_at : Maybe Datetime
, irreversible : Basics.Bool
, whole_word : Basics.Bool
, v : Json.Encode.Value
}
Filter entity.
{ uri : String
, title : String
, description : String
, email : String
, version : String
, thumbnail : Maybe UrlString
, urls : Maybe URLs
, stats : Stats
, max_toot_chars : Maybe Basics.Int
, languages : List ISO6391
, contact_account : Maybe Account
, v : Json.Encode.Value
}
Instance entity.
{ week : Basics.Int
, statuses : Basics.Int
, logins : Maybe Basics.Int
, registrations : Basics.Int
, v : Json.Encode.Value
}
Activity
entity.
Not documented. A list of these is returned by "GET instance/activity"
{ id : String
, title : String
}
List entity.
{ id : String
, type_ : NotificationType
, created_at : Datetime
, account : Account
, emoji : Maybe String
, status : Maybe Status
, v : Json.Encode.Value
}
Notification entity.
{ id : String
, endpoint : UrlString
, server_key : String
, alerts : Json.Encode.Value
, v : Json.Encode.Value
}
Push subscription entity.
{ id : String
, following : Basics.Bool
, followed_by : Basics.Bool
, blocking : Basics.Bool
, muting : Basics.Bool
, muting_notifications : Basics.Bool
, requested : Basics.Bool
, domain_blocking : Basics.Bool
, showing_reblogs : Basics.Bool
, endorsed : Basics.Bool
, v : Json.Encode.Value
}
Relationship entity.
{ accounts : List Account
, statuses : List Status
, hashtags : List String
, groups : List Group
, v : Json.Encode.Value
}
Results entity.
{ id : String
, uri : String
, url : Maybe UrlString
, account : Account
, in_reply_to_id : Maybe String
, in_reply_to_account_id : Maybe String
, reblog : Maybe WrappedStatus
, content : HtmlString
, plain_markdown : Maybe String
, plain_text : Maybe String
, created_at : Datetime
, edited_at : Maybe Datetime
, emojis : List Emoji
, replies_count : Basics.Int
, reblogs_count : Basics.Int
, favourites_count : Basics.Int
, reblogged : Basics.Bool
, favourited : Basics.Bool
, muted : Basics.Bool
, sensitive : Basics.Bool
, spoiler_text : String
, visibility : Visibility
, media_attachments : List Attachment
, mentions : List Mention
, tags : List Tag
, card : Maybe Card
, poll : Maybe Poll
, application : Maybe Application
, language : Maybe String
, pinned : Basics.Bool
, group : Maybe Group
, quote_of_id : Maybe String
, quote : Maybe WrappedStatus
, v : Json.Encode.Value
}
Status entity.
The plain_markdown
and plain_text
fields are elm-mastodon additions.
content
is the HTML to display.
plain_markdown
is the markdown the user entered, if it is available.
plain_text
is the unformatted text, if it is available.
{ content_type : Maybe String
, id : String
, location : Maybe String
, spoiler_text : Maybe String
, text : String
, v : Json.Encode.Value
}
The source for a status. Returned by Request.GetStatusSource
.
Only supported by Soapbox/Rebased, AFAIK.
Json:
{ content_type = "text/plain"
, id = "ARYkeb8NzDPJgvI7n6"
, location = null
, spoiler_text = ""
, text = "A status to edit.\n\nAn added line.\n\nA second edit."
}
{ account : Account
, content : String
, created_at : String
, emojis : List Emoji
, media_attachments : List Attachment
, poll : Maybe Poll
, sensitive : Basics.Bool
, spoiler_text : String
, v : Json.Encode.Value
}
A subset of Status
, returned by Request.GetHistoryStatus
.
{ plain_markdown : Maybe String
, rich_content : Maybe String
, pleroma : Maybe PleromaStatusContent
, v : Json.Encode.Value
}
RawStatus entity.
Extra Status fields that are not returned by all servers.
{ id : String
, scheduled_at : Datetime
, params : StatusParams
, media_attachments : List Attachment
, v : Json.Encode.Value
}
ScheduledStatus entity.
{ id : String
, accounts : List Account
, last_status : Maybe Status
, unread : Basics.Bool
, v : Json.Encode.Value
}
Conversation entity.
{ id : String
, title : String
, description : String
, cover_image_url : String
, is_archived : Basics.Bool
, member_count : Basics.Int
, v : Json.Encode.Value
}
Group entity.
This is a Gab extension.
{ id : String
, member : Basics.Bool
, admin : Basics.Bool
, unread_count : Basics.Int
, v : Json.Encode.Value
}
Group relationship entity.
This is a Gab extension.
{ shortcode : String
, static_url : UrlString
, url : UrlString
, visible_in_picker : Basics.Bool
, category : Maybe String
}
Values for the Account.emojis
list. Also returned by /api/v1/custom_emojis
.
{ name : String
, value : HtmlString
, verified_at : Maybe Datetime
}
Values for the Account.fields
and Source.fields
lists.
Values for Source.privacy
{ id : String
, type_ : AttachmentType
, url : UrlString
, remote_url : Maybe UrlString
, preview_url : Maybe UrlString
, text_url : Maybe UrlString
, meta : Maybe Meta
, description : Maybe String
, v : Json.Encode.Value
}
Element of Status.media_attachments
and ScheduledStatus.media_attachments
.
Note that it's possible to create an Attachment
whose type_
disagrees
with its meta
. Maybe I should have represented it to prevent that, but I
chose to mostly match the JSON.
Types for the Attachment.type_
field.
Value for Attachment.meta
{ small : Maybe ImageMetaInfo
, original : Maybe ImageMetaInfo
, focus : Maybe Focus
}
Fields for an ImageMeta
.
{ small : Maybe VideoMetaInfo
, original : Maybe VideoMetaInfo
, focus : Maybe Focus
}
Fields for a VideoMeta
.
{ width : Maybe Basics.Int
, height : Maybe Basics.Int
, size : Maybe String
, aspect : Maybe Basics.Float
}
Values for ImageMetaFields.small
and ImageMetaFields.original
{ width : Maybe Basics.Int
, height : Maybe Basics.Int
, frame_rate : Maybe String
, duration : Maybe Basics.Float
, bitrate : Maybe Basics.Int
}
Values for VideoMetaFields.small
and VideoMetaFields.original
{ x : Basics.Float, y : Basics.Float }
The optional focus of an image attachment.
Choices for the Card.type_
field.
Choices for the Filter.context
list.
{ streaming_api : UrlString }
Value of Instance.urls
.
{ user_count : Basics.Int
, status_count : Basics.Int
, domain_count : Basics.Int
}
Value of Instance.stats
.
Choices for Notification.type_
.
Values for Status.visibility
.
{ url : UrlString
, username : String
, acct : String
, id : String
}
Values in Status.mentions
.
{ name : String
, url : UrlString
, history : List History
}
Elements of Results.hashtags
and Status.tags
.
{ day : UnixTimestamp
, uses : Basics.Int
, accounts : Basics.Int
}
Value for Tag.history
.
{ id : String
, expires_at : Maybe Datetime
, expired : Basics.Bool
, multiple : Basics.Bool
, votes_count : Basics.Int
, voters_count : Maybe Basics.Int
, options : List PollOption
, emojis : List Emoji
, voted : Basics.Bool
, own_votes : List Basics.Int
, v : Json.Encode.Value
}
Value for Status.poll
, and an Entity
in its own right.
{ title : String
, votes_count : Basics.Int
}
Elements of the Poll.options
list.
{ options : List String
, expires_in : Basics.Int
, multiple : Basics.Bool
, hide_totals : Basics.Bool
}
Define a Poll as part of a posted new or updated Status
{ text : String
, in_reply_to_id : Maybe String
, media_ids : List String
, sensitive : Basics.Bool
, spoiler_text : Maybe String
, visibility : Maybe Visibility
, scheduled_at : Maybe Datetime
, application_id : String
}
Elements of ScheduledStatus.params
.
{ content : { plain_text : String } }
The pleroma
field of a RawStatus
entity (Pleroma only).
{ content : String
, detected_source_language : String
, provider : String
}
Output of (StatusesRequest <| Request.PostTranslate)
From Gleasonator:
{"content":"<html>"
,"detected_source_language":"JA"
,"provider":"DeepL"
}
{ clientId : String
, clientSecret : String
, token : String
}
Authorization Parameters.
Applications will usually save this in localStorage
, use the saved token
until it expires, then use the client ID and secret to mint a new authorization.
The authorization is usually of the type "Bearer
Wrapped Account
, to prevent type recursion.
Wrapped Status
, to prevent type recursion.