2025-12-06 13:00:03 +03:00

28 lines
928 B
Cheetah

{{- /*gotype: efprojects.com/kitten-ipc/kitcom/internal/ts.tsGenData*/ -}}
// Code generated by kitcom. DO NOT EDIT.
import {ParentIPC, ChildIPC} from 'kitten-ipc';
{{ range $e := .Api.Endpoints }}
export default class {{ $e.Name }} {
protected ipc: ParentIPC | ChildIPC;
constructor(ipc: ParentIPC | ChildIPC) {
this.ipc = ipc;
}
{{ range $mtd := $e.Methods }}
async {{ $mtd.Name }}(
{{ range $par := $mtd.Params }}{{ $par.Name }}: {{ $par.Type | typedef }}, {{ end }}
): Promise<{{ if len $mtd.Ret }}{{ (index $mtd.Ret 0).Type | typedef }}{{ else }}void{{ end }}> {
const results = await this.ipc.call('{{ $e.Name }}.{{ $mtd.Name }}',
{{ range $par := $mtd.Params }}{{ $par.Name }}, {{ end }}
);
return {{ range $i, $ret := $mtd.Ret }}{{ if $i }}, {{ end }}{{ convtype (printf "results[%d]" $i) $ret.Type }}{{ end }}
}
{{ end }}
}
{{ end }}