1module Sources.Refresh.AccessToken exposing (..)
2
3import Json.Decode exposing (Decoder)
4import Sources exposing (Service)
5import Sources.Encoding exposing (serviceDecoder)
6
7
8
9-- 🌳
10
11
12type alias PortArguments =
13 { service : Service
14 , sourceId : String
15 , accessToken : String
16
17 -- Unix timestamp in milliseconds
18 , expiresAt : Int
19 }
20
21
22
23-- 🛠
24
25
26portArgumentsDecoder : Decoder PortArguments
27portArgumentsDecoder =
28 Json.Decode.map4
29 (\service sourceId accessToken expiresAt ->
30 { service = service
31 , sourceId = sourceId
32 , accessToken = accessToken
33 , expiresAt = expiresAt
34 }
35 )
36 (Json.Decode.field "service" serviceDecoder)
37 (Json.Decode.field "sourceId" Json.Decode.string)
38 (Json.Decode.field "accessToken" Json.Decode.string)
39 (Json.Decode.field "expiresAt" Json.Decode.int)