Created
October 11, 2016 06:14
-
-
Save shijuvar/dee62552068438b4100f914fee45cc81 to your computer and use it in GitHub Desktop.
Service interface and the structure of the payload messages in Protocol Buffer
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"; | |
package customer; | |
// The Customer service definition. | |
service Customer { | |
// Get all Customers with filter - A server-to-client streaming RPC. | |
rpc GetCustomers(CustomerFilter) returns (stream CustomerRequest) {} | |
// Create a new Customer - A simple RPC | |
rpc CreateCustomer (CustomerRequest) returns (CustomerResponse) {} | |
} | |
// Request message for creating a new customer | |
message CustomerRequest { | |
int32 id = 1; // Unique ID number for a Customer. | |
string name = 2; | |
string email = 3; | |
string phone= 4; | |
message Address { | |
string street = 1; | |
string city = 2; | |
string state = 3; | |
string zip = 4; | |
bool isShippingAddress = 5; | |
} | |
repeated Address addresses = 5; | |
} | |
message CustomerResponse { | |
int32 id = 1; | |
bool success = 2; | |
} | |
message CustomerFilter { | |
string keyword = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment