Skip to content

Instantly share code, notes, and snippets.

@agreatfool
Created February 6, 2018 07:52
Show Gist options
  • Save agreatfool/5e3a41052c6dd2f6d04b30901fc0269b to your computer and use it in GitHub Desktop.
Save agreatfool/5e3a41052c6dd2f6d04b30901fc0269b to your computer and use it in GitHub Desktop.
Sample proto file
syntax = "proto3";
package com.book;
message Book {
int64 isbn = 1;
string title = 2;
string author = 3;
}
message GetBookRequest {
int64 isbn = 1;
}
message GetBookViaAuthor {
string author = 1;
}
service BookService {
rpc GetBook (GetBookRequest) returns (Book) {}
rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}
rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}
rpc GetBooks (stream GetBookRequest) returns (stream Book) {}
}
message BookStore {
string name = 1;
map<int64, string> books = 2;
}
enum EnumSample {
option allow_alias = true;
UNKNOWN = 0;
STARTED = 1;
RUNNING = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment