| // |
| // Licensed to the Apache Software Foundation (ASF) under one or more |
| // contributor license agreements. See the NOTICE file distributed with |
| // this work for additional information regarding copyright ownership. |
| // The ASF licenses this file to You under the Apache License, Version 2.0 |
| // (the "License"); you may not use this file except in compliance with |
| // the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| // |
| |
| syntax = "proto3"; |
| |
| package helloworld; |
| option go_package = "./proto"; |
| |
| service Greeter { |
| // Unary RPC. |
| rpc SayHello (HelloRequest) returns (HelloReply) {} |
| rpc GetErrResp (HelloRequest) returns (HelloReply) {} |
| rpc Plus (PlusRequest) returns (PlusReply) {} |
| rpc SayHelloAfterDelay (HelloRequest) returns (HelloReply) {} |
| rpc SayMultipleHello(MultipleHelloRequest) returns (MultipleHelloReply) {} |
| |
| // Server side streaming. |
| rpc SayHelloServerStream (HelloRequest) returns (stream HelloReply) {} |
| |
| // Client side streaming. |
| rpc SayHelloClientStream (stream HelloRequest) returns (HelloReply) {} |
| |
| // Bidirectional streaming. |
| rpc SayHelloBidirectionalStream (stream HelloRequest) returns (stream HelloReply) {} |
| |
| } |
| |
| enum Gender { |
| GENDER_UNKNOWN = 0; |
| GENDER_MALE = 1; |
| GENDER_FEMALE = 2; |
| } |
| |
| message Person { |
| string name = 1; |
| int32 age = 2; |
| } |
| |
| message HelloRequest { |
| string name = 1; |
| repeated string items = 2; |
| Gender gender = 3; |
| Person person = 4; |
| } |
| |
| message HelloReply { |
| string message = 1; |
| repeated string items = 2; |
| Gender gender = 3; |
| } |
| |
| message PlusRequest { |
| int64 a = 1; |
| int64 b = 2; |
| } |
| |
| message PlusReply { |
| int64 result = 1; |
| } |
| |
| message MultipleHelloRequest { |
| string name = 1; |
| repeated string items = 2; |
| repeated Gender genders = 3; |
| repeated Person persons = 4; |
| } |
| |
| message MultipleHelloReply{ |
| string message = 1; |
| repeated string items = 2; |
| repeated Gender genders = 3; |
| } |
| |
| message ErrorDetail { |
| int64 code = 1; |
| string message = 2; |
| string type = 3; |
| } |