import type { CResult } from '../types.mts'; import type { Spinner } from '@socketsecurity/registry/lib/spinner'; import type { SocketSdkOperations, SocketSdkResult, SocketSdkSuccessResult } from '@socketsecurity/sdk'; // All outbound API requests use node:https.request rather than global fetch. // This ensures no body timeout is applied — large streaming ND-JSON responses // (e.g. full scan results) can transfer without a hard deadline. When // SSL_CERT_FILE is configured, a custom HttpsAgent carrying the extra CA // certificates is passed; otherwise the default agent is used. export type ApiFetchInit = { body?: string | undefined; headers?: Record | undefined; method?: string | undefined; }; export declare function apiFetch(url: string, init?: ApiFetchInit): Promise; export type CommandRequirements = { permissions?: string[] | undefined; quota?: number | undefined; }; // The Socket API server that should be used for operations. export declare function getDefaultApiBaseUrl(): string | undefined; /** * Get user-friendly error message for HTTP status codes. */ export declare function getErrorMessageForHttpStatusCode(code: number): Promise; export type HandleApiCallOptions = { description?: string | undefined; spinner?: Spinner | undefined; silence?: boolean | undefined; commandPath?: string | undefined; }; export type ApiCallResult = CResult['data']>; /** * Handle Socket SDK API calls with error handling and permission logging. */ export declare function handleApiCall(value: Promise>, options?: HandleApiCallOptions | undefined): Promise>; export declare function handleApiCallNoSpinner(value: Promise>, description: string): Promise['data']>>; /** * Query Socket API endpoint and return text response with error handling. */ export declare function queryApiSafeText(path: string, description?: string | undefined, commandPath?: string | undefined): Promise>; /** * Query Socket API endpoint and return parsed JSON response. */ export declare function queryApiSafeJson(path: string, description?: string): Promise>; export type SendApiRequestOptions = { method: 'POST' | 'PUT'; body?: unknown | undefined; description?: string | undefined; commandPath?: string | undefined; }; /** * Send POST/PUT request to Socket API with JSON response handling. */ export declare function sendApiRequest(path: string, options?: SendApiRequestOptions | undefined): Promise>; //# sourceMappingURL=api.d.mts.map