diff --git a/Dockerfile b/Dockerfile index e2a3588..b591a1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -FROM node:18-alpine3.18 as webui -RUN npm config set registry https://registry.npmmirror.com -COPY ./webui . -RUN npm install && npm run build +FROM images.internal/devel:latest -FROM images.local/golang:latest WORKDIR /app + COPY . /app -COPY --from=0 dist /app/webui/dist -RUN go mod tidy && go build . + +RUN make build + +EXPOSE 38002 EXPOSE 38080 ENTRYPOINT [ "./pastebin", "api" ] diff --git a/Makefile b/Makefile index 738d446..1496ebf 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,26 @@ -all: - cd webui && npm install && npm run build - go mod tidy && go build . - ./pastebin api +.PHONY : clean all ui api gen wire docker +gen: +ifeq ($(wildcard "webui/node_modules"),) + buf generate +else + buf generate --exclude-path webui/node_modules +endif + +wire: + go mod tidy + cd gen/wire && wire ui: - cd webui && npm run build + cd webui && npm install && npm run build api: - go build . + go mod tidy && go build . + +build: gen wire ui api + +run: gen wire ui api ./pastebin api + +docker: + podman build -t images.internal/pastebin:latest . + podman push images.internal/pastebin:latest diff --git a/README.md b/README.md new file mode 100644 index 0000000..ad43cc2 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# pastebin + +> 网络文本粘贴箱 + +## usage + +```bash +# 如果遇到proto变更 则进行如下操作 +make gen +make wire + +# 项目编译 +make all + +# 项目本地运行 +make api +``` diff --git a/buf.gen.yaml b/buf.gen.yaml index 044bb8a..965e9e7 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,19 +1,22 @@ version: v1 -managed: - enabled: true - go_package_prefix: - default: pastebin/api_services plugins: - plugin: buf.build/protocolbuffers/go - out: . + out: gen opt: paths=source_relative - plugin: coco - out: . - # opt: paths=source_relative,disable_mongodb_model=true - opt: paths=source_relative + out: gen + opt: + - paths=source_relative + - prefix=proto + - project_name=pastebin - plugin: buf.build/community/stephenh-ts-proto out: ./webui/src/gen opt: - paths=source_relative - snakeToCamel=json - esModuleInterop=true + - plugin: buf.build/grpc/go:v1.3.0 + out: gen + opt: + - paths=source_relative + - require_unimplemented_servers=false diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 0000000..1878b34 --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - proto diff --git a/docker-compose.yaml b/docker-compose.yaml index 655f856..6f5e641 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,10 +2,10 @@ version: "3" services: server: - image: images.local/pastebin:latest + image: images.internal/pastebin:latest container_name: pastebin restart: always volumes: - /data/containers/pastebin:/app/data ports: - - "30002:38080" + - "38001:38080" diff --git a/model/v1/autogen_model_pastebin_model.go b/gen/v1/autogen_model_pastebin_model.go similarity index 91% rename from model/v1/autogen_model_pastebin_model.go rename to gen/v1/autogen_model_pastebin_model.go index 518a487..9c29902 100644 --- a/model/v1/autogen_model_pastebin_model.go +++ b/gen/v1/autogen_model_pastebin_model.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-coco. DO NOT EDIT. -// source: model/v1/pastebin_model.proto -// generate at: 2023-10-15 21:21:24 +// source: v1/pastebin_model.proto +// generate at: 2024-03-19 01:01:42 -package modelv1 +package genv1 const TableNameModelPastebin = "pastebin" diff --git a/api_services/v1/autogen_router_pastebin_service.go b/gen/v1/autogen_router_pastebin_service.go similarity index 86% rename from api_services/v1/autogen_router_pastebin_service.go rename to gen/v1/autogen_router_pastebin_service.go index 08d4254..a19c343 100644 --- a/api_services/v1/autogen_router_pastebin_service.go +++ b/gen/v1/autogen_router_pastebin_service.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-coco. DO NOT EDIT. -// source: api_services/v1/pastebin_module.proto -// generate at: 2023-10-15 21:21:24 +// source: v1/pastebin_module.proto +// generate at: 2024-03-19 01:01:42 -package api_servicesv1 +package genv1 import ( "gitter.top/coco/coco" @@ -16,7 +16,9 @@ type AutoGenPastebinServiceImpl interface { Raw(ctx *coco.Context, req *PastebinServiceRawReq) (resp *PastebinServiceRawResp, err error) } -func (receiver *PastebinService) GetRouterMap() *coco.Routers { +type PastebinService_RouterMap struct{} + +func (receiver *PastebinService_RouterMap) GetRouterMap() *coco.Routers { return &coco.Routers{ BaseURL: "/v1/pastebin", Apis: coco.RouterMap{ diff --git a/gen/v1/pastebin_model.pb.go b/gen/v1/pastebin_model.pb.go new file mode 100644 index 0000000..d83d1d0 --- /dev/null +++ b/gen/v1/pastebin_model.pb.go @@ -0,0 +1,241 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc (unknown) +// source: v1/pastebin_model.proto + +package genv1 + +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) +) + +// @table_name: pastebin +type ModelPastebin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // ID + CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + ExpiredAt int64 `protobuf:"varint,3,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // 过期时间 + ShortId string `protobuf:"bytes,4,opt,name=short_id,json=shortId,proto3" json:"short_id,omitempty"` // ID别名 + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // 标题 + Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"` // 作者 + Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"` // 内容 + Lang string `protobuf:"bytes,8,opt,name=lang,proto3" json:"lang,omitempty"` // 语言 + Password string `protobuf:"bytes,9,opt,name=password,proto3" json:"password,omitempty"` // 是否需要密码 + NeedPassword bool `protobuf:"varint,10,opt,name=need_password,json=needPassword,proto3" json:"need_password,omitempty"` // 是否需要密码 + Editable bool `protobuf:"varint,11,opt,name=editable,proto3" json:"editable,omitempty"` // 是否可以修改 +} + +func (x *ModelPastebin) Reset() { + *x = ModelPastebin{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_pastebin_model_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModelPastebin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModelPastebin) ProtoMessage() {} + +func (x *ModelPastebin) ProtoReflect() protoreflect.Message { + mi := &file_v1_pastebin_model_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 ModelPastebin.ProtoReflect.Descriptor instead. +func (*ModelPastebin) Descriptor() ([]byte, []int) { + return file_v1_pastebin_model_proto_rawDescGZIP(), []int{0} +} + +func (x *ModelPastebin) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ModelPastebin) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ModelPastebin) GetExpiredAt() int64 { + if x != nil { + return x.ExpiredAt + } + return 0 +} + +func (x *ModelPastebin) GetShortId() string { + if x != nil { + return x.ShortId + } + return "" +} + +func (x *ModelPastebin) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *ModelPastebin) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +func (x *ModelPastebin) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *ModelPastebin) GetLang() string { + if x != nil { + return x.Lang + } + return "" +} + +func (x *ModelPastebin) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *ModelPastebin) GetNeedPassword() bool { + if x != nil { + return x.NeedPassword + } + return false +} + +func (x *ModelPastebin) GetEditable() bool { + if x != nil { + return x.Editable + } + return false +} + +var File_v1_pastebin_model_proto protoreflect.FileDescriptor + +var file_v1_pastebin_model_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x5f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x76, 0x31, 0x22, 0xb1, 0x02, 0x0a, 0x0d, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x50, 0x61, 0x73, + 0x74, 0x65, 0x62, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 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, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x65, 0x65, 0x64, 0x5f, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0a, 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, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x65, + 0x64, 0x69, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x70, 0x61, 0x73, 0x74, 0x65, + 0x62, 0x69, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x3b, 0x67, 0x65, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v1_pastebin_model_proto_rawDescOnce sync.Once + file_v1_pastebin_model_proto_rawDescData = file_v1_pastebin_model_proto_rawDesc +) + +func file_v1_pastebin_model_proto_rawDescGZIP() []byte { + file_v1_pastebin_model_proto_rawDescOnce.Do(func() { + file_v1_pastebin_model_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_pastebin_model_proto_rawDescData) + }) + return file_v1_pastebin_model_proto_rawDescData +} + +var file_v1_pastebin_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v1_pastebin_model_proto_goTypes = []interface{}{ + (*ModelPastebin)(nil), // 0: model.v1.ModelPastebin +} +var file_v1_pastebin_model_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_v1_pastebin_model_proto_init() } +func file_v1_pastebin_model_proto_init() { + if File_v1_pastebin_model_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v1_pastebin_model_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModelPastebin); 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_v1_pastebin_model_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v1_pastebin_model_proto_goTypes, + DependencyIndexes: file_v1_pastebin_model_proto_depIdxs, + MessageInfos: file_v1_pastebin_model_proto_msgTypes, + }.Build() + File_v1_pastebin_model_proto = out.File + file_v1_pastebin_model_proto_rawDesc = nil + file_v1_pastebin_model_proto_goTypes = nil + file_v1_pastebin_model_proto_depIdxs = nil +} diff --git a/api_services/v1/pastebin_module.pb.go b/gen/v1/pastebin_module.pb.go similarity index 61% rename from api_services/v1/pastebin_module.pb.go rename to gen/v1/pastebin_module.pb.go index a750210..761dbac 100644 --- a/api_services/v1/pastebin_module.pb.go +++ b/gen/v1/pastebin_module.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc (unknown) -// source: api_services/v1/pastebin_module.proto +// source: v1/pastebin_module.proto -package api_servicesv1 +package genv1 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -59,11 +59,11 @@ func (x ExpireLevel) String() string { } func (ExpireLevel) Descriptor() protoreflect.EnumDescriptor { - return file_api_services_v1_pastebin_module_proto_enumTypes[0].Descriptor() + return file_v1_pastebin_module_proto_enumTypes[0].Descriptor() } func (ExpireLevel) Type() protoreflect.EnumType { - return &file_api_services_v1_pastebin_module_proto_enumTypes[0] + return &file_v1_pastebin_module_proto_enumTypes[0] } func (x ExpireLevel) Number() protoreflect.EnumNumber { @@ -72,7 +72,7 @@ func (x ExpireLevel) Number() protoreflect.EnumNumber { // Deprecated: Use ExpireLevel.Descriptor instead. func (ExpireLevel) EnumDescriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{0} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{0} } type PastebinServiceRecord struct { @@ -97,7 +97,7 @@ type PastebinServiceRecord struct { func (x *PastebinServiceRecord) Reset() { *x = PastebinServiceRecord{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[0] + mi := &file_v1_pastebin_module_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110,7 +110,7 @@ func (x *PastebinServiceRecord) String() string { func (*PastebinServiceRecord) ProtoMessage() {} func (x *PastebinServiceRecord) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[0] + mi := &file_v1_pastebin_module_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -123,7 +123,7 @@ func (x *PastebinServiceRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceRecord.ProtoReflect.Descriptor instead. func (*PastebinServiceRecord) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{0} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{0} } func (x *PastebinServiceRecord) GetId() int64 { @@ -222,7 +222,7 @@ type PastebinServiceListReq struct { func (x *PastebinServiceListReq) Reset() { *x = PastebinServiceListReq{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[1] + mi := &file_v1_pastebin_module_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -235,7 +235,7 @@ func (x *PastebinServiceListReq) String() string { func (*PastebinServiceListReq) ProtoMessage() {} func (x *PastebinServiceListReq) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[1] + mi := &file_v1_pastebin_module_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -248,7 +248,7 @@ func (x *PastebinServiceListReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceListReq.ProtoReflect.Descriptor instead. func (*PastebinServiceListReq) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{1} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{1} } func (x *PastebinServiceListReq) GetPageSize() int64 { @@ -277,7 +277,7 @@ type PastebinServiceListResp struct { func (x *PastebinServiceListResp) Reset() { *x = PastebinServiceListResp{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[2] + mi := &file_v1_pastebin_module_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -290,7 +290,7 @@ func (x *PastebinServiceListResp) String() string { func (*PastebinServiceListResp) ProtoMessage() {} func (x *PastebinServiceListResp) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[2] + mi := &file_v1_pastebin_module_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -303,7 +303,7 @@ func (x *PastebinServiceListResp) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceListResp.ProtoReflect.Descriptor instead. func (*PastebinServiceListResp) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{2} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{2} } func (x *PastebinServiceListResp) GetItems() []*PastebinServiceRecord { @@ -331,7 +331,7 @@ type PastebinServiceAddReq struct { func (x *PastebinServiceAddReq) Reset() { *x = PastebinServiceAddReq{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[3] + mi := &file_v1_pastebin_module_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -344,7 +344,7 @@ func (x *PastebinServiceAddReq) String() string { func (*PastebinServiceAddReq) ProtoMessage() {} func (x *PastebinServiceAddReq) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[3] + mi := &file_v1_pastebin_module_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -357,7 +357,7 @@ func (x *PastebinServiceAddReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceAddReq.ProtoReflect.Descriptor instead. func (*PastebinServiceAddReq) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{3} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{3} } func (x *PastebinServiceAddReq) GetRecord() *PastebinServiceRecord { @@ -376,7 +376,7 @@ type PastebinServiceAddResp struct { func (x *PastebinServiceAddResp) Reset() { *x = PastebinServiceAddResp{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[4] + mi := &file_v1_pastebin_module_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -389,7 +389,7 @@ func (x *PastebinServiceAddResp) String() string { func (*PastebinServiceAddResp) ProtoMessage() {} func (x *PastebinServiceAddResp) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[4] + mi := &file_v1_pastebin_module_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -402,7 +402,7 @@ func (x *PastebinServiceAddResp) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceAddResp.ProtoReflect.Descriptor instead. func (*PastebinServiceAddResp) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{4} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{4} } type PastebinServiceUpdateReq struct { @@ -416,7 +416,7 @@ type PastebinServiceUpdateReq struct { func (x *PastebinServiceUpdateReq) Reset() { *x = PastebinServiceUpdateReq{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[5] + mi := &file_v1_pastebin_module_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -429,7 +429,7 @@ func (x *PastebinServiceUpdateReq) String() string { func (*PastebinServiceUpdateReq) ProtoMessage() {} func (x *PastebinServiceUpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[5] + mi := &file_v1_pastebin_module_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -442,7 +442,7 @@ func (x *PastebinServiceUpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceUpdateReq.ProtoReflect.Descriptor instead. func (*PastebinServiceUpdateReq) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{5} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{5} } func (x *PastebinServiceUpdateReq) GetRecord() *PastebinServiceRecord { @@ -461,7 +461,7 @@ type PastebinServiceUpdateResp struct { func (x *PastebinServiceUpdateResp) Reset() { *x = PastebinServiceUpdateResp{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[6] + mi := &file_v1_pastebin_module_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -474,7 +474,7 @@ func (x *PastebinServiceUpdateResp) String() string { func (*PastebinServiceUpdateResp) ProtoMessage() {} func (x *PastebinServiceUpdateResp) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[6] + mi := &file_v1_pastebin_module_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -487,7 +487,7 @@ func (x *PastebinServiceUpdateResp) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceUpdateResp.ProtoReflect.Descriptor instead. func (*PastebinServiceUpdateResp) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{6} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{6} } type PastebinServiceGetReq struct { @@ -502,7 +502,7 @@ type PastebinServiceGetReq struct { func (x *PastebinServiceGetReq) Reset() { *x = PastebinServiceGetReq{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[7] + mi := &file_v1_pastebin_module_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -515,7 +515,7 @@ func (x *PastebinServiceGetReq) String() string { func (*PastebinServiceGetReq) ProtoMessage() {} func (x *PastebinServiceGetReq) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[7] + mi := &file_v1_pastebin_module_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -528,7 +528,7 @@ func (x *PastebinServiceGetReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceGetReq.ProtoReflect.Descriptor instead. func (*PastebinServiceGetReq) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{7} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{7} } func (x *PastebinServiceGetReq) GetKey() string { @@ -556,7 +556,7 @@ type PastebinServiceGetResp struct { func (x *PastebinServiceGetResp) Reset() { *x = PastebinServiceGetResp{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[8] + mi := &file_v1_pastebin_module_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -569,7 +569,7 @@ func (x *PastebinServiceGetResp) String() string { func (*PastebinServiceGetResp) ProtoMessage() {} func (x *PastebinServiceGetResp) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[8] + mi := &file_v1_pastebin_module_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +582,7 @@ func (x *PastebinServiceGetResp) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceGetResp.ProtoReflect.Descriptor instead. func (*PastebinServiceGetResp) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{8} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{8} } func (x *PastebinServiceGetResp) GetRecord() *PastebinServiceRecord { @@ -604,7 +604,7 @@ type PastebinServiceRawReq struct { func (x *PastebinServiceRawReq) Reset() { *x = PastebinServiceRawReq{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[9] + mi := &file_v1_pastebin_module_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -617,7 +617,7 @@ func (x *PastebinServiceRawReq) String() string { func (*PastebinServiceRawReq) ProtoMessage() {} func (x *PastebinServiceRawReq) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[9] + mi := &file_v1_pastebin_module_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -630,7 +630,7 @@ func (x *PastebinServiceRawReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceRawReq.ProtoReflect.Descriptor instead. func (*PastebinServiceRawReq) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{9} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{9} } func (x *PastebinServiceRawReq) GetKey() string { @@ -656,7 +656,7 @@ type PastebinServiceRawResp struct { func (x *PastebinServiceRawResp) Reset() { *x = PastebinServiceRawResp{} if protoimpl.UnsafeEnabled { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[10] + mi := &file_v1_pastebin_module_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -669,7 +669,7 @@ func (x *PastebinServiceRawResp) String() string { func (*PastebinServiceRawResp) ProtoMessage() {} func (x *PastebinServiceRawResp) ProtoReflect() protoreflect.Message { - mi := &file_api_services_v1_pastebin_module_proto_msgTypes[10] + mi := &file_v1_pastebin_module_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -682,146 +682,135 @@ func (x *PastebinServiceRawResp) ProtoReflect() protoreflect.Message { // Deprecated: Use PastebinServiceRawResp.ProtoReflect.Descriptor instead. func (*PastebinServiceRawResp) Descriptor() ([]byte, []int) { - return file_api_services_v1_pastebin_module_proto_rawDescGZIP(), []int{10} + return file_v1_pastebin_module_proto_rawDescGZIP(), []int{10} } -var File_api_services_v1_pastebin_module_proto protoreflect.FileDescriptor +var File_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, +var file_v1_pastebin_module_proto_rawDesc = []byte{ + 0x0a, 0x18, 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, 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, 0x22, 0x45, 0x0a, 0x15, 0x50, 0x61, 0x73, 0x74, 0x65, - 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x61, 0x77, 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, 0x18, - 0x0a, 0x16, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 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, 0xd5, 0x03, 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, + 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, 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, 0x12, 0x56, 0x0a, 0x03, - 0x52, 0x61, 0x77, 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, 0x52, 0x61, 0x77, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x61, 0x70, - 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, + 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, 0x22, 0x45, 0x0a, 0x15, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x61, 0x77, - 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, + 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, 0x18, 0x0a, 0x16, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x52, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 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, + 0xd5, 0x03, 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, 0x12, + 0x56, 0x0a, 0x03, 0x52, 0x61, 0x77, 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, 0x52, 0x61, 0x77, 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, + 0x52, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 0x42, 0x14, 0x5a, 0x12, 0x70, 0x61, 0x73, 0x74, 0x65, + 0x62, 0x69, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x3b, 0x67, 0x65, 0x6e, 0x76, 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 + file_v1_pastebin_module_proto_rawDescOnce sync.Once + file_v1_pastebin_module_proto_rawDescData = file_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) +func file_v1_pastebin_module_proto_rawDescGZIP() []byte { + file_v1_pastebin_module_proto_rawDescOnce.Do(func() { + file_v1_pastebin_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_pastebin_module_proto_rawDescData) }) - return file_api_services_v1_pastebin_module_proto_rawDescData + return file_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, 11) -var file_api_services_v1_pastebin_module_proto_goTypes = []interface{}{ +var file_v1_pastebin_module_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_v1_pastebin_module_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_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 @@ -835,7 +824,7 @@ var file_api_services_v1_pastebin_module_proto_goTypes = []interface{}{ (*PastebinServiceRawReq)(nil), // 10: api_services.v1.PastebinServiceRawReq (*PastebinServiceRawResp)(nil), // 11: api_services.v1.PastebinServiceRawResp } -var file_api_services_v1_pastebin_module_proto_depIdxs = []int32{ +var file_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 @@ -858,13 +847,13 @@ var file_api_services_v1_pastebin_module_proto_depIdxs = []int32{ 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 { +func init() { file_v1_pastebin_module_proto_init() } +func file_v1_pastebin_module_proto_init() { + if File_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{} { + file_v1_pastebin_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceRecord); i { case 0: return &v.state @@ -876,7 +865,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceListReq); i { case 0: return &v.state @@ -888,7 +877,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceListResp); i { case 0: return &v.state @@ -900,7 +889,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceAddReq); i { case 0: return &v.state @@ -912,7 +901,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceAddResp); i { case 0: return &v.state @@ -924,7 +913,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceUpdateReq); i { case 0: return &v.state @@ -936,7 +925,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceUpdateResp); i { case 0: return &v.state @@ -948,7 +937,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceGetReq); i { case 0: return &v.state @@ -960,7 +949,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceGetResp); i { case 0: return &v.state @@ -972,7 +961,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceRawReq); i { case 0: return &v.state @@ -984,7 +973,7 @@ func file_api_services_v1_pastebin_module_proto_init() { return nil } } - file_api_services_v1_pastebin_module_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_v1_pastebin_module_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PastebinServiceRawResp); i { case 0: return &v.state @@ -1001,19 +990,19 @@ func file_api_services_v1_pastebin_module_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_services_v1_pastebin_module_proto_rawDesc, + RawDescriptor: file_v1_pastebin_module_proto_rawDesc, NumEnums: 1, NumMessages: 11, 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, + GoTypes: file_v1_pastebin_module_proto_goTypes, + DependencyIndexes: file_v1_pastebin_module_proto_depIdxs, + EnumInfos: file_v1_pastebin_module_proto_enumTypes, + MessageInfos: file_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 + File_v1_pastebin_module_proto = out.File + file_v1_pastebin_module_proto_rawDesc = nil + file_v1_pastebin_module_proto_goTypes = nil + file_v1_pastebin_module_proto_depIdxs = nil } diff --git a/gen/v1/pastebin_module_grpc.pb.go b/gen/v1/pastebin_module_grpc.pb.go new file mode 100644 index 0000000..bbcf4c4 --- /dev/null +++ b/gen/v1/pastebin_module_grpc.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: v1/pastebin_module.proto + +package genv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + PastebinService_List_FullMethodName = "/api_services.v1.PastebinService/List" + PastebinService_Add_FullMethodName = "/api_services.v1.PastebinService/Add" + PastebinService_Update_FullMethodName = "/api_services.v1.PastebinService/Update" + PastebinService_Get_FullMethodName = "/api_services.v1.PastebinService/Get" + PastebinService_Raw_FullMethodName = "/api_services.v1.PastebinService/Raw" +) + +// PastebinServiceClient is the client API for PastebinService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PastebinServiceClient interface { + // @desc: 列表 + // @author: Young Xu + // @method: GET + // @api: /list + List(ctx context.Context, in *PastebinServiceListReq, opts ...grpc.CallOption) (*PastebinServiceListResp, error) + // @desc: 新建 + // @author: Young Xu + // @method: PUT + // @api: /add + Add(ctx context.Context, in *PastebinServiceAddReq, opts ...grpc.CallOption) (*PastebinServiceAddResp, error) + // @desc: 更新 + // @author: Young Xu + // @method: POST + // @api: /update + Update(ctx context.Context, in *PastebinServiceUpdateReq, opts ...grpc.CallOption) (*PastebinServiceUpdateResp, error) + // @desc: 获取一条记录 + // @author: Young Xu + // @method: GET + // @api: /get + Get(ctx context.Context, in *PastebinServiceGetReq, opts ...grpc.CallOption) (*PastebinServiceGetResp, error) + // @desc: 获取原文内容 + // @author: Young Xu + // @method: GET + // @api: /raw + Raw(ctx context.Context, in *PastebinServiceRawReq, opts ...grpc.CallOption) (*PastebinServiceRawResp, error) +} + +type pastebinServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPastebinServiceClient(cc grpc.ClientConnInterface) PastebinServiceClient { + return &pastebinServiceClient{cc} +} + +func (c *pastebinServiceClient) List(ctx context.Context, in *PastebinServiceListReq, opts ...grpc.CallOption) (*PastebinServiceListResp, error) { + out := new(PastebinServiceListResp) + err := c.cc.Invoke(ctx, PastebinService_List_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pastebinServiceClient) Add(ctx context.Context, in *PastebinServiceAddReq, opts ...grpc.CallOption) (*PastebinServiceAddResp, error) { + out := new(PastebinServiceAddResp) + err := c.cc.Invoke(ctx, PastebinService_Add_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pastebinServiceClient) Update(ctx context.Context, in *PastebinServiceUpdateReq, opts ...grpc.CallOption) (*PastebinServiceUpdateResp, error) { + out := new(PastebinServiceUpdateResp) + err := c.cc.Invoke(ctx, PastebinService_Update_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pastebinServiceClient) Get(ctx context.Context, in *PastebinServiceGetReq, opts ...grpc.CallOption) (*PastebinServiceGetResp, error) { + out := new(PastebinServiceGetResp) + err := c.cc.Invoke(ctx, PastebinService_Get_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pastebinServiceClient) Raw(ctx context.Context, in *PastebinServiceRawReq, opts ...grpc.CallOption) (*PastebinServiceRawResp, error) { + out := new(PastebinServiceRawResp) + err := c.cc.Invoke(ctx, PastebinService_Raw_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PastebinServiceServer is the server API for PastebinService service. +// All implementations should embed UnimplementedPastebinServiceServer +// for forward compatibility +type PastebinServiceServer interface { + // @desc: 列表 + // @author: Young Xu + // @method: GET + // @api: /list + List(context.Context, *PastebinServiceListReq) (*PastebinServiceListResp, error) + // @desc: 新建 + // @author: Young Xu + // @method: PUT + // @api: /add + Add(context.Context, *PastebinServiceAddReq) (*PastebinServiceAddResp, error) + // @desc: 更新 + // @author: Young Xu + // @method: POST + // @api: /update + Update(context.Context, *PastebinServiceUpdateReq) (*PastebinServiceUpdateResp, error) + // @desc: 获取一条记录 + // @author: Young Xu + // @method: GET + // @api: /get + Get(context.Context, *PastebinServiceGetReq) (*PastebinServiceGetResp, error) + // @desc: 获取原文内容 + // @author: Young Xu + // @method: GET + // @api: /raw + Raw(context.Context, *PastebinServiceRawReq) (*PastebinServiceRawResp, error) +} + +// UnimplementedPastebinServiceServer should be embedded to have forward compatible implementations. +type UnimplementedPastebinServiceServer struct { +} + +func (UnimplementedPastebinServiceServer) List(context.Context, *PastebinServiceListReq) (*PastebinServiceListResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedPastebinServiceServer) Add(context.Context, *PastebinServiceAddReq) (*PastebinServiceAddResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") +} +func (UnimplementedPastebinServiceServer) Update(context.Context, *PastebinServiceUpdateReq) (*PastebinServiceUpdateResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (UnimplementedPastebinServiceServer) Get(context.Context, *PastebinServiceGetReq) (*PastebinServiceGetResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedPastebinServiceServer) Raw(context.Context, *PastebinServiceRawReq) (*PastebinServiceRawResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Raw not implemented") +} + +// UnsafePastebinServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PastebinServiceServer will +// result in compilation errors. +type UnsafePastebinServiceServer interface { + mustEmbedUnimplementedPastebinServiceServer() +} + +func RegisterPastebinServiceServer(s grpc.ServiceRegistrar, srv PastebinServiceServer) { + s.RegisterService(&PastebinService_ServiceDesc, srv) +} + +func _PastebinService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PastebinServiceListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PastebinServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PastebinService_List_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PastebinServiceServer).List(ctx, req.(*PastebinServiceListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PastebinService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PastebinServiceAddReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PastebinServiceServer).Add(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PastebinService_Add_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PastebinServiceServer).Add(ctx, req.(*PastebinServiceAddReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PastebinService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PastebinServiceUpdateReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PastebinServiceServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PastebinService_Update_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PastebinServiceServer).Update(ctx, req.(*PastebinServiceUpdateReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PastebinService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PastebinServiceGetReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PastebinServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PastebinService_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PastebinServiceServer).Get(ctx, req.(*PastebinServiceGetReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PastebinService_Raw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PastebinServiceRawReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PastebinServiceServer).Raw(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PastebinService_Raw_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PastebinServiceServer).Raw(ctx, req.(*PastebinServiceRawReq)) + } + return interceptor(ctx, in, info, handler) +} + +// PastebinService_ServiceDesc is the grpc.ServiceDesc for PastebinService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PastebinService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "api_services.v1.PastebinService", + HandlerType: (*PastebinServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "List", + Handler: _PastebinService_List_Handler, + }, + { + MethodName: "Add", + Handler: _PastebinService_Add_Handler, + }, + { + MethodName: "Update", + Handler: _PastebinService_Update_Handler, + }, + { + MethodName: "Get", + Handler: _PastebinService_Get_Handler, + }, + { + MethodName: "Raw", + Handler: _PastebinService_Raw_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v1/pastebin_module.proto", +} diff --git a/gen/wire/wire.go b/gen/wire/wire.go new file mode 100644 index 0000000..f654dc3 --- /dev/null +++ b/gen/wire/wire.go @@ -0,0 +1,25 @@ +//go:build wireinject +// +build wireinject + +package wire + +import ( + "github.com/google/wire" + + "pastebin/gen/v1" + "pastebin/services/controller/v1" +) + +type PastebinService struct { + *controllerv1.PastebinService + *genv1.PastebinService_RouterMap +} + +func NewPastebinService(c *controllerv1.PastebinService, r *genv1.PastebinService_RouterMap) *PastebinService { + return &PastebinService{c, r} +} + +func InitPastebinService() *PastebinService { + wire.Build(wire.Struct(new(controllerv1.PastebinService)), wire.Struct(new(genv1.PastebinService_RouterMap)), NewPastebinService) + return &PastebinService{} +} diff --git a/gen/wire/wire_gen.go b/gen/wire/wire_gen.go new file mode 100644 index 0000000..6bb336f --- /dev/null +++ b/gen/wire/wire_gen.go @@ -0,0 +1,32 @@ +// Code generated by Wire. DO NOT EDIT. + +//go:generate go run github.com/google/wire/cmd/wire +//go:build !wireinject +// +build !wireinject + +package wire + +import ( + "pastebin/gen/v1" + "pastebin/services/controller/v1" +) + +// Injectors from wire.go: + +func InitPastebinService() *PastebinService { + pastebinService := &controllerv1.PastebinService{} + pastebinService_RouterMap := &genv1.PastebinService_RouterMap{} + wirePastebinService := NewPastebinService(pastebinService, pastebinService_RouterMap) + return wirePastebinService +} + +// wire.go: + +type PastebinService struct { + *controllerv1.PastebinService + *genv1.PastebinService_RouterMap +} + +func NewPastebinService(c *controllerv1.PastebinService, r *genv1.PastebinService_RouterMap) *PastebinService { + return &PastebinService{c, r} +} diff --git a/go.mod b/go.mod index 2bd8abd..43d299e 100644 --- a/go.mod +++ b/go.mod @@ -4,55 +4,60 @@ go 1.21.0 require ( github.com/gin-gonic/gin v1.9.1 + github.com/google/wire v0.6.0 github.com/sirupsen/logrus v1.9.3 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 github.com/sqids/sqids-go v0.4.1 gitter.top/coco/coco v0.0.1 - gitter.top/common/lormatter v0.0.0-20230910075849-28d49dccd03a + gitter.top/common/lormatter v0.0.1 gitter.top/drivers/sdbc v0.0.0-20230929063242-b4baa9aa7ff8 - google.golang.org/protobuf v1.31.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/bytedance/sonic v1.10.2 // indirect + github.com/bytedance/sonic v1.11.3 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect - github.com/chenzhuoyu/iasm v0.9.0 // indirect + github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/glebarez/go-sqlite v1.21.2 // indirect - github.com/glebarez/sqlite v1.9.0 // indirect + github.com/glebarez/go-sqlite v1.22.0 // indirect + github.com/glebarez/sqlite v1.11.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.15.5 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/gorilla/schema v1.2.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/schema v1.2.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect - github.com/leodido/go-urn v1.2.4 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect - gitter.top/common/goref v0.0.0-20230916075900-7b64840146ae // indirect - golang.org/x/arch v0.5.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - gorm.io/gorm v1.25.4 // indirect - modernc.org/libc v1.24.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + gitter.top/common/goref v0.0.0-20240202181934-a82af1d66cc0 // indirect + golang.org/x/arch v0.7.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + gorm.io/gorm v1.25.8 // indirect + modernc.org/libc v1.45.0 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.7.2 // indirect - modernc.org/sqlite v1.25.0 // indirect + modernc.org/sqlite v1.29.5 // indirect ) diff --git a/internal/repositories/sqlite.go b/internal/repositories/sqlite.go index 90af8ef..db9e5aa 100644 --- a/internal/repositories/sqlite.go +++ b/internal/repositories/sqlite.go @@ -1,10 +1,12 @@ package repositories import ( - "gitter.top/drivers/sdbc" - "pastebin/config" - modelv1 "pastebin/model/v1" "time" + + "gitter.top/drivers/sdbc" + + "pastebin/config" + genv1 "pastebin/gen/v1" ) var ( @@ -24,7 +26,7 @@ func GetPastebin() sdbc.Operator { }) } if pastebinOperator == nil { - pastebinOperator = driver.BindModel(&modelv1.ModelPastebin{}) + pastebinOperator = driver.BindModel(&genv1.ModelPastebin{}) } return pastebinOperator } diff --git a/model/v1/pastebin_model.pb.go b/model/v1/pastebin_model.pb.go deleted file mode 100644 index a0712ac..0000000 --- a/model/v1/pastebin_model.pb.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: model/v1/pastebin_model.proto - -package modelv1 - -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) -) - -// @table_name: pastebin -type ModelPastebin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // ID - CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 - ExpiredAt int64 `protobuf:"varint,3,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // 过期时间 - ShortId string `protobuf:"bytes,4,opt,name=short_id,json=shortId,proto3" json:"short_id,omitempty"` // ID别名 - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // 标题 - Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"` // 作者 - Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"` // 内容 - Lang string `protobuf:"bytes,8,opt,name=lang,proto3" json:"lang,omitempty"` // 语言 - Password string `protobuf:"bytes,9,opt,name=password,proto3" json:"password,omitempty"` // 是否需要密码 - NeedPassword bool `protobuf:"varint,10,opt,name=need_password,json=needPassword,proto3" json:"need_password,omitempty"` // 是否需要密码 - Editable bool `protobuf:"varint,11,opt,name=editable,proto3" json:"editable,omitempty"` // 是否可以修改 -} - -func (x *ModelPastebin) Reset() { - *x = ModelPastebin{} - if protoimpl.UnsafeEnabled { - mi := &file_model_v1_pastebin_model_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ModelPastebin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ModelPastebin) ProtoMessage() {} - -func (x *ModelPastebin) ProtoReflect() protoreflect.Message { - mi := &file_model_v1_pastebin_model_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 ModelPastebin.ProtoReflect.Descriptor instead. -func (*ModelPastebin) Descriptor() ([]byte, []int) { - return file_model_v1_pastebin_model_proto_rawDescGZIP(), []int{0} -} - -func (x *ModelPastebin) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *ModelPastebin) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *ModelPastebin) GetExpiredAt() int64 { - if x != nil { - return x.ExpiredAt - } - return 0 -} - -func (x *ModelPastebin) GetShortId() string { - if x != nil { - return x.ShortId - } - return "" -} - -func (x *ModelPastebin) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *ModelPastebin) GetAuthor() string { - if x != nil { - return x.Author - } - return "" -} - -func (x *ModelPastebin) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *ModelPastebin) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *ModelPastebin) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *ModelPastebin) GetNeedPassword() bool { - if x != nil { - return x.NeedPassword - } - return false -} - -func (x *ModelPastebin) GetEditable() bool { - if x != nil { - return x.Editable - } - return false -} - -var File_model_v1_pastebin_model_proto protoreflect.FileDescriptor - -var file_model_v1_pastebin_model_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x73, 0x74, 0x65, - 0x62, 0x69, 0x6e, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x08, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x22, 0xb1, 0x02, 0x0a, 0x0d, 0x4d, 0x6f, - 0x64, 0x65, 0x6c, 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 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, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x41, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x68, 0x6f, - 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x68, 0x6f, - 0x72, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0d, - 0x6e, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0a, 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, 0x0b, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x65, 0x64, 0x69, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x8b, 0x01, - 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x42, 0x12, - 0x50, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x70, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x2f, 0x61, - 0x70, 0x69, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, - 0x58, 0x58, 0xaa, 0x02, 0x08, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, - 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x14, 0x4d, 0x6f, 0x64, 0x65, 0x6c, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x09, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_model_v1_pastebin_model_proto_rawDescOnce sync.Once - file_model_v1_pastebin_model_proto_rawDescData = file_model_v1_pastebin_model_proto_rawDesc -) - -func file_model_v1_pastebin_model_proto_rawDescGZIP() []byte { - file_model_v1_pastebin_model_proto_rawDescOnce.Do(func() { - file_model_v1_pastebin_model_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_v1_pastebin_model_proto_rawDescData) - }) - return file_model_v1_pastebin_model_proto_rawDescData -} - -var file_model_v1_pastebin_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_model_v1_pastebin_model_proto_goTypes = []interface{}{ - (*ModelPastebin)(nil), // 0: model.v1.ModelPastebin -} -var file_model_v1_pastebin_model_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_model_v1_pastebin_model_proto_init() } -func file_model_v1_pastebin_model_proto_init() { - if File_model_v1_pastebin_model_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_model_v1_pastebin_model_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ModelPastebin); 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_model_v1_pastebin_model_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_model_v1_pastebin_model_proto_goTypes, - DependencyIndexes: file_model_v1_pastebin_model_proto_depIdxs, - MessageInfos: file_model_v1_pastebin_model_proto_msgTypes, - }.Build() - File_model_v1_pastebin_model_proto = out.File - file_model_v1_pastebin_model_proto_rawDesc = nil - file_model_v1_pastebin_model_proto_goTypes = nil - file_model_v1_pastebin_model_proto_depIdxs = nil -} diff --git a/proto/v1/buf.yaml b/proto/v1/buf.yaml new file mode 100644 index 0000000..ab534d0 --- /dev/null +++ b/proto/v1/buf.yaml @@ -0,0 +1,9 @@ +version: v1 +breaking: + use: + - FILE +lint: + use: + - DEFAULT + except: + - MINIMAL diff --git a/model/v1/pastebin_model.proto b/proto/v1/pastebin_model.proto similarity index 93% rename from model/v1/pastebin_model.proto rename to proto/v1/pastebin_model.proto index 24e5b8d..64b7977 100644 --- a/model/v1/pastebin_model.proto +++ b/proto/v1/pastebin_model.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package model.v1; -option go_package = "./;modelv1"; +option go_package = "pastebin/gen;genv1"; // @table_name: pastebin diff --git a/api_services/v1/pastebin_module.proto b/proto/v1/pastebin_module.proto similarity index 96% rename from api_services/v1/pastebin_module.proto rename to proto/v1/pastebin_module.proto index 6be7edd..b272023 100644 --- a/api_services/v1/pastebin_module.proto +++ b/proto/v1/pastebin_module.proto @@ -2,12 +2,12 @@ syntax = "proto3"; package api_services.v1; -option go_package = "./;api_servicesv1"; +option go_package = "pastebin/gen;genv1"; // @route_group: true // @base_url: /v1/pastebin -// @gen_to: ./api_services/v1/pastebin_controller.go +// @gen_to: ./services/controller/v1/pastebin_controller.go service PastebinService { // @desc: 列表 // @author: Young Xu diff --git a/register/router.go b/register/router.go index b1ffbb3..7cfac5b 100644 --- a/register/router.go +++ b/register/router.go @@ -4,9 +4,9 @@ import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "gitter.top/coco/coco" - "pastebin/api_services/v1" "pastebin/config" + "pastebin/gen/wire" ) type Router struct{} @@ -21,8 +21,8 @@ func (receiver *Router) Register() error { // 从这里开始实例化路由注册器 var register = coco.NewRegister() register.DefaultRouter(coco.WithListenAddress(cfg.ServerListen), - coco.WithGinMode(gin.ReleaseMode), coco.WithCors(), coco.WithRecovery()) - register.RegisterStruct(&api_servicesv1.PastebinService{}) + coco.WithGinMode(gin.DebugMode), coco.WithCors(), coco.WithRecovery()) + register.RegisterStruct(wire.InitPastebinService()) _ = register.PreRun(func() error { engine := register.RawEngine() engine.Static("/assets", "./webui/dist/assets") diff --git a/rpc_services/.gitkeep b/rpc_services/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/api_services/v1/pastebin_controller.go b/services/controller/v1/pastebin_controller.go similarity index 71% rename from api_services/v1/pastebin_controller.go rename to services/controller/v1/pastebin_controller.go index e350155..8d3e7cb 100644 --- a/api_services/v1/pastebin_controller.go +++ b/services/controller/v1/pastebin_controller.go @@ -1,22 +1,24 @@ -package api_servicesv1 +package controllerv1 import ( + "time" + "github.com/sirupsen/logrus" "gitter.top/coco/coco" + "pastebin/common" + genv1 "pastebin/gen/v1" "pastebin/internal/repositories" - modelv1 "pastebin/model/v1" - "time" ) type PastebinService struct{} -// IDE: PastebinService implemented PastebinServiceImpl interface -var _ AutoGenPastebinServiceImpl = (*PastebinService)(nil) +// IDE: PastebinService implemented genv1.AutoGenPastebinServiceImpl interface +var _ genv1.AutoGenPastebinServiceImpl = (*PastebinService)(nil) // List 列表 -func (receiver *PastebinService) List(ctx *coco.Context, req *PastebinServiceListReq) (resp *PastebinServiceListResp, err error) { - resp = new(PastebinServiceListResp) +func (receiver *PastebinService) List(ctx *coco.Context, req *genv1.PastebinServiceListReq) (resp *genv1.PastebinServiceListResp, err error) { + resp = new(genv1.PastebinServiceListResp) if req.PageSize == 0 { req.PageSize = 25 @@ -32,7 +34,7 @@ func (receiver *PastebinService) List(ctx *coco.Context, req *PastebinServiceLis db := repositories.GetPastebin() - var records []modelv1.ModelPastebin + var records []genv1.ModelPastebin if err := db.Find().SetWhere("expired_at > ?", time.Now().Unix()).SetLimit(int(limit)). SetOffset(int(offset)).SetOrder("id desc").Find(&records); err != nil { @@ -47,7 +49,7 @@ func (receiver *PastebinService) List(ctx *coco.Context, req *PastebinServiceLis } for _, record := range records { - item := &PastebinServiceRecord{ + item := &genv1.PastebinServiceRecord{ Id: record.Id, Key: record.ShortId, Title: record.Title, @@ -66,24 +68,24 @@ func (receiver *PastebinService) List(ctx *coco.Context, req *PastebinServiceLis } // Add 新建 -func (receiver *PastebinService) Add(ctx *coco.Context, req *PastebinServiceAddReq) (resp *PastebinServiceAddResp, err error) { - resp = new(PastebinServiceAddResp) +func (receiver *PastebinService) Add(ctx *coco.Context, req *genv1.PastebinServiceAddReq) (resp *genv1.PastebinServiceAddResp, err error) { + resp = new(genv1.PastebinServiceAddResp) var expiredAt = time.Now() switch req.Record.ExpireLevel { - case ExpireLevel_Forever: + case genv1.ExpireLevel_Forever: expiredAt = expiredAt.Add(time.Hour * 87600) - case ExpireLevel_Day: + case genv1.ExpireLevel_Day: expiredAt = expiredAt.Add(time.Hour * 24) - case ExpireLevel_Week: + case genv1.ExpireLevel_Week: expiredAt = expiredAt.Add(time.Hour * 168) - case ExpireLevel_Month: + case genv1.ExpireLevel_Month: expiredAt = expiredAt.Add(time.Hour * 720) - case ExpireLevel_Year: + case genv1.ExpireLevel_Year: expiredAt = expiredAt.Add(time.Hour * 8760) } - var record = modelv1.ModelPastebin{ + var record = genv1.ModelPastebin{ CreatedAt: time.Now().Unix(), ExpiredAt: expiredAt.Unix(), ShortId: common.UniqID(time.Now().UnixMilli()), @@ -107,8 +109,8 @@ func (receiver *PastebinService) Add(ctx *coco.Context, req *PastebinServiceAddR } // Update 更新 -func (receiver *PastebinService) Update(ctx *coco.Context, req *PastebinServiceUpdateReq) (resp *PastebinServiceUpdateResp, err error) { - resp = new(PastebinServiceUpdateResp) +func (receiver *PastebinService) Update(ctx *coco.Context, req *genv1.PastebinServiceUpdateReq) (resp *genv1.PastebinServiceUpdateResp, err error) { + resp = new(genv1.PastebinServiceUpdateResp) // TODO impl... @@ -116,12 +118,12 @@ func (receiver *PastebinService) Update(ctx *coco.Context, req *PastebinServiceU } // Get 获取一条记录 -func (receiver *PastebinService) Get(ctx *coco.Context, req *PastebinServiceGetReq) (resp *PastebinServiceGetResp, err error) { - resp = new(PastebinServiceGetResp) +func (receiver *PastebinService) Get(ctx *coco.Context, req *genv1.PastebinServiceGetReq) (resp *genv1.PastebinServiceGetResp, err error) { + resp = new(genv1.PastebinServiceGetResp) db := repositories.GetPastebin() - var record modelv1.ModelPastebin + var record genv1.ModelPastebin if err := db.Find().SetWhere("short_id = ?", req.Key).FindOne(&record); err != nil { logrus.Errorf("query records failed: %v", err) @@ -136,7 +138,7 @@ func (receiver *PastebinService) Get(ctx *coco.Context, req *PastebinServiceGetR return nil, coco.CreateErrorWithMsg(4002, "incorrect password") } - item := &PastebinServiceRecord{ + item := &genv1.PastebinServiceRecord{ Id: record.Id, Key: record.ShortId, Title: record.Title, @@ -154,12 +156,12 @@ func (receiver *PastebinService) Get(ctx *coco.Context, req *PastebinServiceGetR } // Raw 获取原文内容 -func (receiver *PastebinService) Raw(ctx *coco.Context, req *PastebinServiceRawReq) (resp *PastebinServiceRawResp, err error) { - resp = new(PastebinServiceRawResp) +func (receiver *PastebinService) Raw(ctx *coco.Context, req *genv1.PastebinServiceRawReq) (resp *genv1.PastebinServiceRawResp, err error) { + resp = new(genv1.PastebinServiceRawResp) db := repositories.GetPastebin() - var record modelv1.ModelPastebin + var record genv1.ModelPastebin if err := db.Find().SetWhere("short_id = ?", req.Key).FindOne(&record); err != nil { logrus.Errorf("query records failed: %v", err) diff --git a/webui/src/gen/v1/pastebin_model.ts b/webui/src/gen/v1/pastebin_model.ts new file mode 100644 index 0000000..d4bf1c5 --- /dev/null +++ b/webui/src/gen/v1/pastebin_model.ts @@ -0,0 +1,280 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "model.v1"; + +/** @table_name: pastebin */ +export interface ModelPastebin { + /** ID */ + id: number; + /** 创建时间 */ + created_at: number; + /** 过期时间 */ + expired_at: number; + /** ID别名 */ + short_id: string; + /** 标题 */ + title: string; + /** 作者 */ + author: string; + /** 内容 */ + content: string; + /** 语言 */ + lang: string; + /** 是否需要密码 */ + password: string; + /** 是否需要密码 */ + need_password: boolean; + /** 是否可以修改 */ + editable: boolean; +} + +function createBaseModelPastebin(): ModelPastebin { + return { + id: 0, + created_at: 0, + expired_at: 0, + short_id: "", + title: "", + author: "", + content: "", + lang: "", + password: "", + need_password: false, + editable: false, + }; +} + +export const ModelPastebin = { + encode(message: ModelPastebin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.created_at !== 0) { + writer.uint32(16).int64(message.created_at); + } + if (message.expired_at !== 0) { + writer.uint32(24).int64(message.expired_at); + } + if (message.short_id !== "") { + writer.uint32(34).string(message.short_id); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.author !== "") { + writer.uint32(50).string(message.author); + } + if (message.content !== "") { + writer.uint32(58).string(message.content); + } + if (message.lang !== "") { + writer.uint32(66).string(message.lang); + } + if (message.password !== "") { + writer.uint32(74).string(message.password); + } + if (message.need_password === true) { + writer.uint32(80).bool(message.need_password); + } + if (message.editable === true) { + writer.uint32(88).bool(message.editable); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModelPastebin { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModelPastebin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.created_at = longToNumber(reader.int64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expired_at = longToNumber(reader.int64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short_id = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.author = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.content = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.lang = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.password = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.need_password = reader.bool(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.editable = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModelPastebin { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + created_at: isSet(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + expired_at: isSet(object.expiredAt) ? globalThis.Number(object.expiredAt) : 0, + short_id: isSet(object.shortId) ? globalThis.String(object.shortId) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + author: isSet(object.author) ? globalThis.String(object.author) : "", + content: isSet(object.content) ? globalThis.String(object.content) : "", + lang: isSet(object.lang) ? globalThis.String(object.lang) : "", + password: isSet(object.password) ? globalThis.String(object.password) : "", + need_password: isSet(object.needPassword) ? globalThis.Boolean(object.needPassword) : false, + editable: isSet(object.editable) ? globalThis.Boolean(object.editable) : false, + }; + }, + + toJSON(message: ModelPastebin): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.created_at !== 0) { + obj.createdAt = Math.round(message.created_at); + } + if (message.expired_at !== 0) { + obj.expiredAt = Math.round(message.expired_at); + } + if (message.short_id !== "") { + obj.shortId = message.short_id; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.author !== "") { + obj.author = message.author; + } + if (message.content !== "") { + obj.content = message.content; + } + if (message.lang !== "") { + obj.lang = message.lang; + } + if (message.password !== "") { + obj.password = message.password; + } + if (message.need_password === true) { + obj.needPassword = message.need_password; + } + if (message.editable === true) { + obj.editable = message.editable; + } + return obj; + }, + + create, I>>(base?: I): ModelPastebin { + return ModelPastebin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModelPastebin { + const message = createBaseModelPastebin(); + message.id = object.id ?? 0; + message.created_at = object.created_at ?? 0; + message.expired_at = object.expired_at ?? 0; + message.short_id = object.short_id ?? ""; + message.title = object.title ?? ""; + message.author = object.author ?? ""; + message.content = object.content ?? ""; + message.lang = object.lang ?? ""; + message.password = object.password ?? ""; + message.need_password = object.need_password ?? false; + message.editable = object.editable ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/webui/src/gen/v1/pastebin_module.ts b/webui/src/gen/v1/pastebin_module.ts new file mode 100644 index 0000000..38c3670 --- /dev/null +++ b/webui/src/gen/v1/pastebin_module.ts @@ -0,0 +1,1088 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "api_services.v1"; + +export enum ExpireLevel { + Forever = 0, + Day = 1, + Week = 2, + Month = 3, + Year = 4, + UNRECOGNIZED = -1, +} + +export function expireLevelFromJSON(object: any): ExpireLevel { + switch (object) { + case 0: + case "Forever": + return ExpireLevel.Forever; + case 1: + case "Day": + return ExpireLevel.Day; + case 2: + case "Week": + return ExpireLevel.Week; + case 3: + case "Month": + return ExpireLevel.Month; + case 4: + case "Year": + return ExpireLevel.Year; + case -1: + case "UNRECOGNIZED": + default: + return ExpireLevel.UNRECOGNIZED; + } +} + +export function expireLevelToJSON(object: ExpireLevel): string { + switch (object) { + case ExpireLevel.Forever: + return "Forever"; + case ExpireLevel.Day: + return "Day"; + case ExpireLevel.Week: + return "Week"; + case ExpireLevel.Month: + return "Month"; + case ExpireLevel.Year: + return "Year"; + case ExpireLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface PastebinServiceRecord { + /** 记录ID */ + id: number; + /** 记录别名 */ + key: string; + /** 记录标题 */ + title: string; + /** 记录渲染后内容 */ + content: string; + /** 记录创建时间 */ + created_at: string; + /** 过期时间 */ + expired_at: string; + /** 是否需要密码 */ + need_password: boolean; + /** 是否可以修订 */ + editable: boolean; + /** 指定记录有效期 */ + expire_level: ExpireLevel; + /** 指定需要密码访问 */ + password: string; + /** 指定语言 */ + lang: string; + /** 作者 */ + author: string; +} + +export interface PastebinServiceListReq { + /** 分页大小 */ + page_size: number; + /** 当前页 从第一页开始 */ + current_page: number; +} + +export interface PastebinServiceListResp { + /** 列表 */ + items: PastebinServiceRecord[]; + /** 是否有下一页 */ + has_more: boolean; +} + +export interface PastebinServiceAddReq { + record: PastebinServiceRecord | undefined; +} + +export interface PastebinServiceAddResp { +} + +export interface PastebinServiceUpdateReq { + record: PastebinServiceRecord | undefined; +} + +export interface PastebinServiceUpdateResp { +} + +export interface PastebinServiceGetReq { + key: string; + password: string; +} + +export interface PastebinServiceGetResp { + record: PastebinServiceRecord | undefined; +} + +export interface PastebinServiceRawReq { + key: string; + password: string; +} + +export interface PastebinServiceRawResp { +} + +function createBasePastebinServiceRecord(): PastebinServiceRecord { + return { + id: 0, + key: "", + title: "", + content: "", + created_at: "", + expired_at: "", + need_password: false, + editable: false, + expire_level: 0, + password: "", + lang: "", + author: "", + }; +} + +export const PastebinServiceRecord = { + encode(message: PastebinServiceRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.title !== "") { + writer.uint32(26).string(message.title); + } + if (message.content !== "") { + writer.uint32(42).string(message.content); + } + if (message.created_at !== "") { + writer.uint32(50).string(message.created_at); + } + if (message.expired_at !== "") { + writer.uint32(58).string(message.expired_at); + } + if (message.need_password === true) { + writer.uint32(64).bool(message.need_password); + } + if (message.editable === true) { + writer.uint32(72).bool(message.editable); + } + if (message.expire_level !== 0) { + writer.uint32(80).int32(message.expire_level); + } + if (message.password !== "") { + writer.uint32(90).string(message.password); + } + if (message.lang !== "") { + writer.uint32(98).string(message.lang); + } + if (message.author !== "") { + writer.uint32(106).string(message.author); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.title = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.content = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.created_at = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.expired_at = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.need_password = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.editable = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.expire_level = reader.int32() as any; + continue; + case 11: + if (tag !== 90) { + break; + } + + message.password = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lang = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.author = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceRecord { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + key: isSet(object.key) ? globalThis.String(object.key) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + content: isSet(object.content) ? globalThis.String(object.content) : "", + created_at: isSet(object.createdAt) ? globalThis.String(object.createdAt) : "", + expired_at: isSet(object.expiredAt) ? globalThis.String(object.expiredAt) : "", + need_password: isSet(object.needPassword) ? globalThis.Boolean(object.needPassword) : false, + editable: isSet(object.editable) ? globalThis.Boolean(object.editable) : false, + expire_level: isSet(object.expireLevel) ? expireLevelFromJSON(object.expireLevel) : 0, + password: isSet(object.password) ? globalThis.String(object.password) : "", + lang: isSet(object.lang) ? globalThis.String(object.lang) : "", + author: isSet(object.author) ? globalThis.String(object.author) : "", + }; + }, + + toJSON(message: PastebinServiceRecord): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.content !== "") { + obj.content = message.content; + } + if (message.created_at !== "") { + obj.createdAt = message.created_at; + } + if (message.expired_at !== "") { + obj.expiredAt = message.expired_at; + } + if (message.need_password === true) { + obj.needPassword = message.need_password; + } + if (message.editable === true) { + obj.editable = message.editable; + } + if (message.expire_level !== 0) { + obj.expireLevel = expireLevelToJSON(message.expire_level); + } + if (message.password !== "") { + obj.password = message.password; + } + if (message.lang !== "") { + obj.lang = message.lang; + } + if (message.author !== "") { + obj.author = message.author; + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceRecord { + return PastebinServiceRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceRecord { + const message = createBasePastebinServiceRecord(); + message.id = object.id ?? 0; + message.key = object.key ?? ""; + message.title = object.title ?? ""; + message.content = object.content ?? ""; + message.created_at = object.created_at ?? ""; + message.expired_at = object.expired_at ?? ""; + message.need_password = object.need_password ?? false; + message.editable = object.editable ?? false; + message.expire_level = object.expire_level ?? 0; + message.password = object.password ?? ""; + message.lang = object.lang ?? ""; + message.author = object.author ?? ""; + return message; + }, +}; + +function createBasePastebinServiceListReq(): PastebinServiceListReq { + return { page_size: 0, current_page: 0 }; +} + +export const PastebinServiceListReq = { + encode(message: PastebinServiceListReq, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.page_size !== 0) { + writer.uint32(8).int64(message.page_size); + } + if (message.current_page !== 0) { + writer.uint32(16).int64(message.current_page); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceListReq { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceListReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.page_size = longToNumber(reader.int64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.current_page = longToNumber(reader.int64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceListReq { + return { + page_size: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0, + current_page: isSet(object.currentPage) ? globalThis.Number(object.currentPage) : 0, + }; + }, + + toJSON(message: PastebinServiceListReq): unknown { + const obj: any = {}; + if (message.page_size !== 0) { + obj.pageSize = Math.round(message.page_size); + } + if (message.current_page !== 0) { + obj.currentPage = Math.round(message.current_page); + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceListReq { + return PastebinServiceListReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceListReq { + const message = createBasePastebinServiceListReq(); + message.page_size = object.page_size ?? 0; + message.current_page = object.current_page ?? 0; + return message; + }, +}; + +function createBasePastebinServiceListResp(): PastebinServiceListResp { + return { items: [], has_more: false }; +} + +export const PastebinServiceListResp = { + encode(message: PastebinServiceListResp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.items) { + PastebinServiceRecord.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.has_more === true) { + writer.uint32(16).bool(message.has_more); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceListResp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceListResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.items.push(PastebinServiceRecord.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.has_more = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceListResp { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PastebinServiceRecord.fromJSON(e)) + : [], + has_more: isSet(object.hasMore) ? globalThis.Boolean(object.hasMore) : false, + }; + }, + + toJSON(message: PastebinServiceListResp): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => PastebinServiceRecord.toJSON(e)); + } + if (message.has_more === true) { + obj.hasMore = message.has_more; + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceListResp { + return PastebinServiceListResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceListResp { + const message = createBasePastebinServiceListResp(); + message.items = object.items?.map((e) => PastebinServiceRecord.fromPartial(e)) || []; + message.has_more = object.has_more ?? false; + return message; + }, +}; + +function createBasePastebinServiceAddReq(): PastebinServiceAddReq { + return { record: undefined }; +} + +export const PastebinServiceAddReq = { + encode(message: PastebinServiceAddReq, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.record !== undefined) { + PastebinServiceRecord.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceAddReq { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceAddReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.record = PastebinServiceRecord.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceAddReq { + return { record: isSet(object.record) ? PastebinServiceRecord.fromJSON(object.record) : undefined }; + }, + + toJSON(message: PastebinServiceAddReq): unknown { + const obj: any = {}; + if (message.record !== undefined) { + obj.record = PastebinServiceRecord.toJSON(message.record); + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceAddReq { + return PastebinServiceAddReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceAddReq { + const message = createBasePastebinServiceAddReq(); + message.record = (object.record !== undefined && object.record !== null) + ? PastebinServiceRecord.fromPartial(object.record) + : undefined; + return message; + }, +}; + +function createBasePastebinServiceAddResp(): PastebinServiceAddResp { + return {}; +} + +export const PastebinServiceAddResp = { + encode(_: PastebinServiceAddResp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceAddResp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceAddResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): PastebinServiceAddResp { + return {}; + }, + + toJSON(_: PastebinServiceAddResp): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PastebinServiceAddResp { + return PastebinServiceAddResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PastebinServiceAddResp { + const message = createBasePastebinServiceAddResp(); + return message; + }, +}; + +function createBasePastebinServiceUpdateReq(): PastebinServiceUpdateReq { + return { record: undefined }; +} + +export const PastebinServiceUpdateReq = { + encode(message: PastebinServiceUpdateReq, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.record !== undefined) { + PastebinServiceRecord.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceUpdateReq { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceUpdateReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.record = PastebinServiceRecord.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceUpdateReq { + return { record: isSet(object.record) ? PastebinServiceRecord.fromJSON(object.record) : undefined }; + }, + + toJSON(message: PastebinServiceUpdateReq): unknown { + const obj: any = {}; + if (message.record !== undefined) { + obj.record = PastebinServiceRecord.toJSON(message.record); + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceUpdateReq { + return PastebinServiceUpdateReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceUpdateReq { + const message = createBasePastebinServiceUpdateReq(); + message.record = (object.record !== undefined && object.record !== null) + ? PastebinServiceRecord.fromPartial(object.record) + : undefined; + return message; + }, +}; + +function createBasePastebinServiceUpdateResp(): PastebinServiceUpdateResp { + return {}; +} + +export const PastebinServiceUpdateResp = { + encode(_: PastebinServiceUpdateResp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceUpdateResp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceUpdateResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): PastebinServiceUpdateResp { + return {}; + }, + + toJSON(_: PastebinServiceUpdateResp): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PastebinServiceUpdateResp { + return PastebinServiceUpdateResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PastebinServiceUpdateResp { + const message = createBasePastebinServiceUpdateResp(); + return message; + }, +}; + +function createBasePastebinServiceGetReq(): PastebinServiceGetReq { + return { key: "", password: "" }; +} + +export const PastebinServiceGetReq = { + encode(message: PastebinServiceGetReq, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceGetReq { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceGetReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceGetReq { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + password: isSet(object.password) ? globalThis.String(object.password) : "", + }; + }, + + toJSON(message: PastebinServiceGetReq): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.password !== "") { + obj.password = message.password; + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceGetReq { + return PastebinServiceGetReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceGetReq { + const message = createBasePastebinServiceGetReq(); + message.key = object.key ?? ""; + message.password = object.password ?? ""; + return message; + }, +}; + +function createBasePastebinServiceGetResp(): PastebinServiceGetResp { + return { record: undefined }; +} + +export const PastebinServiceGetResp = { + encode(message: PastebinServiceGetResp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.record !== undefined) { + PastebinServiceRecord.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceGetResp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceGetResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.record = PastebinServiceRecord.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceGetResp { + return { record: isSet(object.record) ? PastebinServiceRecord.fromJSON(object.record) : undefined }; + }, + + toJSON(message: PastebinServiceGetResp): unknown { + const obj: any = {}; + if (message.record !== undefined) { + obj.record = PastebinServiceRecord.toJSON(message.record); + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceGetResp { + return PastebinServiceGetResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceGetResp { + const message = createBasePastebinServiceGetResp(); + message.record = (object.record !== undefined && object.record !== null) + ? PastebinServiceRecord.fromPartial(object.record) + : undefined; + return message; + }, +}; + +function createBasePastebinServiceRawReq(): PastebinServiceRawReq { + return { key: "", password: "" }; +} + +export const PastebinServiceRawReq = { + encode(message: PastebinServiceRawReq, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceRawReq { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceRawReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PastebinServiceRawReq { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + password: isSet(object.password) ? globalThis.String(object.password) : "", + }; + }, + + toJSON(message: PastebinServiceRawReq): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.password !== "") { + obj.password = message.password; + } + return obj; + }, + + create, I>>(base?: I): PastebinServiceRawReq { + return PastebinServiceRawReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PastebinServiceRawReq { + const message = createBasePastebinServiceRawReq(); + message.key = object.key ?? ""; + message.password = object.password ?? ""; + return message; + }, +}; + +function createBasePastebinServiceRawResp(): PastebinServiceRawResp { + return {}; +} + +export const PastebinServiceRawResp = { + encode(_: PastebinServiceRawResp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PastebinServiceRawResp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePastebinServiceRawResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): PastebinServiceRawResp { + return {}; + }, + + toJSON(_: PastebinServiceRawResp): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PastebinServiceRawResp { + return PastebinServiceRawResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PastebinServiceRawResp { + const message = createBasePastebinServiceRawResp(); + return message; + }, +}; + +/** + * @route_group: true + * @base_url: /v1/pastebin + * @gen_to: ./services/controller/v1/pastebin_controller.go + */ +export interface PastebinService { + /** + * @desc: 列表 + * @author: Young Xu + * @method: GET + * @api: /list + */ + List(request: PastebinServiceListReq): Promise; + /** + * @desc: 新建 + * @author: Young Xu + * @method: PUT + * @api: /add + */ + Add(request: PastebinServiceAddReq): Promise; + /** + * @desc: 更新 + * @author: Young Xu + * @method: POST + * @api: /update + */ + Update(request: PastebinServiceUpdateReq): Promise; + /** + * @desc: 获取一条记录 + * @author: Young Xu + * @method: GET + * @api: /get + */ + Get(request: PastebinServiceGetReq): Promise; + /** + * @desc: 获取原文内容 + * @author: Young Xu + * @method: GET + * @api: /raw + */ + Raw(request: PastebinServiceRawReq): Promise; +} + +export const PastebinServiceServiceName = "api_services.v1.PastebinService"; +export class PastebinServiceClientImpl implements PastebinService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || PastebinServiceServiceName; + this.rpc = rpc; + this.List = this.List.bind(this); + this.Add = this.Add.bind(this); + this.Update = this.Update.bind(this); + this.Get = this.Get.bind(this); + this.Raw = this.Raw.bind(this); + } + List(request: PastebinServiceListReq): Promise { + const data = PastebinServiceListReq.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => PastebinServiceListResp.decode(_m0.Reader.create(data))); + } + + Add(request: PastebinServiceAddReq): Promise { + const data = PastebinServiceAddReq.encode(request).finish(); + const promise = this.rpc.request(this.service, "Add", data); + return promise.then((data) => PastebinServiceAddResp.decode(_m0.Reader.create(data))); + } + + Update(request: PastebinServiceUpdateReq): Promise { + const data = PastebinServiceUpdateReq.encode(request).finish(); + const promise = this.rpc.request(this.service, "Update", data); + return promise.then((data) => PastebinServiceUpdateResp.decode(_m0.Reader.create(data))); + } + + Get(request: PastebinServiceGetReq): Promise { + const data = PastebinServiceGetReq.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => PastebinServiceGetResp.decode(_m0.Reader.create(data))); + } + + Raw(request: PastebinServiceRawReq): Promise { + const data = PastebinServiceRawReq.encode(request).finish(); + const promise = this.rpc.request(this.service, "Raw", data); + return promise.then((data) => PastebinServiceRawResp.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +}