Load even more data from accounts
This commit is contained in:
parent
5da1d8882c
commit
628ac848d3
@ -7,6 +7,8 @@ module Mastodon.Decoder
|
|||||||
, contextDecoder
|
, contextDecoder
|
||||||
, decodeWebSocketMessage
|
, decodeWebSocketMessage
|
||||||
, decodeClients
|
, decodeClients
|
||||||
|
, emojiDecoder
|
||||||
|
, fieldDecoder
|
||||||
, mastodonErrorDecoder
|
, mastodonErrorDecoder
|
||||||
, mentionDecoder
|
, mentionDecoder
|
||||||
, notificationDecoder
|
, notificationDecoder
|
||||||
@ -41,25 +43,51 @@ accessTokenDecoder registration =
|
|||||||
|> Pipe.hardcoded registration.server
|
|> Pipe.hardcoded registration.server
|
||||||
|> Pipe.required "access_token" Decode.string
|
|> Pipe.required "access_token" Decode.string
|
||||||
|
|
||||||
|
|
||||||
|
emojiDecoder : Decode.Decoder Emoji
|
||||||
|
emojiDecoder =
|
||||||
|
Pipe.decode Emoji
|
||||||
|
|> Pipe.required "shortcode" Decode.string
|
||||||
|
|> Pipe.required "url" Decode.string
|
||||||
|
|> Pipe.required "static_url" Decode.string
|
||||||
|
|> Pipe.required "visible_in_picker" Decode.bool
|
||||||
|
|
||||||
|
|
||||||
|
fieldDecoder : Decode.Decoder Field
|
||||||
|
fieldDecoder =
|
||||||
|
Pipe.decode Field
|
||||||
|
|> Pipe.optional "name" Decode.string ""
|
||||||
|
|> Pipe.optional "value" Decode.string ""
|
||||||
|
|> Pipe.optional "verified_at" Decode.string ""
|
||||||
|
|
||||||
|
|
||||||
sourceDecoder : Decode.Decoder Source
|
sourceDecoder : Decode.Decoder Source
|
||||||
sourceDecoder =
|
sourceDecoder =
|
||||||
Pipe.decode Source
|
Pipe.decode Source
|
||||||
|> Pipe.optional "privacy" Decode.string "public"
|
|> Pipe.optional "privacy" Decode.string "public"
|
||||||
|> Pipe.optional "sensitive" Decode.bool False
|
|> Pipe.optional "sensitive" Decode.bool False
|
||||||
|> Pipe.optional "language" Decode.string ""
|
|> Pipe.optional "language" Decode.string ""
|
||||||
|
|> Pipe.optional "note" Decode.string ""
|
||||||
|
|> Pipe.optional "fields" (Decode.list fieldDecoder) []
|
||||||
|
|> Pipe.optional "follow_requests_count" Decode.int 0
|
||||||
|
|
||||||
|
|
||||||
accountDecoder : Decode.Decoder Account
|
accountDecoder : Decode.Decoder Account
|
||||||
accountDecoder =
|
accountDecoder =
|
||||||
Pipe.decode Account
|
Pipe.decode Account
|
||||||
|> Pipe.required "acct" Decode.string
|
|> Pipe.required "acct" Decode.string
|
||||||
|> Pipe.required "avatar" Decode.string
|
|> Pipe.required "avatar" Decode.string
|
||||||
|
|> Pipe.required "avatar_static" Decode.string
|
||||||
|> Pipe.required "created_at" Decode.string
|
|> Pipe.required "created_at" Decode.string
|
||||||
|
|> Pipe.required "last_status_at" Decode.string
|
||||||
|> Pipe.required "display_name" Decode.string
|
|> Pipe.required "display_name" Decode.string
|
||||||
|> Pipe.required "followers_count" Decode.int
|
|> Pipe.required "followers_count" Decode.int
|
||||||
|> Pipe.required "following_count" Decode.int
|
|> Pipe.required "following_count" Decode.int
|
||||||
|> Pipe.required "header" Decode.string
|
|> Pipe.required "header" Decode.string
|
||||||
|
|> Pipe.required "header_static" Decode.string
|
||||||
|> Pipe.required "id" idDecoder
|
|> Pipe.required "id" idDecoder
|
||||||
|> Pipe.required "locked" Decode.bool
|
|> Pipe.required "locked" Decode.bool
|
||||||
|
|> Pipe.required "bot" Decode.bool
|
||||||
|> Pipe.required "note" Decode.string
|
|> Pipe.required "note" Decode.string
|
||||||
|> Pipe.required "statuses_count" Decode.int
|
|> Pipe.required "statuses_count" Decode.int
|
||||||
|> Pipe.required "url" Decode.string
|
|> Pipe.required "url" Decode.string
|
||||||
@ -68,7 +96,12 @@ accountDecoder =
|
|||||||
{ privacy = "public"
|
{ privacy = "public"
|
||||||
, sensitive = False
|
, sensitive = False
|
||||||
, language = ""
|
, language = ""
|
||||||
|
, note = ""
|
||||||
|
, fields = []
|
||||||
|
, follow_requests_count = 0
|
||||||
}
|
}
|
||||||
|
|> Pipe.optional "emojis" (Decode.list emojiDecoder) []
|
||||||
|
|> Pipe.optional "fields" (Decode.list fieldDecoder) []
|
||||||
|
|
||||||
|
|
||||||
applicationDecoder : Decode.Decoder Application
|
applicationDecoder : Decode.Decoder Application
|
||||||
|
@ -8,7 +8,9 @@ module Mastodon.Model
|
|||||||
, Attachment
|
, Attachment
|
||||||
, Client
|
, Client
|
||||||
, Context
|
, Context
|
||||||
|
, Emoji
|
||||||
, Error(..)
|
, Error(..)
|
||||||
|
, Field
|
||||||
, Mention
|
, Mention
|
||||||
, Notification
|
, Notification
|
||||||
, NotificationAggregate
|
, NotificationAggregate
|
||||||
@ -82,21 +84,42 @@ type alias AppRegistration =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias Emoji =
|
||||||
|
{ shortcode : String
|
||||||
|
, url : String
|
||||||
|
, static_url : String
|
||||||
|
, visible_in_picker : Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias Field =
|
||||||
|
{ name : String
|
||||||
|
, value : String
|
||||||
|
, verified_at : String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
type alias Account =
|
type alias Account =
|
||||||
{ acct : String
|
{ acct : String
|
||||||
, avatar : String
|
, avatar : String
|
||||||
|
, avatar_static : String
|
||||||
, created_at : String
|
, created_at : String
|
||||||
|
, last_status_at : String
|
||||||
, display_name : String
|
, display_name : String
|
||||||
, followers_count : Int
|
, followers_count : Int
|
||||||
, following_count : Int
|
, following_count : Int
|
||||||
, header : String
|
, header : String
|
||||||
|
, header_static : String
|
||||||
, id : AccountId
|
, id : AccountId
|
||||||
, locked : Bool
|
, locked : Bool
|
||||||
|
, bot : Bool
|
||||||
, note : String
|
, note : String
|
||||||
, statuses_count : Int
|
, statuses_count : Int
|
||||||
, url : String
|
, url : String
|
||||||
, username : String
|
, username : String
|
||||||
, source : Source
|
, source : Source
|
||||||
|
, emojis : List Emoji
|
||||||
|
, fields : List Field
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,6 +217,9 @@ type alias Source =
|
|||||||
{ privacy : String
|
{ privacy : String
|
||||||
, sensitive : Bool
|
, sensitive : Bool
|
||||||
, language : String
|
, language : String
|
||||||
|
, note : String
|
||||||
|
, fields : List Field
|
||||||
|
, follow_requests_count : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user