import { OAuthClient, AuthHeader, Token, GenerateAuthUrlOptions } from "./types";
import { RequestOptions } from "./request";
export type OAuth2Scopes = "account:read" | "invoices:create" | "invoices:read" | "transactions:read" | "balance:read" | "payments:send";
export interface OAuth2UserOptions {
    client_id: string;
    client_secret?: string;
    callback: string;
    scopes: OAuth2Scopes[];
    request_options?: Partial<RequestOptions>;
    user_agent: string;
    token?: Token;
}
export type TokenRefreshedListener = (tokens: Token) => void;
export type TokenRefreshFailedListener = (error: Error) => void;
export type EventName = "tokenRefreshed" | "tokenRefreshFailed";
export type EventListener = TokenRefreshedListener | TokenRefreshFailedListener;
export declare class OAuth2User implements OAuthClient {
    token?: Token;
    options: OAuth2UserOptions;
    code_verifier?: string;
    code_challenge?: string;
    private _refreshAccessTokenPromise;
    private _tokenEvents;
    constructor(options: OAuth2UserOptions);
    /**
     * Subscribe to the events
     */
    on(eventName: EventName, listener: EventListener): void;
    /**
     * Refresh the access token
     */
    refreshAccessToken(): Promise<{
        token: Token;
    }>;
    /**
     * Check if an access token is expired
     */
    isAccessTokenExpired(): boolean;
    /**
     * Request an access token
     */
    requestAccessToken(code?: string): Promise<{
        token: Token;
    }>;
    generateAuthURL(options?: GenerateAuthUrlOptions): string;
    getAuthHeader(): Promise<AuthHeader>;
}
//# sourceMappingURL=OAuth2User.d.ts.map