release: v2
This commit is contained in:
9
proto/v1/buf.yaml
Normal file
9
proto/v1/buf.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
version: v1
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
except:
|
||||
- MINIMAL
|
||||
21
proto/v1/pastebin_model.proto
Normal file
21
proto/v1/pastebin_model.proto
Normal file
@@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package model.v1;
|
||||
|
||||
option go_package = "pastebin/gen;genv1";
|
||||
|
||||
|
||||
// @table_name: pastebin
|
||||
message ModelPastebin {
|
||||
int64 id = 1; // ID
|
||||
int64 created_at = 2; // 创建时间
|
||||
int64 expired_at = 3; // 过期时间
|
||||
string short_id = 4; // ID别名
|
||||
string title = 5; // 标题
|
||||
string author = 6; // 作者
|
||||
string content = 7; // 内容
|
||||
string lang = 8; // 语言
|
||||
string password = 9; // 是否需要密码
|
||||
bool need_password = 10; // 是否需要密码
|
||||
bool editable = 11; // 是否可以修改
|
||||
}
|
||||
99
proto/v1/pastebin_module.proto
Normal file
99
proto/v1/pastebin_module.proto
Normal file
@@ -0,0 +1,99 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api_services.v1;
|
||||
|
||||
option go_package = "pastebin/gen;genv1";
|
||||
|
||||
|
||||
// @route_group: true
|
||||
// @base_url: /v1/pastebin
|
||||
// @gen_to: ./services/controller/v1/pastebin_controller.go
|
||||
service PastebinService {
|
||||
// @desc: 列表
|
||||
// @author: Young Xu
|
||||
// @method: GET
|
||||
// @api: /list
|
||||
rpc List (PastebinServiceListReq) returns (PastebinServiceListResp);
|
||||
// @desc: 新建
|
||||
// @author: Young Xu
|
||||
// @method: PUT
|
||||
// @api: /add
|
||||
rpc Add (PastebinServiceAddReq) returns (PastebinServiceAddResp);
|
||||
// @desc: 更新
|
||||
// @author: Young Xu
|
||||
// @method: POST
|
||||
// @api: /update
|
||||
rpc Update (PastebinServiceUpdateReq) returns (PastebinServiceUpdateResp);
|
||||
// @desc: 获取一条记录
|
||||
// @author: Young Xu
|
||||
// @method: GET
|
||||
// @api: /get
|
||||
rpc Get (PastebinServiceGetReq) returns (PastebinServiceGetResp);
|
||||
// @desc: 获取原文内容
|
||||
// @author: Young Xu
|
||||
// @method: GET
|
||||
// @api: /raw
|
||||
rpc Raw (PastebinServiceRawReq) returns (PastebinServiceRawResp);
|
||||
}
|
||||
|
||||
|
||||
enum ExpireLevel {
|
||||
Forever = 0;
|
||||
Day = 1;
|
||||
Week = 2;
|
||||
Month = 3;
|
||||
Year = 4;
|
||||
}
|
||||
|
||||
message PastebinServiceRecord {
|
||||
int64 id = 1; // 记录ID
|
||||
string key = 2; // 记录别名
|
||||
string title = 3; // 记录标题
|
||||
string content = 5; // 记录渲染后内容
|
||||
string created_at = 6; // 记录创建时间
|
||||
string expired_at = 7; // 过期时间
|
||||
bool need_password = 8; // 是否需要密码
|
||||
bool editable = 9; // 是否可以修订
|
||||
ExpireLevel expire_level = 10; // 指定记录有效期
|
||||
string password = 11; // 指定需要密码访问
|
||||
string lang = 12; // 指定语言
|
||||
string author = 13; // 作者
|
||||
}
|
||||
|
||||
message PastebinServiceListReq {
|
||||
int64 page_size = 1; // 分页大小
|
||||
int64 current_page = 2; // 当前页 从第一页开始
|
||||
}
|
||||
|
||||
message PastebinServiceListResp {
|
||||
repeated PastebinServiceRecord items = 1; // 列表
|
||||
bool has_more = 2; // 是否有下一页
|
||||
}
|
||||
|
||||
message PastebinServiceAddReq {
|
||||
PastebinServiceRecord record = 1;
|
||||
}
|
||||
|
||||
message PastebinServiceAddResp {}
|
||||
|
||||
message PastebinServiceUpdateReq {
|
||||
PastebinServiceRecord record = 1;
|
||||
}
|
||||
|
||||
message PastebinServiceUpdateResp {}
|
||||
|
||||
message PastebinServiceGetReq {
|
||||
string key = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message PastebinServiceGetResp {
|
||||
PastebinServiceRecord record = 1;
|
||||
}
|
||||
|
||||
message PastebinServiceRawReq {
|
||||
string key = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message PastebinServiceRawResp {}
|
||||
Reference in New Issue
Block a user