[
    {
        "name": "Rails",
        "comment": "\n\n# Http\n@docs Error, get, post, send, fromJson, always, decoder",
        "unions": [
            {
                "name": "Error",
                "comment": "The kinds of errors a Rails server may return.",
                "args": [
                    "error"
                ],
                "cases": [
                    [
                        "HttpError",
                        [
                            "Error"
                        ]
                    ],
                    [
                        "RailsError",
                        [
                            "error"
                        ]
                    ]
                ]
            }
        ],
        "aliases": [],
        "values": [
            {
                "name": "always",
                "comment": "Returns a decoder suitable for passing to `fromJson`, which uses the same decoder for both success and failure responses.",
                "type": "Decoder value -> ResponseDecoder value value"
            },
            {
                "name": "decoder",
                "comment": "Returns a decoder suitable for passing to `fromJson`.",
                "type": "Decoder value -> Decoder error -> ResponseDecoder error value"
            },
            {
                "name": "fromJson",
                "comment": "Think `Http.fromJson`, but with additional effort to parse a non-20x response as JSON.\n\n  * If the status code is in the 200 range, try to parse with the given `decoder.success`.\n    * If parsing fails, return an `Http.UnexpectedPayload` wrapped in `HttpError`\n  * If the status code is outside the 200 range, try to parse with the given `decoder.success`.\n    * If parsing fails, return an `Http.BadResponse` wrapped in `HttpError`",
                "type": "ResponseDecoder error value -> Task RawError Response -> Task (Error error) value"
            },
            {
                "name": "get",
                "comment": "Send a GET request to the given URL. You also specify how to decode the response.\n\n    import Json.Decode (list, string)\n\n    hats : String -> Task (Error (List String)) (List String)\n    hats authToken =\n        get (decoder (list string) (succeed ())) \"http://example.com/hat-categories.json\"",
                "type": "String -> ResponseDecoder error value -> String -> Task (Error error) value"
            },
            {
                "name": "post",
                "comment": "Send a POST request to the given URL. You also specify how to decode the response.\n\n    import Json.Decode (list, string)\n    import Http\n\n    hats : String -> Task (Error (List String)) (List String)\n    hats authToken =\n        post (decoder (list string) (succeed ())) \"http://example.com/hat-categories.json\" Http.empty",
                "type": "String -> ResponseDecoder error value -> String -> Body -> Task (Error error) value"
            },
            {
                "name": "send",
                "comment": "Utility for working with Rails. Wraps Http.send, passing an Authenticity Token along with the type of request. Suitable for use with `fromJson`:\n\n    import Dict\n    import Json.Decode (list, string)\n    import Json.Encode as Encode\n    import Http\n\n    hats : String -> HatStyle -> Task (Error (List String)) (List String)\n    hats authToken style =\n\n        let\n            payload =\n                Encode.object\n                    [ ( \"style\", encodeHatStyle style ) ]\n\n            body =\n                Http.string (Encode.encode 0 payload)\n\n            success =\n                list string\n\n            failure =\n                Dict.fromList [ (\"style\", HatStyle) ]\n                    |> Rails.Decode.errors\n        in\n            send authToken \"POST\" url body\n                |> fromJson (decoder success failure)",
                "type": "String -> String -> String -> Body -> Task RawError Response"
            }
        ],
        "binops": []
    },
    {
        "name": "Rails.Decode",
        "comment": "\n\nTypes\n@docs ErrorList\n\n# Decoding\n@docs errors",
        "unions": [],
        "aliases": [
            {
                "name": "ErrorList",
                "comment": "ErrorList is a type alias for\na list of fields to String, where `field` is expected to be a type for matching\nerrors to\n```\n\ntype Field = Name | Password\n\ndecode : ErrorList Field\n\n```",
                "args": [
                    "field"
                ],
                "type": "List ( field, String )"
            }
        ],
        "values": [
            {
                "name": "errors",
                "comment": "Decodes errors passed from rails formatted as\n\n`{ errors: {errorName: [\"Error String\"] } }`.\n\nThis function takes a Dict that is a map of all the fields you need decoded. It should be formatted\nnest\n\nDict.fromList\n    [ ( \"school\", School )\n    , ( \"school.name\", SchoolName )\n    , ( \"school.address\", SchoolAddress )\n    , ( \"school.city\", City )\n    , ( \"school.state\", State )\n    , ( \"school.zip\", Zip )\n    , ( \"school.country\", Country )\n    ]",
                "type": "Dict String field -> Decoder (ErrorList field)"
            }
        ],
        "binops": []
    }
]