first commit
This commit is contained in:
48
api_services/v1/autogen_router_pastebin_service.go
Normal file
48
api_services/v1/autogen_router_pastebin_service.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// Code generated by protoc-gen-coco. DO NOT EDIT.
|
||||
// source: api_services/v1/pastebin_module.proto
|
||||
// generate at: 2023-09-30 21:44:38
|
||||
|
||||
package api_servicesv1
|
||||
|
||||
import (
|
||||
"gitter.top/coco/coco/core"
|
||||
)
|
||||
|
||||
type AutoGenPastebinServiceImpl interface {
|
||||
List(ctx *core.Context, req *PastebinServiceListReq) (resp *PastebinServiceListResp, err error)
|
||||
Add(ctx *core.Context, req *PastebinServiceAddReq) (resp *PastebinServiceAddResp, err error)
|
||||
Update(ctx *core.Context, req *PastebinServiceUpdateReq) (resp *PastebinServiceUpdateResp, err error)
|
||||
Get(ctx *core.Context, req *PastebinServiceGetReq) (resp *PastebinServiceGetResp, err error)
|
||||
}
|
||||
|
||||
var (
|
||||
AutoGenPastebinServiceRouterMap = &core.Routers{
|
||||
BaseURL: "/v1/pastebin",
|
||||
Apis: core.RouterMap{
|
||||
"List": {
|
||||
API: "/list",
|
||||
Method: "GET",
|
||||
Author: "Young Xu",
|
||||
Describe: "列表",
|
||||
},
|
||||
"Add": {
|
||||
API: "/add",
|
||||
Method: "PUT",
|
||||
Author: "Young Xu",
|
||||
Describe: "新建",
|
||||
},
|
||||
"Update": {
|
||||
API: "/update",
|
||||
Method: "POST",
|
||||
Author: "Young Xu",
|
||||
Describe: "更新",
|
||||
},
|
||||
"Get": {
|
||||
API: "/get",
|
||||
Method: "GET",
|
||||
Author: "Young Xu",
|
||||
Describe: "获取一条记录",
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
154
api_services/v1/pastebin_controller.go
Normal file
154
api_services/v1/pastebin_controller.go
Normal file
@@ -0,0 +1,154 @@
|
||||
package api_servicesv1
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"gitter.top/coco/coco/core"
|
||||
"pastebin/common"
|
||||
"pastebin/internal/repositories"
|
||||
modelv1 "pastebin/model/v1"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PastebinService struct{}
|
||||
|
||||
// IDE: PastebinService implemented PastebinServiceImpl interface
|
||||
var _ AutoGenPastebinServiceImpl = (*PastebinService)(nil)
|
||||
|
||||
// List 列表
|
||||
func (receiver *PastebinService) List(ctx *core.Context, req *PastebinServiceListReq) (resp *PastebinServiceListResp, err error) {
|
||||
resp = new(PastebinServiceListResp)
|
||||
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 25
|
||||
}
|
||||
|
||||
var limit = req.PageSize + 1
|
||||
|
||||
var offset int64
|
||||
if req.CurrentPage == 0 {
|
||||
req.CurrentPage = 1
|
||||
}
|
||||
offset = (req.CurrentPage - 1) * req.PageSize
|
||||
|
||||
db := repositories.GetPastebin()
|
||||
|
||||
var records []modelv1.ModelPastebin
|
||||
|
||||
if err := db.Find().SetWhere("expired_at > ?", time.Now().Unix()).SetLimit(int(limit)).
|
||||
SetOffset(int(offset)).SetOrder("id desc").Find(&records); err != nil {
|
||||
logrus.Errorf("query records failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var hasMore bool
|
||||
if len(records) >= int(limit) {
|
||||
hasMore = true
|
||||
records = records[:req.PageSize]
|
||||
}
|
||||
|
||||
for _, record := range records {
|
||||
item := &PastebinServiceRecord{
|
||||
Id: record.Id,
|
||||
Key: record.ShortId,
|
||||
Title: record.Title,
|
||||
Lang: record.Lang,
|
||||
Author: record.Author,
|
||||
CreatedAt: common.Unix2Datetime(record.CreatedAt),
|
||||
ExpiredAt: common.Unix2Datetime(record.ExpiredAt),
|
||||
NeedPassword: record.NeedPassword,
|
||||
}
|
||||
resp.Items = append(resp.Items, item)
|
||||
}
|
||||
|
||||
resp.HasMore = hasMore
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Add 新建
|
||||
func (receiver *PastebinService) Add(ctx *core.Context, req *PastebinServiceAddReq) (resp *PastebinServiceAddResp, err error) {
|
||||
resp = new(PastebinServiceAddResp)
|
||||
|
||||
var expiredAt = time.Now()
|
||||
switch req.Record.ExpireLevel {
|
||||
case ExpireLevel_Forever:
|
||||
expiredAt = expiredAt.Add(time.Hour * 87600)
|
||||
case ExpireLevel_Day:
|
||||
expiredAt = expiredAt.Add(time.Hour * 24)
|
||||
case ExpireLevel_Week:
|
||||
expiredAt = expiredAt.Add(time.Hour * 168)
|
||||
case ExpireLevel_Month:
|
||||
expiredAt = expiredAt.Add(time.Hour * 720)
|
||||
case ExpireLevel_Year:
|
||||
expiredAt = expiredAt.Add(time.Hour * 8760)
|
||||
}
|
||||
|
||||
var record = modelv1.ModelPastebin{
|
||||
CreatedAt: time.Now().Unix(),
|
||||
ExpiredAt: expiredAt.Unix(),
|
||||
ShortId: common.UniqID(time.Now().UnixMilli()),
|
||||
Title: req.Record.Title,
|
||||
Content: req.Record.Content,
|
||||
Lang: req.Record.Lang,
|
||||
Password: req.Record.Password,
|
||||
NeedPassword: req.Record.NeedPassword,
|
||||
Editable: req.Record.Editable,
|
||||
Author: req.Record.Author,
|
||||
}
|
||||
|
||||
db := repositories.GetPastebin()
|
||||
|
||||
if err := db.Insert().Insert(&record); err != nil {
|
||||
logrus.Errorf("insert record failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Update 更新
|
||||
func (receiver *PastebinService) Update(ctx *core.Context, req *PastebinServiceUpdateReq) (resp *PastebinServiceUpdateResp, err error) {
|
||||
resp = new(PastebinServiceUpdateResp)
|
||||
|
||||
// TODO impl...
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Get 获取一条记录
|
||||
func (receiver *PastebinService) Get(ctx *core.Context, req *PastebinServiceGetReq) (resp *PastebinServiceGetResp, err error) {
|
||||
resp = new(PastebinServiceGetResp)
|
||||
|
||||
db := repositories.GetPastebin()
|
||||
|
||||
var record modelv1.ModelPastebin
|
||||
|
||||
if err := db.Find().SetWhere("short_id = ?", req.Key).FindOne(&record); err != nil {
|
||||
logrus.Errorf("query records failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if record.NeedPassword && req.Password == "" {
|
||||
return nil, core.CreateErrorWithMsg(4001, "pastebin need password")
|
||||
}
|
||||
|
||||
if record.NeedPassword && req.Password != record.Password {
|
||||
return nil, core.CreateErrorWithMsg(4002, "incorrect password")
|
||||
}
|
||||
|
||||
item := &PastebinServiceRecord{
|
||||
Id: record.Id,
|
||||
Key: record.ShortId,
|
||||
Title: record.Title,
|
||||
Content: record.Content,
|
||||
CreatedAt: common.Unix2Datetime(record.CreatedAt),
|
||||
ExpiredAt: common.Unix2Datetime(record.ExpiredAt),
|
||||
NeedPassword: record.NeedPassword,
|
||||
Lang: record.Lang,
|
||||
Author: record.Author,
|
||||
}
|
||||
|
||||
resp.Record = item
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
886
api_services/v1/pastebin_module.pb.go
Normal file
886
api_services/v1/pastebin_module.pb.go
Normal file
@@ -0,0 +1,886 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: api_services/v1/pastebin_module.proto
|
||||
|
||||
package api_servicesv1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ExpireLevel int32
|
||||
|
||||
const (
|
||||
ExpireLevel_Forever ExpireLevel = 0
|
||||
ExpireLevel_Day ExpireLevel = 1
|
||||
ExpireLevel_Week ExpireLevel = 2
|
||||
ExpireLevel_Month ExpireLevel = 3
|
||||
ExpireLevel_Year ExpireLevel = 4
|
||||
)
|
||||
|
||||
// Enum value maps for ExpireLevel.
|
||||
var (
|
||||
ExpireLevel_name = map[int32]string{
|
||||
0: "Forever",
|
||||
1: "Day",
|
||||
2: "Week",
|
||||
3: "Month",
|
||||
4: "Year",
|
||||
}
|
||||
ExpireLevel_value = map[string]int32{
|
||||
"Forever": 0,
|
||||
"Day": 1,
|
||||
"Week": 2,
|
||||
"Month": 3,
|
||||
"Year": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ExpireLevel) Enum() *ExpireLevel {
|
||||
p := new(ExpireLevel)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ExpireLevel) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ExpireLevel) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_services_v1_pastebin_module_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (ExpireLevel) Type() protoreflect.EnumType {
|
||||
return &file_api_services_v1_pastebin_module_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x ExpireLevel) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExpireLevel.Descriptor instead.
|
||||
func (ExpireLevel) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type PastebinServiceRecord struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 记录ID
|
||||
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // 记录别名
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` // 记录标题
|
||||
Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` // 记录渲染后内容
|
||||
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 记录创建时间
|
||||
ExpiredAt string `protobuf:"bytes,7,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // 过期时间
|
||||
NeedPassword bool `protobuf:"varint,8,opt,name=need_password,json=needPassword,proto3" json:"need_password,omitempty"` // 是否需要密码
|
||||
Editable bool `protobuf:"varint,9,opt,name=editable,proto3" json:"editable,omitempty"` // 是否可以修订
|
||||
ExpireLevel ExpireLevel `protobuf:"varint,10,opt,name=expire_level,json=expireLevel,proto3,enum=api_services.v1.ExpireLevel" json:"expire_level,omitempty"` // 指定记录有效期
|
||||
Password string `protobuf:"bytes,11,opt,name=password,proto3" json:"password,omitempty"` // 指定需要密码访问
|
||||
Lang string `protobuf:"bytes,12,opt,name=lang,proto3" json:"lang,omitempty"` // 指定语言
|
||||
Author string `protobuf:"bytes,13,opt,name=author,proto3" json:"author,omitempty"` // 作者
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) Reset() {
|
||||
*x = PastebinServiceRecord{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceRecord) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceRecord) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceRecord.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceRecord) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetContent() string {
|
||||
if x != nil {
|
||||
return x.Content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetExpiredAt() string {
|
||||
if x != nil {
|
||||
return x.ExpiredAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetNeedPassword() bool {
|
||||
if x != nil {
|
||||
return x.NeedPassword
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetEditable() bool {
|
||||
if x != nil {
|
||||
return x.Editable
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetExpireLevel() ExpireLevel {
|
||||
if x != nil {
|
||||
return x.ExpireLevel
|
||||
}
|
||||
return ExpireLevel_Forever
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetLang() string {
|
||||
if x != nil {
|
||||
return x.Lang
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceRecord) GetAuthor() string {
|
||||
if x != nil {
|
||||
return x.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type PastebinServiceListReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
PageSize int64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // 分页大小
|
||||
CurrentPage int64 `protobuf:"varint,2,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"` // 当前页 从第一页开始
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListReq) Reset() {
|
||||
*x = PastebinServiceListReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceListReq) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceListReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceListReq.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceListReq) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListReq) GetPageSize() int64 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListReq) GetCurrentPage() int64 {
|
||||
if x != nil {
|
||||
return x.CurrentPage
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PastebinServiceListResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Items []*PastebinServiceRecord `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // 列表
|
||||
HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` // 是否有下一页
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListResp) Reset() {
|
||||
*x = PastebinServiceListResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceListResp) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceListResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceListResp.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceListResp) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListResp) GetItems() []*PastebinServiceRecord {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PastebinServiceListResp) GetHasMore() bool {
|
||||
if x != nil {
|
||||
return x.HasMore
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type PastebinServiceAddReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Record *PastebinServiceRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PastebinServiceAddReq) Reset() {
|
||||
*x = PastebinServiceAddReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceAddReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceAddReq) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceAddReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceAddReq.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceAddReq) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceAddReq) GetRecord() *PastebinServiceRecord {
|
||||
if x != nil {
|
||||
return x.Record
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PastebinServiceAddResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *PastebinServiceAddResp) Reset() {
|
||||
*x = PastebinServiceAddResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceAddResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceAddResp) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceAddResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceAddResp.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceAddResp) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type PastebinServiceUpdateReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Record *PastebinServiceRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PastebinServiceUpdateReq) Reset() {
|
||||
*x = PastebinServiceUpdateReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceUpdateReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceUpdateReq) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceUpdateReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceUpdateReq.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceUpdateReq) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceUpdateReq) GetRecord() *PastebinServiceRecord {
|
||||
if x != nil {
|
||||
return x.Record
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PastebinServiceUpdateResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *PastebinServiceUpdateResp) Reset() {
|
||||
*x = PastebinServiceUpdateResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceUpdateResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceUpdateResp) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceUpdateResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceUpdateResp.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceUpdateResp) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
type PastebinServiceGetReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetReq) Reset() {
|
||||
*x = PastebinServiceGetReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceGetReq) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceGetReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceGetReq.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceGetReq) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetReq) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetReq) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type PastebinServiceGetResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Record *PastebinServiceRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetResp) Reset() {
|
||||
*x = PastebinServiceGetResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PastebinServiceGetResp) ProtoMessage() {}
|
||||
|
||||
func (x *PastebinServiceGetResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_services_v1_pastebin_module_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PastebinServiceGetResp.ProtoReflect.Descriptor instead.
|
||||
func (*PastebinServiceGetResp) Descriptor() ([]byte, []int) {
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *PastebinServiceGetResp) GetRecord() *PastebinServiceRecord {
|
||||
if x != nil {
|
||||
return x.Record
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_api_services_v1_pastebin_module_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_api_services_v1_pastebin_module_proto_rawDesc = []byte{
|
||||
0x0a, 0x25, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x70, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x22, 0xf1, 0x02, 0x0a, 0x15, 0x50, 0x61, 0x73,
|
||||
0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f,
|
||||
0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f,
|
||||
0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61,
|
||||
0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64,
|
||||
0x41, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6e, 0x65, 0x65, 0x64, 0x50,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x64, 0x69, 0x74, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x65, 0x64, 0x69, 0x74, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x6c, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69,
|
||||
0x72, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x4c,
|
||||
0x65, 0x76, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6c, 0x61, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x0d,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x22, 0x58, 0x0a, 0x16,
|
||||
0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73,
|
||||
0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53,
|
||||
0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70,
|
||||
0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65,
|
||||
0x6e, 0x74, 0x50, 0x61, 0x67, 0x65, 0x22, 0x72, 0x0a, 0x17, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62,
|
||||
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x3c, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12,
|
||||
0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x22, 0x57, 0x0a, 0x15, 0x50, 0x61,
|
||||
0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64,
|
||||
0x52, 0x65, 0x71, 0x12, 0x3e, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63,
|
||||
0x6f, 0x72, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x5a, 0x0a,
|
||||
0x18, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x3e, 0x0a, 0x06, 0x72, 0x65, 0x63,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74,
|
||||
0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x1b, 0x0a, 0x19, 0x50, 0x61, 0x73,
|
||||
0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x45, 0x0a, 0x15, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62,
|
||||
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x58, 0x0a,
|
||||
0x16, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62,
|
||||
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52,
|
||||
0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2a, 0x42, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x69, 0x72,
|
||||
0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x65, 0x76, 0x65,
|
||||
0x72, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x61, 0x79, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x57, 0x65, 0x65, 0x6b, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x10,
|
||||
0x03, 0x12, 0x08, 0x0a, 0x04, 0x59, 0x65, 0x61, 0x72, 0x10, 0x04, 0x32, 0xfd, 0x02, 0x0a, 0x0f,
|
||||
0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x59, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62,
|
||||
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
|
||||
0x1a, 0x28, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x56, 0x0a, 0x03, 0x41, 0x64,
|
||||
0x64, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74,
|
||||
0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65,
|
||||
0x73, 0x70, 0x12, 0x5f, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x29, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50,
|
||||
0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62,
|
||||
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x56, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73,
|
||||
0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52,
|
||||
0x65, 0x71, 0x1a, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0xb9, 0x01, 0x0a, 0x13,
|
||||
0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x2e, 0x76, 0x31, 0x42, 0x13, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x4d, 0x6f, 0x64,
|
||||
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x70, 0x61, 0x73, 0x74,
|
||||
0x65, 0x62, 0x69, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x2f, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76,
|
||||
0x31, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x76, 0x31,
|
||||
0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x0e, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0e, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x41, 0x70, 0x69, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_api_services_v1_pastebin_module_proto_rawDescOnce sync.Once
|
||||
file_api_services_v1_pastebin_module_proto_rawDescData = file_api_services_v1_pastebin_module_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_api_services_v1_pastebin_module_proto_rawDescGZIP() []byte {
|
||||
file_api_services_v1_pastebin_module_proto_rawDescOnce.Do(func() {
|
||||
file_api_services_v1_pastebin_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_services_v1_pastebin_module_proto_rawDescData)
|
||||
})
|
||||
return file_api_services_v1_pastebin_module_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_api_services_v1_pastebin_module_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_api_services_v1_pastebin_module_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_api_services_v1_pastebin_module_proto_goTypes = []interface{}{
|
||||
(ExpireLevel)(0), // 0: api_services.v1.ExpireLevel
|
||||
(*PastebinServiceRecord)(nil), // 1: api_services.v1.PastebinServiceRecord
|
||||
(*PastebinServiceListReq)(nil), // 2: api_services.v1.PastebinServiceListReq
|
||||
(*PastebinServiceListResp)(nil), // 3: api_services.v1.PastebinServiceListResp
|
||||
(*PastebinServiceAddReq)(nil), // 4: api_services.v1.PastebinServiceAddReq
|
||||
(*PastebinServiceAddResp)(nil), // 5: api_services.v1.PastebinServiceAddResp
|
||||
(*PastebinServiceUpdateReq)(nil), // 6: api_services.v1.PastebinServiceUpdateReq
|
||||
(*PastebinServiceUpdateResp)(nil), // 7: api_services.v1.PastebinServiceUpdateResp
|
||||
(*PastebinServiceGetReq)(nil), // 8: api_services.v1.PastebinServiceGetReq
|
||||
(*PastebinServiceGetResp)(nil), // 9: api_services.v1.PastebinServiceGetResp
|
||||
}
|
||||
var file_api_services_v1_pastebin_module_proto_depIdxs = []int32{
|
||||
0, // 0: api_services.v1.PastebinServiceRecord.expire_level:type_name -> api_services.v1.ExpireLevel
|
||||
1, // 1: api_services.v1.PastebinServiceListResp.items:type_name -> api_services.v1.PastebinServiceRecord
|
||||
1, // 2: api_services.v1.PastebinServiceAddReq.record:type_name -> api_services.v1.PastebinServiceRecord
|
||||
1, // 3: api_services.v1.PastebinServiceUpdateReq.record:type_name -> api_services.v1.PastebinServiceRecord
|
||||
1, // 4: api_services.v1.PastebinServiceGetResp.record:type_name -> api_services.v1.PastebinServiceRecord
|
||||
2, // 5: api_services.v1.PastebinService.List:input_type -> api_services.v1.PastebinServiceListReq
|
||||
4, // 6: api_services.v1.PastebinService.Add:input_type -> api_services.v1.PastebinServiceAddReq
|
||||
6, // 7: api_services.v1.PastebinService.Update:input_type -> api_services.v1.PastebinServiceUpdateReq
|
||||
8, // 8: api_services.v1.PastebinService.Get:input_type -> api_services.v1.PastebinServiceGetReq
|
||||
3, // 9: api_services.v1.PastebinService.List:output_type -> api_services.v1.PastebinServiceListResp
|
||||
5, // 10: api_services.v1.PastebinService.Add:output_type -> api_services.v1.PastebinServiceAddResp
|
||||
7, // 11: api_services.v1.PastebinService.Update:output_type -> api_services.v1.PastebinServiceUpdateResp
|
||||
9, // 12: api_services.v1.PastebinService.Get:output_type -> api_services.v1.PastebinServiceGetResp
|
||||
9, // [9:13] is the sub-list for method output_type
|
||||
5, // [5:9] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_api_services_v1_pastebin_module_proto_init() }
|
||||
func file_api_services_v1_pastebin_module_proto_init() {
|
||||
if File_api_services_v1_pastebin_module_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceRecord); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceListReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceListResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceAddReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceAddResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceUpdateReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceUpdateResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceGetReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_api_services_v1_pastebin_module_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PastebinServiceGetResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_api_services_v1_pastebin_module_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_api_services_v1_pastebin_module_proto_goTypes,
|
||||
DependencyIndexes: file_api_services_v1_pastebin_module_proto_depIdxs,
|
||||
EnumInfos: file_api_services_v1_pastebin_module_proto_enumTypes,
|
||||
MessageInfos: file_api_services_v1_pastebin_module_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_services_v1_pastebin_module_proto = out.File
|
||||
file_api_services_v1_pastebin_module_proto_rawDesc = nil
|
||||
file_api_services_v1_pastebin_module_proto_goTypes = nil
|
||||
file_api_services_v1_pastebin_module_proto_depIdxs = nil
|
||||
}
|
||||
87
api_services/v1/pastebin_module.proto
Normal file
87
api_services/v1/pastebin_module.proto
Normal file
@@ -0,0 +1,87 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api_services.v1;
|
||||
|
||||
option go_package = "./;api_servicesv1";
|
||||
|
||||
|
||||
// @route_group: true
|
||||
// @base_url: /v1/pastebin
|
||||
// @gen_to: ./api_services/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);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user