# (generated with --quick)

import datetime
import oauth.exceptions
import secrets
from typing import Any, Callable, Iterable, Mapping, Optional, Sequence, TypeVar, Union, overload

HttpRequest: Any
OAuthConnection: Any
OAuthError: type[oauth.exceptions.OAuthError]
OAuthStateMismatchError: type[oauth.exceptions.OAuthStateMismatchError]
Response: Any
ResponseRedirect: Any
SESSION_NEXT_KEY: str
SESSION_STATE_KEY: str
auth_login: Any
get_random_string: Any
import_string: Any
reverse: Any
settings: Any

AnyStr = TypeVar('AnyStr', str, bytes)
_Q = TypeVar('_Q', bound=Union[str, Iterable[int]])

class OAuthProvider:
    authorization_url: str
    client_id: str
    client_secret: str
    provider_key: str
    scope: str
    def __init__(self, *, provider_key: str, client_id: str, client_secret: str, scope: str = ...) -> None: ...
    def check_request_state(self, *, request) -> None: ...
    def generate_state(self) -> str: ...
    def get_authorization_url(self, *, request) -> str: ...
    def get_authorization_url_params(self, *, request) -> dict: ...
    def get_callback_url(self, *, request) -> str: ...
    def get_client_id(self) -> str: ...
    def get_client_secret(self) -> str: ...
    def get_disconnect_redirect_url(self, *, request) -> str: ...
    def get_login_redirect_url(self, *, request) -> str: ...
    def get_oauth_token(self, *, code: str, request) -> OAuthToken: ...
    def get_oauth_user(self, *, oauth_token: OAuthToken) -> OAuthUser: ...
    def get_scope(self) -> str: ...
    def handle_callback_request(self, *, request) -> Any: ...
    def handle_connect_request(self, *, request, redirect_to: str = ...) -> Any: ...
    def handle_disconnect_request(self, *, request) -> Any: ...
    def handle_login_request(self, *, request, redirect_to: str = ...) -> Any: ...
    def login(self, *, request, user) -> Any: ...
    def refresh_oauth_token(self, *, oauth_token: OAuthToken) -> OAuthToken: ...

class OAuthToken:
    access_token: str
    access_token_expires_at: datetime.datetime
    refresh_token: str
    refresh_token_expires_at: datetime.datetime
    def __init__(self, *, access_token: str, refresh_token: str = ..., access_token_expires_at: datetime.datetime = ..., refresh_token_expires_at: datetime.datetime = ...) -> None: ...

class OAuthUser:
    id: str
    user_model_fields: dict[str, dict]
    def __init__(self, *, id: str, **user_model_fields: dict) -> None: ...
    def __str__(self) -> Union[dict, str]: ...

def get_oauth_provider_instance(*, provider_key: str) -> OAuthProvider: ...
def get_provider_keys() -> list[str]: ...
@overload
def urlencode(query: Union[Mapping, Sequence[tuple[Any, Any]]], doseq: bool = ..., safe: str = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., quote_via: Callable[[AnyStr, str, str, str], str] = ...) -> str: ...
@overload
def urlencode(query: Union[Mapping, Sequence[tuple[Any, Any]]], doseq: bool, safe: _Q, encoding: Optional[str] = ..., errors: Optional[str] = ..., quote_via: Callable[[AnyStr, _Q, str, str], str] = ...) -> str: ...
@overload
def urlencode(query: Union[Mapping, Sequence[tuple[Any, Any]]], doseq: bool = ..., *, safe: _Q, encoding: Optional[str] = ..., errors: Optional[str] = ..., quote_via: Callable[[AnyStr, _Q, str, str], str] = ...) -> str: ...
