altjsus/elmtable/1.0.0

Renamed to shegeley/elmtable. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as altjsus/elmtable still install under that name. 1 version of 1 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/shegeley/elmtable.

What we checked: The repo moved to github.com/shegeley/elmtable. Rebuilt with git archive from commit b155d8fb7feb of https://github.com/shegeley/elmtable (zip prefix altjsus-elmtable-516dbdf/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 b47ca1cae5d98b8963cc486bef822f269cd16285.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/altjsus/elmtable/zipball/1.0.0/

Nonofficial Airtable API module for ELM

Nonofficial and raw Airtable API module. Just an Http wrapper for the calls. My first elm package and opensource repo.

Following example is not guaranteed to work copypasted. It's just an abstraction of how could the module work.

import Airtable exposing (..)
import Json.Decode exposing (..)

myDB = Airtable.DB "myKey" "myDB" "myTable"

type Msg a = Request | Data (Result Http.Error (List a))

view : Model -> Html Msg
view model = Grid.container [] [ CDN.stylesheet , Grid.row [] [ Grid.col [] [ viewTestMessage model.name ] ] ]

init : () -> (Model, Cmd Msg)
init _ = ({ data = Ok []}, Task.perform identity <| Task.succeed Request)

{- | Where `a` is your type
-}
yourJsonDecoder : Decoder a
yourJsonDecoder =
    Json.Decode.map2 a
        (field "id" string)
        (at ["fields", "Name"] string)

{-| NB: field "records" should be always put because of airtable response format [https://airtable.com/api]
-}

getRecs = getRecords testDB "Grid view" 100 100 0 <| Http.expectJson Data <| field "records" <| Json.Decode.list yourJsonDecoder

update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
  case msg of
    Request ->
      (model, getRecs)
    Data r -> 
      case r of 
        Ok data -> ({ model | data = Ok data}, Cmd.none)
        Err e -> (model, Cmd.none)