add Upload and Download files

This commit is contained in:
2026-07-12 18:05:52 +07:00
parent 2ecc6ecd6a
commit 487b1aa436
13 changed files with 854 additions and 63 deletions
+78 -1
View File
@@ -1,13 +1,14 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.35.0
// - protoc v7.35.1
// source: main.proto
package proto
import (
context "context"
httpbody "google.golang.org/genproto/googleapis/api/httpbody"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -31,6 +32,8 @@ const (
EveningDetectiveServer_AddUserRole_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddUserRole"
EveningDetectiveServer_DeleteUserRole_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteUserRole"
EveningDetectiveServer_GetPermissions_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetPermissions"
EveningDetectiveServer_UploadFile_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UploadFile"
EveningDetectiveServer_DownloadFile_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DownloadFile"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
@@ -49,6 +52,8 @@ type EveningDetectiveServerClient interface {
AddUserRole(ctx context.Context, in *AddUserRoleReq, opts ...grpc.CallOption) (*AddUserRoleRsp, error)
DeleteUserRole(ctx context.Context, in *DeleteUserRoleReq, opts ...grpc.CallOption) (*DeleteUserRoleRsp, error)
GetPermissions(ctx context.Context, in *GetPermissionsReq, opts ...grpc.CallOption) (*GetPermissionsRsp, error)
UploadFile(ctx context.Context, in *UploadFileReq, opts ...grpc.CallOption) (*UploadFileRsp, error)
DownloadFile(ctx context.Context, in *DownloadFileReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
}
type eveningDetectiveServerClient struct {
@@ -179,6 +184,26 @@ func (c *eveningDetectiveServerClient) GetPermissions(ctx context.Context, in *G
return out, nil
}
func (c *eveningDetectiveServerClient) UploadFile(ctx context.Context, in *UploadFileReq, opts ...grpc.CallOption) (*UploadFileRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UploadFileRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_UploadFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveServerClient) DownloadFile(ctx context.Context, in *DownloadFileReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(httpbody.HttpBody)
err := c.cc.Invoke(ctx, EveningDetectiveServer_DownloadFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
// All implementations must embed UnimplementedEveningDetectiveServerServer
// for forward compatibility.
@@ -195,6 +220,8 @@ type EveningDetectiveServerServer interface {
AddUserRole(context.Context, *AddUserRoleReq) (*AddUserRoleRsp, error)
DeleteUserRole(context.Context, *DeleteUserRoleReq) (*DeleteUserRoleRsp, error)
GetPermissions(context.Context, *GetPermissionsReq) (*GetPermissionsRsp, error)
UploadFile(context.Context, *UploadFileReq) (*UploadFileRsp, error)
DownloadFile(context.Context, *DownloadFileReq) (*httpbody.HttpBody, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
@@ -241,6 +268,12 @@ func (UnimplementedEveningDetectiveServerServer) DeleteUserRole(context.Context,
func (UnimplementedEveningDetectiveServerServer) GetPermissions(context.Context, *GetPermissionsReq) (*GetPermissionsRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetPermissions not implemented")
}
func (UnimplementedEveningDetectiveServerServer) UploadFile(context.Context, *UploadFileReq) (*UploadFileRsp, error) {
return nil, status.Error(codes.Unimplemented, "method UploadFile not implemented")
}
func (UnimplementedEveningDetectiveServerServer) DownloadFile(context.Context, *DownloadFileReq) (*httpbody.HttpBody, error) {
return nil, status.Error(codes.Unimplemented, "method DownloadFile not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
@@ -479,6 +512,42 @@ func _EveningDetectiveServer_GetPermissions_Handler(srv interface{}, ctx context
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadFileReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).UploadFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_UploadFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).UploadFile(ctx, req.(*UploadFileReq))
}
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_DownloadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DownloadFileReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).DownloadFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_DownloadFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).DownloadFile(ctx, req.(*DownloadFileReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -534,6 +603,14 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetPermissions",
Handler: _EveningDetectiveServer_GetPermissions_Handler,
},
{
MethodName: "UploadFile",
Handler: _EveningDetectiveServer_UploadFile_Handler,
},
{
MethodName: "DownloadFile",
Handler: _EveningDetectiveServer_DownloadFile_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",