canceraiddev/elm-aws-amplify/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 : Error AWSAppError -> Cmd Msg
, analyticsConfigureFailed : Error AWSAppError -> Cmd Msg
, recordFailed : Error AWSAppError -> Cmd Msg
, fetchNewCredentialsFailed : 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 AmplifyEvent
}

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.

recordWithHooks : Event -> EventHooks -> Cmd Msg

Record event with hooks.

Used for running a command when a record request has finished successfully or failed.

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

Event datatype

type alias EventHooks =
{ recorded : Cmd Msg
, recordFailed : Error AWSAppError -> Cmd Msg
}

EventHooks datatype