UNPKG

@noves/intent-typescript-sdk

Version:

Noves Intent Typescript SDK

18 lines (17 loc) 1.3 kB
import { BaseSDKConfig, Intent } from './types'; import { IntentMap, IntentParams, IntentResponse, ValueIntentId, StreamableIntentId } from '../types/generated'; export declare abstract class IntentSDKBase { protected config: BaseSDKConfig; protected intents: Intent[]; private initialized; constructor(config: BaseSDKConfig); private init; protected ensureInitialized(): Promise<void>; protected loadIntents(): void; protected abstract executeIntent(intentId: string, params: Record<string, any>): Promise<any>; protected abstract getStream<T extends StreamableIntentId>(intentId: T, params: IntentMap[T]['params'], onData: (data: IntentMap[T]['response']) => void, onError?: (error: Error) => void, onComplete?: () => void): Promise<void>; protected abstract getValue<T extends ValueIntentId>(intentId: T, params: IntentMap[T]['params'], pageSize?: number): Promise<IntentMap[T]['response']>; getIntents(): Promise<Intent[]>; protected execute<T extends keyof IntentMap>(intentId: T, params: IntentParams<T>): Promise<IntentResponse<T>>; protected stream<T extends StreamableIntentId>(intentId: T, params: IntentMap[T]['params'], onData: (data: IntentResponse<T>) => void, onError?: (error: Error) => void, onComplete?: () => void): Promise<void>; }