Skip to content

Instantly share code, notes, and snippets.

@shijuvar
Created October 11, 2016 06:14
Show Gist options
  • Save shijuvar/dee62552068438b4100f914fee45cc81 to your computer and use it in GitHub Desktop.
Save shijuvar/dee62552068438b4100f914fee45cc81 to your computer and use it in GitHub Desktop.
Service interface and the structure of the payload messages in Protocol Buffer
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