alexbruf/elm-clerk/1.0.0

NOTE: the latest version is 2.0.0

Clerk.User

The Clerk user resource, reduced to the fields listed in coverage.json.

Fields that ClerkJS exposes but this package does not decode are simply ignored, so a Clerk release that adds a field cannot break decoding.

type alias User =
{ id : String
, primaryEmailAddress : Maybe String
, firstName : Maybe String
, lastName : Maybe String
, imageUrl : String
, createdAt : Maybe Posix
}

A signed-in Clerk user.

primaryEmailAddress is the email address string itself (user.primaryEmailAddress?.emailAddress in ClerkJS), not the resource object.

decoder : Decoder User

Decode a User from the JSON the shim sends.

{ "id": "user_1"
, "primaryEmailAddress": "[email protected]"
, "firstName": "Ada"
, "lastName": "Lovelace"
, "imageUrl": "https://img.clerk.com/ada"
, "createdAt": 1700000000000
}

Every nullable field accepts null. createdAt arrives as epoch milliseconds.