import {Api} from "./core/index"; import {DynamicApi, HasDelete, HasGet, HasOptions, HasPatch, HasPost, HasPut} from "./core/ApiTypes"; import {ApiStructureMap} from "./core/StructureTypes"; import axios from 'axios' type StandardResource = HasOptions & HasGet & HasPost & { [id: string]: HasGet & HasPut & HasDelete; } interface MyApi { people: HasGet & HasPost & { (id): HasPut & HasDelete & { addresses: HasGet & HasPost & { (id): HasDelete & HasPut; } }; nearMe: HasGet, me: HasGet & { (id): HasPut } }; } let structure = { people: { $id: { addresses: { $id: {} } }, nearMe: {}, me: { $id: {} } } } as ApiStructureMap // async function doStuff() { // let api = Api('/api', axios , {structure}) as MyApi; // let result = await api.people('123').addresses.get({ x: 'hello', y: 'world'}); // // let dynamic = Api('/api', axios) as DynamicApi; // let result2 = await dynamic.people['123'].addresses.get({ x: 'hello', y: 'world'}); // }