Files
services/blog/posts/proto/posts/posts.proto
Janos Dobronszki 0110816efb Polishing posts and tags (#11)
* Polishing posts

* Parent -> Resource
2020-10-16 11:20:10 +02:00

58 lines
1.1 KiB
Protocol Buffer

syntax = "proto3";
package posts;
service Posts {
// Query currently only supports read by slug or timestamp, no listing.
rpc Query(QueryRequest) returns (QueryResponse) {}
rpc Save(SaveRequest) returns (SaveResponse) {}
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
}
message Post {
string id = 1;
string title = 2;
string slug = 3;
string content = 4;
int64 created = 5;
int64 updated = 6;
string author = 7;
repeated string tags = 8;
}
// Query posts. Acts as a listing when no id or slug provided.
// Gets a single post by id or slug if any of them provided.
message QueryRequest {
string id = 1;
string slug = 2;
string tag = 3;
int64 offset = 4;
int64 limit = 5;
}
message QueryResponse {
repeated Post posts = 1;
}
message SaveRequest {
string id = 1;
string title = 2;
string slug = 3;
string content = 4;
int64 timestamp = 5;
// When updating a post and wanting to delete all tags,
// send a list of tags with only one member being an empty string [""]
repeated string tags = 6;
}
message SaveResponse {
string id = 1;
}
message DeleteRequest {
string id = 1;
}
message DeleteResponse {}