@lightfeed/sdk
Version:
Lightfeed SDK for Node.js
55 lines (54 loc) • 2 kB
TypeScript
import { LightfeedConfig, RecordsResponse, GetRecordsParams, SearchRecordsParams, FilterRecordsParams } from "./types";
/**
* Lightfeed API Client
*
* Client for interacting with the Lightfeed API to access your extracted web data.
*/
export declare class LightfeedClient {
private readonly httpClient;
private readonly config;
/**
* Creates a new Lightfeed API client
*
* @param config Client configuration
*/
constructor(config: LightfeedConfig);
/**
* Get all records from a database with optional filters
*
* @param databaseId The database ID
* @param params Optional query parameters
* @returns Records response containing results and pagination information
*/
getRecords(databaseId: string, params?: GetRecordsParams): Promise<RecordsResponse>;
/**
* Search records using semantic search with optional filters
*
* @param databaseId The database ID
* @param params Search parameters including search text, filters, and pagination
* @returns Records response containing results and pagination information
*/
searchRecords(databaseId: string, params: SearchRecordsParams): Promise<RecordsResponse>;
/**
* Filter records using complex filter expressions
*
* @param databaseId The database ID
* @param params Filter parameters including filter rules, time range, and pagination
* @returns Records response containing results and pagination information
*/
filterRecords(databaseId: string, params: FilterRecordsParams): Promise<RecordsResponse>;
/**
* Handles and transforms API errors into a consistent format
*
* @param error The error from axios
* @returns A formatted LightfeedError
*/
private handleError;
/**
* Gets a default error message for a given status code
*
* @param status HTTP status code
* @returns A default error message
*/
private getDefaultErrorMessage;
}