Skip to content

Instantly share code, notes, and snippets.

@cristianovagos
Created September 26, 2019 19:03
Show Gist options
  • Save cristianovagos/6e5d3bb8f3d9982f74fef5b349223e3d to your computer and use it in GitHub Desktop.
Save cristianovagos/6e5d3bb8f3d9982f74fef5b349223e3d to your computer and use it in GitHub Desktop.
syntax = "proto3";
package com.todos.v1;
option go_package = "protocols/todos/v1";
option java_multiple_files = true;
option java_outer_classname = "TodosServiceV1";
option java_package = "com.todos.v1";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
service TodosService {
rpc NewTodo (NewTodoRequest) returns (NewTodoResponse) {
option (google.api.http) = {
post: "/v1/todo/new"
body: "*"
};
}
rpc NewTodos (NewTodosRequest) returns (NewTodoResponse) {
option (google.api.http) = {
post: "/v1/todos/new"
body: "*"
};
}
rpc GetTodos (GetTodoRequest) returns (GetTodoResponse) {
option (google.api.http) = {
get: "/v1/todos"
};
}
}
message Todo {
string title = 1;
string message = 2;
int64 author_id = 3;
Language language = 4;
}
enum Language {
ENGLISH = 0;
PORTUGUESE = 1;
FRENCH = 2;
}
message NewTodoRequest {
Todo todo = 1;
google.protobuf.Timestamp sent_at = 2;
}
message NewTodoResponse {
int64 todo_id = 1;
}
message NewTodosRequest {
repeated Todo todos = 1;
google.protobuf.Timestamp sent_at = 2;
}
message NewTodosResponse {
repeated int64 todo_id = 1;
}
message GetTodoRequest {
int64 todo_id = 1;
}
message GetTodoResponse {
Todo result = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment