UNPKG

@curatedotfun/masa-source

Version:
56 lines (55 loc) 1.9 kB
import type { SourceItem } from "@curatedotfun/types"; export interface MasaSearchResult extends SourceItem { ID: string; ExternalID: string; Content: string; Metadata: { author?: string; user_id?: string; created_at?: string; conversation_id?: string; IsReply?: boolean; InReplyToStatusID?: string; [key: string]: any; }; [key: string]: any; } export interface MasaApiSearchOptions { query: string; maxResults?: number; sinceDate?: string; } export interface MasaClientConfig { apiKey: string; baseUrl?: string; } /** * Client for interacting with the Masa API for social media scraping. */ export declare class MasaClient { private apiKey; private baseUrl; constructor(config: MasaClientConfig); /** * Submit a search job to the Masa API. * @param searchType The type of scraper, e.g., "twitter-scraper". * @param query The search query. * @param maxResults Maximum number of results to return. * @returns Promise resolving to the UUID of the search job, or null on error. */ submitSearchJob(searchType: string, query: string, maxResults: number): Promise<string | null>; /** * Check the status of a Masa search job. * @param searchType The type of scraper used for the job. * @param uuid The UUID of the search job. * @returns Promise resolving to the status of the job. */ checkJobStatus(searchType: string, uuid: string): Promise<string | null>; /** * Retrieve the results of a completed Masa search job. * @param searchType The type of scraper used for the job. * @param uuid The UUID of the search job. * @returns Promise resolving to an array of search results, or null on error. */ getJobResults(searchType: string, uuid: string): Promise<MasaSearchResult[] | null>; }