This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
Tag 8.0.0
Committed At 2019-11-05 16:04:33 UTC



    elm-kinto client

    Build Status

    Kinto client for elm.

    Need help? Join the #kinto channel on the freenode irc server, or in the kinto-storage Slack!

    Thanks to @luke_dot_js and his elm-http-builder package which this library uses, and which was a huge inspiration for the design (and even for the README ;)


    You can find some full examples in src/examples.

    import Kinto
    -- Define what our Kinto records will look like for a Todo list.
    type alias Todo =
        { id : String
        , title : Maybe String
        , description : Maybe String
        , last_modified : Int
    -- And how to decode from a Kinto record to a Todo...
    decodeTodo : Decode.Decoder Todo
    decodeTodo =
        Decode.map4 Todo
            (Decode.field "id" Decode.string)
            (Decode.maybe (Decode.field "title" Decode.string))
            (Decode.maybe (Decode.field "description" Decode.string))
            (Decode.field "last_modified"
    -- And how to encode Todo data to send to Kinto.
    encodeData : Maybe String -> Maybe String -> Encode.Value
    encodeData title description =
            [ ( "title", Encode.string (Maybe.withDefault "" title) )
            , ( "description", Encode.string (Maybe.withDefault "" description) )
    -- Configure a Kinto client: the server url and authentication
    client : Kinto.Client
    client =
            (Kinto.Basic "test" "test")
    -- Set up the resource we're interested in: in this case, Kinto records, stored
    -- in the "test-items" collection, in the "default" bucket.
    -- We give it the `decodeTodo` decoder so the data we get back from the Kinto
    -- server will be properly decoded into our `Todo` record.
    recordResource : Kinto.Resource Todo
    recordResource =
        Kinto.recordResource "default" "test-items" decodeTodo
    type Msg
        = TodoAdded (Result Kinto.Error Todo)
        | TodosFetched (Result Kinto.Error (Kinto.Pager Todo))
    update : Msg -> Model -> ( Model, Cmd Msg )
    update msg model =
        case msg of
            TodoAdded (Ok todo) ->
                ( { model | todos = todo :: model.todos }, Cmd.none )
            TodoAdded (Err err) ->
                    _ =
                        Debug.log "Error while creating the todo" err
                    ( model, Cmd.none )
            TodosFetched (Ok todoPager) ->
                ( { model | todos = todoPager.objects }, Cmd.none )
            TodosFetched (Err err) ->
                    _ =
                        Debug.log "Error while getting the list of todos" err
                    ( model, Cmd.none )
    -- Add a new Todo
    addTodo : Maybe String -> Maybe String -> Cmd Msg
    addTodo title description =
            data =
                encodeData title description
                |> Kinto.create recordResource data TodoAdded
                |> Kinto.send
    -- Get all the Todos
    getTodoList : Cmd Msg
    getTodoList =
            |> Kinto.getList recordResource TodosFetched
            |> Kinto.sort [ "title", "description" ]
            |> Kinto.send


    We're happy to receive any feedback and ideas for about additional features. Any input and pull requests are very welcome and encouraged. If you'd like to help or have ideas, get in touch with us on irc, slack, email, github or any other mean listed on the kinto webpage!