2017-05-01 23:55:55 +02:00
|
|
|
// Code generated by protoc-gen-gotemplate
|
2018-08-09 10:23:10 +02:00
|
|
|
{{- $file := .File}}
|
2017-05-01 23:55:55 +02:00
|
|
|
package {{.File.Package}}
|
|
|
|
|
|
|
|
import (
|
2018-09-12 20:29:07 +02:00
|
|
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/article"
|
|
|
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
2017-05-01 23:55:55 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Repository interface {
|
|
|
|
{{range $m := .Service.Method}}{{with $t := $m.InputType | getMessageType $.File}} {{$m.Name}}({{range $f := $t.Field}}{{$f.Name|lowerCamelCase}} {{$f| goTypeWithPackage }} {{end}}) ({{with $out := $m.OutputType | getMessageType $.File}}{{range $f := $out.Field}}{{$f | goTypeWithPackage}}, {{end}}{{end}} error){{end}}{{end}}
|
2018-08-09 10:23:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------- Public SDK -----------------------------
|
|
|
|
{{$pkg := "pb"}}
|
|
|
|
|
|
|
|
|
|
|
|
{{range $m := .Service.Method}}
|
|
|
|
{{with $t := $m.InputType | getMessageType $.File}}
|
|
|
|
{{if and (not $m.ServerStreaming) (not $m.ClientStreaming)}}
|
|
|
|
{{/* ----------------------------- nominal case ---------------------------- */}}
|
|
|
|
// {{$m.Name}} : {{$m | httpVerb}} {{$m | httpPath}}
|
|
|
|
func (sdk *Sdk) {{$m.Name}}(ctx context.Context, {{if $t.OneofDecl}} req *{{$pkg}}.{{$m.Name}}Request,{{else}}{{range $f := $t.Field}}
|
|
|
|
{{$f.Name|lowerCamelCase}} {{$f| goTypeWithGoPackage $.File}},{{end}}{{end}} token, requestID string)({{with $out := $m.OutputType | getMessageType $.File}}{{range $f := $out.Field}}{{$f.Name|lowerCamelCase}} {{$f | goTypeWithGoPackage $.File}}, {{end}}{{end}}err error) {
|
|
|
|
|
|
|
|
out := &{{$pkg}}.{{$m.Name}}Response{}
|
|
|
|
_ = out
|
|
|
|
|
|
|
|
{{with $out := $m.OutputType | getMessageType $.File}}
|
|
|
|
return {{range $f := $out.Field}}out.{{$f.Name|camelCase}}, {{end}}nil
|
|
|
|
{{end}} {{/* with */}}
|
|
|
|
}
|
|
|
|
|
|
|
|
{{end}} {{/* streaming ifs */}}
|
2018-09-12 20:29:07 +02:00
|
|
|
{{end}}{{end}} {{/* range with */}}
|