kratos-blog的api目录代码
api/blog/blog.proto
syntax = "proto3";
package api.v1;
import "third_party/google/api/annotations.proto";
option go_package = "blog/api/v1;v1";
option java_multiple_files = true;
option java_package = "api.v1";
service Blog {
rpc CreateBlog (CreateBlogRequest) returns (CreateBlogReply) {
option (google.api.http) = {
post: "/api/addBlog",
body:"*",
};
};
rpc UpdateBlog (UpdateBlogRequest) returns (UpdateBlogReply) {
option (google.api.http) = {
put: "/api/updateBlog/{id}",
body:"*",
};
};
rpc DeleteBlog (DeleteBlogRequest) returns (DeleteBlogReply) {
option(google.api.http) = {
delete:"/api/deleteBlog/{id}/{key}",
};
};
rpc UpdateIndividualFields (UpdateIndividualFieldsRequest) returns (UpdateIndividualFieldsReply) {
option (google.api.http) = {
put: "/api/updateIndividual",
body:"*",
};
};
rpc GetBlogByTag (GetBlogRequest) returns (GetBlogReply) {
option(google.api.http) = {
get:"/api/getTagName/{tag}",
};
};
rpc ListBlog (ListBlogRequest) returns (ListBlogReply) {
option(google.api.http) = {
get:"/api/getAllBlog",
};
};
rpc GetBlogByID (GetBlogIDRequest) returns (GetBlogIDReply) {
option(google.api.http) = {
get:"/api/getId/{id}",
};
};
rpc GetBlogByTitle (GetBlogByTitleRequest) returns (GetBlogByTitleReply) {
option(google.api.http) = {
get:"/api/searchBlog/{title}",
};
};
rpc UpdateOnly (UpdateOnlyRequest) returns (UpdateOnlyReply) {
option (google.api.http) = {
put:"/api/updateOnly",
body:"*",
};
}
rpc CacheBlog(CreateBlogRequest) returns (CreateBlogReply) {
option (google.api.http) = {
post:"/api/cacheBlog",
body:"*",
};
}
rpc GetCacheBlog(ListBlogRequest) returns (ListCacheReply) {
option (google.api.http) = {
get:"/api/getCacheBlog"
};
}
rpc DeleteCacheBlog(DeleteCacheBlogRequest) returns(DeleteCacheBlogReply) {
option (google.api.http) = {
delete:"/api/deleteCacheBlog",
};
}
rpc AddSuggestBlog(SuggestBlogRequest) returns(SuggestBlogReply) {
option (google.api.http) = {
post:"/api/addSuggest",
body:"*"
};
}
rpc DeleteSuggestBlog(SuggestBlogRequest) returns(SuggestBlogReply) {
option (google.api.http) = {
delete:"/api/deleteSuggest/{id}",
};
}
rpc GetAllSuggest(SearchAllSuggest) returns(SearchAllReply) {
option (google.api.http) = {
get:"/api/getAllSuggest",
};
}
}
message BlogData {
optional uint32 id = 1;
optional string title = 2;
optional string preface = 3;
optional string photo = 4;
optional string tag = 5;
optional string createTime = 6;
optional string updateTime = 7;
optional uint64 visits = 8;
optional string content = 9;
optional bool appear = 10;
optional bool comment = 11;
}
message CommonReply {
int64 code = 1;
string result = 2;
}
message CreateBlogRequest {
BlogData data = 1;
}
message CreateBlogReply {
CommonReply common = 1;
}
message UpdateBlogRequest {
uint32 id = 1;
BlogData data = 2;
}
message UpdateBlogReply {
CommonReply common = 1;
}
message UpdateIndividualFieldsRequest {
int64 raw = 1;
bool status = 2;
}
message UpdateIndividualFieldsReply {
CommonReply common = 1;
}
message DeleteBlogRequest {
int64 id = 1;
string key = 2;
}
message DeleteBlogReply {
CommonReply common = 1;
}
message GetBlogRequest {
string tag = 1;
optional Permission permission = 2;
}
message GetBlogReply {
CommonReply common = 1;
repeated BlogData List = 2;
}
message ListBlogRequest {
optional Permission permission = 1;
}
message ListBlogReply {
CommonReply common = 1;
repeated BlogData List = 2;
}
message ListCacheReply {
CommonReply common = 1;
repeated BlogData List = 2;
}
message GetBlogByTitleRequest {
string title = 1;
}
message GetBlogByTitleReply {
CommonReply common = 1;
repeated BlogData data = 2;
}
message UpdateOnlyRequest {
int64 raw = 1;
int64 id = 2;
bool res = 3;
}
message UpdateOnlyReply {
CommonReply common = 1;
}
message GetBlogIDRequest {
int64 id = 1;
optional Permission permission = 2;
}
message GetBlogIDReply {
CommonReply common = 1;
BlogData data = 2;
}
message DeleteCacheBlogRequest {
int64 key = 1;
}
message DeleteCacheBlogReply {
CommonReply common = 1;
}
message SuggestBlogRequest {
int64 id = 1;
}
message SuggestBlogReply {
CommonReply common = 1;
}
message SearchAllSuggest {}
message SearchAllReply {
CommonReply common = 1;
repeated BlogData List = 2;
}
message Permission {
bool Admin = 1;
}
api/comment/comment.proto
syntax = "proto3"
package api.comment
import "third_party/google/api/annotations.proto"
option go_package = "comment/api/comment;comment"
option java_multiple_files = true
option java_package = "api.comment"
service Comment {
rpc AddComment (CreateCommentRequest) returns (CreateCommentReply) {
option (google.api.http) = {
post:"/api/addComment",
body:"*"
}
}
rpc AddReward (CreateRewardRequest) returns (CreateRewardReply) {
option (google.api.http) = {
post:"/api/addReward/{reward_id}",
body:"*"
}
}
rpc ExtractParentComments (ExtractParentCommentsRequest) returns (ExtractParentCommentsReply) {
option (google.api.http) = {
get:"/api/getComment/{id}"
}
}
}
message CreateCommentRequest {
string article_id = 1
string comment = 2
string comment_addr = 3
optional string name = 4
optional string email = 5
}
message CreateCommentReply {
int64 code = 1
string result = 2
}
message CreateRewardRequest {
string reward_id = 1
string reward_content = 2
string article_id = 3
string reward_addr = 4
optional string name = 5
optional string email = 6
}
message CreateRewardReply {
int64 code = 1
string result = 2
}
message ExtractParentCommentsRequest {
string id = 1
}
message ExtractParentCommentsReply {
int64 code = 1
string result = 2
repeated string list = 3
}
api/friend/friend.proto
syntax = "proto3"
package friend
import "third_party/google/api/annotations.proto"
option go_package = "/friend;friend"
option java_multiple_files = true
option java_package = "friend"
service Friend {
rpc CreateFriend (CreateFriendRequest) returns (CreateFriendReply) {
option (google.api.http) = {
post:'/api/addFriend',
body:"*",
}
}
rpc UpdateFriend (UpdateFriendRequest) returns (UpdateFriendReply) {
option (google.api.http) = {
put:'/api/updateFriend',
body:"*"
}
}
rpc DeleteFriend (DeleteFriendRequest) returns (DeleteFriendReply) {
option (google.api.http) = {
delete:'/api/deleteFriend/{id}'
}
}
rpc GetFriend (GetFriendRequest) returns (GetFriendReply) {
option (google.api.http) = {
get:"/api/getFriend/{id}"
}
}
rpc ListFriend (ListFriendRequest) returns (ListFriendReply) {
option (google.api.http) = {
get:'/api/getAllFriend'
}
}
}
message FriendData {
optional int64 id = 1
optional string title = 2
optional string preface = 3
optional string url = 4
optional string photo = 5
optional string date = 6
}
message CommonReply {
int64 code = 1
string result = 2
}
message CreateFriendRequest {
FriendData data = 2
}
message CreateFriendReply {
CommonReply common = 1
}
message UpdateFriendRequest {
FriendData data = 2
}
message UpdateFriendReply {
CommonReply common = 1
}
message DeleteFriendRequest {
int64 id = 1
}
message DeleteFriendReply {
CommonReply common = 1
}
message GetFriendRequest {
int64 id = 1
}
message GetFriendReply {
CommonReply common = 1
FriendData data = 2
}
message ListFriendRequest {}
message ListFriendReply {
CommonReply common = 1
repeated FriendData data = 2
}
api/photo/photo.proto
syntax = "proto3"
package photo
import "third_party/google/api/annotations.proto"
option go_package = "/photo;photo"
option java_multiple_files = true
option java_package = "photo"
service Photo {
rpc CreatePhoto (CreatePhotoRequest) returns (CreatePhotoReply) {
option (google.api.http) = {
post:"/api/addPhoto",
body:"*"
}
}
rpc DeletePhoto (DeletePhotoRequest) returns (DeletePhotoReply) {
option (google.api.http) = {
delete:'/api/deletePhoto/{id}'
}
}
rpc ListPhoto (ListPhotoRequest) returns (ListPhotoReply) {
option (google.api.http) = {
get:'/api/getAllPhoto'
}
}
}
message CommonReply {
int64 code = 1
string result = 2
}
message PhotoData {
int64 id = 1
string photo = 2
string date = 3
string title = 4
string position = 5
}
message CreatePhotoRequest {
PhotoData data = 1
}
message CreatePhotoReply {
CommonReply common = 1
}
message DeletePhotoRequest {
int64 id = 1
}
message DeletePhotoReply {
CommonReply common = 1
}
message ListPhotoRequest {}
message ListPhotoReply {
CommonReply common = 1
repeated PhotoData data = 2
}
api/user/user.proto
syntax = "proto3"
package api.user
import "third_party/google/api/annotations.proto"
option go_package = "gateway/api/gateway;gateway"
option java_multiple_files = true
option java_package = "api.gateway"
service User {
rpc CreateUser (CreateUserRequest) returns (CreateUserReply) {
option (google.api.http) = {
post:"/api/register/{code}",
body:"*",
}
}
rpc LoginUser (LoginRequest) returns (LoginReply) {
option (google.api.http) = {
post:"/api/login",
body:"*",
}
}
rpc SendEmail (SendEmailRequest) returns (SendEmailReply) {
option (google.api.http) = {
get:"/api/sendEmail/{email}"
}
}
rpc UpdatePassword (UpdatePasswordRequest) returns (UpdatePasswordReply) {
option (google.api.http) = {
post:"/api/updatePassword/{code}",
body:"*",
}
}
rpc SetBlack (SetBlackRequest) returns (SetBlackReply) {
option (google.api.http) = {
get:"/api/setBlack/{name}"
}
}
rpc GetUser (GetUserRequest) returns (GetUserReply) {
option (google.api.http) = {
get:"/api/getUserMessage/{name}"
}
}
rpc AdminLogin (AdminLoginRequest) returns (AdminLoginReply) {
option (google.api.http) = {
post:"/api/admin",
body:"*",
}
}
}
message CommonReply {
int64 code = 1
string result = 2
}
message CreateUserRequest {
string name = 1
string email = 2
string password = 3
string code = 4
}
message CreateUserReply {
CommonReply common = 1
}
message LoginRequest {
string name = 1
string pass = 2
}
message LoginReply {
CommonReply common = 1
repeated string data = 2
}
message SendEmailRequest {
string email = 1
}
message SendEmailReply {
CommonReply common = 1
}
message UpdatePasswordRequest {
string code = 1
string email = 2
string name = 3
string password = 4
}
message UpdatePasswordReply {
CommonReply common = 1
}
message SetBlackRequest {
string name = 1
}
message SetBlackReply {
CommonReply common = 1
}
message GetUserRequest {
string name = 1
}
message GetUserReply {
CommonReply common = 1
repeated string data = 2
}
message AdminLoginRequest {
string name = 1
string password = 2
}
message AdminLoginReply {
CommonReply common = 1
repeated string data = 2
}
api/tag/tag.proto
syntax = "proto3"
package api.v1.tag
import "third_party/google/api/annotations.proto"
option go_package = "kratos-blog/api/v1/tag;tag"
option java_multiple_files = true
option java_package = "api.v1.tag"
service Tag {
rpc CreateTag (CreateTagRequest) returns (CreateTagReply) {
option (google.api.http) = {
post: "/api/addTag",
body:"*",
}
}
rpc DeleteTag (DeleteTagRequest) returns (DeleteTagReply) {
option (google.api.http) = {
delete: "/api/deleteTag/{id}",
}
}
rpc ListTag (ListTagRequest) returns (ListTagReply) {
option(google.api.http) = {
get:"/api/getAllTag",
}
}
}
message TagData {
optional uint32 id = 1
string tagName = 2
}
message CommonReply {
int64 code = 1
string result = 2
}
message CreateTagRequest {
TagData data = 1
}
message CreateTagReply {
CommonReply common = 1
}
message DeleteTagRequest {
uint32 id = 1
}
message DeleteTagReply {
CommonReply common = 1
}
message ListTagRequest {}
message ListTagReply {
CommonReply common = 1
repeated TagData data = 2
}
api/gateway/i_blog.proto
syntax = "proto3";
package api.v1;
import "third_party/google/api/annotations.proto";
option go_package = "blog/api/v1;v1";
option java_multiple_files = true;
option java_package = "api.v1";
import "api/v1/blog/blog.proto";
service BlogService {
rpc CreateBlog (CreateBlogRequest) returns (CreateBlogReply) {
option (google.api.http) = {
post: "/api/addBlog",
body:"*",
};
};
rpc UpdateBlog (UpdateBlogRequest) returns (UpdateBlogReply) {
option (google.api.http) = {
put: "/api/updateBlog/{id}",
body:"*",
};
};
rpc UpdateIndividualFields (UpdateIndividualFieldsRequest) returns (UpdateIndividualFieldsReply) {
option (google.api.http) = {
put: "/api/updateIndividual",
body:"*",
};
};
rpc DeleteBlog (DeleteBlogRequest) returns (DeleteBlogReply) {
option(google.api.http) = {
delete:"/api/deleteBlog/{id}/{key}",
};
};
rpc GetBlogByTag (GetBlogRequest) returns (GetBlogReply) {
option(google.api.http) = {
get:"/api/getTagName/{tag}",
};
};
rpc ListBlog (ListBlogRequest) returns (ListBlogReply) {
option(google.api.http) = {
get:"/api/getAllBlog",
};
};
rpc GetBlogByID (GetBlogIDRequest) returns (GetBlogIDReply) {
option(google.api.http) = {
get:"/api/getId/{id}",
};
};
rpc GetBlogByTitle (GetBlogByTitleRequest) returns (GetBlogByTitleReply) {
option(google.api.http) = {
get:"/api/searchBlog/{title}",
};
};
rpc UpdateOnly (UpdateOnlyRequest) returns (UpdateOnlyReply) {
option (google.api.http) = {
put:"/api/updateOnly",
body:"*",
};
}
rpc CacheBlog(CreateBlogRequest) returns (CreateBlogReply) {
option (google.api.http) = {
post:"/api/cacheBlog",
body:"*",
};
}
rpc GetCacheBlog(ListBlogRequest) returns (ListCacheReply) {
option (google.api.http) = {
get:"/api/getCacheBlog"
};
}
rpc DeleteCacheBlog(DeleteCacheBlogRequest) returns(DeleteCacheBlogReply) {
option (google.api.http) = {
delete:"/api/deleteCacheBlog",
};
}
rpc AddSuggestBlog(SuggestBlogRequest) returns(SuggestBlogReply) {
option (google.api.http) = {
post:"/api/addSuggest",
body:"*"
};
}
rpc DeleteSuggestBlog(SuggestBlogRequest) returns(SuggestBlogReply) {
option (google.api.http) = {
delete:"/api/deleteSuggest/{id}",
};
}
rpc GetAllSuggest(SearchAllSuggest) returns(SearchAllReply) {
option (google.api.http) = {
get:"/api/getAllSuggest",
};
}
}
api/gateway/i_comment.proto
syntax = "proto3"
package api.comment
import "third_party/google/api/annotations.proto"
option go_package = "comment/api/comment;comment"
option java_multiple_files = true
option java_package = "api.comment"
import "api/v1/comment/comment.proto"
service CommentService {
rpc AddComment (CreateCommentRequest) returns (CreateCommentReply) {
option (google.api.http) = {
post:"/api/addComment",
body:"*"
}
}
rpc AddReward (CreateRewardRequest) returns (CreateRewardReply) {
option (google.api.http) = {
post:"/api/addReward/{reward_id}",
body:"*"
}
}
rpc ExtractParentComments (ExtractParentCommentsRequest) returns (ExtractParentCommentsReply) {
option (google.api.http) = {
get:"/api/getComment/{id}"
}
}
}
api/gateway/i_friend.proto
syntax = "proto3"
package friend
import "third_party/google/api/annotations.proto"
import "api/v1/friend/friend.proto"
option go_package = "/friend;friend"
option java_multiple_files = true
option java_package = "friend"
service FriendService {
rpc CreateFriend (CreateFriendRequest) returns (CreateFriendReply) {
option (google.api.http) = {
post:'/api/addFriend',
body:"*",
}
}
rpc UpdateFriend (UpdateFriendRequest) returns (UpdateFriendReply) {
option (google.api.http) = {
put:'/api/updateFriend',
body:"*"
}
}
rpc DeleteFriend (DeleteFriendRequest) returns (DeleteFriendReply) {
option (google.api.http) = {
delete:'/api/deleteFriend/{id}'
}
}
rpc GetFriend (GetFriendRequest) returns (GetFriendReply) {
option (google.api.http) = {
get:"/api/getFriend/{id}"
}
}
rpc ListFriend (ListFriendRequest) returns (ListFriendReply) {
option (google.api.http) = {
get:'/api/getAllFriend'
}
}
}
api/gateway/i_tag.proto
syntax = "proto3"
package api.v1.tag
import "third_party/google/api/annotations.proto"
import "api/v1/tag/tag.proto"
option go_package = "kratos-blog/api/v1/tag;tag"
option java_multiple_files = true
option java_package = "api.v1.tag"
service TagService {
rpc CreateTag (CreateTagRequest) returns (CreateTagReply) {
option (google.api.http) = {
post: "/api/addTag",
body:"*",
}
}
rpc DeleteTag (DeleteTagRequest) returns (DeleteTagReply) {
option (google.api.http) = {
delete: "/api/deleteTag/{id}",
}
}
rpc ListTag (ListTagRequest) returns (ListTagReply) {
option(google.api.http) = {
get:"/api/getAllTag",
}
}
}
api/gateway/i_user.proto
syntax = "proto3"
package api.user
import "third_party/google/api/annotations.proto"
import "api/v1/user/user.proto"
option go_package = "gateway/api/gateway;gateway"
option java_multiple_files = true
option java_package = "api.gateway"
service UserService {
rpc CreateUser (CreateUserRequest) returns (CreateUserReply) {
option (google.api.http) = {
post:"/api/register/{code}",
body:"*",
}
}
rpc LoginUser (LoginRequest) returns (LoginReply) {
option (google.api.http) = {
post:"/api/login",
body:"*",
}
}
rpc SendEmail (SendEmailRequest) returns (SendEmailReply) {
option (google.api.http) = {
get:"/api/sendEmail/{email}"
}
}
rpc UpdatePassword (UpdatePasswordRequest) returns (UpdatePasswordReply) {
option (google.api.http) = {
post:"/api/updatePassword/{code}",
body:"*",
}
}
rpc SetBlack (SetBlackRequest) returns (SetBlackReply) {
option (google.api.http) = {
get:"/api/setBlack/{name}"
}
}
rpc GetUser (GetUserRequest) returns (GetUserReply) {
option (google.api.http) = {
get:"/api/getUserMessage/{name}"
}
}
rpc AdminLogin (AdminLoginRequest) returns (AdminLoginReply) {
option (google.api.http) = {
post:"/api/admin",
body:"*",
}
}
}