import type { ApiMethods } from '@puregram/api'; import type { ApiResponseError } from '../errors.js'; export type ApiCaller = (method: string, params?: Record) => Promise; interface SuppressAddition { /** if true, returns ApiResponseError instead of throwing on API errors */ suppress?: B; } type SuppressedReturn = void extends R ? void : undefined extends B ? R : false extends B ? R : R | ApiResponseError; type IsNullableParams

= unknown extends P ? true : undefined extends P ? true : false; type SuppressedMethod Promise> = M extends (params: infer P) => Promise ? true extends IsNullableParams

? (params?: P & SuppressAddition) => Promise> : (params: P & SuppressAddition) => Promise> : never; export type SuppressableApi = { [K in keyof ApiMethods]: SuppressedMethod; }; export interface ApiCallEscape { call: (method: string, params?: Record) => Promise; } export type TelegramApi = SuppressableApi & ApiCallEscape; export declare function createApiProxy(caller: ApiCaller): TelegramApi; export {}; //# sourceMappingURL=proxy.d.ts.map