vjousse / elm-mastodon-tooty / Mastodon.Model

Model the Mastodon entities

Definition


type alias Account =
{ acct : String
, avatar : String
, created_at : String
, display_name : String
, followers_count : Basics.Int
, following_count : Basics.Int
, header : String
, id : AccountId
, locked : Basics.Bool
, note : String
, statuses_count : Basics.Int
, url : String
, username : String 
}

Mastodon account


type alias AccessTokenResult =
{ server : Server
, accessToken : Token 
}

Server token


type alias AccountNotificationDate =
{ account : Account
, created_at : String 
}

AccountNotificationDate


type alias AppRegistration =
{ server : Server
, scope : String
, client_id : ClientId
, client_secret : ClientSecret
, id : String
, redirect_uri : String 
}

App registration


type alias Application =
{ name : String
, website : Maybe String 
}

Application


type alias Attachment =
{ id : String
, type_ : String
, url : String
, remote_url : String
, preview_url : Maybe String
, text_url : Maybe String
, description : Maybe String 
}

Attachment can be an image, a video, an audio or a gifv


type alias Client =
{ server : Server
, token : Token
, account : Maybe Account 
}

Web Client


type alias Context =
{ ancestors : List Status
, descendants : List Status 
}

Context of a status

Contains ancestors statuses and descendants statuses


type Error
    = MastodonError StatusCode StatusMsg String
    | ServerError StatusCode StatusMsg String
    | TimeoutError
    | NetworkError

Mastodon error types


type alias Hashtag =
{ name : String
, url : String
, history : List HashtagHistory 
}

Tag with history


type alias HashtagHistory =
{ day : String
, uses : String
, accounts : String 
}

HashtagHistory


type alias MediaRequestBody =
{ description : String }

Update a media


type alias Mention =
{ id : AccountId
, url : String
, username : String
, acct : String 
}

Mention


type alias Notification =
{ id : String
, type_ : String
, created_at : String
, account : Account
, status : Maybe Status 
}

Notification

   - id: The notification ID
   - type_: One of: "mention", "reblog", "favourite", "follow"
   - created_at: The time the notification was created
   - account: The Account sending the notification to the user
   - status: The Status associated with the notification, if applicable


type alias NotificationAggregate =
{ id : String
, type_ : String
, status : Maybe Status
, accounts : List AccountNotificationDate
, created_at : String 
}

NotificationAggregate

Group multiple notification together


type Reblog
    = Reblog Status

Reblog of a Status


type alias Relationship =
{ id : String
, blocking : Basics.Bool
, followed_by : Basics.Bool
, following : Basics.Bool
, muting : Basics.Bool
, requested : Basics.Bool 
}

Relationship between followers


type alias SearchResults =
{ accounts : List Account
, statuses : List Status
, hashtags : List Hashtag 
}

SearchResults


type alias Status =
{ account : Account
, application : Maybe Application
, content : String
, created_at : String
, edited_at : Maybe String
, favourited : Maybe Basics.Bool
, favourites_count : Basics.Int
, id : StatusId
, in_reply_to_account_id : Maybe String
, in_reply_to_id : Maybe StatusId
, media_attachments : List Attachment
, mentions : List Mention
, reblog : Maybe Reblog
, reblogged : Maybe Basics.Bool
, reblogs_count : Basics.Int
, sensitive : Maybe Basics.Bool
, spoiler_text : String
, tags : List Tag
, uri : String
, url : Maybe String
, visibility : String 
}

Status


type alias StatusEdit =
{ status : Status
, text : Maybe String
, spoiler_text : Maybe String 
}

Used when editing a status


type alias StatusEditRequestBody =
{ status : String
, spoiler_text : Maybe String
, sensitive : Basics.Bool
, media_ids : List String 
}

Edit a status


type StatusId
    = StatusId String

Status id


type alias StatusSource =
{ id : StatusId
, text : String
, spoiler_text : String 
}

Used to get the original content of a status


type alias StatusRequestBody =
{ status : String
, in_reply_to_id : Maybe StatusId
, spoiler_text : Maybe String
, sensitive : Basics.Bool
, visibility : String
, media_ids : List String 
}

Submit a status


type alias Tag =
{ name : String
, url : String 
}

tags

#hashtag