2017-04-27 10:34:27 -04:00
|
|
|
module Mastodon.Model
|
|
|
|
exposing
|
|
|
|
( AccessTokenResult
|
|
|
|
, AppRegistration
|
|
|
|
, Account
|
2021-01-15 23:53:12 -05:00
|
|
|
, AccountMoved
|
2017-06-01 06:01:13 -04:00
|
|
|
, AccountNotificationDate
|
2017-05-22 18:25:28 -04:00
|
|
|
, Application
|
2017-04-27 10:34:27 -04:00
|
|
|
, Attachment
|
|
|
|
, Client
|
2017-04-27 12:39:14 -04:00
|
|
|
, Context
|
2021-01-11 03:47:19 -05:00
|
|
|
, Emoji
|
2017-04-27 10:34:27 -04:00
|
|
|
, Error(..)
|
2021-01-11 03:47:19 -05:00
|
|
|
, Field
|
2021-01-11 19:12:13 -05:00
|
|
|
, HashtagHistory
|
|
|
|
, Hashtag
|
2017-04-27 10:34:27 -04:00
|
|
|
, Mention
|
|
|
|
, Notification
|
|
|
|
, NotificationAggregate
|
|
|
|
, Reblog(..)
|
2017-04-29 16:48:55 -04:00
|
|
|
, Relationship
|
2017-04-27 10:34:27 -04:00
|
|
|
, Tag
|
2021-03-06 18:20:53 -05:00
|
|
|
, PollId(..)
|
|
|
|
, PollOption
|
|
|
|
, Poll
|
2017-05-30 18:27:30 -04:00
|
|
|
, SearchResults
|
2021-01-10 16:25:03 -05:00
|
|
|
, Source
|
2017-04-27 10:34:27 -04:00
|
|
|
, Status
|
2017-11-29 08:06:08 -05:00
|
|
|
, StatusId(..)
|
2017-04-27 10:34:27 -04:00
|
|
|
, StatusRequestBody
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type alias AccountId =
|
2017-11-29 08:06:08 -05:00
|
|
|
String
|
2017-04-27 10:34:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
type alias AuthCode =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias ClientId =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias ClientSecret =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias Server =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
2017-11-29 08:06:08 -05:00
|
|
|
type StatusId
|
|
|
|
= StatusId String
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias StatusCode =
|
|
|
|
Int
|
|
|
|
|
|
|
|
|
|
|
|
type alias StatusMsg =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias Token =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type Error
|
|
|
|
= MastodonError StatusCode StatusMsg String
|
|
|
|
| ServerError StatusCode StatusMsg String
|
|
|
|
| TimeoutError
|
|
|
|
| NetworkError
|
|
|
|
|
|
|
|
|
|
|
|
type alias AccessTokenResult =
|
|
|
|
{ server : Server
|
|
|
|
, accessToken : Token
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias AppRegistration =
|
|
|
|
{ server : Server
|
|
|
|
, scope : String
|
|
|
|
, client_id : ClientId
|
|
|
|
, client_secret : ClientSecret
|
2017-11-29 08:06:08 -05:00
|
|
|
, id : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, redirect_uri : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-11 03:47:19 -05:00
|
|
|
type alias Emoji =
|
|
|
|
{ shortcode : String
|
|
|
|
, url : String
|
|
|
|
, static_url : String
|
|
|
|
, visible_in_picker : Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Field =
|
|
|
|
{ name : String
|
|
|
|
, value : String
|
|
|
|
, verified_at : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias Account =
|
|
|
|
{ acct : String
|
|
|
|
, avatar : String
|
2021-01-11 03:47:19 -05:00
|
|
|
, avatar_static : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, created_at : String
|
2021-01-11 03:47:19 -05:00
|
|
|
, last_status_at : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, display_name : String
|
|
|
|
, followers_count : Int
|
|
|
|
, following_count : Int
|
|
|
|
, header : String
|
2021-01-11 03:47:19 -05:00
|
|
|
, header_static : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, id : AccountId
|
|
|
|
, locked : Bool
|
2021-01-11 03:47:19 -05:00
|
|
|
, bot : Bool
|
2017-04-27 10:34:27 -04:00
|
|
|
, note : String
|
|
|
|
, statuses_count : Int
|
|
|
|
, url : String
|
|
|
|
, username : String
|
2021-01-10 16:25:03 -05:00
|
|
|
, source : Source
|
2021-01-11 03:47:19 -05:00
|
|
|
, emojis : List Emoji
|
|
|
|
, fields : List Field
|
2021-01-15 23:53:12 -05:00
|
|
|
, moved : AccountMoved
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias AccountMoved =
|
|
|
|
-- Minimal account to avoid recursive type alias
|
|
|
|
{ acct : String
|
|
|
|
, avatar : String
|
|
|
|
, display_name : String
|
|
|
|
, header : String
|
|
|
|
, id : AccountId
|
|
|
|
, locked : Bool
|
|
|
|
, bot : Bool
|
|
|
|
, username : String
|
|
|
|
, url : String
|
|
|
|
, note : String
|
2017-04-27 10:34:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-22 18:25:28 -04:00
|
|
|
type alias Application =
|
|
|
|
{ name : String
|
|
|
|
, website : Maybe String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias Attachment =
|
|
|
|
-- type_: -- "image", "video", "gifv"
|
2017-11-29 08:06:08 -05:00
|
|
|
{ id : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, type_ : String
|
|
|
|
, url : String
|
|
|
|
, remote_url : String
|
|
|
|
, preview_url : String
|
|
|
|
, text_url : Maybe String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Client =
|
|
|
|
{ server : Server
|
|
|
|
, token : Token
|
2017-05-09 12:43:12 -04:00
|
|
|
, account : Maybe Account
|
2017-04-27 10:34:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 12:39:14 -04:00
|
|
|
type alias Context =
|
|
|
|
{ ancestors : List Status
|
|
|
|
, descendants : List Status
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias Mention =
|
|
|
|
{ id : AccountId
|
|
|
|
, url : String
|
|
|
|
, username : String
|
|
|
|
, acct : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Notification =
|
|
|
|
{-
|
|
|
|
- id: The notification ID
|
2021-01-12 16:06:13 -05:00
|
|
|
- type_: One of: "mention", "reblog", "favourite", "follow", "follow_request", "poll", "status"
|
2017-04-27 10:34:27 -04:00
|
|
|
- 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
|
|
|
|
-}
|
2017-11-29 08:06:08 -05:00
|
|
|
{ id : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, type_ : String
|
|
|
|
, created_at : String
|
|
|
|
, account : Account
|
|
|
|
, status : Maybe Status
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-01 06:01:13 -04:00
|
|
|
type alias AccountNotificationDate =
|
|
|
|
{ account : Account
|
|
|
|
, created_at : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias NotificationAggregate =
|
2017-11-29 08:06:08 -05:00
|
|
|
{ id : String
|
2017-05-01 16:10:34 -04:00
|
|
|
, type_ : String
|
2017-04-27 10:34:27 -04:00
|
|
|
, status : Maybe Status
|
2017-06-01 06:01:13 -04:00
|
|
|
, accounts : List AccountNotificationDate
|
2017-04-27 10:34:27 -04:00
|
|
|
, created_at : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Reblog
|
|
|
|
= Reblog Status
|
|
|
|
|
|
|
|
|
2017-04-29 16:48:55 -04:00
|
|
|
type alias Relationship =
|
2017-11-29 08:06:08 -05:00
|
|
|
{ id : String
|
2017-04-29 16:48:55 -04:00
|
|
|
, blocking : Bool
|
|
|
|
, followed_by : Bool
|
|
|
|
, following : Bool
|
|
|
|
, muting : Bool
|
|
|
|
, requested : Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-11 19:12:13 -05:00
|
|
|
type alias HashtagHistory =
|
|
|
|
{ day : String
|
|
|
|
, uses : String
|
|
|
|
, accounts : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Hashtag =
|
|
|
|
{ name : String
|
|
|
|
, url : String
|
|
|
|
, history : List HashtagHistory
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-06 18:20:53 -05:00
|
|
|
type PollId
|
|
|
|
= PollId String
|
|
|
|
|
|
|
|
|
|
|
|
type alias PollOption =
|
|
|
|
{ title : String
|
|
|
|
, votes_count : Int
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Poll =
|
|
|
|
{ id : PollId
|
|
|
|
, expired : Bool
|
|
|
|
, voted : Bool
|
|
|
|
, votes_count : Int
|
|
|
|
, options : List PollOption
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-30 18:27:30 -04:00
|
|
|
type alias SearchResults =
|
|
|
|
{ accounts : List Account
|
|
|
|
, statuses : List Status
|
2021-01-11 19:12:13 -05:00
|
|
|
, hashtags : List Hashtag
|
2017-05-30 18:27:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-10 16:25:03 -05:00
|
|
|
type alias Source =
|
|
|
|
{ privacy : String
|
|
|
|
, sensitive : Bool
|
|
|
|
, language : String
|
2021-01-11 03:47:19 -05:00
|
|
|
, note : String
|
|
|
|
, fields : List Field
|
|
|
|
, follow_requests_count : Int
|
2021-01-10 16:25:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-27 10:34:27 -04:00
|
|
|
type alias Status =
|
|
|
|
{ account : Account
|
2017-05-22 18:25:28 -04:00
|
|
|
, application : Maybe Application
|
2017-04-27 10:34:27 -04:00
|
|
|
, content : String
|
|
|
|
, created_at : String
|
|
|
|
, favourited : Maybe Bool
|
|
|
|
, favourites_count : Int
|
2017-11-29 08:06:08 -05:00
|
|
|
, id : StatusId
|
|
|
|
, in_reply_to_account_id : Maybe String
|
|
|
|
, in_reply_to_id : Maybe StatusId
|
2017-04-27 10:34:27 -04:00
|
|
|
, media_attachments : List Attachment
|
|
|
|
, mentions : List Mention
|
|
|
|
, reblog : Maybe Reblog
|
|
|
|
, reblogged : Maybe Bool
|
|
|
|
, reblogs_count : Int
|
|
|
|
, sensitive : Maybe Bool
|
|
|
|
, spoiler_text : String
|
|
|
|
, tags : List Tag
|
|
|
|
, uri : String
|
2017-05-14 09:12:04 -04:00
|
|
|
, url : Maybe String
|
2017-04-27 10:34:27 -04:00
|
|
|
, visibility : String
|
2021-03-06 18:20:53 -05:00
|
|
|
, poll : Poll
|
2021-01-12 01:08:43 -05:00
|
|
|
, pinned : Bool -- Not a real value, used to show pinned indicator
|
2017-04-27 10:34:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias StatusRequestBody =
|
|
|
|
-- status: The text of the status
|
|
|
|
-- in_reply_to_id: local ID of the status you want to reply to
|
|
|
|
-- sensitive: set this to mark the media of the status as NSFW
|
|
|
|
-- spoiler_text: text to be shown as a warning before the actual content
|
|
|
|
-- visibility: either "direct", "private", "unlisted" or "public"
|
|
|
|
{ status : String
|
2017-11-29 08:06:08 -05:00
|
|
|
, in_reply_to_id : Maybe StatusId
|
2017-04-27 10:34:27 -04:00
|
|
|
, spoiler_text : Maybe String
|
|
|
|
, sensitive : Bool
|
|
|
|
, visibility : String
|
2017-11-29 08:06:08 -05:00
|
|
|
, media_ids : List String
|
2017-04-27 10:34:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Tag =
|
|
|
|
{ name : String
|
|
|
|
, url : String
|
|
|
|
}
|