import { type Connection } from '../network/connection.ts'; import { type NullableString } from '../protocol/definitions.ts'; import { type Reader } from '../protocol/reader.ts'; import { type Writer } from '../protocol/writer.ts'; export type Callback = (error: Error | null, payload?: ReturnType) => void; export type CallbackArguments = [cb: Callback]; export type RequestCreator = (...args: any[]) => Writer; export type ResponseParser = (correlationId: number, apiKey: number, apiVersion: number, reader: Reader) => ReturnType | Promise; export type ResponseErrorWithLocation = [string, [number, NullableString]]; export type APIWithCallback, ResponseType> = (connection: Connection, ...args: [...RequestArguments, ...Partial>]) => void; export type APIWithPromise, ResponseType> = (connection: Connection, ...args: RequestArguments) => Promise; export type API, ResponseType> = APIWithCallback & { async: APIWithPromise; key: number; version: number; }; export declare function createAPI, ResponseType>(apiKey: number, apiVersion: number, createRequest: RequestCreator, parseResponse: ResponseParser, hasRequestHeaderTaggedFields?: boolean, hasResponseHeaderTaggedFields?: boolean): API;