-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathclientInterface.go.tmpl
More file actions
38 lines (34 loc) · 1.13 KB
/
clientInterface.go.tmpl
File metadata and controls
38 lines (34 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{{- define "clientInterface" -}}
{{- $services := .Services -}}
{{- $typeMap := .TypeMap -}}
{{- $opts := .Opts -}}
{{- if $services}}
//
// Client interface
//
{{- "\n" -}}{{ range $_, $service := $services}}
export interface {{$service.Name}}Client {
{{- range $i, $method := $service.Methods}}
{{- $deprecated := index $method.Annotations "deprecated" -}}
{{- if gt (len $method.Comments) 0 }}
/**
{{- range $_, $comment := $method.Comments }}
* {{ replaceAll $comment "\"" "'" }}
{{- end }}
{{- if $deprecated }}
*
* @deprecated {{ $deprecated.Value }}
{{- end }}
*/
{{- else if $deprecated }}
/**
* @deprecated {{ $deprecated.Value }}
*/
{{- end }}
{{firstLetterToLower $method.Name}}({{template "methodInputs" dict "Method" $method "TypeMap" $typeMap "Opts" $opts}}): {{if $method.StreamOutput}}WebrpcStreamController{{else}}{{if $method.Succinct}}Promise<{{(index $method.Outputs 0).Type}}>{{else}}Promise<{{$method.Name}}{{if $opts.compat}}Return{{else}}Response{{end}}>{{end}}{{end}}
{{- if lt (add $i 1) (len $service.Methods)}}{{"\n"}}{{end}}
{{- end}}
}
{{- end}}
{{- end -}}
{{- end -}}