Encoders and Decoders for JSON that goes over the wire.
You will rarely use any of these. Encoding and decoding will usually
be done for you by by Mastodon.Requests.requestToRawRequest, which
your code will call indirectly via Mastodon.Requests.serverRequest.
Decode an Entity.
You'll usually know which entity you're looking for, and will use its decoder explicitly. In case you don't...
The urlString is used only to decode an Instance. It is used to default fields when the server returns {} (which it shouldn't, but some do).
Similar to encodeEntity, but returns the v field, if it is non-null,
giving you the raw data that came over the wire, if this entity DID come over
the wire, and is not one of the few that don't have a v field.
Decode an Account.
Encode an Account.
Decode a Field.
Encode a Field.
Decode an App.
Encode an App.
Decode a Source.
Encode a Source.
Decode a Token.
Encode a Token.
Decode an Application.
Encode an Application.
Decode an Attachment.
Encode an Attachment.
Decode a Card.
Encode a Card.
Decode a Context.
Encode a Context.
Decode a Visibility.
Encode a Visibility.
Decode an Emoji.
Encode an Emoji.
Encode a Status.
Decode a Status.
This integrates the non-standard fields, so that you can just use content
for the full HTML to actually display.
Decode a RawStatus.
Just decode the fields that are supported by all servers.
The content field means different things on some servers, so use
statusDecoder if you want it to have the full HTML for the post.
Same as statusDecoder, except if it fails, falls back to a
mostly defaulted Status, with only the id, uri, url, and
account fields filled in.
The content property will be:
"*** This status was malformed, id: <id> ***"Encode a HistoryStatus
Decode a HistoryStatus.
Encode an Error.
Note that the httpStatus field does NOT get encoded.
You'll probably never need to encode one of these, anyway.
Decode an Error.
Since the httpStatus comes from the HTTP headers, it needs to be
passed in here as a parameter, as it isn't in the JSON.
Encode a Poll.
Decode a Poll.
Encode a PollDefinition.
Decode a PollDefinition.
Encode a Filter.
Decode a Filter.
Encode a FilterContext.
Decode a FilterContext.
Encode an Instance.
Decode an Instance.
Return the default instance for a URL string.
Used for servers that return a malformed Instance or no JSON at all.
Encode an Activity.
Mastodon encodes all the Int fields as strings, so we follow suit here.
Pleroma and Gab don't support "GET instance/activity".
Decode an Activity
Encode a ListEntity.
Decode a ListEntity.
Encode a Notification.
Decode a Notification.
Encode a NotificationType.
Decode a `NotificationType.
Encoder for PushSubscription.
Decoder for PushSubscription.
Encoder for Relationship.
Decode a Relationship.
Encoder for Results.
Decoder for Results.
Encoder for ScheduledStatus.
Decoder for ScheduledStatus.
Encoder for Conversation.
Decoder for Conversation.
Encoder for Group.
Decoder for Group.
Encoder for GroupRelationship.
Decoder for GroupRelationship.
Encode a Tag.
Decode a Tag.
Encoder for Authorization.
Decoder for Authorization.
Encode Maybe x to Json.Encode.null if it's Nothing,
or with the encoder otherwise.
Useful for omitting encoded properties with a default value.
encodePropertyAsList name property encode defaultReturns [], if property == default.
Otherwise, returns:
[ ( name, encoder property ) ]Convert Privacy to a String.
Convert a NoticiationType to a string
Turn a FilterContext into a String.
Encode an
Entityinto aValue.