import { BaseService } from "stentor-models"; /** * A simple map of keys and values that are used * to replace a templated request. * * @export * @interface RequestMap */ export interface RequestMap { [key: string]: string; } /** * A simple map of keys of T to where to find them * in the payload using JSONPath. * * Note: It would nice to have this eventually typed * where the key is a key of T. * * @export * @interface ResponseMap */ export interface ResponseMap { [key: string]: string; } /** * A particular resource for a service; the path to the resource * and how to map the returned payload to an actionable object. * * @export * @interface Resource * @template T */ export interface Resource { name?: string; path: string; query?: { [key: string]: string; }; defaultValues?: T; requestMap?: ResponseMap; responseMap?: ResponseMap; } /** * Definition of an external resource service. * * @export * @interface ResourceService * @extends {Service} */ export interface ResourceService extends BaseService { protocol?: string; hostname: string; port?: number; headers?: HeadersInit; resources?: Resource[]; } /** * Maps a response payload to the resource. * * @export * @template T * @param {*} payload * @param {Resource} resource * @returns {T} */ export declare function mapResponseToResource(payload: any, resource: Resource): T;