[
    {
        "name": "OAuth.ClientCredentials",
        "comment": " The client can request an access token using only its client\ncredentials (or other supported means of authentication) when the client is requesting access to\nthe protected resources under its control, or those of another resource owner that have been\npreviously arranged with the authorization server (the method of which is beyond the scope of\nthis specification).\n\nThere's only one step in this process:\n\n  - The client authenticates itself directly using credentials it owns.\n\nAfter this step, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authenticate\n\n@docs authenticate\n\n",
        "unions": [],
        "aliases": [],
        "values": [
            {
                "name": "authenticate",
                "comment": " Authenticate the client using the authorization code obtained from the authorization.\n\nIn this case, use the `ClientCredentials` constructor.\n\n",
                "type": "Authentication -> Request Response"
            }
        ],
        "binops": []
    },
    {
        "name": "OAuth.Implicit",
        "comment": " The implicit grant type is used to obtain access tokens (it does not\nsupport the issuance of refresh tokens) and is optimized for public clients known to operate a\nparticular redirection URI. These clients are typically implemented in a browser using a\nscripting language such as JavaScript.\n\nThis is a 2-step process:\n\n  - The client asks for an authorization and implicit authentication to the OAuth provider: the user is redirected.\n  - The provider redirects the user back and the client parses the request query parameters from the url.\n\nAfter those steps, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authorize\n\n@docs authorize, parse\n\n",
        "unions": [],
        "aliases": [],
        "values": [
            {
                "name": "authorize",
                "comment": " Redirects the resource owner (user) to the resource provider server using the specified\nauthorization flow.\n\nIn this case, use `Token` as a `responseType`\n\n",
                "type": "Authorization -> Cmd msg"
            },
            {
                "name": "parse",
                "comment": " Parse the location looking for a parameters set by the resource provider server after\nredirecting the resource owner (user).\n\nFails with `Empty` when there's nothing\n\n",
                "type": "Location -> Result ParseError Response"
            }
        ],
        "binops": []
    },
    {
        "name": "OAuth.Password",
        "comment": " The resource owner password credentials grant type is suitable in\ncases where the resource owner has a trust relationship with the\nclient, such as the device operating system or a highly privileged\napplication. The authorization server should take special care when\nenabling this grant type and only allow it when other flows are not\nviable.\n\nThere's only one step in this process:\n\n  - The client authenticates itself directly using the resource owner (user) credentials\n\nAfter this step, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authenticate\n\n@docs authenticate\n\n",
        "unions": [],
        "aliases": [],
        "values": [
            {
                "name": "authenticate",
                "comment": " Authenticate the client using the authorization code obtained from the authorization.\n\nIn this case, use the `Password` constructor.\n\n",
                "type": "Authentication -> Request Response"
            }
        ],
        "binops": []
    },
    {
        "name": "OAuth.AuthorizationCode",
        "comment": " The authorization code grant type is used to obtain both access\ntokens and refresh tokens and is optimized for confidential clients.\nSince this is a redirection-based flow, the client must be capable of\ninteracting with the resource owner's user-agent (typically a web\nbrowser) and capable of receiving incoming requests (via redirection)\nfrom the authorization server.\n\nThis is a 3-step process:\n\n  - The client asks for an authorization to the OAuth provider: the user is redirected.\n  - The provider redirects the user back and the client parses the request query parameters from the url.\n  - The client authenticate itself using the authorization code found in the previous step.\n\nAfter those steps, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authorize\n\n@docs authorize, parse\n\n\n## Authenticate\n\n@docs authenticate\n\n",
        "unions": [],
        "aliases": [],
        "values": [
            {
                "name": "authenticate",
                "comment": " Authenticate the client using the authorization code obtained from the authorization.\n\nIn this case, use the `AuthorizationCode` constructor.\n\n",
                "type": "Authentication -> Request Response"
            },
            {
                "name": "authorize",
                "comment": " Redirects the resource owner (user) to the resource provider server using the specified\nauthorization flow.\n\nIn this case, use `Code` as a `responseType`\n\n",
                "type": "Authorization -> Cmd msg"
            },
            {
                "name": "parse",
                "comment": " Parse the location looking for a parameters set by the resource provider server after\nredirecting the resource owner (user).\n\nFails with `Empty` when there's nothing\n\n",
                "type": "Location -> Result ParseError Response"
            }
        ],
        "binops": []
    },
    {
        "name": "OAuth",
        "comment": " Utility library to manage client-side OAuth 2.0 authentications\n\nThe library contains a main OAuth module exposing types used accross other modules. In practice,\nyou'll only need tu use one of the additional modules:\n\n  - OAuth.AuthorizationCode: The authorization code grant type is used to obtain both access tokens\n    and refresh tokens via a redirection-based flow and is optimized for confidential clients\n    [4.1](https://tools.ietf.org/html/rfc6749#section-4.1).\n\n  - OAuth.Implicit: The implicit grant type is used to obtain access tokens (it does not support the\n    issuance of refresh tokens) and is optimized for public clients known to operate a particular\n    redirection URI [4.2](https://tools.ietf.org/html/rfc6749#section-4.2).\n\n  - OAuth.Password: The resource owner password credentials grant type is suitable in cases where the\n    resource owner has a trust relationship with the client, such as the device operating system or a\n    highly privileged application [4.3](https://tools.ietf.org/html/rfc6749#section-4.3)\n\n  - OAuth.ClientCredentials: The client can request an access token using only its client credentials\n    (or other supported means of authentication) when the client is requesting access to the protected\n    resources under its control, or those of another resource owner that have been previously arranged\n    with the authorization server (the method of which is beyond the scope of this specification)\n    [4.4](https://tools.ietf.org/html/rfc6749#section-4.3).\n\nIn practice, you most probably want to use the *OAuth.Implicit* module which is the most commonly\nused.\n\n\n## Use a token\n\n@docs use\n\n\n## Requests\n\n@docs Authorization, Authentication, Credentials, ResponseType, showResponseType\n\n\n## Responses\n\n@docs Response, Token, ParseError, Error, showToken, showError, errorFromString, errorDecoder\n\n",
        "unions": [
            {
                "name": "Authentication",
                "comment": " Request configuration for an authentication (Authorization Code, Password & Client Credentials\nflows)\n\n    -- AuthorizationCode\n    let req = OAuth.AuthorizationCode\n          { credentials =\n              { clientId = \"<my-client-id>\"\n              , secret = \"\"\n              }\n          ,\n          , code = \"<authorization-code>\"\n          , url = \"<token-endpoint>\"\n          , redirectUri = \"<my-web-server>\"\n          , scope = [\"read:whatever\"]\n          , state = \"whatever\"\n          }\n\n    -- ClientCredentials\n    let req = OAuth.ClientCredentials\n          { credentials =\n              { clientId = \"<my-client-id>\"\n              , secret = \"<my-client-secret>\"\n              }\n          , url = \"<token-endpoint>\"\n          , scope = [\"read:whatever\"]\n          , state = \"whatever\"\n          }\n\n    -- Password\n    let req = OAuth.Password\n          { credentials = Just\n              { clientId = \"<my-client-id>\"\n              , secret = \"<my-client-secret>\"\n              }\n          , password = \"<user-password>\"\n          , scope = [\"read:whatever\"]\n          , state = \"whatever\"\n          , url = \"<token-endpoint>\"\n          , username = \"<user-username>\"\n          }\n\n    -- Refresh\n    let req = OAuth.Refresh\n          { credentials = Nothing\n          , scope = [\"read:whatever\"]\n          , token = OAuth.Bearer \"abcdef1234567890\"\n          , url = \"<token-endpoint>\"\n          }\n\n",
                "args": [],
                "cases": [
                    [
                        "AuthorizationCode",
                        [
                            "{ credentials : Credentials, code : String, redirectUri : String, scope : List String, state : Maybe String, url : String }"
                        ]
                    ],
                    [
                        "ClientCredentials",
                        [
                            "{ credentials : Credentials, scope : List String, state : Maybe String, url : String }"
                        ]
                    ],
                    [
                        "Password",
                        [
                            "{ credentials : Maybe Credentials, password : String, scope : List String, state : Maybe String, url : String, username : String }"
                        ]
                    ],
                    [
                        "Refresh",
                        [
                            "{ credentials : Maybe Credentials, token : Token, scope : List String, url : String }"
                        ]
                    ]
                ]
            },
            {
                "name": "Error",
                "comment": " Describes an OAuth error response [4.1.2.1](https://tools.ietf.org/html/rfc6749#section-4.1.2.1)\n\n  - InvalidRequest: The request is missing a required parameter, includes an invalid parameter value,\n    includes a parameter more than once, or is otherwise malformed.\n\n  - UnauthorizedClient: The client is not authorized to request an authorization code using this\n    method.\n\n  - AccessDenied: The resource owner or authorization server denied the request.\n\n  - UnsupportedResponseType: The authorization server does not support obtaining an authorization code\n    using this method.\n\n  - InvalidScope: The requested scope is invalid, unknown, or malformed.\n\n  - ServerError: The authorization server encountered an unexpected condition that prevented it from\n    fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status\n    code cannot be returned to the client via an HTTP redirect.)\n\n  - TemporarilyUnavailable: The authorization server is currently unable to handle the request due to\n    a temporary overloading or maintenance of the server. (This error code is needed because a 503\n    Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)\n\n  - Unknown: The server returned an unknown error code.\n\n",
                "args": [],
                "cases": [
                    [
                        "InvalidRequest",
                        []
                    ],
                    [
                        "UnauthorizedClient",
                        []
                    ],
                    [
                        "AccessDenied",
                        []
                    ],
                    [
                        "UnsupportedResponseType",
                        []
                    ],
                    [
                        "InvalidScope",
                        []
                    ],
                    [
                        "ServerError",
                        []
                    ],
                    [
                        "TemporarilyUnavailable",
                        []
                    ],
                    [
                        "Unknown",
                        []
                    ]
                ]
            },
            {
                "name": "ParseError",
                "comment": " Describes errors coming from attempting to parse a url after an OAuth redirection\n\n  - Empty: means there were nothing (related to OAuth 2.0) to parse\n  - Missing: means the OAuth provider didn't with all the required parameters for the given grant type.\n  - Invalid: means the OAuth provider did reply with an invalid parameter for the given grant type.\n\n",
                "args": [],
                "cases": [
                    [
                        "Empty",
                        []
                    ],
                    [
                        "Missing",
                        [
                            "List String"
                        ]
                    ],
                    [
                        "Invalid",
                        [
                            "List String"
                        ]
                    ]
                ]
            },
            {
                "name": "Response",
                "comment": " The response obtained as a result of an authorization or authentication. `OkCode` can only be\nencountered after an authorization.\n",
                "args": [],
                "cases": [
                    [
                        "OkToken",
                        [
                            "{ expiresIn : Maybe Int, refreshToken : Maybe Token, scope : List String, state : Maybe String, token : Token }"
                        ]
                    ],
                    [
                        "OkCode",
                        [
                            "{ code : String, state : Maybe String }"
                        ]
                    ],
                    [
                        "Err",
                        [
                            "{ error : Error, errorDescription : Maybe String, errorUri : Maybe String, state : Maybe String }"
                        ]
                    ]
                ]
            },
            {
                "name": "ResponseType",
                "comment": " Describes the desired type of response to an authorization. Use `Code` to ask for an\nauthorization code and continue with the according flow. Use `Token` to do an implicit\nauthentication and directly retrieve a `Token` from the authorization.\n",
                "args": [],
                "cases": [
                    [
                        "Code",
                        []
                    ],
                    [
                        "Token",
                        []
                    ]
                ]
            },
            {
                "name": "Token",
                "comment": " Describes the type of access token to use.\n\n  - Bearer: Utilized by simply including the access token string in the request\n    [rfc6750](https://tools.ietf.org/html/rfc6750)\n\n  - Mac: Not yet supported.\n\n",
                "args": [],
                "cases": [
                    [
                        "Bearer",
                        [
                            "String"
                        ]
                    ]
                ]
            }
        ],
        "aliases": [
            {
                "name": "Authorization",
                "comment": " Request configuration for an authorization (Authorization Code & Implicit flows)\n",
                "args": [],
                "type": "{ clientId : String, url : String, redirectUri : String, responseType : ResponseType, scope : List String, state : Maybe String }"
            },
            {
                "name": "Credentials",
                "comment": " Describes a couple of client credentials used for Basic authentication\n",
                "args": [],
                "type": "{ clientId : String, secret : String }"
            }
        ],
        "values": [
            {
                "name": "errorDecoder",
                "comment": " A json decoder for response error carried by the `Result Http.Error OAuth.Response` result of\nan http call.\n",
                "type": "Decoder { error : Error, errorUri : Maybe String, errorDescription : Maybe String }"
            },
            {
                "name": "errorFromString",
                "comment": " Attempts to parse a `String` into an `Error` code. Will parse to `Unknown` when the string\nisn't recognized.\n",
                "type": "String -> Error"
            },
            {
                "name": "showError",
                "comment": " Gets the `String` representation of an `Error`.\n",
                "type": "Error -> String"
            },
            {
                "name": "showResponseType",
                "comment": " Gets the `String` representation of a `ResponseType`.\n",
                "type": "ResponseType -> String"
            },
            {
                "name": "showToken",
                "comment": " Gets the `String` representation of a `Token`.\n",
                "type": "Token -> String"
            },
            {
                "name": "use",
                "comment": " Use a token to authenticate a request.\n",
                "type": "Token -> List Header -> List Header"
            }
        ],
        "binops": []
    }
]