[
    {
        "name": "Jwt",
        "comment": " Helper functions for working with Jwt tokens and authenticated CRUD APIs.\n\nThis package provides functions for reading tokens, and for using them to make\nauthenticated Http requests.\n\n\n# Token reading\n\n@docs decodeToken, tokenDecoder, isExpired, checkTokenExpiry\n\n\n# Authenticated Http requests\n\n@docs createRequest, createRequestObject, send, sendCheckExpired, get, post, put, delete\n\n\n# Error handlers\n\n@docs JwtError, promote401, handleError\n\n\n# Logging in\n\n@docs authenticate\n\n",
        "unions": [
            {
                "name": "JwtError",
                "comment": " The following errors are modeled\n\n  - Any Http.Error, other than a 401\n  - 401 (Unauthorized), due either to token expiry or e.g. inadequate permissions\n  - token (non-)expiry information\n  - issues with processing (e.g. base 64 decoding) the token, and\n  - problems decoding the json data within the content of the token\n\n",
                "args": [],
                "cases": [
                    [
                        "HttpError",
                        [
                            "Error"
                        ]
                    ],
                    [
                        "Unauthorized",
                        []
                    ],
                    [
                        "TokenExpired",
                        []
                    ],
                    [
                        "TokenNotExpired",
                        []
                    ],
                    [
                        "TokenProcessingError",
                        [
                            "String"
                        ]
                    ],
                    [
                        "TokenDecodeError",
                        [
                            "String"
                        ]
                    ]
                ]
            }
        ],
        "aliases": [],
        "values": [
            {
                "name": "authenticate",
                "comment": " `authenticate` creates an Http.Request based on login credentials.\nThere is very little to this function (and it will be removed in future releases), so feel free to role your own here instead.\n\n    submitCredentials : Model -> Cmd Msg\n    submitCredentials model =\n        E.object\n            [ ( \"username\", E.string model.uname )\n            , ( \"password\", E.string model.pword )\n            ]\n            |> authenticate \"/sessions\" tokenStringDecoder\n\n",
                "type": "String -> Decoder a -> Value -> Request a"
            },
            {
                "name": "checkTokenExpiry",
                "comment": " Checks a token for Expiry. Returns expiry or any errors that occurred in decoding.\n",
                "type": "String -> Task Never JwtError"
            },
            {
                "name": "createRequest",
                "comment": " createRequest creates a Http.Request with the token added to the headers, and\nsets the `withCredentials` field to True.\n",
                "type": "String -> String -> String -> Body -> Decoder a -> Request a"
            },
            {
                "name": "createRequestObject",
                "comment": " createRequestObject creates the data structure expected by Http.Request.\nIt is broken out here so that users can change the expect part in the event that\none of their REST apis does not return Json.\n",
                "type": "String -> String -> String -> Body -> Decoder a -> { method : String, headers : List Header, url : String, body : Body, expect : Expect a, timeout : Maybe Time, withCredentials : Bool }"
            },
            {
                "name": "decodeToken",
                "comment": " decodeToken parses the token, checking that it meets the Jwt standards.\n\n    decodeToken dec token\n\nIn the event of success, `decodeToken` returns an Elm record structure using the JSON Decoder.\n\n",
                "type": "Decoder a -> String -> Result JwtError a"
            },
            {
                "name": "delete",
                "comment": " returns a `DELETE` Http.Request with the token attached to the headers.\n",
                "type": "String -> String -> Decoder a -> Request a"
            },
            {
                "name": "get",
                "comment": " `get` is a replacement for `Http.get` that returns a Http.Request with the token\nattached to the headers.\n\n    getData : String -> Cmd Msg\n    getData token =\n        Jwt.get token \"/api/data\" dataDecoder\n            |> Jwt.send DataResult\n\n",
                "type": "String -> String -> Decoder a -> Request a"
            },
            {
                "name": "handleError",
                "comment": " Takes an Http.Error. If it is a 401, then it checks the token for expiry.\n",
                "type": "String -> Error -> Task Never JwtError"
            },
            {
                "name": "isExpired",
                "comment": " Checks whether a token has expired, and returns True or False, or\nany error that occurred while decoding the token.\n",
                "type": "Time -> String -> Result JwtError Bool"
            },
            {
                "name": "post",
                "comment": " post is a replacement for `Http.post` that returns a Http.Request with the token\nattached to the headers.\n\n** Note that is important to use jsonBody to ensure that the 'application/json' is added to the headers **\n\n    postContent : Token -> Json.Decoder a -> E.Value -> String -> Request a\n    postContent token dec value url =\n        Jwt.post token url (Http.jsonBody value) (phoenixDecoder dec)\n            |> Jwt.send ContentResult\n\n",
                "type": "String -> String -> Body -> Decoder a -> Request a"
            },
            {
                "name": "promote401",
                "comment": " Examines a 401 Unauthorized reponse, and converts the error to TokenExpired\nwhen that is the case.\n\n    getAuth : String -> String -> Json.Decoder a -> Task Never (Result JwtError a)\n    getAuth token url dec =\n        createRequest \"GET\" token url Http.emptyBody dec\n            |> toTask\n            |> Task.map Result.Ok\n            |> Task.onError (promote401 token)\n\n",
                "type": "Error -> JwtError"
            },
            {
                "name": "put",
                "comment": " Create a PUT request with a token attached to the Authorization header\n",
                "type": "String -> String -> Body -> Decoder a -> Request a"
            },
            {
                "name": "send",
                "comment": " `send` replaces `Http.send`. On receipt of a 401 error, it returns a Jwt.Unauthorized.\n",
                "type": "(Result JwtError a -> msg) -> Request a -> Cmd msg"
            },
            {
                "name": "sendCheckExpired",
                "comment": " `sendCheckExpired` is similar to `send` but, on receiving a 401, it carries out a further check to\ndetermine whether the token has expired.\n",
                "type": "String -> (Result JwtError a -> msg) -> Request a -> Cmd msg"
            },
            {
                "name": "tokenDecoder",
                "comment": " All the token parsing goodness in the form of a Json Decoder\n\n    -- decode token from Firebase\n    let firebaseToken =\n        decodeString\n            (tokenDecoder Jwt.Decoders.firebase)\n            tokenString\n\n",
                "type": "Decoder a -> Decoder a"
            }
        ],
        "binops": []
    },
    {
        "name": "Jwt.Decoders",
        "comment": " Helper functions for working with Jwt tokens and authenticated CRUD APIs.\n\nThis package provides functions for reading tokens, and for using them to make\nauthenticated Http requests.\n\n\n# Decoders for popular Jwt tokens\n\n@docs JwtToken, firebase\n\n",
        "unions": [],
        "aliases": [
            {
                "name": "JwtToken",
                "comment": " Generic constructor for commonly found fields in a Jwt token\n",
                "args": [],
                "type": "{ iat : Int, exp : Int, userId : Maybe String, email : Maybe String }"
            }
        ],
        "values": [
            {
                "name": "firebase",
                "comment": " Decoder for Firebase Jwt\n",
                "type": "Decoder JwtToken"
            }
        ],
        "binops": []
    }
]