# The PEP 484 type hints stub file for the QtNetworkAuth module.
#
# Generated by SIP 6.9.1
#
# Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
# 
# This file is part of PyQt6-NetworkAuth.
# 
# This file may be used under the terms of the GNU General Public License
# version 3.0 as published by the Free Software Foundation and appearing in
# the file LICENSE included in the packaging of this file.  Please review the
# following information to ensure the GNU General Public License version 3.0
# requirements will be met: http://www.gnu.org/copyleft/gpl.html.
# 
# If you do not wish to use this file under the terms of the GPL version 3.0
# then you may purchase a commercial license.  For more information contact
# info@riverbankcomputing.com.
# 
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


import collections, re, typing, enum

try:
    from warnings import deprecated
except ImportError:
    pass

import PyQt6.sip

from PyQt6 import QtCore
from PyQt6 import QtNetwork

# Support for QDate, QDateTime and QTime.
import datetime

# Convenient type aliases.
PYQT_SIGNAL = typing.Union[QtCore.pyqtSignal, QtCore.pyqtBoundSignal]
PYQT_SLOT = typing.Union[collections.abc.Callable[..., Any], QtCore.pyqtBoundSignal]


class QAbstractOAuth(QtCore.QObject):

    class ContentType(enum.Enum):
        WwwFormUrlEncoded = ... # type: QAbstractOAuth.ContentType
        Json = ... # type: QAbstractOAuth.ContentType

    class Error(enum.Enum):
        NoError = ... # type: QAbstractOAuth.Error
        NetworkError = ... # type: QAbstractOAuth.Error
        ServerError = ... # type: QAbstractOAuth.Error
        OAuthTokenNotFoundError = ... # type: QAbstractOAuth.Error
        OAuthTokenSecretNotFoundError = ... # type: QAbstractOAuth.Error
        OAuthCallbackNotVerified = ... # type: QAbstractOAuth.Error

    class Stage(enum.Enum):
        RequestingTemporaryCredentials = ... # type: QAbstractOAuth.Stage
        RequestingAuthorization = ... # type: QAbstractOAuth.Stage
        RequestingAccessToken = ... # type: QAbstractOAuth.Stage
        RefreshingAccessToken = ... # type: QAbstractOAuth.Stage

    class Status(enum.Enum):
        NotAuthenticated = ... # type: QAbstractOAuth.Status
        TemporaryCredentialsReceived = ... # type: QAbstractOAuth.Status
        Granted = ... # type: QAbstractOAuth.Status
        RefreshingToken = ... # type: QAbstractOAuth.Status

    @staticmethod
    def generateRandomString(length: int) -> QtCore.QByteArray: ...
    def resourceOwnerAuthorization(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]]) -> None: ...
    def callback(self) -> str: ...
    def setStatus(self, status: 'QAbstractOAuth.Status') -> None: ...
    replyDataReceived: typing.ClassVar[QtCore.pyqtSignal]
    finished: typing.ClassVar[QtCore.pyqtSignal]
    granted: typing.ClassVar[QtCore.pyqtSignal]
    authorizeWithBrowser: typing.ClassVar[QtCore.pyqtSignal]
    requestFailed: typing.ClassVar[QtCore.pyqtSignal]
    contentTypeChanged: typing.ClassVar[QtCore.pyqtSignal]
    extraTokensChanged: typing.ClassVar[QtCore.pyqtSignal]
    authorizationUrlChanged: typing.ClassVar[QtCore.pyqtSignal]
    statusChanged: typing.ClassVar[QtCore.pyqtSignal]
    tokenChanged: typing.ClassVar[QtCore.pyqtSignal]
    clientIdentifierChanged: typing.ClassVar[QtCore.pyqtSignal]
    def grant(self) -> None: ...
    def prepareRequest(self, request: typing.Optional[QtNetwork.QNetworkRequest], verb: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview], body: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview] = ...) -> None: ...
    def setContentType(self, contentType: 'QAbstractOAuth.ContentType') -> None: ...
    def contentType(self) -> 'QAbstractOAuth.ContentType': ...
    def setModifyParametersFunction(self, modifyParametersFunction: typing.Optional[typing.Callable[..., None]]) -> None: ...
    def modifyParametersFunction(self) -> typing.Callable[..., None]: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def put(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def post(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def get(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def head(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def setReplyHandler(self, handler: typing.Optional['QAbstractOAuthReplyHandler']) -> None: ...
    def replyHandler(self) -> typing.Optional['QAbstractOAuthReplyHandler']: ...
    def extraTokens(self) -> dict[str, typing.Any]: ...
    def setAuthorizationUrl(self, url: QtCore.QUrl) -> None: ...
    def authorizationUrl(self) -> QtCore.QUrl: ...
    def status(self) -> 'QAbstractOAuth.Status': ...
    def setNetworkAccessManager(self, networkAccessManager: typing.Optional[QtNetwork.QNetworkAccessManager]) -> None: ...
    def networkAccessManager(self) -> typing.Optional[QtNetwork.QNetworkAccessManager]: ...
    def setToken(self, token: typing.Optional[str]) -> None: ...
    def token(self) -> str: ...
    def setClientIdentifier(self, clientIdentifier: typing.Optional[str]) -> None: ...
    def clientIdentifier(self) -> str: ...


class QAbstractOAuth2(QAbstractOAuth):

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    sslConfigurationChanged: typing.ClassVar[QtCore.pyqtSignal]
    def setSslConfiguration(self, configuration: QtNetwork.QSslConfiguration) -> None: ...
    def sslConfiguration(self) -> QtNetwork.QSslConfiguration: ...
    def prepareRequest(self, request: typing.Optional[QtNetwork.QNetworkRequest], verb: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview], body: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview] = ...) -> None: ...
    def setResponseType(self, responseType: typing.Optional[str]) -> None: ...
    authorizationCallbackReceived: typing.ClassVar[QtCore.pyqtSignal]
    error: typing.ClassVar[QtCore.pyqtSignal]
    expirationAtChanged: typing.ClassVar[QtCore.pyqtSignal]
    stateChanged: typing.ClassVar[QtCore.pyqtSignal]
    clientIdentifierSharedKeyChanged: typing.ClassVar[QtCore.pyqtSignal]
    responseTypeChanged: typing.ClassVar[QtCore.pyqtSignal]
    refreshTokenChanged: typing.ClassVar[QtCore.pyqtSignal]
    userAgentChanged: typing.ClassVar[QtCore.pyqtSignal]
    scopeChanged: typing.ClassVar[QtCore.pyqtSignal]
    def setRefreshToken(self, refreshToken: typing.Optional[str]) -> None: ...
    def refreshToken(self) -> str: ...
    def expirationAt(self) -> QtCore.QDateTime: ...
    def setState(self, state: typing.Optional[str]) -> None: ...
    def state(self) -> str: ...
    def setClientIdentifierSharedKey(self, clientIdentifierSharedKey: typing.Optional[str]) -> None: ...
    def clientIdentifierSharedKey(self) -> str: ...
    def responseType(self) -> str: ...
    def setUserAgent(self, userAgent: typing.Optional[str]) -> None: ...
    def userAgent(self) -> str: ...
    def setScope(self, scope: typing.Optional[str]) -> None: ...
    def scope(self) -> str: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, data: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview]) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, multiPart: typing.Optional[QtNetwork.QHttpMultiPart]) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, data: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview]) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, multiPart: typing.Optional[QtNetwork.QHttpMultiPart]) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def get(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def head(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def createAuthenticatedUrl(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> QtCore.QUrl: ...


class QAbstractOAuthReplyHandler(QtCore.QObject):

    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    tokenRequestErrorOccurred: typing.ClassVar[QtCore.pyqtSignal]
    callbackDataReceived: typing.ClassVar[QtCore.pyqtSignal]
    replyDataReceived: typing.ClassVar[QtCore.pyqtSignal]
    tokensReceived: typing.ClassVar[QtCore.pyqtSignal]
    callbackReceived: typing.ClassVar[QtCore.pyqtSignal]
    def networkReplyFinished(self, reply: typing.Optional[QtNetwork.QNetworkReply]) -> None: ...
    def callback(self) -> str: ...


class QOAuth1(QAbstractOAuth):

    class SignatureMethod(enum.Enum):
        Hmac_Sha1 = ... # type: QOAuth1.SignatureMethod
        Rsa_Sha1 = ... # type: QOAuth1.SignatureMethod
        PlainText = ... # type: QOAuth1.SignatureMethod

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: typing.Optional[str], clientSharedSecret: typing.Optional[str], manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    @staticmethod
    def generateAuthorizationHeader(oauthParams: dict[typing.Optional[str], typing.Any]) -> QtCore.QByteArray: ...
    @staticmethod
    def nonce() -> QtCore.QByteArray: ...
    @typing.overload
    def setup(self, request: typing.Optional[QtNetwork.QNetworkRequest], signingParameters: dict[typing.Optional[str], typing.Any], operation: QtNetwork.QNetworkAccessManager.Operation) -> None: ...
    @typing.overload
    def setup(self, request: typing.Optional[QtNetwork.QNetworkRequest], signingParameters: dict[typing.Optional[str], typing.Any], operationVerb: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ...
    def requestTokenCredentials(self, operation: QtNetwork.QNetworkAccessManager.Operation, url: QtCore.QUrl, temporaryToken: tuple[typing.Optional[str], typing.Optional[str]], parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def requestTemporaryCredentials(self, operation: QtNetwork.QNetworkAccessManager.Operation, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    tokenCredentialsUrlChanged: typing.ClassVar[QtCore.pyqtSignal]
    temporaryCredentialsUrlChanged: typing.ClassVar[QtCore.pyqtSignal]
    tokenSecretChanged: typing.ClassVar[QtCore.pyqtSignal]
    clientSharedSecretChanged: typing.ClassVar[QtCore.pyqtSignal]
    signatureMethodChanged: typing.ClassVar[QtCore.pyqtSignal]
    def continueGrantWithVerifier(self, verifier: typing.Optional[str]) -> None: ...
    def grant(self) -> None: ...
    def prepareRequest(self, request: typing.Optional[QtNetwork.QNetworkRequest], verb: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview], body: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview] = ...) -> None: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def put(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def post(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def get(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def head(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], typing.Any] = ...) -> typing.Optional[QtNetwork.QNetworkReply]: ...
    def setSignatureMethod(self, value: 'QOAuth1.SignatureMethod') -> None: ...
    def signatureMethod(self) -> 'QOAuth1.SignatureMethod': ...
    def setTokenCredentialsUrl(self, url: QtCore.QUrl) -> None: ...
    def tokenCredentialsUrl(self) -> QtCore.QUrl: ...
    def setTemporaryCredentialsUrl(self, url: QtCore.QUrl) -> None: ...
    def temporaryCredentialsUrl(self) -> QtCore.QUrl: ...
    @typing.overload
    def setTokenCredentials(self, tokenCredentials: tuple[typing.Optional[str], typing.Optional[str]]) -> None: ...
    @typing.overload
    def setTokenCredentials(self, token: typing.Optional[str], tokenSecret: typing.Optional[str]) -> None: ...
    def tokenCredentials(self) -> tuple[str, str]: ...
    def setTokenSecret(self, tokenSecret: typing.Optional[str]) -> None: ...
    def tokenSecret(self) -> str: ...
    @typing.overload
    def setClientCredentials(self, clientCredentials: tuple[typing.Optional[str], typing.Optional[str]]) -> None: ...
    @typing.overload
    def setClientCredentials(self, clientIdentifier: typing.Optional[str], clientSharedSecret: typing.Optional[str]) -> None: ...
    def clientCredentials(self) -> tuple[str, str]: ...
    def setClientSharedSecret(self, clientSharedSecret: typing.Optional[str]) -> None: ...
    def clientSharedSecret(self) -> str: ...


class QOAuth1Signature(PyQt6.sip.simplewrapper):

    class HttpRequestMethod(enum.Enum):
        Head = ... # type: QOAuth1Signature.HttpRequestMethod
        Get = ... # type: QOAuth1Signature.HttpRequestMethod
        Put = ... # type: QOAuth1Signature.HttpRequestMethod
        Post = ... # type: QOAuth1Signature.HttpRequestMethod
        Delete = ... # type: QOAuth1Signature.HttpRequestMethod
        Custom = ... # type: QOAuth1Signature.HttpRequestMethod
        Unknown = ... # type: QOAuth1Signature.HttpRequestMethod

    @typing.overload
    def __init__(self, url: QtCore.QUrl = ..., method: 'QOAuth1Signature.HttpRequestMethod' = ..., parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]] = ...) -> None: ...
    @typing.overload
    def __init__(self, url: QtCore.QUrl, clientSharedKey: typing.Optional[str], tokenSecret: typing.Optional[str], method: 'QOAuth1Signature.HttpRequestMethod' = ..., parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]] = ...) -> None: ...
    @typing.overload
    def __init__(self, other: 'QOAuth1Signature') -> None: ...

    def setCustomMethodString(self, verb: typing.Union[QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ...
    def customMethodString(self) -> QtCore.QByteArray: ...
    def swap(self, other: 'QOAuth1Signature') -> None: ...
    @typing.overload
    def plainText(self) -> QtCore.QByteArray: ...
    @typing.overload
    @staticmethod
    def plainText(clientSharedSecret: typing.Optional[str], tokenSecret: typing.Optional[str]) -> QtCore.QByteArray: ...
    def rsaSha1(self) -> QtCore.QByteArray: ...
    def hmacSha1(self) -> QtCore.QByteArray: ...
    def setTokenSecret(self, secret: typing.Optional[str]) -> None: ...
    def tokenSecret(self) -> str: ...
    def setClientSharedKey(self, secret: typing.Optional[str]) -> None: ...
    def clientSharedKey(self) -> str: ...
    def value(self, key: typing.Optional[str], defaultValue: typing.Any = ...) -> typing.Any: ...
    def take(self, key: typing.Optional[str]) -> typing.Any: ...
    def keys(self) -> list[str]: ...
    def insert(self, key: typing.Optional[str], value: typing.Any) -> None: ...
    def addRequestBody(self, body: QtCore.QUrlQuery) -> None: ...
    def setParameters(self, parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]]) -> None: ...
    def parameters(self) -> dict[str, list[typing.Any]]: ...
    def setUrl(self, url: QtCore.QUrl) -> None: ...
    def url(self) -> QtCore.QUrl: ...
    def setHttpRequestMethod(self, method: 'QOAuth1Signature.HttpRequestMethod') -> None: ...
    def httpRequestMethod(self) -> 'QOAuth1Signature.HttpRequestMethod': ...


class QOAuth2AuthorizationCodeFlow(QAbstractOAuth2):

    class PkceMethod(enum.Enum):
        S256 = ... # type: QOAuth2AuthorizationCodeFlow.PkceMethod
        Plain = ... # type: QOAuth2AuthorizationCodeFlow.PkceMethod
        None_ = ... # type: QOAuth2AuthorizationCodeFlow.PkceMethod

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: typing.Optional[str], manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, authorizationUrl: QtCore.QUrl, accessTokenUrl: QtCore.QUrl, manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: typing.Optional[str], authorizationUrl: QtCore.QUrl, accessTokenUrl: QtCore.QUrl, manager: typing.Optional[QtNetwork.QNetworkAccessManager], parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def pkceMethod(self) -> 'QOAuth2AuthorizationCodeFlow.PkceMethod': ...
    def setPkceMethod(self, method: 'QOAuth2AuthorizationCodeFlow.PkceMethod', length: int = ...) -> None: ...
    def resourceOwnerAuthorization(self, url: QtCore.QUrl, parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]] = ...) -> None: ...
    def requestAccessToken(self, code: typing.Optional[str]) -> None: ...
    def buildAuthenticateUrl(self, parameters: dict[typing.Optional[str], collections.abc.Sequence[typing.Any]] = ...) -> QtCore.QUrl: ...
    accessTokenUrlChanged: typing.ClassVar[QtCore.pyqtSignal]
    def refreshAccessToken(self) -> None: ...
    def grant(self) -> None: ...
    def setAccessTokenUrl(self, accessTokenUrl: QtCore.QUrl) -> None: ...
    def accessTokenUrl(self) -> QtCore.QUrl: ...


