[{"name":"Http.Legacy","comment":" Create and send HTTP requests.\n\nThis is a shim version of the `elm/http` 1.0.0 API, including its\ndocumentation. Copyright (c) 2016-present, Evan Czaplicki.\n\nThe purpose of this module is to allow a smooth upgrade to version 2.x of\nelm/http without requiring a large amount of changes across the codebase.\n\n[url]: /packages/elm/url/latest\n\n\n# Send Requests\n\n@docs Request, send, Error\n\n\n# GET\n\n@docs getString, get\n\n\n# POST\n\n@docs post\n\n\n# Custom Requests\n\n@docs request\n\n\n## Headers\n\n@docs Header, header\n\n\n## Request Bodies\n\n@docs Body, emptyBody, jsonBody, stringBody, multipartBody, Part, stringPart\n\n\n## Responses\n\n@docs Expect, expectString, expectJson, expectStringResponse, Response\n\n\n# Low-Level\n\n@docs toTask\n\n\n# Helpers for use during the elm/http 2.0.0 upgrade\n\n@docs toHttp2Error\n\n","unions":[{"name":"Error","comment":" A `Request` can fail in a couple ways:\n\n  - `BadUrl` means you did not provide a valid URL.\n  - `Timeout` means it took too long to get a response.\n  - `NetworkError` means the user turned off their wifi, went in a cave, etc.\n  - `BadStatus` means you got a response back, but the [status code][sc]\n    indicates failure.\n  - `BadPayload` means you got a response back with a nice status code, but\n    the body of the response was something unexpected. The `String` in this\n    case is a debugging message that explains what went wrong with your JSON\n    decoder or whatever.\n\n[sc]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\n\n","args":[],"cases":[["BadUrl",["String.String"]],["Timeout",[]],["NetworkError",[]],["BadStatus",["Http.Legacy.Response String.String"]],["BadPayload",["String.String","Http.Legacy.Response String.String"]]]}],"aliases":[{"name":"Body","comment":" Represents the body of a `Request`.\n","args":[],"type":"Http.Body"},{"name":"Expect","comment":" Logic for interpreting a response body.\n","args":["a"],"type":"{ expect : Http.Expect (Result.Result Http.Legacy.Error (Http.Legacy.Response String.String)), decode : Http.Legacy.Response String.String -> Result.Result Http.Legacy.Error a }"},{"name":"Header","comment":" An HTTP header for configuring requests. See a bunch of common headers\n[here].\n\n[here]: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields\n\n","args":[],"type":"Http.Header"},{"name":"Part","comment":" Contents of a multi-part body. Right now it only supports strings, but we\nwill support blobs and files when we get an API for them in Elm.\n","args":[],"type":"Http.Part"},{"name":"Request","comment":" Describes an HTTP request.\n","args":["a"],"type":"{ method : String.String, headers : List.List Http.Header, url : String.String, body : Http.Body, expect : Http.Legacy.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool }"},{"name":"Response","comment":" The response from a `Request`.\n","args":["body"],"type":"{ url : String.String, status : { code : Basics.Int, message : String.String }, headers : Dict.Dict String.String String.String, body : body }"}],"values":[{"name":"emptyBody","comment":" Create an empty body for your `Request`. This is useful for GET requests\nand POST requests where you are not sending any data.\n","type":"Http.Legacy.Body"},{"name":"expectJson","comment":" Expect the response body to be JSON. You provide a `Decoder` to turn that\nJSON into an Elm value. If the body cannot be parsed as JSON or if the JSON\ndoes not match the decoder, the request will resolve to a `BadPayload` error.\n","type":"Json.Decode.Decoder a -> Http.Legacy.Expect a"},{"name":"expectString","comment":" Expect the response body to be a `String`.\n","type":"Http.Legacy.Expect String.String"},{"name":"expectStringResponse","comment":" Maybe you want the whole `Response`: status code, headers, body, etc. This\nlets you get all of that information. From there you can use functions like\n`Json.Decode.decodeString` to interpret it as JSON or whatever else you want.\n","type":"(Http.Legacy.Response String.String -> Result.Result String.String a) -> Http.Legacy.Expect a"},{"name":"get","comment":" Create a `GET` request and try to decode the response body from JSON to\nsome Elm value.\n\n    import Http\n    import Json.Decode exposing (list, string)\n\n    getBooks : Http.Request (List String)\n    getBooks =\n        Http.get \"https://example.com/books\" (list string)\n\nYou can learn more about how JSON decoders work [here] in the guide.\n\n[here]: https://guide.elm-lang.org/interop/json.html\n\n**Note:** Use [`elm/url`][url] to build URLs.\n\n[url]: /packages/elm/url/latest\n\n","type":"String.String -> Json.Decode.Decoder a -> Http.Legacy.Request a"},{"name":"getString","comment":" Create a `GET` request and interpret the response body as a `String`.\n\n    import Http.Legacy as Http\n\n    getWarAndPeace : Http.Request String\n    getWarAndPeace =\n        Http.getString \"<https://example.com/books/war-and-peace\">\n\n**Note:** Use [`elm/url`][url] to build URLs.\n[url]: /packages/elm/url/latest\n\n","type":"String.String -> Http.Legacy.Request String.String"},{"name":"header","comment":" Create a `Header`.\n\n    header \"If-Modified-Since\" \"Sat 29 Oct 1994 19:43:31 GMT\"\n\n    header \"Max-Forwards\" \"10\"\n\n    header \"X-Requested-With\" \"XMLHttpRequest\"\n\n**Note:** In the future, we may split this out into an `Http.Headers` module\nand provide helpers for cases that are common on the client-side. If this\nsounds nice to you, open an issue [here] describing the helper you want and\nwhy you need it.\n\n[here]: https://github.com/elm/http/issues\n\n","type":"String.String -> String.String -> Http.Legacy.Header"},{"name":"jsonBody","comment":" Put some JSON value in the body of your `Request`. This will automatically\nadd the `Content-Type: application/json` header.\n","type":"Json.Encode.Value -> Http.Legacy.Body"},{"name":"multipartBody","comment":" Create multi-part bodies for your `Request`, automatically adding the\n`Content-Type: multipart/form-data` header.\n","type":"List.List Http.Legacy.Part -> Http.Legacy.Body"},{"name":"post","comment":" Create a `POST` request and try to decode the response body from JSON to\nan Elm value. For example, if we want to send a POST without any data in the\nrequest body, it would be like this:\n\n    import Http\n    import Json.Decode exposing (list, string)\n\n    postBooks : Http.Request (List String)\n    postBooks =\n        Http.post \"https://example.com/books\" Http.emptyBody (list string)\n\nSee [`jsonBody`](#jsonBody) to learn how to have a more interesting request\nbody. And check out [this section][here] of the guide to learn more about\nJSON decoders.\n\n[here]: https://guide.elm-lang.org/interop/json.html\n\n","type":"String.String -> Http.Legacy.Body -> Json.Decode.Decoder a -> Http.Legacy.Request a"},{"name":"request","comment":" Create a custom request. For example, a custom PUT request would look like\nthis:\n\n    put : String -> Body -> Request ()\n    put url body =\n        request\n            { method = \"PUT\"\n            , headers = []\n            , url = url\n            , body = body\n            , expect = expectStringResponse (\\_ -> Ok ())\n            , timeout = Nothing\n            , withCredentials = False\n            }\n\nThe `timeout` is the number of milliseconds you are willing to wait before\ngiving up.\n\n","type":"{ method : String.String, headers : List.List Http.Legacy.Header, url : String.String, body : Http.Legacy.Body, expect : Http.Legacy.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool } -> Http.Legacy.Request a"},{"name":"send","comment":" Send a `Request`. We could get the text of “War and Peace” like this:\n\n    import Http\n\n    type Msg = Click | NewBook (Result Http.Error String)\n\n    update : Msg -> Model -> ( Model, Cmd Msg )\n    update msg model =\n      case msg of\n        Click ->\n          ( model, getWarAndPeace )\n\n        NewBook (Ok book) ->\n          ...\n\n        NewBook (Err _) ->\n          ...\n\n    getWarAndPeace : Cmd Msg\n    getWarAndPeace =\n      Http.send NewBook <|\n        Http.getString \"https://example.com/books/war-and-peace.md\"\n\n","type":"(Result.Result Http.Legacy.Error a -> msg) -> Http.Legacy.Request a -> Platform.Cmd.Cmd msg"},{"name":"stringBody","comment":" Put some string in the body of your `Request`. Defining `jsonBody` looks\nlike this:\n\n    import Json.Encode as Encode\n\n    jsonBody : Encode.Value -> Body\n    jsonBody value =\n        stringBody \"application/json\" (Encode.encode 0 value)\n\nNotice that the first argument is a [MIME type][mime] so we know to add\n`Content-Type: application/json` to our request headers. Make sure your\nMIME type matches your data. Some servers are strict about this!\n\n[mime]: https://en.wikipedia.org/wiki/Media_type\n\n","type":"String.String -> String.String -> Http.Legacy.Body"},{"name":"stringPart","comment":" A named chunk of string data.\n\n    body =\n        multipartBody\n            [ stringPart \"user\" \"tom\"\n            , stringPart \"payload\" \"42\"\n            ]\n\n","type":"String.String -> String.String -> Http.Legacy.Part"},{"name":"toHttp2Error","comment":" Convert an error from this module to the original `Http` module type.\nThis function leaks the current implementation using the elm/http 1.0.0 API, so\nevery place outside of this module we need to use this indicates a spot that\nwill require a bit of massaging when we upgrade to version 2.0.0.\n","type":"Http.Legacy.Error -> Http.Error"},{"name":"toTask","comment":" Convert a `Request` into a `Task`. This is only really useful if you want\nto chain together a bunch of requests (or any other tasks) in a single command.\n","type":"Http.Legacy.Request a -> Task.Task Http.Legacy.Error a"}],"binops":[]}]