[
    {
        "name": "OAuthMiddleware",
        "comment": " Client side of OAuth Authorization Code Grant Flow.\n\nYour top-level Elm program must be created with `Navigation.program` or `Navigation.programWithFlags`. You can ignore incoming `Location` changes, but your `init` function needs to pass the initial `Location` to `receiveTokenAndState`, in case you're here because of a redirect back from your OAuth callback server (at `redirectUri`).\n\n\n# Types\n\n@docs Authorization, TokenAuthorization, ResponseToken, TokenState\n\n\n# Client-side functions\n\n@docs getAuthorization, getAuthorizations\n@docs locationToRedirectBackUri, authorize, receiveTokenAndState, use\n\n",
        "unions": [
            {
                "name": "TokenState",
                "comment": " The result of parsing a Navigation.Location that may have come from\na redirect from a callback server, as implemented in the `server` directory\nof this project.\n\nFor a `TokenAndState` or `TokenErrorAndState`, the state you passed is the `(Maybe String)`.\n\nYou will rarely need to look inside a `ResponseToken`. Just pass it to `use` to add it to the headers for a request to the protected resource.\n\n`TokenDecodeError` means that there was a properly-named query string, but an error occurred while decoding it.\n\n`NoToken` means that there was no query parameter that looked like a token or an error message about getting a token. In other words, this invocation of your webapp was not due to a redirection from the callback server.\n\n",
                "args": [],
                "cases": [
                    [
                        "TokenAndState",
                        [
                            "ResponseToken",
                            "Maybe String"
                        ]
                    ],
                    [
                        "TokenErrorAndState",
                        [
                            "String",
                            "Maybe String"
                        ]
                    ],
                    [
                        "TokenDecodeError",
                        [
                            "String"
                        ]
                    ],
                    [
                        "NoToken",
                        []
                    ]
                ]
            }
        ],
        "aliases": [
            {
                "name": "Authorization",
                "comment": " You'll usually get this from a JSON file, often via `getAuthorizations`.\n",
                "args": [],
                "type": "Authorization"
            },
            {
                "name": "ResponseToken",
                "comment": " An alias for `OAuth.ResponseToken`.\n",
                "args": [],
                "type": "ResponseToken"
            },
            {
                "name": "TokenAuthorization",
                "comment": " Configuration for sending a request to the authorization server.\n\n`authorizationUri` and `tokenUri` are provided by the OAuth authentication service.\n\n`authorize` sends a request to `authorizationUri`, encoding the other parameters into the `state` sent there. The `redirectUri` server, implemented by the `server` directory of this package, uses the `tokenUri` as a key into its table containing valid values for `redirectBackUri` and the client secret that will be sent to the `tokenUri`.\n\n`clientId`, `redirectUri`, `scope`, and `state` are all standard parts of the OAuth protocol, except `state` is optional here, and encoded so it comes back just as it went out.\n\n`clientId` is assigned by the OAuth resource. It also provides a list of possible `scope` values. You can use any subset of those.\n\n`redirectUri` is sent to the OAuth authorization web server. If the user successfullly logs in, an authorization code will be sent there as a Uri query parameter.\n\n`state` is any string you'd like. It is passed to the authorization web server, which passes it to the `redirectUri`, and it is passed back to your application via the `redirectBackUri`.\n\n`redirectBackUri` is a Uri to redirect to AFTER the `redirectUri` exchanges the received code for an access token. It will resume your Elm application, this time with an access token in its hand.\n\n",
                "args": [],
                "type": "{ authorization : Authorization, scope : List String, state : Maybe String, redirectBackUri : String }"
            }
        ],
        "values": [
            {
                "name": "authorize",
                "comment": " Send an authorization request.\n\nThis will cause the authorization server to ask the user to login. If successful, it will send the received code and `TokenAuthorization.state` to the `TokenAuthorization.authorization.redirectUri` for generation of a token to send back to the `TokenAuthorization.redirectBackUri`. Your code at that Uri will receive an encoded `ResponseToken` on the `responseTokenQuery` parameter, or an error string on the `responseTokenQueryError` parameter. Use `decodeResponseToken` to turn the `responseTokenQuery` string into an `ResponseToken`, which you can use to do authenticated requests, just as if you had called `OAuth.TokenAuthorizationCode.authenticate` yourself, but hiding the client secret on the redirect server.\n\nThe returned `Cmd` will cause the user's browser to navigate away from your app for authentication and token fetching by the `redirectUri`. The redirect server will navigate back with query args that you can process with `receiveTokenAndState`.\n\n",
                "type": "TokenAuthorization -> Cmd msg"
            },
            {
                "name": "getAuthorization",
                "comment": " Get a JSON file encoding an `Authorization`.\n\n    getAuthorization useCache url\n\nIf `useCache` is true, will use the browser's cache, meaning that it may not immediately notice changes to the file on the server.\n\nThe JSON format is as follows. You'll change it with information from your OAuth provider, and for your redirect server, and store it in a convenient place on the same server serving your compiled Elm code.\n\nThe `scopes` field is an object, mapping your internal name for each scope to the actual OAuth provider name. For most OAuth providers, the two will be identical, but Google, for example, uses long URL-looking strings for scope names, so it's convenient to have a shorter name your application can use. This field isn't used by any of the `OAuthMiddleware` code, except the example, so you can safely set it to `{}`, if you prefer to just encode the scope strings as constants in your Elm code.\n\nYour client secret is stored with the redirect server, and never leaves that server machine.\n\n    { \"name\": \"Gmail\",\n      \"authorizationUri\": \"https://accounts.google.com/o/oauth2/auth\",\n      \"tokenUri\": \"https://accounts.google.com/o/oauth2/token\",\n      \"apiUri\": \"https://www.googleapis.com/gmail/v1/users/\",\n      \"clientId\": \"<Your OAuth clientid>\",\n      \"redirectUri\": \"<Your redirect server Uri>\",\n      \"scopes\": {\"<Your scope name>\": \"<OAuth provider's scope name>\"}\n    }\n\nThe example contains more information about this, and a sample authorizations file.\n\n",
                "type": "Bool -> String -> Request Authorization"
            },
            {
                "name": "getAuthorizations",
                "comment": " Get a JSON file encoding an `Authorization` list.\n\n    getAuthorizations useCache url\n\nIf `useCache` is true, will use the browser's cache, meaning that it may not immediately notice changes to the file on the server.\n\n",
                "type": "Bool -> String -> Request (List Authorization)"
            },
            {
                "name": "locationToRedirectBackUri",
                "comment": " Convert a `Navigation.Location` into a string suitable for the `redirectBackUri` in a `TokenAuthorization`.\n",
                "type": "Location -> String"
            },
            {
                "name": "receiveTokenAndState",
                "comment": " Parse a returned `ResponseToken` from a `Navigation.Location`.\n\nNote that the `scope` in the returned `TokenAndState` `ResponseToken` is not guaranteed to match what you requested. The RFC 6749 [Authorization Code Grant](https://tools.ietf.org/html/rfc6749#section-4.1) flow does not specify a returned scope from the OAuth token server, so if your redirectUri server receives no scope, or an empty scope, it will send back the list of scopes you requested. The spec does not guarantee that you'll get all the scopes you requested in your call to `authorize`, so this may be incorrect. It appears that GitHub returns proper scopes, so they will be as granted in that case.\n\n",
                "type": "Location -> TokenState"
            },
            {
                "name": "use",
                "comment": " Use a token to add authenticatication to a request header.\n\nA thin wrapper around `OAuth.use`.\n\n",
                "type": "ResponseToken -> List Header -> List Header"
            }
        ],
        "binops": []
    },
    {
        "name": "OAuthMiddleware.EncodeDecode",
        "comment": " JSON Encoders and Decoders for the `OAuthMiddleware` module.\n\n\n# Types\n\n@docs Authorization, RedirectState, ResponseTokenError\n\n\n# Encode/Decode state for passing over the wire.\n\n@docs encodeRedirectState, decodeRedirectState\n@docs encodeResponseToken, decodeResponseToken\n@docs encodeResponseTokenError, decodeResponseTokenError\n\n\n# Encoders and Decoders\n\n@docs authorizationsDecoder, authorizationsEncoder\n@docs authorizationDecoder, authorizationEncoder\n@docs redirectStateDecoder, redirectStateEncoder\n@docs responseTokenDecoder, responseTokenEncoder\n@docs responseTokenErrorDecoder, responseTokenErrorEncoder\n@docs nullableStringEncoder\n\n",
        "unions": [],
        "aliases": [
            {
                "name": "Authorization",
                "comment": " Authorization information to send to the redirect (callback) server.\n\nUsually stored in a JSON file, and read and decoded by `OAuthMiddleware.getAuthorizations` or `OAuthMiddleware.getAuthorization`.\n\n",
                "args": [],
                "type": "{ name : String, authorizationUri : String, tokenUri : String, apiUri : String, clientId : String, redirectUri : String, scopes : Dict String String }"
            },
            {
                "name": "RedirectState",
                "comment": " The state sent to the `redirectUri`.\n\nThis is created by `OAuthMiddleware.authorize` from the passed `TokenAuthorization`.\n\n",
                "args": [],
                "type": "{ clientId : String, tokenUri : String, redirectUri : String, scope : List String, redirectBackUri : String, state : Maybe String }"
            },
            {
                "name": "ResponseTokenError",
                "comment": " If an error occurs getting a token from the token server,\nit is encoded in a `ResponseTokenError`.\n",
                "args": [],
                "type": "{ err : String, state : Maybe String }"
            }
        ],
        "values": [
            {
                "name": "authorizationDecoder",
                "comment": " Decode an `Authorization`.\n\nUsually used via `OAuthMiddleware.getAuthorization`.\n\n",
                "type": "Decoder Authorization"
            },
            {
                "name": "authorizationEncoder",
                "comment": " Encode an `Authorization`.\n",
                "type": "Authorization -> Value"
            },
            {
                "name": "authorizationsDecoder",
                "comment": " Decode an `Authorization` list.\n\nUsually used via `OAuthMiddleware.getAuthorizations`.\n\n",
                "type": "Decoder (List Authorization)"
            },
            {
                "name": "authorizationsEncoder",
                "comment": " Encode an `Authorization` list.\n",
                "type": "List Authorization -> Value"
            },
            {
                "name": "decodeRedirectState",
                "comment": " Decode the state encoded by `encodeRedirectState`.\n",
                "type": "String -> Result String RedirectState"
            },
            {
                "name": "decodeResponseToken",
                "comment": " Decode the `ResponseToken` that is sent back to the `redirectUri`\nfrom the redirect server.\n",
                "type": "String -> Result String ResponseToken"
            },
            {
                "name": "decodeResponseTokenError",
                "comment": " Decode the `ResponseTokenError` that may be sent back to the\n`redirectUri` from the redirect server.\n",
                "type": "String -> Result String ResponseTokenError"
            },
            {
                "name": "encodeRedirectState",
                "comment": " Encode the redirectBackUri and user state for the authorization server.\n",
                "type": "RedirectState -> String"
            },
            {
                "name": "encodeResponseToken",
                "comment": " Encode the `ResponseToken` that is received by the redirect server\nfrom its call to `OAuth.AuthorizationCode.authenticate`.\n",
                "type": "ResponseToken -> String"
            },
            {
                "name": "encodeResponseTokenError",
                "comment": " Encode the `ResponseTokenError` that may be sent back to the\n`redirectUri` from the redirect server.\n",
                "type": "ResponseTokenError -> String"
            },
            {
                "name": "nullableStringEncoder",
                "comment": " Simple encoder for a nullable string.\n",
                "type": "Maybe String -> Value"
            },
            {
                "name": "redirectStateDecoder",
                "comment": " Decode the state sent to the authenticate server\nvia `OAuth.AuthorizationCode.authenticate` and received\nby the redirect server.\n",
                "type": "Decoder RedirectState"
            },
            {
                "name": "redirectStateEncoder",
                "comment": " Encode the state sent to the authenticate server\nvia `OAuth.AuthorizationCode.authenticate` and received\nby the redirect server.\n",
                "type": "RedirectState -> Value"
            },
            {
                "name": "responseTokenDecoder",
                "comment": " Decode the \"response-token\" query arg for the redirectBackUri.\n\nChanges the default by swapping `lenientScopeDecoder` for `scopeDecoder`.\n\nThis isn't necessary on the client side, but is needed by the server for GitHub.\n\n",
                "type": "Decoder ResponseToken"
            },
            {
                "name": "responseTokenEncoder",
                "comment": " Encode the \"response-token\" query arg for the redirectBackUri\n",
                "type": "ResponseToken -> Value"
            },
            {
                "name": "responseTokenErrorDecoder",
                "comment": " Decode a `ResponseTokenError`.\n",
                "type": "Decoder ResponseTokenError"
            },
            {
                "name": "responseTokenErrorEncoder",
                "comment": " Turn a `ResponseTokenError` into a `Value`.\n",
                "type": "ResponseTokenError -> Value"
            }
        ],
        "binops": []
    }
]