import { RPCError } from './RPCError';

export interface RPCClientCodec {
  request(method: string, args: any[], id: number): any;
  response(res: any): RPCClientResponseCodec;
}

export interface RPCClientResponseCodec {
  id(): number | undefined;
  error(): RPCError | undefined;
  result(): any | undefined;

  isNotification(): boolean;
  notification(): RPCClientNotificationCodec | undefined;
}

export interface RPCClientNotificationCodec {
  method(): string;
  params(): any | undefined;
}
