import Base from '../api/base.js'; import { EventCallback } from '../nanoevents.js'; import { IEBayApiRequest } from '../request.js'; import { AppConfig, Scope } from '../types/index.js'; export type Token = { access_token: string; expires_in?: number; token_type?: string; }; export type ClientToken = Token; export type AuthToken = Token & { refresh_token: string; refresh_token_expires_in?: number; }; export default class OAuth2 extends Base { static readonly IDENTITY_ENDPOINT: Record; static readonly AUTHORIZE_ENDPOINT: Record; static readonly defaultScopes: Scope; private readonly emitter; private scope; private _clientToken?; private _authToken?; constructor(config: AppConfig, req: IEBayApiRequest); on(event: string, callback: EventCallback): () => void; get identityEndpoint(): string; static generateAuthUrl(sandbox: boolean, appId: string, ruName: string, scope: string[], state?: string): string; generateAuthUrl(ruName?: string, scope?: string[], state?: string): string; getAccessToken(): Promise; getUserAccessToken(): string | null; getApplicationAccessToken(): Promise; getScope(): string[]; setClientToken(clientToken?: Token): void; setScope(scope: Scope): void; mintApplicationAccessToken(): Promise; obtainApplicationAccessToken(): Promise; mintUserAccessToken(code: string, ruName?: string | undefined): Promise; getToken(code: string, ruName?: string | undefined): Promise; refreshUserAccessToken(): Promise; obtainToken(code: string): Promise; getCredentials(): AuthToken | ClientToken | null; setCredentials(authToken: AuthToken | string): void; refreshToken(): Promise; }