-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmethodInputs.go.tmpl
More file actions
35 lines (27 loc) · 911 Bytes
/
methodInputs.go.tmpl
File metadata and controls
35 lines (27 loc) · 911 Bytes
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
{{- define "methodInputs" -}}
{{- $method := .Method -}}
{{- $typeMap := .TypeMap -}}
{{- $opts := .Opts -}}
{{if $method.Succinct }}
{{- if gt (len $method.Inputs) 0}}req: {{(index $method.Inputs 0).Type}}, {{end}}
{{- if $method.StreamOutput -}}
options: WebrpcStreamOptions<{{(index $method.Outputs 0).Type}}>
{{- else -}}
headers?: object, signal?: AbortSignal
{{- end -}}
{{else if $opts.compat }}
{{- if gt (len $method.Inputs) 0}}req: {{$method.Name}}Args, {{end}}
{{- if $method.StreamOutput -}}
options: WebrpcStreamOptions<{{$method.Name}}Return>
{{- else -}}
headers?: object, signal?: AbortSignal
{{- end -}}
{{- else}}
{{- if gt (len $method.Inputs) 0}}req: {{$method.Name}}Request, {{end}}
{{- if $method.StreamOutput -}}
options: WebrpcStreamOptions<{{$method.Name}}Response>
{{- else -}}
headers?: object, signal?: AbortSignal
{{- end -}}
{{- end -}}
{{- end -}}