import type * as Airtop from '../api'; import { Sessions as SessionsClass, type Sessions as SessionsNamespace } from '../api/resources/sessions/client/Client'; export interface AirtopSessionConfigV1 extends Airtop.SessionConfigV1 { skipWaitSessionReady?: boolean; } export interface AirtopSessionRestInputV1 { /** Session configuration */ configuration?: AirtopSessionConfigV1; } export declare class AirtopSessions extends SessionsClass { readonly _options: SessionsNamespace.Options; private debug; constructor(_options: SessionsNamespace.Options, debug?: boolean); log(message: any): void; /** * @param {Airtop.SessionRestInputV1} request * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.sessions.create() */ create(request?: AirtopSessionRestInputV1, requestOptions?: SessionsNamespace.RequestOptions): Promise; /** * Waits for a session to enter the 'running' status * * @param id - The ID of the session to wait for * @param requestOptions - Optional request configuration including timeout * @returns The session event indicating the session is ready, or null if timed out */ waitForSessionReady(id: string, requestOptions?: SessionsNamespace.RequestOptions): Promise; /** * Waits for a file to be downloaded in a session and reach 'available' status. * Defaults to looking back 5 seconds in the event stream for the file to be available. * Use `lookbackSeconds` to control this behavior. * * @param {string} sessionId - The ID of the session to monitor * @param {Object} configuration - The optional configuration parameters for the function * @param {number} [configuration.lookbackSeconds=5] - The number of seconds to look back for prior events. Default `5`. 0 means no lookback. * @param {Sessions.RequestOptions} [requestOptions] - Optional request configuration including timeout * @returns {Promise<{ id: string, downloadUrl: string } | null>} Object containing file's id and downloadUrl, or null if timed out */ waitForDownload(sessionId: string, configuration?: { lookbackSeconds?: number; }, requestOptions?: SessionsNamespace.RequestOptions): Promise<{ id: string; downloadUrl: string; } | null>; /** * Waits for a file download to start in a session. * Defaults to looking back 5 seconds in the event stream for the file to be available. * Use `lookbackSeconds` to control this behavior. * * @param {string} sessionId - The ID of the session to monitor * @param {Object} configuration - The optional configuration parameters for the function * @param {number} [configuration.lookbackSeconds=5] - The number of seconds to look back for prior events. Default `5`. 0 means no lookback. * @param {Sessions.RequestOptions} [requestOptions] - Optional request configuration including timeout * @returns {Promise<{ id: string, downloadUrl: string } | null>} Object containing file's id and downloadUrl, or null if timed out */ waitForDownloadStart(sessionId: string, configuration?: { lookbackSeconds?: number; }, requestOptions?: SessionsNamespace.RequestOptions): Promise<{ id: string; downloadUrl: string; } | null>; /** * Downloads the next file from a session as soon as it starts to become available * * @param {string} sessionId - The ID of the session to download from * @param {string} destinationPath - The local path where the file should be saved * @param {Object} configuration - The optional configuration parameters for the function * @param {function} [configuration.onProgress] - Optional callback to track download progress * @param {number} [configuration.lookbackSeconds=5] - Optional number of seconds to look back for prior events. Default `5`. 0 means no lookback. * @param {number} [configuration.timeoutSeconds=120] - Optional timeout in seconds. Default `120`. * @param {Sessions.RequestOptions} [requestOptions] - Optional request configuration including timeout * @throws Error if no file is available to download within the timeout period */ downloadNextFile(sessionId: string, destinationPath: string, configuration?: { onProgress?: (downloadedBytes: number, totalBytes: number) => void; lookbackSeconds?: number; timeoutSeconds?: number; }, requestOptions?: SessionsNamespace.RequestOptions): Promise; /** * Waits for a file upload to become available to a session. * * @param sessionId - The session id for the file upload. * @param fileId - The file id for the file upload. * @param timeoutSeconds - The timeout in seconds. * @returns The event for the file upload. */ waitForUploadAvailable(sessionId: string, fileId: string, timeoutSeconds?: number): Promise; /** * Captcha event listener * Defaults to looking back 5 seconds in the event stream for the captcha event to be available. * Use `lookbackSeconds` to control this behavior. * * @param {string} sessionId - The ID of the session to monitor * @param {function} callback - The callback function to be called when a captcha event is received * @param {Object} configuration - The optional configuration parameters for the function * @param {number} [configuration.lookbackSeconds=5] - The number of seconds to look back for prior events. Default `5`. 0 means no lookback. * @param {Sessions.RequestOptions} [requestOptions] - Optional request configuration including timeout * @returns {function} - A function to stop listening for captcha events */ onCaptchaEvent(sessionId: string, callback: (data: Airtop.CaptchaEventMessage) => void | Promise, configuration?: { lookbackSeconds?: number; }, requestOptions?: SessionsNamespace.RequestOptions): () => void; }