import { Config, AuthConfig, IDToken, ProviderList, IMAPPayload, EWSPayload } from "./@types"; import { FetchEventSourceInit } from "@microsoft/fetch-event-source"; export declare class NylasSessions { private clientId; private redirectUri; private accessType; private domain; private versioned; private Storage; private hosted; private multiAccount; private loginId; constructor(config: Config); validateAccessToken(grant_id?: string): Promise; validateIDToken(grant_id?: string): Promise; getDomain(): string; auth(config: AuthConfig): Promise; private generateAuthURL; generateReauthURL(grant_id: string, scopes: string[]): Promise; generateCodeChallenge(): Promise; private hostedSetCodeChallenge; private getCodeChallege; isLoggedIn(): Promise; isMultiAccount(): boolean; logout(): Promise; getProfile(grant_id?: string): Promise; getProfiles(): Promise; removeProfile(id: string): Promise; authIMAP(data: IMAPPayload): Promise; authEWS(data: EWSPayload): Promise; detectEmail(email: string): Promise; applicationInfo(): Promise; getAvailableProviders(): Promise; onLoginSuccess(callback: Function): void; onLogoutSuccess(callback: Function): void; onLoginFail(callback: any): void; onTokenRefreshSuccess(callback: Function): void; onTokenRefreshFail(callback: any): void; onSessionExpired(callback: any): void; codeExchange(search: string | null): Promise; tokenExchange(grant_id?: string): Promise; private handleCodeExchangeResponse; popUp(url: string): Promise; getAccessToken(grant_id?: string): Promise; sse(url: string, request: FetchEventSourceInit): Promise; fetch(url: string, request: any, parseJSON?: boolean, domain?: string): Promise; /** * This method will make a request to the Nylas API to exchange an authorization code for an access token. * @param path A path to the Nylas API, e.g. `/v3/grants/methreads` * @param method GET, POST, PUT, DELETE, etc. * @param body A JSON object to send as the body of the request * @param domain The domain to use for the request, e.g. `api.us.nylas.com` * @param parseJSON Whether to parse the response as JSON or return the readable stream/body response (default: true) * @param request A RequestInit object to pass to the fetch request * @returns */ fetchRequest(path: string, method?: "GET" | "POST" | "PUT" | "DELETE", body?: any, parseJSON?: boolean, domain?: string, request?: RequestInit): Promise; fetchRequest(path: string, method: "GET" | "POST" | "PUT" | "DELETE", body: any, parseJSON: false, domain?: string, request?: RequestInit): Promise | null>; fetchRequest(path: string, method: "GET" | "POST" | "PUT" | "DELETE", body: any, parseJSON: true, domain?: string, request?: RequestInit): Promise; fetchRequest(path: string, method: "GET" | "POST" | "PUT" | "DELETE", body: any, parseJSON: boolean, domain?: string, request?: RequestInit): Promise | null>; private isAuthenticatedResponse; addAPIKey(grant_id: string, email: string, key: string): void; }