56 lines
902 B
Protocol Buffer
56 lines
902 B
Protocol Buffer
|
syntax = "proto3";
|
||
|
|
||
|
package service;
|
||
|
|
||
|
option go_package = ".;rpc";
|
||
|
|
||
|
import "google/api/annotations.proto";
|
||
|
|
||
|
message City {
|
||
|
int32 id = 1;
|
||
|
string name = 2;
|
||
|
string postalCode = 3;
|
||
|
}
|
||
|
|
||
|
message Address {
|
||
|
City city = 2;
|
||
|
string street = 3;
|
||
|
int32 number = 4;
|
||
|
int32 apartment = 5;
|
||
|
}
|
||
|
|
||
|
message Node {
|
||
|
int32 id = 1;
|
||
|
string name = 2;
|
||
|
string email = 3;
|
||
|
Address address = 4;
|
||
|
}
|
||
|
|
||
|
message NodeRequest {
|
||
|
string name = 1;
|
||
|
}
|
||
|
|
||
|
message Message {
|
||
|
string content = 1;
|
||
|
}
|
||
|
|
||
|
message NodeResponse {
|
||
|
int32 id = 1;
|
||
|
string name = 2;
|
||
|
string email = 3;
|
||
|
Address address = 4;
|
||
|
}
|
||
|
|
||
|
service NodeService {
|
||
|
rpc GetNode(NodeRequest) returns (NodeResponse) {
|
||
|
option (google.api.http) = { get: "/v1/node" };
|
||
|
}
|
||
|
|
||
|
rpc SayHello(Message) returns (Message) {
|
||
|
option (google.api.http) = {
|
||
|
post: "/v1/hello"
|
||
|
body: "*"
|
||
|
};
|
||
|
}
|
||
|
}
|