{"id":13393413,"url":"https://github.com/lukewestby/elm-http-builder","last_synced_at":"2025-04-07T18:13:24.559Z","repository":{"id":55883671,"uuid":"57707211","full_name":"lukewestby/elm-http-builder","owner":"lukewestby","description":"elm-http-builder","archived":false,"fork":false,"pushed_at":"2020-12-09T16:54:47.000Z","size":175,"stargazers_count":162,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T15:19:54.289Z","etag":null,"topics":["elm","http"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/lukewestby/elm-http-builder/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukewestby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-01T17:55:35.000Z","updated_at":"2023-09-07T13:49:55.000Z","dependencies_parsed_at":"2022-08-15T08:31:39.170Z","dependency_job_id":null,"html_url":"https://github.com/lukewestby/elm-http-builder","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewestby%2Felm-http-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewestby%2Felm-http-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewestby%2Felm-http-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewestby%2Felm-http-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukewestby","download_url":"https://codeload.github.com/lukewestby/elm-http-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704571,"owners_count":20982298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","http"],"created_at":"2024-07-30T17:00:52.191Z","updated_at":"2025-04-07T18:13:24.541Z","avatar_url":"https://github.com/lukewestby.png","language":"Elm","funding_links":[],"categories":["Elm","Libraries"],"sub_categories":[],"readme":"# elm-http-builder\n\nPipeable functions for building HTTP requests\n\n```elm\nimport Http\nimport HttpBuilder\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Url.Builder as UrlBuilder\n\n\ntype Status a = Loading | Loaded a | Failure\n\n\ntype alias Model = { items : Status (List String) }\n\n\nitemsDecoder : Decode.Decoder (List String)\nitemsDecoder =\n    Decode.list Decode.string\n\n\nitemEncoder : String -\u003e Encode.Value\nitemEncoder item =\n    Encode.object\n        [ (\"item\", Encode.string item) ]\n\n\n{-| addItem will send a post request to\n`\"http://example.com/api/items?hello=world\"` with the given JSON body and a\ncustom header. It'll try to decode with `itemsDecoder`.\n\n-}\naddItem : String -\u003e Cmd Msg\naddItem item =\n    UrlBuilder.crossOrigin\n        \"http://example.com\"\n        [ \"api\", \"items\" ]\n        [ UrlBuilder.string \"hello\" \"world\" ]\n        |\u003e HttpBuilder.post\n        |\u003e HttpBuilder.withHeader \"X-My-Header\" \"Some Header Value\"\n        |\u003e HttpBuilder.withJsonBody (itemEncoder item)\n        |\u003e HttpBuilder.withTimeout 10000\n        |\u003e HttpBuilder.withExpect (Http.expectJson GotItem itemsDecoder)\n        |\u003e HttpBuilder.request\n\n\ntype Msg = GotItem (Result Http.Error (List String))\n\n\nupdate : Msg -\u003e Model -\u003e ( Model, Cmd Msg )\nupdate msg model =\n    case msg of\n        GotItem (Ok items) -\u003e\n          ( { model | items = Loaded items }\n          , Cmd.none\n          )\n\n        GotItem (Err err) -\u003e\n          ( { model | items = Failure } , Cmd.none)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewestby%2Felm-http-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukewestby%2Felm-http-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewestby%2Felm-http-builder/lists"}