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 {}