Many-in-one AI client.

17 lines
522 B

  1. export type DataEventCallback<D> = (data: D) => void;
  2. export type ErrorEventCallback = (event: Error) => void;
  3. export interface PlatformEventEmitter extends NodeJS.EventEmitter {
  4. on<D>(event: 'data', callback: DataEventCallback<D>): this;
  5. on(event: 'end', callback: () => void): this;
  6. on(event: 'error', callback: ErrorEventCallback): this;
  7. }
  8. export class PlatformApiError extends Error {
  9. constructor(message: string, readonly response: Response) {
  10. super(message);
  11. this.name = 'PlatformApiError';
  12. }
  13. }