import { CallOptions, ClientMiddleware } from 'nice-grpc-common'; import { CompatServiceDefinition, NormalizedServiceDefinition, ServiceDefinition } from '../service-definitions'; import { Channel } from './channel'; import { Client } from './Client'; export type ClientFactory = { /** * Attach a middleware to the client factory. * * This method returns a new client factory with the middleware attached. * * A middleware that is attached first, will be invoked last. * * @param middleware The middleware to attach. * @returns A new client factory with the middleware attached. */ use(middleware: ClientMiddleware): ClientFactory; /** * Create a client using the client factory. * * @param definition The service definition. * @param channel The channel to use. * @param defaultCallOptions Default call options per method, or `'*'` for all * methods. */ create(definition: Service, channel: Channel, defaultCallOptions?: DefaultCallOptions, CallOptionsExt>): Client; }; export type DefaultCallOptions = { [K in keyof Service | '*']?: CallOptions & Partial; }; /** * Create a client factory that can be used to create clients with middleware. */ export declare function createClientFactory(): ClientFactory; /** * Create a client with no middleware. * * This is the same as calling `createClientFactory().create()`. */ export declare function createClient(definition: Service, channel: Channel, defaultCallOptions?: DefaultCallOptions>): Client;