@akala/core
Version:
20 lines (19 loc) • 1.52 kB
TypeScript
import { HttpOptions } from '../http';
import { Api, IServerProxyBuilder } from './base';
export interface RestConfig<T> {
method: string;
url: string;
param?: {
[key in keyof T]: 'body' | 'query' | 'header' | 'route' | string;
} | 'body' | 'query' | 'route' | string;
type?: 'json' | 'xml';
}
export declare class Rest<TConnection, TServerOneWay, TServerTwoWay, TClientOneWay, TClientTwoWay, TServerOneWayProxy extends TServerOneWay, TServerTwoWayProxy extends TServerTwoWay, TClientOneWayProxy extends TClientOneWay, TClientTwoWayProxy extends TClientTwoWay> implements IServerProxyBuilder<string, TConnection, TServerOneWay, TServerTwoWay, TClientOneWay, TClientTwoWay, TServerOneWayProxy, TServerTwoWayProxy, TClientOneWayProxy, TClientTwoWayProxy> {
api: Api<TConnection, TServerOneWay, TServerTwoWay, TClientOneWay, TClientTwoWay, TServerOneWayProxy, TServerTwoWayProxy, TClientOneWayProxy, TClientTwoWayProxy>;
constructor(api: Api<TConnection, TServerOneWay, TServerTwoWay, TClientOneWay, TClientTwoWay, TServerOneWayProxy, TServerTwoWayProxy, TClientOneWayProxy, TClientTwoWayProxy>);
static buildCall<T extends object>(config: RestConfig<T>, baseURL: string | URL, param: T): HttpOptions;
createServerProxy(baseUrl: string): Partial<TServerOneWayProxy & TServerTwoWayProxy>;
createClient(baseUrl: string): (impl: TClientOneWay & TClientTwoWay) => Partial<TClientOneWay & TClientTwoWay> & {
$proxy(): Partial<TServerOneWayProxy & TServerTwoWayProxy>;
};
}