diff --git a/src/Mastodon/Decoder.elm b/src/Mastodon/Decoder.elm index 29515fe..da6de58 100644 --- a/src/Mastodon/Decoder.elm +++ b/src/Mastodon/Decoder.elm @@ -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 diff --git a/src/Mastodon/Model.elm b/src/Mastodon/Model.elm index 0ab50a1..ddc1aae 100644 --- a/src/Mastodon/Model.elm +++ b/src/Mastodon/Model.elm @@ -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