Many-in-one AI client.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
696 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. once<D>(event: 'data', callback: DataEventCallback<D>): this;
  8. once(event: 'end', callback: () => void): this;
  9. once(event: 'error', callback: ErrorEventCallback): this;
  10. }
  11. export class PlatformApiError extends Error {
  12. constructor(message: string, readonly response: Response) {
  13. super(message);
  14. this.name = 'PlatformApiError';
  15. }
  16. }