Skip to content

Instantly share code, notes, and snippets.

@amsokol
Last active September 15, 2018 05:26
Show Gist options
  • Save amsokol/9a4cdd4d53f7f32757cc06d34d2c6097 to your computer and use it in GitHub Desktop.
Save amsokol/9a4cdd4d53f7f32757cc06d34d2c6097 to your computer and use it in GitHub Desktop.
syntax = "proto3";
package v1;
import "google/protobuf/timestamp.proto";
// Taks we have to do
message ToDo {
// Unique integer identifier of the todo task
int64 id = 1;
// Title of the task
string title = 2;
// Detail description of the todo task
string description = 3;
// Date and time to remind the todo task
google.protobuf.Timestamp reminder = 4;
}
// Request data to create new todo task
message CreateRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Task entity to add
ToDo toDo = 2;
}
// Contains data of created todo task
message CreateResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// ID of created task
int64 id = 2;
}
// Request data to read todo task
message ReadRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Unique integer identifier of the todo task
int64 id = 2;
}
// Contains todo task data specified in by ID request
message ReadResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Task entity read by ID
ToDo toDo = 2;
}
// Request data to update todo task
message UpdateRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Task entity to update
ToDo toDo = 2;
}
// Contains status of update operation
message UpdateResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Contains number of entities have beed updated
// Equals 1 in case of succesfull update
int64 updated = 2;
}
// Request data to delete todo task
message DeleteRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Unique integer identifier of the todo task to delete
int64 id = 2;
}
// Contains status of delete operation
message DeleteResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Contains number of entities have beed deleted
// Equals 1 in case of succesfull delete
int64 deleted = 2;
}
// Request data to read all todo task
message ReadAllRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
}
// Contains list of all todo tasks
message ReadAllResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// List of all todo tasks
repeated ToDo toDos = 2;
}
// Service to manage list of todo tasks
service ToDoService {
// Create new todo task
rpc Create(CreateRequest) returns (CreateResponse);
// Read todo task
rpc Read(ReadRequest) returns (ReadResponse);
// Update todo task
rpc Update(UpdateRequest) returns (UpdateResponse);
// Delete todo task
rpc Delete(DeleteRequest) returns (DeleteResponse);
// Read all todo tasks
rpc ReadAll(ReadAllRequest) returns (ReadAllResponse);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment