Last active
November 26, 2015 10:38
-
-
Save bobbytables/f18da91913cd1336912c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
message Error { | |
string message = 1; | |
int32 error_code = 20; | |
} | |
message Application { | |
string id = 1; | |
string type = 2; | |
} | |
message CreateApplicationRequest { | |
string type = 1; | |
} | |
message CreateApplicationResponse { | |
oneof SuccessOrError { | |
Application application = 1; | |
Error error = 20; | |
}; | |
} | |
service Server { | |
// Sends a greeting | |
rpc CreateApplication (CreateApplicationRequest) returns (CreateApplicationResponse) {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
message Application { | |
string id = 1; | |
string type = 2; | |
string error = 20 | |
} | |
service Server { | |
rpc CreateApplication (Application) returns (Application) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Didn't know about
oneof
thats pretty cool!I think prefer
style2.proto
. Seems more similar to signature from most Go functions. TheCreateApplication
function returns an error (or nil for error):Client:
Service: