// The Heavenly Office – HeavenlyOffice, the gRPC service of the The Heavenly Office practice sandbox. // // Import this file into Postman (New > gRPC > Service definition > Import a .proto file), or let // the server's reflection describe the service. GetTablet and ListTablets need no token; every other // method except Login needs "authorization: Bearer " in the call metadata – the token // comes from Login with your sandbox username and password. syntax = "proto3"; package heaven.registry.v1; import "google/protobuf/timestamp.proto"; service HeavenlyOffice { // Your sandbox username and password → a token for the metadata. rpc Login(LoginRequest) returns (LoginResponse); // One tablet by id. NOT_FOUND when there is none for you. rpc GetTablet(GetTabletRequest) returns (Tablet); // A filtered page and the total number of matches. rpc ListTablets(ListTabletsRequest) returns (ListTabletsResponse); // A new tablet of yours. Needs a token. rpc CreateTablet(CreateTabletRequest) returns (Tablet); // Replaces one of your tablets entirely: fields you leave unset return to their defaults. Needs a token. rpc UpdateTablet(UpdateTabletRequest) returns (Tablet); // Deletes one of your tablets. Needs a token. rpc DeleteTablet(DeleteTabletRequest) returns (DeleteTabletResponse); // Server streaming: count messages, one every interval_ms. Needs a token. rpc WatchOmens(WatchOmensRequest) returns (stream Omen); // Client streaming: send reports, end the stream, get one summary. Needs a token. rpc SubmitReports(stream Report) returns (SubmitSummary); // Bidirectional streaming: one reply to every message you send. Needs a token. rpc DragonCouncil(stream CouncilMessage) returns (stream CouncilMessage); // Answers after delay_ms – a method to try deadlines and cancelling on. Needs a token. rpc ConsultOracle(ConsultOracleRequest) returns (OracleAnswer); } enum Rank { RANK_UNSPECIFIED = 0; EMPEROR = 1; OFFICIAL = 2; DRAGON = 3; IMMORTAL = 4; SPIRIT = 5; DEMON = 6; } enum Element { ELEMENT_UNSPECIFIED = 0; WOOD = 1; FIRE = 2; EARTH = 3; METAL = 4; WATER = 5; } enum Status { STATUS_UNSPECIFIED = 0; ACTIVE = 1; SLEEPING = 2; BANISHED = 3; } enum Severity { SEVERITY_UNSPECIFIED = 0; GOOD = 1; NEUTRAL = 2; BAD = 3; } message Tablet { // Set by the server: 21 and up for yours, 1–20 for the sealed ones. int32 id = 1; // 1 to 100 characters, unique (case does not matter). string name = 2; Rank rank = 3; Element element = 4; // 0 to 1000. int32 power = 5; // Unset means ACTIVE. Status status = 6; // At most 10. repeated string artifacts = 7; // At most 10 pairs. map titles = 8; // Read-only: true for the sealed tablets. bool sealed = 9; // Read-only. google.protobuf.Timestamp created_at = 10; } message LoginRequest { string username = 1; string password = 2; } message LoginResponse { string token = 1; // Seconds the token stays valid. int32 expires_in = 2; } message GetTabletRequest { int32 id = 1; } message ListTabletsRequest { // Unset (…_UNSPECIFIED) means no filter. Filters combine with AND. Rank rank = 1; Element element = 2; Status status = 3; // Part of the name, case does not matter. string name_contains = 4; // 0 means 20; at most 100. int32 limit = 5; int32 offset = 6; } message ListTabletsResponse { // All matches, not only this page. int32 total = 1; repeated Tablet tablets = 2; } message CreateTabletRequest { string name = 1; Rank rank = 2; Element element = 3; int32 power = 4; Status status = 5; repeated string artifacts = 6; map titles = 7; } message UpdateTabletRequest { int32 id = 1; // The whole new tablet; its id, sealed and created_at are ignored. Tablet tablet = 2; } message DeleteTabletRequest { int32 id = 1; } message DeleteTabletResponse { bool success = 1; string message = 2; } message WatchOmensRequest { // 0 means 10; at most 50. int32 count = 1; // 0 means 1000; otherwise 200 to 5000. int32 interval_ms = 2; } message Omen { // Position in the list: 1, 2, 3 … int32 id = 1; string text = 2; Severity severity = 3; google.protobuf.Timestamp observed_at = 4; } message Report { // Must not be empty. string province = 1; // 0 to 10000. int32 rainfall_mm = 2; } message SubmitSummary { int32 accepted = 1; int32 rejected = 2; // The sum over accepted reports only. int32 total_rainfall_mm = 3; } message CouncilMessage { string author = 1; string text = 2; } message ConsultOracleRequest { // 0 means 5000; at most 30000. int32 delay_ms = 1; } message OracleAnswer { string text = 1; int32 waited_ms = 2; }