class QOAuthOobReplyHandler(QAbstractOAuthReplyHandler):

    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def networkReplyFinished(self, reply: typing.Optional[QtNetwork.QNetworkReply]) -> None: ...
    def callback(self) -> str: ...


class QOAuthHttpServerReplyHandler(QOAuthOobReplyHandler):

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, port: int, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, address: typing.Union[QtNetwork.QHostAddress, QtNetwork.QHostAddress.SpecialAddress], port: int, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def isListening(self) -> bool: ...
    def close(self) -> None: ...
    def listen(self, address: typing.Union[QtNetwork.QHostAddress, QtNetwork.QHostAddress.SpecialAddress] = ..., port: int = ...) -> bool: ...
    def port(self) -> int: ...
    def setCallbackText(self, text: typing.Optional[str]) -> None: ...
    def callbackText(self) -> str: ...
    def setCallbackPath(self, path: typing.Optional[str]) -> None: ...
    def callbackPath(self) -> str: ...
    def callback(self) -> str: ...


class QOAuthUriSchemeReplyHandler(QOAuthOobReplyHandler):

    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject]) -> None: ...
    @typing.overload
    def __init__(self, redirectUrl: QtCore.QUrl, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    redirectUrlChanged: typing.ClassVar[QtCore.pyqtSignal]
    def isListening(self) -> bool: ...
    def close(self) -> None: ...
    def listen(self) -> bool: ...
    def redirectUrl(self) -> QtCore.QUrl: ...
    def setRedirectUrl(self, url: QtCore.QUrl) -> None: ...
    def callback(self) -> str: ...


PYQT_NETWORKAUTH_VERSION = ... # type: int
PYQT_NETWORKAUTH_VERSION_STR = ... # type: str
