add api
This commit is contained in:
+46
-1
@@ -3,7 +3,6 @@ syntax = "proto3";
|
||||
package crabs.smm_core;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/httpbody.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
|
||||
option go_package = "pkg/proto";
|
||||
@@ -16,8 +15,54 @@ service SmmCore {
|
||||
get: "/ping"
|
||||
};
|
||||
}
|
||||
|
||||
// categories
|
||||
rpc AddCategory(CreateCategoryReq) returns (Category) {
|
||||
option (google.api.http) = {
|
||||
post: "/categories"
|
||||
};
|
||||
}
|
||||
rpc UpdateCategory(UpdateCategoryReq) returns (Category) {
|
||||
option (google.api.http) = {
|
||||
put: "/categories/{id}"
|
||||
};
|
||||
}
|
||||
rpc GetCategories(CategoryFilterReq) returns (Categories) {
|
||||
option (google.api.http) = {
|
||||
get: "/categories"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message PingReq {}
|
||||
|
||||
message PingRsp {}
|
||||
|
||||
message CreateCategoryReq {
|
||||
string name = 1;
|
||||
int32 user_id = 2;
|
||||
bool favorite = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message UpdateCategoryReq {
|
||||
int32 id = 1;
|
||||
string name = 2;
|
||||
bool favorite = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message Category {
|
||||
int32 id = 1;
|
||||
string name = 2;
|
||||
bool favorite = 4;
|
||||
int32 monthly_limit = 5;
|
||||
}
|
||||
|
||||
message CategoryFilterReq {
|
||||
bool favorite = 1;
|
||||
}
|
||||
|
||||
message Categories {
|
||||
repeated Category categories = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user