1
0
Fork 0

Get "source" information from Mastodon

We will need this to get the correct draft defaults later.
This commit is contained in:
Ryan Fox 2021-01-10 21:25:03 +00:00
parent 5043e89837
commit ea39adf374
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 20 additions and 0 deletions

View File

@ -41,6 +41,12 @@ accessTokenDecoder registration =
|> Pipe.hardcoded registration.server
|> Pipe.required "access_token" Decode.string
sourceDecoder : Decode.Decoder Source
sourceDecoder =
Pipe.decode Source
|> Pipe.optional "privacy" Decode.string "public"
|> Pipe.optional "sensitive" Decode.bool False
|> Pipe.optional "language" Decode.string ""
accountDecoder : Decode.Decoder Account
accountDecoder =
@ -58,6 +64,11 @@ accountDecoder =
|> Pipe.required "statuses_count" Decode.int
|> Pipe.required "url" Decode.string
|> Pipe.required "username" Decode.string
|> Pipe.optional "source" sourceDecoder
{ privacy = "public"
, sensitive = False
, language = ""
}
applicationDecoder : Decode.Decoder Application

View File

@ -16,6 +16,7 @@ module Mastodon.Model
, Relationship
, Tag
, SearchResults
, Source
, Status
, StatusId(..)
, StatusRequestBody
@ -95,6 +96,7 @@ type alias Account =
, statuses_count : Int
, url : String
, username : String
, source : Source
}
@ -188,6 +190,13 @@ type alias SearchResults =
}
type alias Source =
{ privacy : String
, sensitive : Bool
, language : String
}
type alias Status =
{ account : Account
, application : Maybe Application