import { AxiosInstance } from 'axios'; import { Authorization } from '../client'; export interface OauthToken { access_token: string; expires_in: string; refresh_token: string; scope: string; token_type: string; } export interface TradingSession { accountId: string; clientId: string; lightstreamerEndpoint: string; oauthToken: OauthToken; timezoneOffset: number; } export interface SwitchAccountResponse { dealingEnabled: boolean; hasActiveDemoAccounts: boolean; hasActiveLiveAccounts: boolean; trailingStopsEnabled: boolean; } export declare class LoginAPI { private readonly apiClient; private readonly auth; static readonly URL: { REFRESH_TOKEN: string; SESSION: string; }; constructor(apiClient: AxiosInstance, auth: Authorization); /** * Creates a trading session, obtaining session tokens for subsequent API access. Please note that region-specific * login restrictions may apply. * * @param username - Username * @param password - Password * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=534 */ createSession(username?: string, password?: string): Promise; /** * Switches active accounts, optionally setting the default IG account (of type CFD or spreadbet), against which trades may be made. * * @param accountId - Account ID * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=534 */ switchAccount(accountId: string): Promise; /** * Saves the user's session details. * * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=534 */ getSessionToken(): Promise; /** * Creates a session from predefined token values. */ createSessionFromToken(securityToken: string, cst: string, accountId: string, lightstreamerEndpoint: string): void; /** * Creates a session using the IG Mobile App API. * * WARNING: This endpoint only works with a production environment. */ createSessionFromMobileLogin(username: string, password: string): Promise; /** * Returns the user's session details. * * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=534 */ getSession(): Promise; login(username: string, password: string): Promise; /** * Log out of the current session. * * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=600 */ logout(): Promise; /** * Refreshes a trading session, obtaining new session tokens for subsequent API access. * * @see cache:https://labs.ig.com/rest-trading-api-reference/service-detail?id=523 */ refreshToken(): Promise; }