carpe / elm-data / ElmData.Resource

Resource allows you to make requests on behalf of a DAO, without having to think about the state of the DAO


type alias Resource recordType msg =
{ create : ElmData.Session.Session -> recordType -> Platform.Cmd.Cmd msg
, fetch : ElmData.Session.Session -> String -> Platform.Cmd.Cmd msg
, fetchAll : ElmData.Session.Session -> Platform.Cmd.Cmd msg
, query : ElmData.Session.Session -> List ElmData.QueryParam.QueryParam -> Platform.Cmd.Cmd msg
, update : ElmData.Session.Session -> recordType -> String -> Platform.Cmd.Cmd msg
, delete : msg -> ElmData.Session.Session -> String -> Platform.Cmd.Cmd msg 
}

A Resource that can be used to make requests that target a single record. (i.e. SHOW/CREATE/UPDATE)


type ResourceMsg recordType
    = Success recordType
    | Failure ElmData.Messages.RequestError

A message that contains the results of a request

resource : ElmData.DAO.DAO recordType -> (ResourceMsg recordType -> msg) -> Resource recordType msg

Convenience function for creating a Resource