canceraiddev/elm-aws-amplify/3.0.0

NOTE: the latest version is 4.0.0

AWS.Amplify

Amplify component that handles refresh of expired cognito credentials.

Setup

type alias Config =
{ pinpointProjectId : String
, awsRegion : String
, clientInfo : ClientInfo
, cmds :
{ authConfigureFailed : Maybe (Error AWSAppError -> Cmd Msg)
, analyticsConfigureFailed : Maybe (Error AWSAppError -> Cmd Msg)
, recordFailed : Maybe (Error AWSAppError -> Cmd Msg)
, fetchNewCredentialsFailed : Maybe (Error AWSAppError -> Cmd Msg)
}
}

Static configuration settings

type alias Model =
{ seed : Seed
, sessionId : String
, sessionStartTime : Posix
, authIdentity : RemoteData (Error AWSAppError) Identity
, analytics : RemoteData (Error AWSAppError) ()
, queue : Dict String Event
}

Model datatype

{ awsRegion : String
, identityPoolId : String
, time : Posix
, seed : Seed
}
-> ( Model, Cmd Msg )

Initialise Model and fetch identity and credentials

Update

update : Config -> Msg -> Model -> ( Model, Cmd Msg )

Update

type Msg

Opaque Msg datatype

Record Events

record : Event -> Cmd Msg

Record event.

Events are stored in a queue if the identity, credentials, or analytics are loading.

type alias Event =
{ name : String
, attributes : Dict String String
}

Event datatype