33 lines
671 B
Protocol Buffer
33 lines
671 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package twirp.example.haberdasher;
|
|
option go_package = "haberdasher-twirp/haberdasher";
|
|
|
|
// Haberdasher service makes hats for clients.
|
|
service Haberdasher {
|
|
// MakeHat produces a hat of mysterious, randomly-selected color!
|
|
rpc MakeHat(Size) returns (Hat);
|
|
|
|
rpc ListHats(HatQuery) returns (Hats);
|
|
}
|
|
|
|
message HatQuery {
|
|
int32 limit = 1;
|
|
}
|
|
|
|
// Size of a Hat, in inches.
|
|
message Size {
|
|
int32 inches = 1; // must be > 0
|
|
}
|
|
|
|
// A Hat is a piece of headwear made by a Haberdasher.
|
|
message Hat {
|
|
int32 inches = 1;
|
|
string color = 2; // anything but "invisible"
|
|
string name = 3; // i.e. "bowler"
|
|
}
|
|
|
|
message Hats {
|
|
repeated Hat hats = 1;
|
|
}
|