2016-12-13 21:10:02 +03:00
|
|
|
// GENERATED CODE -- DO NOT EDIT!
|
2016-12-16 18:24:05 +03:00
|
|
|
{{$Package:=.File.Package}}
|
2016-12-13 21:10:02 +03:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
var grpc = require('grpc');
|
2016-12-16 18:08:37 +03:00
|
|
|
var {{$Package}}_{{$Package}}_pb = require('../{{$Package}}/{{$Package}}_pb.js');
|
|
|
|
|
|
|
|
{{range .File.Service}}
|
|
|
|
{{range .Method}}
|
|
|
|
function serialize_{{$Package}}_{{.InputType | splitArray "." | last}}(arg) {
|
|
|
|
if (!(arg instanceof {{$Package}}_{{$Package}}_pb.{{.InputType | splitArray "." | last}})) {
|
|
|
|
throw new Error('Expected argument of type {{$Package}}.{{.InputType | splitArray "." | last}}');
|
|
|
|
}
|
|
|
|
return new Buffer(arg.serializeBinary());
|
2016-12-13 21:10:02 +03:00
|
|
|
}
|
|
|
|
|
2016-12-16 18:08:37 +03:00
|
|
|
function deserialize_{{$Package}}_{{.InputType | splitArray "." | last}}(buffer_arg) {
|
|
|
|
return {{$Package}}_{{$Package}}_pb.{{.InputType | splitArray "." | last}}.deserializeBinary(new Uint8Array(buffer_arg));
|
2016-12-13 21:10:02 +03:00
|
|
|
}
|
|
|
|
|
2016-12-16 18:08:37 +03:00
|
|
|
function serialize_{{$Package}}_{{.OutputType | splitArray "." | last}}(arg) {
|
|
|
|
if (!(arg instanceof {{$Package}}_{{$Package}}_pb.{{.OutputType | splitArray "." | last}})) {
|
|
|
|
throw new Error('Expected argument of type {{$Package}}.{{.OutputType | splitArray "." | last}}');
|
|
|
|
}
|
|
|
|
return new Buffer(arg.serializeBinary());
|
2016-12-13 21:10:02 +03:00
|
|
|
}
|
|
|
|
|
2016-12-16 18:08:37 +03:00
|
|
|
function deserialize_{{$Package}}_{{.OutputType | splitArray "." | last}}(buffer_arg) {
|
|
|
|
return {{$Package}}_{{$Package}}_pb.{{.OutputType | splitArray "." | last}}.deserializeBinary(new Uint8Array(buffer_arg));
|
2016-12-13 21:10:02 +03:00
|
|
|
}
|
|
|
|
{{end}}
|
2016-12-16 18:08:37 +03:00
|
|
|
{{end}}
|
2016-12-13 21:10:02 +03:00
|
|
|
|
2016-12-16 18:08:37 +03:00
|
|
|
{{range .File.Service}}
|
|
|
|
var {{.Name}}Service = exports.{{.Name}}Service = {
|
|
|
|
{{$serviceName:=.Name}}
|
|
|
|
{{range .Method}}
|
|
|
|
{{.Name | lowerFirst}}: {
|
|
|
|
path: '/{{$Package}}.{{$serviceName}}/{{.Name}}',
|
|
|
|
requestStream: {{.ClientStreaming | default "false"}},
|
|
|
|
responseStream: {{.ServerStreaming | default "false"}},
|
|
|
|
requestType: {{$Package}}_{{$Package}}_pb.{{.InputType | splitArray "." | last}},
|
|
|
|
responseType: {{$Package}}_{{$Package}}_pb.{{.OutputType | splitArray "." | last}},
|
|
|
|
requestSerialize: serialize_{{$Package}}_{{.InputType | splitArray "." | last}},
|
|
|
|
requestDeserialize: deserialize_{{$Package}}_{{.InputType | splitArray "." | last}},
|
|
|
|
responseSerialize: serialize_{{$Package}}_{{.OutputType | splitArray "." | last}},
|
|
|
|
responseDeserialize: deserialize_{{$Package}}_{{.OutputType | splitArray "." | last}},
|
|
|
|
},
|
|
|
|
{{end}}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.{{.Name}}Client = grpc.makeGenericClientConstructor({{.Name}}Service);
|
|
|
|
{{end}}
|