billstclair/elm-mastodon/1.0.0

NOTE: the latest version is 24.0.0

Mastodon.EncodeDecode

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.

For the one type to rule them all

encodeEntity : Entity -> Value

Encode an Entity into a Value.

Decode an Entity.

You'll usually know which entity you're looking for, and will use its decoder explicitly. In case you don't...

entityValue : Entity -> Value

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.

For the individual entity types

accountDecoder : Decoder Account

Decode an Account.

encodeAccount : Account -> Value

Encode an Account.

fieldDecoder : Decoder Field

Decode a Field.

encodeField : Field -> Value

Encode a Field.

appDecoder : Decoder App

Decode an App.

encodeApp : App -> Value

Encode an App.

sourceDecoder : Decoder Source

Decode a Source.

encodeSource : Source -> Value

Encode a Source.

tokenDecoder : Decoder Token

Decode a Token.

encodeToken : Token -> Value

Encode a Token.

applicationDecoder : Decoder Application

Decode an Application.

encodeApplication : Application -> Value

Encode an Application.

attachmentDecoder : Decoder Attachment

Decode an Attachment.

encodeAttachment : Attachment -> Value

Encode an Attachment.

cardDecoder : Decoder Card

Decode a Card.

encodeCard : Card -> Value

Encode a Card.

contextDecoder : Decoder Context

Decode a Context.

encodeContext : Context -> Value

Encode a Context.

Decode a Visibility.

Encode a Visibility.

emojiDecoder : Decoder Emoji

Decode an Emoji.

encodeEmoji : Emoji -> Value

Encode an Emoji.

encodeStatus : Status -> Value

Encode a Status.

statusDecoder : Decoder Status

Decode a Status.

encodeError : Error -> Value

Encode an Error.

Note that the httpStatus field does NOT get encoded. You'll probably never need to encode one of these, anyway.

errorDecoder : String -> Decoder Error

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.

encodePoll : Poll -> Value

Encode a Poll.

pollDecoder : Decoder Poll

Decode a Poll.

encodeFilter : Filter -> Value

Encode a Filter.

filterDecoder : Decoder Filter

Decode a Filter.

Encode a FilterContext.

Decode a FilterContext.

encodeInstance : Instance -> Value

Encode an Instance.

instanceDecoder : Decoder Instance

Decode an Instance.

encodeActivity : Activity -> Value

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".

activityDecoder : Decoder Activity

Decode an Activity

encodeListEntity : ListEntity -> Value

Encode a ListEntity.

listEntityDecoder : Decoder ListEntity

Decode a ListEntity.

encodeNotification : Notification -> Value

Encode a Notification.

notificationDecoder : Decoder Notification

Decode a Notification.

Encode a NotificationType.

Decode a `NotificationType.

encodePushSubscription : PushSubscription -> Value

Encoder for PushSubscription.

pushSubscriptionDecoder : Decoder PushSubscription

Decoder for PushSubscription.

encodeRelationship : Relationship -> Value

Encoder for Relationship.

relationshipDecoder : Decoder Relationship

Decode a Relationship.

encodeResults : Results -> Value

Encoder for Results.

resultsDecoder : Decoder Results

Decoder for Results.

encodeScheduledStatus : ScheduledStatus -> Value

Encoder for ScheduledStatus.

scheduledStatusDecoder : Decoder ScheduledStatus

Decoder for ScheduledStatus.

encodeConversation : Conversation -> Value

Encoder for Conversation.

conversationDecoder : Decoder Conversation

Decoder for Conversation.

encodeGroup : Group -> Value

Encoder for Group.

groupDecoder : Decoder Group

Decoder for Group.

encodeGroupRelationship : GroupRelationship -> Value

Encoder for GroupRelationship.

groupRelationshipDecoder : Decoder GroupRelationship

Decoder for GroupRelationship.

encodeTag : Tag -> Value

Encode a Tag.

tagDecoder : Decoder Tag

Decode a Tag.

Encoder and decoder for the login parameters.

encodeAuthorization : Authorization -> Value

Encoder for Authorization.

authorizationDecoder : Decoder Authorization

Decoder for Authorization.

Utilities

encodeMaybe : (x -> Value) -> Maybe x -> Value

Encode Maybe x to Json.Encode.null if it's Nothing,

or with the encoder otherwise.

Convert Privacy to a String.

Convert a NoticiationType to a string

Turn a FilterContext into a String.