[{"name":"Engage.Http","comment":" Helpers for working with DNN Web API\n\n\n# Types\n\n@docs Config, Error\n\n\n# HTTP Verbs\n\n@docs get, post, patch, put, delete\n\n\n# Raw requests\n\n@docs requestJson, requestString, requestAnything, requestBytes\n\n\n# Helper functions\n\n@docs getErrorMessage, urlWithQueryString\n\n\n# Decoders\n\n@docs configDecoder, serverErrorDecoder, multipleServerErrorDecoder, nullDecoder\n\n","unions":[{"name":"Error","comment":" When a request fails, the `Failure` value will be one of these. Most of these are copied from `Http.Error` in the `elm/http` module.\n\nWhen there is a `BadStatus`, both the status code and the body of the response are included. This allows `getErrorMessage` to retrieve any error message in the response, if they are available.\n\n","args":[],"cases":[["BadUrl",["String.String"]],["Timeout",[]],["NetworkError",[]],["BadStatus",["Basics.Int","String.String"]],["BadBody",["String.String"]]]}],"aliases":[{"name":"Config","comment":" Configuration type\n\n  - `baseUrl` the base URL for the HTTP requests\n  - `headers`: list of the headers for the HTTP requests\n\n","args":[],"type":"{ baseUrl : String.String, headers : List.List Http.Header }"}],"values":[{"name":"configDecoder","comment":" Json decoder for `Config`\n\n    import Http\n    import Json.Decode as Decode\n\n    \"\"\"\n    {\n        \"baseUrl\": \"/API/MyModule/Search\",\n        \"headers\": {\n            \"ModuleId\": \"100\",\n            \"TabId\": \"404\"\n        }\n    }\n    \"\"\"\n        |> Decode.decodeString Engage.Http.configDecoder\n    --> Ok { baseUrl = \"/API/MyModule/Search\", headers = [ Http.header \"ModuleId\" \"100\", Http.header \"TabId\" \"404\" ] }\n\n","type":"Json.Decode.Decoder Engage.Http.Config"},{"name":"delete","comment":" HTTP DELETE\n","type":"Engage.Http.Config -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> { methodName : String.String, value : Json.Encode.Value } -> Platform.Cmd.Cmd msg"},{"name":"get","comment":" HTTP GET\n","type":"Engage.Http.Config -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> { methodName : String.String, queryStringParams : List.List ( String.String, String.String ) } -> Platform.Cmd.Cmd msg"},{"name":"getErrorMessage","comment":" Get the localized error message from the `Error`\n\n    import Dict\n    import Engage.Localization as Localization exposing (Localization)\n\n    type alias Model =\n        { localization : Localization }\n\n    model : Model\n    model =\n        Model Localization.empty\n\n    decodeError : Engage.Http.Error\n    decodeError =\n        Engage.Http.BadBody \"Problem with the given value: null Expecting an INT\"\n\n    Engage.Http.getErrorMessage model decodeError\n    --> \"Problem with the given value: null Expecting an INT\"\n\n    errorFromServer : Engage.Http.Error\n    errorFromServer =\n        Engage.Http.BadStatus 404 \"\"\" { \"Message\": \"The requested item wasn't found\" } \"\"\"\n\n    Engage.Http.getErrorMessage model errorFromServer\n    --> \"The requested item wasn't found\"\n\n    localizedModel : Model\n    localizedModel =\n        Dict.fromList\n            [ ( \"NetworkError.Text\", \"The network had an issue\" )\n            , ( \"Server.Error\", \"The server had an issue\" )\n            ]\n            |> Localization.fromDict\n            |> Model\n\n    statusError : Engage.Http.Error\n    statusError =\n        Engage.Http.BadStatus 404 \"\"\" 404 Error response \"\"\"\n\n    Engage.Http.getErrorMessage localizedModel statusError\n    --> \"The server had an issue\"\n\n    Engage.Http.getErrorMessage localizedModel Engage.Http.NetworkError\n    --> \"The network had an issue\"\n\n","type":"{ a | localization : Engage.Localization.Localization } -> Engage.Http.Error -> String.String"},{"name":"multipleServerErrorDecoder","comment":" JSON decoder for multiple server error messages, localized.\n\nThe messages come from a string array field named \"ExceptionMessage\", \"exceptionMessage\", \"Messages\", or \"message\".\nThese values are then concatenated with spaces.\n\n","type":"{ a | localization : Engage.Localization.Localization } -> Json.Decode.Decoder String.String"},{"name":"nullDecoder","comment":" Null decoder. Useful for when the server doesn't return any value.\n","type":"Json.Decode.Decoder ()"},{"name":"patch","comment":" HTTP PATCH\n","type":"Engage.Http.Config -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> { methodName : String.String, value : Json.Encode.Value } -> Platform.Cmd.Cmd msg"},{"name":"post","comment":" HTTP POST\n","type":"Engage.Http.Config -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> { methodName : String.String, value : Json.Encode.Value } -> Platform.Cmd.Cmd msg"},{"name":"put","comment":" HTTP PUT\n","type":"Engage.Http.Config -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> { methodName : String.String, value : Json.Encode.Value } -> Platform.Cmd.Cmd msg"},{"name":"requestAnything","comment":" Raw request that does not expect a response.\n\nThis version can use any method and accepts any body (e.g. `Http.fileBody`, `Http.bytesBody`, or `Http.emptyBody`).\n\n","type":"String.String -> List.List Http.Header -> String.String -> Http.Body -> (RemoteData.RemoteData Engage.Http.Error () -> msg) -> Platform.Cmd.Cmd msg"},{"name":"requestBytes","comment":" Raw request that expects a Bytes response.\n\nThis version can use any method and accepts any body (e.g. `Http.fileBody`, `Http.bytesBody`, or `Http.emptyBody`).\n\n","type":"String.String -> List.List Http.Header -> String.String -> Http.Body -> (RemoteData.RemoteData Engage.Http.Error Bytes.Bytes -> msg) -> Platform.Cmd.Cmd msg"},{"name":"requestJson","comment":" Raw request that expects a JSON response.\n\nThis version can use any method and accepts any body (e.g. `Http.fileBody`, `Http.bytesBody`, or `Http.emptyBody`).\n\n","type":"String.String -> List.List Http.Header -> String.String -> Http.Body -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> Json.Decode.Decoder success -> Platform.Cmd.Cmd msg"},{"name":"requestString","comment":" Raw request that expects a `String` response (but not necessarily a valid JSON `String`).\n\nThis version can use any method and accepts any body (e.g. `Http.fileBody`, `Http.bytesBody`, or `Http.emptyBody`).\nAdditionally, instead of providing a `Json.Decode.Decoder` to handle the response, you provide a function which can\ntransform the `String` response body (and response metadata) however you need.\n\n","type":"String.String -> List.List Http.Header -> String.String -> Http.Body -> (RemoteData.RemoteData Engage.Http.Error success -> msg) -> (Http.Metadata -> String.String -> Result.Result Engage.Http.Error success) -> Platform.Cmd.Cmd msg"},{"name":"serverErrorDecoder","comment":" JSON decoder for server error, localized.\n\nThe error comes from a string field named \"ExceptionMessage\", \"exceptionMessage\", \"Message\", \"message\", or otherwise `multipleServerErrorDecoder`.\n\n","type":"{ a | localization : Engage.Localization.Localization } -> Json.Decode.Decoder String.String"},{"name":"urlWithQueryString","comment":" Get the full URL from a base URL, a method name (i.e. a route), and query string values.\n\nThe function adds a trailing slash to the base URL if missing. Query string values are URL encoded.\n\n    config : Engage.Http.Config\n    config =\n        { baseUrl = \"https://example.com/API/MyModule\"\n        , headers = []\n        }\n\n    Engage.Http.urlWithQueryString config.baseUrl \"\" []\n    --> \"https://example.com/API/MyModule/\"\n\n    Engage.Http.urlWithQueryString config.baseUrl \"health\" []\n    --> \"https://example.com/API/MyModule/health\"\n\n    Engage.Http.urlWithQueryString config.baseUrl \"articles\" [ ( \"page\", \"1\" ) ]\n    --> \"https://example.com/API/MyModule/articles?page=1\"\n\n    Engage.Http.urlWithQueryString config.baseUrl \"author\" [ ( \"name\", \"Joël Quenneville\" ) ]\n    --> \"https://example.com/API/MyModule/author?name=Jo%C3%ABl%20Quenneville\"\n\n","type":"String.String -> String.String -> List.List ( String.String, String.String ) -> String.String"}],"binops":[]}]