add: some user api and all api desc

This commit is contained in:
wwweww
2026-02-27 19:17:01 +08:00
parent a0c720eb2f
commit 5930fb0dde
156 changed files with 9457 additions and 1086 deletions
+326
View File
@@ -0,0 +1,326 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.6
// source: objectstory.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 文件上传的元数据信息
type UploadFileMetadataReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
FileName string `protobuf:"bytes,1,opt,name=fileName,proto3" json:"fileName,omitempty"`
FileSize int64 `protobuf:"varint,2,opt,name=fileSize,proto3" json:"fileSize,omitempty"`
FileType string `protobuf:"bytes,3,opt,name=fileType,proto3" json:"fileType,omitempty"` // avatar, chat, etc.
UserId string `protobuf:"bytes,4,opt,name=userId,proto3" json:"userId,omitempty"`
FileData []byte `protobuf:"bytes,5,opt,name=fileData,proto3" json:"fileData,omitempty"` // 如果文件很小可以直接传,大文件建议API层直接传S3,RPC只传元数据
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UploadFileMetadataReq) Reset() {
*x = UploadFileMetadataReq{}
mi := &file_objectstory_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UploadFileMetadataReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UploadFileMetadataReq) ProtoMessage() {}
func (x *UploadFileMetadataReq) ProtoReflect() protoreflect.Message {
mi := &file_objectstory_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UploadFileMetadataReq.ProtoReflect.Descriptor instead.
func (*UploadFileMetadataReq) Descriptor() ([]byte, []int) {
return file_objectstory_proto_rawDescGZIP(), []int{0}
}
func (x *UploadFileMetadataReq) GetFileName() string {
if x != nil {
return x.FileName
}
return ""
}
func (x *UploadFileMetadataReq) GetFileSize() int64 {
if x != nil {
return x.FileSize
}
return 0
}
func (x *UploadFileMetadataReq) GetFileType() string {
if x != nil {
return x.FileType
}
return ""
}
func (x *UploadFileMetadataReq) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *UploadFileMetadataReq) GetFileData() []byte {
if x != nil {
return x.FileData
}
return nil
}
type UploadFileResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
FileId string `protobuf:"bytes,2,opt,name=fileId,proto3" json:"fileId,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UploadFileResp) Reset() {
*x = UploadFileResp{}
mi := &file_objectstory_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UploadFileResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UploadFileResp) ProtoMessage() {}
func (x *UploadFileResp) ProtoReflect() protoreflect.Message {
mi := &file_objectstory_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UploadFileResp.ProtoReflect.Descriptor instead.
func (*UploadFileResp) Descriptor() ([]byte, []int) {
return file_objectstory_proto_rawDescGZIP(), []int{1}
}
func (x *UploadFileResp) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
func (x *UploadFileResp) GetFileId() string {
if x != nil {
return x.FileId
}
return ""
}
type GetFileUrlReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
FileId string `protobuf:"bytes,1,opt,name=fileId,proto3" json:"fileId,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` // 用于鉴权
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFileUrlReq) Reset() {
*x = GetFileUrlReq{}
mi := &file_objectstory_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetFileUrlReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFileUrlReq) ProtoMessage() {}
func (x *GetFileUrlReq) ProtoReflect() protoreflect.Message {
mi := &file_objectstory_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetFileUrlReq.ProtoReflect.Descriptor instead.
func (*GetFileUrlReq) Descriptor() ([]byte, []int) {
return file_objectstory_proto_rawDescGZIP(), []int{2}
}
func (x *GetFileUrlReq) GetFileId() string {
if x != nil {
return x.FileId
}
return ""
}
func (x *GetFileUrlReq) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
type GetFileUrlResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // 可能是带签名的临时 URL
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFileUrlResp) Reset() {
*x = GetFileUrlResp{}
mi := &file_objectstory_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetFileUrlResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFileUrlResp) ProtoMessage() {}
func (x *GetFileUrlResp) ProtoReflect() protoreflect.Message {
mi := &file_objectstory_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetFileUrlResp.ProtoReflect.Descriptor instead.
func (*GetFileUrlResp) Descriptor() ([]byte, []int) {
return file_objectstory_proto_rawDescGZIP(), []int{3}
}
func (x *GetFileUrlResp) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
var File_objectstory_proto protoreflect.FileDescriptor
const file_objectstory_proto_rawDesc = "" +
"\n" +
"\x11objectstory.proto\x12\x04file\"\x9f\x01\n" +
"\x15UploadFileMetadataReq\x12\x1a\n" +
"\bfileName\x18\x01 \x01(\tR\bfileName\x12\x1a\n" +
"\bfileSize\x18\x02 \x01(\x03R\bfileSize\x12\x1a\n" +
"\bfileType\x18\x03 \x01(\tR\bfileType\x12\x16\n" +
"\x06userId\x18\x04 \x01(\tR\x06userId\x12\x1a\n" +
"\bfileData\x18\x05 \x01(\fR\bfileData\":\n" +
"\x0eUploadFileResp\x12\x10\n" +
"\x03url\x18\x01 \x01(\tR\x03url\x12\x16\n" +
"\x06fileId\x18\x02 \x01(\tR\x06fileId\"?\n" +
"\rGetFileUrlReq\x12\x16\n" +
"\x06fileId\x18\x01 \x01(\tR\x06fileId\x12\x16\n" +
"\x06userId\x18\x02 \x01(\tR\x06userId\"\"\n" +
"\x0eGetFileUrlResp\x12\x10\n" +
"\x03url\x18\x01 \x01(\tR\x03url2\x83\x01\n" +
"\vFileService\x12;\n" +
"\x06Upload\x12\x1b.file.UploadFileMetadataReq\x1a\x14.file.UploadFileResp\x127\n" +
"\n" +
"GetFileUrl\x12\x13.file.GetFileUrlReq\x1a\x14.file.GetFileUrlRespB\x06Z\x04./pbb\x06proto3"
var (
file_objectstory_proto_rawDescOnce sync.Once
file_objectstory_proto_rawDescData []byte
)
func file_objectstory_proto_rawDescGZIP() []byte {
file_objectstory_proto_rawDescOnce.Do(func() {
file_objectstory_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_objectstory_proto_rawDesc), len(file_objectstory_proto_rawDesc)))
})
return file_objectstory_proto_rawDescData
}
var file_objectstory_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_objectstory_proto_goTypes = []any{
(*UploadFileMetadataReq)(nil), // 0: file.UploadFileMetadataReq
(*UploadFileResp)(nil), // 1: file.UploadFileResp
(*GetFileUrlReq)(nil), // 2: file.GetFileUrlReq
(*GetFileUrlResp)(nil), // 3: file.GetFileUrlResp
}
var file_objectstory_proto_depIdxs = []int32{
0, // 0: file.FileService.Upload:input_type -> file.UploadFileMetadataReq
2, // 1: file.FileService.GetFileUrl:input_type -> file.GetFileUrlReq
1, // 2: file.FileService.Upload:output_type -> file.UploadFileResp
3, // 3: file.FileService.GetFileUrl:output_type -> file.GetFileUrlResp
2, // [2:4] is the sub-list for method output_type
0, // [0:2] 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_objectstory_proto_init() }
func file_objectstory_proto_init() {
if File_objectstory_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_objectstory_proto_rawDesc), len(file_objectstory_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_objectstory_proto_goTypes,
DependencyIndexes: file_objectstory_proto_depIdxs,
MessageInfos: file_objectstory_proto_msgTypes,
}.Build()
File_objectstory_proto = out.File
file_objectstory_proto_goTypes = nil
file_objectstory_proto_depIdxs = nil
}
@@ -0,0 +1,163 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.6
// source: objectstory.proto
package pb
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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
FileService_Upload_FullMethodName = "/file.FileService/Upload"
FileService_GetFileUrl_FullMethodName = "/file.FileService/GetFileUrl"
)
// FileServiceClient is the client API for FileService 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 FileServiceClient interface {
// 简单上传(适合小文件,或保存元数据)
Upload(ctx context.Context, in *UploadFileMetadataReq, opts ...grpc.CallOption) (*UploadFileResp, error)
// 获取文件访问链接(处理私有文件的鉴权)
GetFileUrl(ctx context.Context, in *GetFileUrlReq, opts ...grpc.CallOption) (*GetFileUrlResp, error)
}
type fileServiceClient struct {
cc grpc.ClientConnInterface
}
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
return &fileServiceClient{cc}
}
func (c *fileServiceClient) Upload(ctx context.Context, in *UploadFileMetadataReq, opts ...grpc.CallOption) (*UploadFileResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UploadFileResp)
err := c.cc.Invoke(ctx, FileService_Upload_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) GetFileUrl(ctx context.Context, in *GetFileUrlReq, opts ...grpc.CallOption) (*GetFileUrlResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFileUrlResp)
err := c.cc.Invoke(ctx, FileService_GetFileUrl_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileServiceServer is the server API for FileService service.
// All implementations must embed UnimplementedFileServiceServer
// for forward compatibility.
type FileServiceServer interface {
// 简单上传(适合小文件,或保存元数据)
Upload(context.Context, *UploadFileMetadataReq) (*UploadFileResp, error)
// 获取文件访问链接(处理私有文件的鉴权)
GetFileUrl(context.Context, *GetFileUrlReq) (*GetFileUrlResp, error)
mustEmbedUnimplementedFileServiceServer()
}
// UnimplementedFileServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileServiceServer struct{}
func (UnimplementedFileServiceServer) Upload(context.Context, *UploadFileMetadataReq) (*UploadFileResp, error) {
return nil, status.Error(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedFileServiceServer) GetFileUrl(context.Context, *GetFileUrlReq) (*GetFileUrlResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetFileUrl not implemented")
}
func (UnimplementedFileServiceServer) mustEmbedUnimplementedFileServiceServer() {}
func (UnimplementedFileServiceServer) testEmbeddedByValue() {}
// UnsafeFileServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileServiceServer will
// result in compilation errors.
type UnsafeFileServiceServer interface {
mustEmbedUnimplementedFileServiceServer()
}
func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer) {
// If the following call panics, it indicates UnimplementedFileServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&FileService_ServiceDesc, srv)
}
func _FileService_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadFileMetadataReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).Upload(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_Upload_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).Upload(ctx, req.(*UploadFileMetadataReq))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_GetFileUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileUrlReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).GetFileUrl(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_GetFileUrl_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).GetFileUrl(ctx, req.(*GetFileUrlReq))
}
return interceptor(ctx, in, info, handler)
}
// FileService_ServiceDesc is the grpc.ServiceDesc for FileService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "file.FileService",
HandlerType: (*FileServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Upload",
Handler: _FileService_Upload_Handler,
},
{
MethodName: "GetFileUrl",
Handler: _FileService_GetFileUrl_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "objectstory.proto",
}