Skip to content

Instantly share code, notes, and snippets.

@codesword
Last active April 30, 2017 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codesword/918fd41cbafc89fdfffcc3b00ce62fc8 to your computer and use it in GitHub Desktop.
Save codesword/918fd41cbafc89fdfffcc3b00ce62fc8 to your computer and use it in GitHub Desktop.
syntax = "proto3";
package blog;
import "blog/blog.proto";
import "google/api/annotations.proto";
service BlogSvc {
rpc GetPost (blog.Slug) returns (blog.Post) {
option (google.api.http).get = "/v1/posts/{slug}";
}
rpc ListPosts (blog.BlogListRequest) returns (blog.Posts) {
option (google.api.http).get = "/v1/posts";
}
rpc CreatePost (blog.Post) returns (blog.Post) {
option (google.api.http) = {
post: "/v1/posts"
body: "*"
};
}
rpc updateMyPost (blog.Post) returns (blog.Post) {
option (google.api.http) = {
put: "/v1/posts/me/{id}"
body: "*"
};
}
rpc updatePost (blog.Post) returns (blog.Post) {
option (google.api.http) = {
put: "/v1/posts/{id}"
body: "*"
};
}
rpc DeleteMyPost (blog.Id) returns (blog.Empty) {
option (google.api.http) = {
delete: "/v1/posts/me/{id}"
};
}
rpc DeletePost (blog.Id) returns (blog.Empty) {
option (google.api.http) = {
delete: "/v1/posts/{id}"
};
}
rpc ListCommentsForAPost (blog.Empty) returns (blog.Comments) {
option (google.api.http).get = "/v1/posts/{post_id}/comments";
}
rpc CreateComment (blog.Comment) returns (blog.Comment) {
option (google.api.http) = {
post: "/v1/posts/{post_id}/comments"
body: "*"
};
}
rpc updateMyComment (blog.Comment) returns (blog.Comment) {
option (google.api.http) = {
put: "/v1/posts/me/{post_id}/comments/{id}"
body: "*"
};
}
rpc updateComment (blog.Comment) returns (blog.Comment) {
option (google.api.http) = {
put: "/v1/posts/{post_id}/comments/{id}"
body: "*"
};
}
rpc DeleteMyComment (blog.Id) returns (blog.Empty) {
option (google.api.http) = {
delete: "/v1/posts/me/{id}"
};
}
rpc DeleteComment (blog.Id) returns (blog.Empty) {
option (google.api.http) = {
delete: "/v1/posts/{id}"
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment