Files
core/hwe/ts/util/APIPathGen.d.ts
T
Hide_D 5879661267 refac, feat: API 호출 구조 재작성
- api.php에서 param path 강제
- api.php에서 GET param 허용
- SammoAPI 호출자를 axios에서 fetch 기반(ky)로 변경
- SammoAPI에서 단순 POST대신 REST에 따라 지정 가능하도록 재구성
- SammoAPI에서 NumVar, StrVar를 PathParam으로 변경하도록 변경
- API CallType들을 def/API로 분리 시작
  - 일부 API를 시험삼아 변경(login)
2022-04-02 23:31:05 +09:00

26 lines
637 B
TypeScript

export function APIPathGen<T, V>(
obj: T,
callback: (path: string[], tail: V, pathParam?: Record<string, string | number>) => unknown,
pathParam?: Record<string, string | number>
): T;
export function StrVar<PathType extends string>(paramKey: string): <NextCall>(next: NextCall) => {
[v in PathType]: NextCall
};
export function NumVar<NextCall>(paramKey: string, next: NextCall): {
[v: number]: NextCall
};
/*
const apiPath = {
SomePath: someFunc,
User: StrVar<'a'|'b'>('name')({
Update: someFunc,
Delete: someFunc,
}),
NationInfo: NumVar('id', {
show: someFunc
})
}
*/