feat: define file service proto API with HTTP+gRPC annotations
This commit is contained in:
parent
ed47904a85
commit
1cfa43a33c
99
api/errors/errors.pb.go
Normal file
99
api/errors/errors.pb.go
Normal file
@ -0,0 +1,99 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: errors/errors.proto
|
||||
|
||||
package errors
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
|
||||
reflect "reflect"
|
||||
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)
|
||||
)
|
||||
|
||||
var file_errors_errors_proto_extTypes = []protoimpl.ExtensionInfo{
|
||||
{
|
||||
ExtendedType: (*descriptorpb.EnumOptions)(nil),
|
||||
ExtensionType: (*int32)(nil),
|
||||
Field: 1108,
|
||||
Name: "errors.default_code",
|
||||
Tag: "varint,1108,opt,name=default_code",
|
||||
Filename: "errors/errors.proto",
|
||||
},
|
||||
{
|
||||
ExtendedType: (*descriptorpb.EnumValueOptions)(nil),
|
||||
ExtensionType: (*int32)(nil),
|
||||
Field: 1109,
|
||||
Name: "errors.code",
|
||||
Tag: "varint,1109,opt,name=code",
|
||||
Filename: "errors/errors.proto",
|
||||
},
|
||||
}
|
||||
|
||||
// Extension fields to descriptorpb.EnumOptions.
|
||||
var (
|
||||
// optional int32 default_code = 1108;
|
||||
E_DefaultCode = &file_errors_errors_proto_extTypes[0]
|
||||
)
|
||||
|
||||
// Extension fields to descriptorpb.EnumValueOptions.
|
||||
var (
|
||||
// optional int32 code = 1109;
|
||||
E_Code = &file_errors_errors_proto_extTypes[1]
|
||||
)
|
||||
|
||||
var File_errors_errors_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_errors_errors_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x13errors/errors.proto\x12\x06errors\x1a google/protobuf/descriptor.proto:@\n" +
|
||||
"\fdefault_code\x12\x1c.google.protobuf.EnumOptions\x18\xd4\b \x01(\x05R\vdefaultCode:6\n" +
|
||||
"\x04code\x12!.google.protobuf.EnumValueOptions\x18\xd5\b \x01(\x05R\x04codeB'Z%github.com/go-kratos/kratos/v2/errorsb\x06proto3"
|
||||
|
||||
var file_errors_errors_proto_goTypes = []any{
|
||||
(*descriptorpb.EnumOptions)(nil), // 0: google.protobuf.EnumOptions
|
||||
(*descriptorpb.EnumValueOptions)(nil), // 1: google.protobuf.EnumValueOptions
|
||||
}
|
||||
var file_errors_errors_proto_depIdxs = []int32{
|
||||
0, // 0: errors.default_code:extendee -> google.protobuf.EnumOptions
|
||||
1, // 1: errors.code:extendee -> google.protobuf.EnumValueOptions
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
0, // [0:2] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_errors_errors_proto_init() }
|
||||
func file_errors_errors_proto_init() {
|
||||
if File_errors_errors_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_errors_errors_proto_rawDesc), len(file_errors_errors_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 2,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_errors_errors_proto_goTypes,
|
||||
DependencyIndexes: file_errors_errors_proto_depIdxs,
|
||||
ExtensionInfos: file_errors_errors_proto_extTypes,
|
||||
}.Build()
|
||||
File_errors_errors_proto = out.File
|
||||
file_errors_errors_proto_goTypes = nil
|
||||
file_errors_errors_proto_depIdxs = nil
|
||||
}
|
||||
167
api/file/v1/error_reason.pb.go
Normal file
167
api/file/v1/error_reason.pb.go
Normal file
@ -0,0 +1,167 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: file/v1/error_reason.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
_ "github.com/go-kratos/kratos/v2/errors"
|
||||
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 ErrorReason int32
|
||||
|
||||
const (
|
||||
ErrorReason_BUCKET_NOT_FOUND ErrorReason = 0
|
||||
ErrorReason_FILE_NOT_FOUND ErrorReason = 1
|
||||
ErrorReason_FOLDER_NOT_FOUND ErrorReason = 2
|
||||
ErrorReason_SHARE_NOT_FOUND ErrorReason = 3
|
||||
ErrorReason_INVALID_PARAMETER ErrorReason = 4
|
||||
ErrorReason_PATH_TRAVERSAL_DETECTED ErrorReason = 5
|
||||
ErrorReason_INVALID_BUCKET_NAME ErrorReason = 6
|
||||
ErrorReason_STORAGE_OPERATION_FAILED ErrorReason = 7
|
||||
ErrorReason_SHARE_PASSWORD_REQUIRED ErrorReason = 8
|
||||
ErrorReason_SHARE_EXPIRED ErrorReason = 9
|
||||
ErrorReason_SHARE_DOWNLOAD_LIMIT_REACHED ErrorReason = 10
|
||||
ErrorReason_FOLDER_NAME_CONFLICT ErrorReason = 11
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorReason.
|
||||
var (
|
||||
ErrorReason_name = map[int32]string{
|
||||
0: "BUCKET_NOT_FOUND",
|
||||
1: "FILE_NOT_FOUND",
|
||||
2: "FOLDER_NOT_FOUND",
|
||||
3: "SHARE_NOT_FOUND",
|
||||
4: "INVALID_PARAMETER",
|
||||
5: "PATH_TRAVERSAL_DETECTED",
|
||||
6: "INVALID_BUCKET_NAME",
|
||||
7: "STORAGE_OPERATION_FAILED",
|
||||
8: "SHARE_PASSWORD_REQUIRED",
|
||||
9: "SHARE_EXPIRED",
|
||||
10: "SHARE_DOWNLOAD_LIMIT_REACHED",
|
||||
11: "FOLDER_NAME_CONFLICT",
|
||||
}
|
||||
ErrorReason_value = map[string]int32{
|
||||
"BUCKET_NOT_FOUND": 0,
|
||||
"FILE_NOT_FOUND": 1,
|
||||
"FOLDER_NOT_FOUND": 2,
|
||||
"SHARE_NOT_FOUND": 3,
|
||||
"INVALID_PARAMETER": 4,
|
||||
"PATH_TRAVERSAL_DETECTED": 5,
|
||||
"INVALID_BUCKET_NAME": 6,
|
||||
"STORAGE_OPERATION_FAILED": 7,
|
||||
"SHARE_PASSWORD_REQUIRED": 8,
|
||||
"SHARE_EXPIRED": 9,
|
||||
"SHARE_DOWNLOAD_LIMIT_REACHED": 10,
|
||||
"FOLDER_NAME_CONFLICT": 11,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ErrorReason) Enum() *ErrorReason {
|
||||
p := new(ErrorReason)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ErrorReason) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_file_v1_error_reason_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (ErrorReason) Type() protoreflect.EnumType {
|
||||
return &file_file_v1_error_reason_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x ErrorReason) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorReason.Descriptor instead.
|
||||
func (ErrorReason) EnumDescriptor() ([]byte, []int) {
|
||||
return file_file_v1_error_reason_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
var File_file_v1_error_reason_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_file_v1_error_reason_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1afile/v1/error_reason.proto\x12\vapi.file.v1\x1a\x13errors/errors.proto*\x87\x03\n" +
|
||||
"\vErrorReason\x12\x1a\n" +
|
||||
"\x10BUCKET_NOT_FOUND\x10\x00\x1a\x04\xa8E\x94\x03\x12\x18\n" +
|
||||
"\x0eFILE_NOT_FOUND\x10\x01\x1a\x04\xa8E\x94\x03\x12\x1a\n" +
|
||||
"\x10FOLDER_NOT_FOUND\x10\x02\x1a\x04\xa8E\x94\x03\x12\x19\n" +
|
||||
"\x0fSHARE_NOT_FOUND\x10\x03\x1a\x04\xa8E\x94\x03\x12\x1b\n" +
|
||||
"\x11INVALID_PARAMETER\x10\x04\x1a\x04\xa8E\x90\x03\x12!\n" +
|
||||
"\x17PATH_TRAVERSAL_DETECTED\x10\x05\x1a\x04\xa8E\x90\x03\x12\x1d\n" +
|
||||
"\x13INVALID_BUCKET_NAME\x10\x06\x1a\x04\xa8E\x90\x03\x12\"\n" +
|
||||
"\x18STORAGE_OPERATION_FAILED\x10\a\x1a\x04\xa8E\xf4\x03\x12!\n" +
|
||||
"\x17SHARE_PASSWORD_REQUIRED\x10\b\x1a\x04\xa8E\x91\x03\x12\x17\n" +
|
||||
"\rSHARE_EXPIRED\x10\t\x1a\x04\xa8E\x9a\x03\x12&\n" +
|
||||
"\x1cSHARE_DOWNLOAD_LIMIT_REACHED\x10\n" +
|
||||
"\x1a\x04\xa8E\xad\x03\x12\x1e\n" +
|
||||
"\x14FOLDER_NAME_CONFLICT\x10\v\x1a\x04\xa8E\x99\x03\x1a\x04\xa0E\xf4\x03B\x1dZ\x1brag/file-system/api/file/v1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_file_v1_error_reason_proto_rawDescOnce sync.Once
|
||||
file_file_v1_error_reason_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_file_v1_error_reason_proto_rawDescGZIP() []byte {
|
||||
file_file_v1_error_reason_proto_rawDescOnce.Do(func() {
|
||||
file_file_v1_error_reason_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_file_v1_error_reason_proto_rawDesc), len(file_file_v1_error_reason_proto_rawDesc)))
|
||||
})
|
||||
return file_file_v1_error_reason_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_file_v1_error_reason_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_file_v1_error_reason_proto_goTypes = []any{
|
||||
(ErrorReason)(0), // 0: api.file.v1.ErrorReason
|
||||
}
|
||||
var file_file_v1_error_reason_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_file_v1_error_reason_proto_init() }
|
||||
func file_file_v1_error_reason_proto_init() {
|
||||
if File_file_v1_error_reason_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_file_v1_error_reason_proto_rawDesc), len(file_file_v1_error_reason_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_file_v1_error_reason_proto_goTypes,
|
||||
DependencyIndexes: file_file_v1_error_reason_proto_depIdxs,
|
||||
EnumInfos: file_file_v1_error_reason_proto_enumTypes,
|
||||
}.Build()
|
||||
File_file_v1_error_reason_proto = out.File
|
||||
file_file_v1_error_reason_proto_goTypes = nil
|
||||
file_file_v1_error_reason_proto_depIdxs = nil
|
||||
}
|
||||
24
api/file/v1/error_reason.proto
Normal file
24
api/file/v1/error_reason.proto
Normal file
@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api.file.v1;
|
||||
|
||||
option go_package = "rag/file-system/api/file/v1";
|
||||
|
||||
import "errors/errors.proto";
|
||||
|
||||
enum ErrorReason {
|
||||
option (errors.default_code) = 500;
|
||||
|
||||
BUCKET_NOT_FOUND = 0 [(errors.code) = 404];
|
||||
FILE_NOT_FOUND = 1 [(errors.code) = 404];
|
||||
FOLDER_NOT_FOUND = 2 [(errors.code) = 404];
|
||||
SHARE_NOT_FOUND = 3 [(errors.code) = 404];
|
||||
INVALID_PARAMETER = 4 [(errors.code) = 400];
|
||||
PATH_TRAVERSAL_DETECTED = 5 [(errors.code) = 400];
|
||||
INVALID_BUCKET_NAME = 6 [(errors.code) = 400];
|
||||
STORAGE_OPERATION_FAILED = 7 [(errors.code) = 500];
|
||||
SHARE_PASSWORD_REQUIRED = 8 [(errors.code) = 401];
|
||||
SHARE_EXPIRED = 9 [(errors.code) = 410];
|
||||
SHARE_DOWNLOAD_LIMIT_REACHED = 10 [(errors.code) = 429];
|
||||
FOLDER_NAME_CONFLICT = 11 [(errors.code) = 409];
|
||||
}
|
||||
2834
api/file/v1/file.pb.go
Normal file
2834
api/file/v1/file.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
339
api/file/v1/file.proto
Normal file
339
api/file/v1/file.proto
Normal file
@ -0,0 +1,339 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api.file.v1;
|
||||
|
||||
option go_package = "rag/file-system/api/file/v1";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
service FileService {
|
||||
// File operations
|
||||
rpc UploadFile (UploadFileRequest) returns (UploadFileResponse) {
|
||||
option (google.api.http) = { post: "/files/upload" body: "*" };
|
||||
}
|
||||
rpc DownloadFile (DownloadFileRequest) returns (DownloadFileResponse) {
|
||||
option (google.api.http) = { get: "/files/download" };
|
||||
}
|
||||
rpc ListFiles (ListFilesRequest) returns (ListFilesResponse) {
|
||||
option (google.api.http) = { get: "/files/list" };
|
||||
}
|
||||
rpc GetFilePreview (GetFilePreviewRequest) returns (GetFilePreviewResponse) {
|
||||
option (google.api.http) = { get: "/files/preview" };
|
||||
}
|
||||
rpc GetFileContent (GetFileContentRequest) returns (GetFileContentResponse) {
|
||||
option (google.api.http) = { get: "/files/content" };
|
||||
}
|
||||
rpc DeleteFile (DeleteFileRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/files/delete" };
|
||||
}
|
||||
|
||||
// Multipart upload
|
||||
rpc InitMultipartUpload (InitMultipartRequest) returns (InitMultipartResponse) {
|
||||
option (google.api.http) = { post: "/files/multipart/init" body: "*" };
|
||||
}
|
||||
rpc UploadPart (UploadPartRequest) returns (UploadPartResponse) {
|
||||
option (google.api.http) = { put: "/files/multipart/part" body: "*" };
|
||||
}
|
||||
rpc CompleteMultipartUpload (CompleteMultipartRequest) returns (CompleteMultipartResponse) {
|
||||
option (google.api.http) = { post: "/files/multipart/complete" body: "*" };
|
||||
}
|
||||
rpc AbortMultipartUpload (AbortMultipartRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { post: "/files/multipart/abort" body: "*" };
|
||||
}
|
||||
|
||||
// Bucket operations
|
||||
rpc CreateBucket (CreateBucketRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { post: "/buckets" body: "*" };
|
||||
}
|
||||
rpc ListBuckets (google.protobuf.Empty) returns (ListBucketsResponse) {
|
||||
option (google.api.http) = { get: "/buckets" };
|
||||
}
|
||||
rpc DeleteBucket (DeleteBucketRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/buckets" };
|
||||
}
|
||||
|
||||
// Folder operations
|
||||
rpc CreateFolder (CreateFolderRequest) returns (Folder) {
|
||||
option (google.api.http) = { post: "/folders" body: "*" };
|
||||
}
|
||||
rpc GetFolderTree (GetFolderTreeRequest) returns (GetFolderTreeResponse) {
|
||||
option (google.api.http) = { get: "/folders/tree" };
|
||||
}
|
||||
rpc GetFolder (GetFolderRequest) returns (FolderWithChildren) {
|
||||
option (google.api.http) = { get: "/folders/{id}" };
|
||||
}
|
||||
rpc RenameFolder (RenameFolderRequest) returns (Folder) {
|
||||
option (google.api.http) = { put: "/folders/{id}" body: "*" };
|
||||
}
|
||||
rpc DeleteFolder (DeleteFolderRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/folders/{id}" };
|
||||
}
|
||||
rpc UploadToFolder (UploadToFolderRequest) returns (FileMeta) {
|
||||
option (google.api.http) = { post: "/folders/{folder_id}/files" body: "*" };
|
||||
}
|
||||
rpc MoveFile (MoveFileRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { post: "/files/{id}/move" body: "*" };
|
||||
}
|
||||
|
||||
// Share operations
|
||||
rpc CreateShare (CreateShareRequest) returns (ShareLink) {
|
||||
option (google.api.http) = { post: "/share" body: "*" };
|
||||
}
|
||||
rpc DeleteShare (DeleteShareRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/share/{id}" };
|
||||
}
|
||||
rpc GetShareInfo (GetShareInfoRequest) returns (ShareInfo) {
|
||||
option (google.api.http) = { get: "/share/{token}" };
|
||||
}
|
||||
rpc DownloadShare (DownloadShareRequest) returns (DownloadShareResponse) {
|
||||
option (google.api.http) = { post: "/share/{token}/download" body: "*" };
|
||||
}
|
||||
}
|
||||
|
||||
// File messages
|
||||
message UploadFileRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
bytes data = 3;
|
||||
string content_type = 4;
|
||||
}
|
||||
|
||||
message UploadFileResponse {
|
||||
string message = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
message DownloadFileRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
message DownloadFileResponse {
|
||||
bytes data = 1;
|
||||
string content_type = 2;
|
||||
string file_name = 3;
|
||||
}
|
||||
|
||||
message ListFilesRequest {
|
||||
string bucket_name = 1;
|
||||
string prefix = 2;
|
||||
int32 max_keys = 3;
|
||||
string continuation_token = 4;
|
||||
}
|
||||
|
||||
message FileInfo {
|
||||
string key = 1;
|
||||
int64 size = 2;
|
||||
string last_modified = 3;
|
||||
string etag = 4;
|
||||
}
|
||||
|
||||
message ListFilesResponse {
|
||||
repeated FileInfo files = 1;
|
||||
string next_continuation_token = 2;
|
||||
}
|
||||
|
||||
message GetFilePreviewRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
message GetFilePreviewResponse {
|
||||
string presigned_url = 1;
|
||||
}
|
||||
|
||||
message GetFileContentRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
message GetFileContentResponse {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message DeleteFileRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
// Multipart messages
|
||||
message InitMultipartRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
}
|
||||
|
||||
message InitMultipartResponse {
|
||||
string upload_id = 1;
|
||||
}
|
||||
|
||||
message UploadPartRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
string upload_id = 3;
|
||||
int32 part_number = 4;
|
||||
bytes data = 5;
|
||||
}
|
||||
|
||||
message UploadPartResponse {
|
||||
string etag = 1;
|
||||
}
|
||||
|
||||
message CompletedPart {
|
||||
int32 part_number = 1;
|
||||
string etag = 2;
|
||||
}
|
||||
|
||||
message CompleteMultipartRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
string upload_id = 3;
|
||||
repeated CompletedPart parts = 4;
|
||||
}
|
||||
|
||||
message CompleteMultipartResponse {
|
||||
string location = 1;
|
||||
}
|
||||
|
||||
message AbortMultipartRequest {
|
||||
string bucket_name = 1;
|
||||
string object_key = 2;
|
||||
string upload_id = 3;
|
||||
}
|
||||
|
||||
// Bucket messages
|
||||
message CreateBucketRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListBucketsResponse {
|
||||
repeated string buckets = 1;
|
||||
}
|
||||
|
||||
message DeleteBucketRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// Folder messages
|
||||
message Folder {
|
||||
string id = 1;
|
||||
string parent_id = 2;
|
||||
string name = 3;
|
||||
string owner_id = 4;
|
||||
string created_at = 5;
|
||||
string updated_at = 6;
|
||||
}
|
||||
|
||||
message FolderWithChildren {
|
||||
Folder folder = 1;
|
||||
repeated Folder sub_folders = 2;
|
||||
repeated FileMeta files = 3;
|
||||
}
|
||||
|
||||
message CreateFolderRequest {
|
||||
string parent_id = 1;
|
||||
string name = 2;
|
||||
string owner_id = 3;
|
||||
}
|
||||
|
||||
message GetFolderTreeRequest {
|
||||
string owner_id = 1;
|
||||
}
|
||||
|
||||
message GetFolderTreeResponse {
|
||||
repeated Folder folders = 1;
|
||||
}
|
||||
|
||||
message GetFolderRequest {
|
||||
string id = 1;
|
||||
string owner_id = 2;
|
||||
}
|
||||
|
||||
message RenameFolderRequest {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string owner_id = 3;
|
||||
}
|
||||
|
||||
message DeleteFolderRequest {
|
||||
string id = 1;
|
||||
string owner_id = 2;
|
||||
}
|
||||
|
||||
message FileMeta {
|
||||
string id = 1;
|
||||
string folder_id = 2;
|
||||
string name = 3;
|
||||
string s3_key = 4;
|
||||
string s3_bucket = 5;
|
||||
int64 size = 6;
|
||||
string content_type = 7;
|
||||
string owner_id = 8;
|
||||
string created_at = 9;
|
||||
string updated_at = 10;
|
||||
}
|
||||
|
||||
message UploadToFolderRequest {
|
||||
string folder_id = 1;
|
||||
string file_name = 2;
|
||||
bytes data = 3;
|
||||
string content_type = 4;
|
||||
string owner_id = 5;
|
||||
}
|
||||
|
||||
message MoveFileRequest {
|
||||
string id = 1;
|
||||
string target_folder_id = 2;
|
||||
string owner_id = 3;
|
||||
}
|
||||
|
||||
// Share messages
|
||||
message ShareLink {
|
||||
string id = 1;
|
||||
string resource_type = 2;
|
||||
string resource_id = 3;
|
||||
string token = 4;
|
||||
string password = 5;
|
||||
string expires_at = 6;
|
||||
int32 download_count = 7;
|
||||
int32 max_downloads = 8;
|
||||
string created_by = 9;
|
||||
string created_at = 10;
|
||||
}
|
||||
|
||||
message ShareInfo {
|
||||
string token = 1;
|
||||
string resource_type = 2;
|
||||
string file_name = 3;
|
||||
int64 file_size = 4;
|
||||
bool has_password = 5;
|
||||
string expires_at = 6;
|
||||
}
|
||||
|
||||
message CreateShareRequest {
|
||||
string resource_type = 1;
|
||||
string resource_id = 2;
|
||||
string password = 3;
|
||||
string expires_at = 4;
|
||||
int32 max_downloads = 5;
|
||||
string created_by = 6;
|
||||
}
|
||||
|
||||
message DeleteShareRequest {
|
||||
string id = 1;
|
||||
string created_by = 2;
|
||||
}
|
||||
|
||||
message GetShareInfoRequest {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
message DownloadShareRequest {
|
||||
string token = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message DownloadShareResponse {
|
||||
string presigned_url = 1;
|
||||
string file_name = 2;
|
||||
}
|
||||
1006
api/file/v1/file_grpc.pb.go
Normal file
1006
api/file/v1/file_grpc.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
979
api/file/v1/file_http.pb.go
Normal file
979
api/file/v1/file_http.pb.go
Normal file
@ -0,0 +1,979 @@
|
||||
// Code generated by protoc-gen-go-http. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-http v2.9.2
|
||||
// - protoc (unknown)
|
||||
// source: file/v1/file.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "github.com/go-kratos/kratos/v2/transport/http"
|
||||
binding "github.com/go-kratos/kratos/v2/transport/http/binding"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the kratos package it is being compiled against.
|
||||
var _ = new(context.Context)
|
||||
var _ = binding.EncodeURL
|
||||
|
||||
const _ = http.SupportPackageIsVersion1
|
||||
|
||||
const OperationFileServiceAbortMultipartUpload = "/api.file.v1.FileService/AbortMultipartUpload"
|
||||
const OperationFileServiceCompleteMultipartUpload = "/api.file.v1.FileService/CompleteMultipartUpload"
|
||||
const OperationFileServiceCreateBucket = "/api.file.v1.FileService/CreateBucket"
|
||||
const OperationFileServiceCreateFolder = "/api.file.v1.FileService/CreateFolder"
|
||||
const OperationFileServiceCreateShare = "/api.file.v1.FileService/CreateShare"
|
||||
const OperationFileServiceDeleteBucket = "/api.file.v1.FileService/DeleteBucket"
|
||||
const OperationFileServiceDeleteFile = "/api.file.v1.FileService/DeleteFile"
|
||||
const OperationFileServiceDeleteFolder = "/api.file.v1.FileService/DeleteFolder"
|
||||
const OperationFileServiceDeleteShare = "/api.file.v1.FileService/DeleteShare"
|
||||
const OperationFileServiceDownloadFile = "/api.file.v1.FileService/DownloadFile"
|
||||
const OperationFileServiceDownloadShare = "/api.file.v1.FileService/DownloadShare"
|
||||
const OperationFileServiceGetFileContent = "/api.file.v1.FileService/GetFileContent"
|
||||
const OperationFileServiceGetFilePreview = "/api.file.v1.FileService/GetFilePreview"
|
||||
const OperationFileServiceGetFolder = "/api.file.v1.FileService/GetFolder"
|
||||
const OperationFileServiceGetFolderTree = "/api.file.v1.FileService/GetFolderTree"
|
||||
const OperationFileServiceGetShareInfo = "/api.file.v1.FileService/GetShareInfo"
|
||||
const OperationFileServiceInitMultipartUpload = "/api.file.v1.FileService/InitMultipartUpload"
|
||||
const OperationFileServiceListBuckets = "/api.file.v1.FileService/ListBuckets"
|
||||
const OperationFileServiceListFiles = "/api.file.v1.FileService/ListFiles"
|
||||
const OperationFileServiceMoveFile = "/api.file.v1.FileService/MoveFile"
|
||||
const OperationFileServiceRenameFolder = "/api.file.v1.FileService/RenameFolder"
|
||||
const OperationFileServiceUploadFile = "/api.file.v1.FileService/UploadFile"
|
||||
const OperationFileServiceUploadPart = "/api.file.v1.FileService/UploadPart"
|
||||
const OperationFileServiceUploadToFolder = "/api.file.v1.FileService/UploadToFolder"
|
||||
|
||||
type FileServiceHTTPServer interface {
|
||||
AbortMultipartUpload(context.Context, *AbortMultipartRequest) (*emptypb.Empty, error)
|
||||
CompleteMultipartUpload(context.Context, *CompleteMultipartRequest) (*CompleteMultipartResponse, error)
|
||||
// CreateBucket Bucket operations
|
||||
CreateBucket(context.Context, *CreateBucketRequest) (*emptypb.Empty, error)
|
||||
// CreateFolder Folder operations
|
||||
CreateFolder(context.Context, *CreateFolderRequest) (*Folder, error)
|
||||
// CreateShare Share operations
|
||||
CreateShare(context.Context, *CreateShareRequest) (*ShareLink, error)
|
||||
DeleteBucket(context.Context, *DeleteBucketRequest) (*emptypb.Empty, error)
|
||||
DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error)
|
||||
DeleteFolder(context.Context, *DeleteFolderRequest) (*emptypb.Empty, error)
|
||||
DeleteShare(context.Context, *DeleteShareRequest) (*emptypb.Empty, error)
|
||||
DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileResponse, error)
|
||||
DownloadShare(context.Context, *DownloadShareRequest) (*DownloadShareResponse, error)
|
||||
GetFileContent(context.Context, *GetFileContentRequest) (*GetFileContentResponse, error)
|
||||
GetFilePreview(context.Context, *GetFilePreviewRequest) (*GetFilePreviewResponse, error)
|
||||
GetFolder(context.Context, *GetFolderRequest) (*FolderWithChildren, error)
|
||||
GetFolderTree(context.Context, *GetFolderTreeRequest) (*GetFolderTreeResponse, error)
|
||||
GetShareInfo(context.Context, *GetShareInfoRequest) (*ShareInfo, error)
|
||||
// InitMultipartUpload Multipart upload
|
||||
InitMultipartUpload(context.Context, *InitMultipartRequest) (*InitMultipartResponse, error)
|
||||
ListBuckets(context.Context, *emptypb.Empty) (*ListBucketsResponse, error)
|
||||
ListFiles(context.Context, *ListFilesRequest) (*ListFilesResponse, error)
|
||||
MoveFile(context.Context, *MoveFileRequest) (*emptypb.Empty, error)
|
||||
RenameFolder(context.Context, *RenameFolderRequest) (*Folder, error)
|
||||
// UploadFile File operations
|
||||
UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error)
|
||||
UploadPart(context.Context, *UploadPartRequest) (*UploadPartResponse, error)
|
||||
UploadToFolder(context.Context, *UploadToFolderRequest) (*FileMeta, error)
|
||||
}
|
||||
|
||||
func RegisterFileServiceHTTPServer(s *http.Server, srv FileServiceHTTPServer) {
|
||||
r := s.Route("/")
|
||||
r.POST("/files/upload", _FileService_UploadFile0_HTTP_Handler(srv))
|
||||
r.GET("/files/download", _FileService_DownloadFile0_HTTP_Handler(srv))
|
||||
r.GET("/files/list", _FileService_ListFiles0_HTTP_Handler(srv))
|
||||
r.GET("/files/preview", _FileService_GetFilePreview0_HTTP_Handler(srv))
|
||||
r.GET("/files/content", _FileService_GetFileContent0_HTTP_Handler(srv))
|
||||
r.DELETE("/files/delete", _FileService_DeleteFile0_HTTP_Handler(srv))
|
||||
r.POST("/files/multipart/init", _FileService_InitMultipartUpload0_HTTP_Handler(srv))
|
||||
r.PUT("/files/multipart/part", _FileService_UploadPart0_HTTP_Handler(srv))
|
||||
r.POST("/files/multipart/complete", _FileService_CompleteMultipartUpload0_HTTP_Handler(srv))
|
||||
r.POST("/files/multipart/abort", _FileService_AbortMultipartUpload0_HTTP_Handler(srv))
|
||||
r.POST("/buckets", _FileService_CreateBucket0_HTTP_Handler(srv))
|
||||
r.GET("/buckets", _FileService_ListBuckets0_HTTP_Handler(srv))
|
||||
r.DELETE("/buckets", _FileService_DeleteBucket0_HTTP_Handler(srv))
|
||||
r.POST("/folders", _FileService_CreateFolder0_HTTP_Handler(srv))
|
||||
r.GET("/folders/tree", _FileService_GetFolderTree0_HTTP_Handler(srv))
|
||||
r.GET("/folders/{id}", _FileService_GetFolder0_HTTP_Handler(srv))
|
||||
r.PUT("/folders/{id}", _FileService_RenameFolder0_HTTP_Handler(srv))
|
||||
r.DELETE("/folders/{id}", _FileService_DeleteFolder0_HTTP_Handler(srv))
|
||||
r.POST("/folders/{folder_id}/files", _FileService_UploadToFolder0_HTTP_Handler(srv))
|
||||
r.POST("/files/{id}/move", _FileService_MoveFile0_HTTP_Handler(srv))
|
||||
r.POST("/share", _FileService_CreateShare0_HTTP_Handler(srv))
|
||||
r.DELETE("/share/{id}", _FileService_DeleteShare0_HTTP_Handler(srv))
|
||||
r.GET("/share/{token}", _FileService_GetShareInfo0_HTTP_Handler(srv))
|
||||
r.POST("/share/{token}/download", _FileService_DownloadShare0_HTTP_Handler(srv))
|
||||
}
|
||||
|
||||
func _FileService_UploadFile0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in UploadFileRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceUploadFile)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.UploadFile(ctx, req.(*UploadFileRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*UploadFileResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DownloadFile0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DownloadFileRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDownloadFile)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DownloadFile(ctx, req.(*DownloadFileRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*DownloadFileResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_ListFiles0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in ListFilesRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceListFiles)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.ListFiles(ctx, req.(*ListFilesRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*ListFilesResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_GetFilePreview0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in GetFilePreviewRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceGetFilePreview)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.GetFilePreview(ctx, req.(*GetFilePreviewRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*GetFilePreviewResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_GetFileContent0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in GetFileContentRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceGetFileContent)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.GetFileContent(ctx, req.(*GetFileContentRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*GetFileContentResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DeleteFile0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DeleteFileRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDeleteFile)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DeleteFile(ctx, req.(*DeleteFileRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_InitMultipartUpload0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in InitMultipartRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceInitMultipartUpload)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.InitMultipartUpload(ctx, req.(*InitMultipartRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*InitMultipartResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_UploadPart0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in UploadPartRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceUploadPart)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.UploadPart(ctx, req.(*UploadPartRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*UploadPartResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_CompleteMultipartUpload0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in CompleteMultipartRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceCompleteMultipartUpload)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.CompleteMultipartUpload(ctx, req.(*CompleteMultipartRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*CompleteMultipartResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_AbortMultipartUpload0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in AbortMultipartRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceAbortMultipartUpload)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.AbortMultipartUpload(ctx, req.(*AbortMultipartRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_CreateBucket0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in CreateBucketRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceCreateBucket)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.CreateBucket(ctx, req.(*CreateBucketRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_ListBuckets0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in emptypb.Empty
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceListBuckets)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.ListBuckets(ctx, req.(*emptypb.Empty))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*ListBucketsResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DeleteBucket0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DeleteBucketRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDeleteBucket)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DeleteBucket(ctx, req.(*DeleteBucketRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_CreateFolder0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in CreateFolderRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceCreateFolder)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.CreateFolder(ctx, req.(*CreateFolderRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*Folder)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_GetFolderTree0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in GetFolderTreeRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceGetFolderTree)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.GetFolderTree(ctx, req.(*GetFolderTreeRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*GetFolderTreeResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_GetFolder0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in GetFolderRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceGetFolder)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.GetFolder(ctx, req.(*GetFolderRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*FolderWithChildren)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_RenameFolder0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in RenameFolderRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceRenameFolder)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.RenameFolder(ctx, req.(*RenameFolderRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*Folder)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DeleteFolder0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DeleteFolderRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDeleteFolder)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DeleteFolder(ctx, req.(*DeleteFolderRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_UploadToFolder0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in UploadToFolderRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceUploadToFolder)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.UploadToFolder(ctx, req.(*UploadToFolderRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*FileMeta)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_MoveFile0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in MoveFileRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceMoveFile)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.MoveFile(ctx, req.(*MoveFileRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_CreateShare0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in CreateShareRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceCreateShare)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.CreateShare(ctx, req.(*CreateShareRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*ShareLink)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DeleteShare0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DeleteShareRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDeleteShare)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DeleteShare(ctx, req.(*DeleteShareRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*emptypb.Empty)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_GetShareInfo0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in GetShareInfoRequest
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceGetShareInfo)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.GetShareInfo(ctx, req.(*GetShareInfoRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*ShareInfo)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func _FileService_DownloadShare0_HTTP_Handler(srv FileServiceHTTPServer) func(ctx http.Context) error {
|
||||
return func(ctx http.Context) error {
|
||||
var in DownloadShareRequest
|
||||
if err := ctx.Bind(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindQuery(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.BindVars(&in); err != nil {
|
||||
return err
|
||||
}
|
||||
http.SetOperation(ctx, OperationFileServiceDownloadShare)
|
||||
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.DownloadShare(ctx, req.(*DownloadShareRequest))
|
||||
})
|
||||
out, err := h(ctx, &in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply := out.(*DownloadShareResponse)
|
||||
return ctx.Result(200, reply)
|
||||
}
|
||||
}
|
||||
|
||||
type FileServiceHTTPClient interface {
|
||||
AbortMultipartUpload(ctx context.Context, req *AbortMultipartRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
CompleteMultipartUpload(ctx context.Context, req *CompleteMultipartRequest, opts ...http.CallOption) (rsp *CompleteMultipartResponse, err error)
|
||||
// CreateBucket Bucket operations
|
||||
CreateBucket(ctx context.Context, req *CreateBucketRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
// CreateFolder Folder operations
|
||||
CreateFolder(ctx context.Context, req *CreateFolderRequest, opts ...http.CallOption) (rsp *Folder, err error)
|
||||
// CreateShare Share operations
|
||||
CreateShare(ctx context.Context, req *CreateShareRequest, opts ...http.CallOption) (rsp *ShareLink, err error)
|
||||
DeleteBucket(ctx context.Context, req *DeleteBucketRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
DeleteFile(ctx context.Context, req *DeleteFileRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
DeleteFolder(ctx context.Context, req *DeleteFolderRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
DeleteShare(ctx context.Context, req *DeleteShareRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
DownloadFile(ctx context.Context, req *DownloadFileRequest, opts ...http.CallOption) (rsp *DownloadFileResponse, err error)
|
||||
DownloadShare(ctx context.Context, req *DownloadShareRequest, opts ...http.CallOption) (rsp *DownloadShareResponse, err error)
|
||||
GetFileContent(ctx context.Context, req *GetFileContentRequest, opts ...http.CallOption) (rsp *GetFileContentResponse, err error)
|
||||
GetFilePreview(ctx context.Context, req *GetFilePreviewRequest, opts ...http.CallOption) (rsp *GetFilePreviewResponse, err error)
|
||||
GetFolder(ctx context.Context, req *GetFolderRequest, opts ...http.CallOption) (rsp *FolderWithChildren, err error)
|
||||
GetFolderTree(ctx context.Context, req *GetFolderTreeRequest, opts ...http.CallOption) (rsp *GetFolderTreeResponse, err error)
|
||||
GetShareInfo(ctx context.Context, req *GetShareInfoRequest, opts ...http.CallOption) (rsp *ShareInfo, err error)
|
||||
// InitMultipartUpload Multipart upload
|
||||
InitMultipartUpload(ctx context.Context, req *InitMultipartRequest, opts ...http.CallOption) (rsp *InitMultipartResponse, err error)
|
||||
ListBuckets(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *ListBucketsResponse, err error)
|
||||
ListFiles(ctx context.Context, req *ListFilesRequest, opts ...http.CallOption) (rsp *ListFilesResponse, err error)
|
||||
MoveFile(ctx context.Context, req *MoveFileRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
|
||||
RenameFolder(ctx context.Context, req *RenameFolderRequest, opts ...http.CallOption) (rsp *Folder, err error)
|
||||
// UploadFile File operations
|
||||
UploadFile(ctx context.Context, req *UploadFileRequest, opts ...http.CallOption) (rsp *UploadFileResponse, err error)
|
||||
UploadPart(ctx context.Context, req *UploadPartRequest, opts ...http.CallOption) (rsp *UploadPartResponse, err error)
|
||||
UploadToFolder(ctx context.Context, req *UploadToFolderRequest, opts ...http.CallOption) (rsp *FileMeta, err error)
|
||||
}
|
||||
|
||||
type FileServiceHTTPClientImpl struct {
|
||||
cc *http.Client
|
||||
}
|
||||
|
||||
func NewFileServiceHTTPClient(client *http.Client) FileServiceHTTPClient {
|
||||
return &FileServiceHTTPClientImpl{client}
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) AbortMultipartUpload(ctx context.Context, in *AbortMultipartRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/files/multipart/abort"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceAbortMultipartUpload))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) CompleteMultipartUpload(ctx context.Context, in *CompleteMultipartRequest, opts ...http.CallOption) (*CompleteMultipartResponse, error) {
|
||||
var out CompleteMultipartResponse
|
||||
pattern := "/files/multipart/complete"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceCompleteMultipartUpload))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// CreateBucket Bucket operations
|
||||
func (c *FileServiceHTTPClientImpl) CreateBucket(ctx context.Context, in *CreateBucketRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/buckets"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceCreateBucket))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// CreateFolder Folder operations
|
||||
func (c *FileServiceHTTPClientImpl) CreateFolder(ctx context.Context, in *CreateFolderRequest, opts ...http.CallOption) (*Folder, error) {
|
||||
var out Folder
|
||||
pattern := "/folders"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceCreateFolder))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// CreateShare Share operations
|
||||
func (c *FileServiceHTTPClientImpl) CreateShare(ctx context.Context, in *CreateShareRequest, opts ...http.CallOption) (*ShareLink, error) {
|
||||
var out ShareLink
|
||||
pattern := "/share"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceCreateShare))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DeleteBucket(ctx context.Context, in *DeleteBucketRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/buckets"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDeleteBucket))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/files/delete"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDeleteFile))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DeleteFolder(ctx context.Context, in *DeleteFolderRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/folders/{id}"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDeleteFolder))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DeleteShare(ctx context.Context, in *DeleteShareRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/share/{id}"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDeleteShare))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...http.CallOption) (*DownloadFileResponse, error) {
|
||||
var out DownloadFileResponse
|
||||
pattern := "/files/download"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDownloadFile))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) DownloadShare(ctx context.Context, in *DownloadShareRequest, opts ...http.CallOption) (*DownloadShareResponse, error) {
|
||||
var out DownloadShareResponse
|
||||
pattern := "/share/{token}/download"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceDownloadShare))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) GetFileContent(ctx context.Context, in *GetFileContentRequest, opts ...http.CallOption) (*GetFileContentResponse, error) {
|
||||
var out GetFileContentResponse
|
||||
pattern := "/files/content"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceGetFileContent))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) GetFilePreview(ctx context.Context, in *GetFilePreviewRequest, opts ...http.CallOption) (*GetFilePreviewResponse, error) {
|
||||
var out GetFilePreviewResponse
|
||||
pattern := "/files/preview"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceGetFilePreview))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) GetFolder(ctx context.Context, in *GetFolderRequest, opts ...http.CallOption) (*FolderWithChildren, error) {
|
||||
var out FolderWithChildren
|
||||
pattern := "/folders/{id}"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceGetFolder))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) GetFolderTree(ctx context.Context, in *GetFolderTreeRequest, opts ...http.CallOption) (*GetFolderTreeResponse, error) {
|
||||
var out GetFolderTreeResponse
|
||||
pattern := "/folders/tree"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceGetFolderTree))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) GetShareInfo(ctx context.Context, in *GetShareInfoRequest, opts ...http.CallOption) (*ShareInfo, error) {
|
||||
var out ShareInfo
|
||||
pattern := "/share/{token}"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceGetShareInfo))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// InitMultipartUpload Multipart upload
|
||||
func (c *FileServiceHTTPClientImpl) InitMultipartUpload(ctx context.Context, in *InitMultipartRequest, opts ...http.CallOption) (*InitMultipartResponse, error) {
|
||||
var out InitMultipartResponse
|
||||
pattern := "/files/multipart/init"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceInitMultipartUpload))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) ListBuckets(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*ListBucketsResponse, error) {
|
||||
var out ListBucketsResponse
|
||||
pattern := "/buckets"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceListBuckets))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) ListFiles(ctx context.Context, in *ListFilesRequest, opts ...http.CallOption) (*ListFilesResponse, error) {
|
||||
var out ListFilesResponse
|
||||
pattern := "/files/list"
|
||||
path := binding.EncodeURL(pattern, in, true)
|
||||
opts = append(opts, http.Operation(OperationFileServiceListFiles))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) MoveFile(ctx context.Context, in *MoveFileRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
|
||||
var out emptypb.Empty
|
||||
pattern := "/files/{id}/move"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceMoveFile))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) RenameFolder(ctx context.Context, in *RenameFolderRequest, opts ...http.CallOption) (*Folder, error) {
|
||||
var out Folder
|
||||
pattern := "/folders/{id}"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceRenameFolder))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// UploadFile File operations
|
||||
func (c *FileServiceHTTPClientImpl) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...http.CallOption) (*UploadFileResponse, error) {
|
||||
var out UploadFileResponse
|
||||
pattern := "/files/upload"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceUploadFile))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) UploadPart(ctx context.Context, in *UploadPartRequest, opts ...http.CallOption) (*UploadPartResponse, error) {
|
||||
var out UploadPartResponse
|
||||
pattern := "/files/multipart/part"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceUploadPart))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *FileServiceHTTPClientImpl) UploadToFolder(ctx context.Context, in *UploadToFolderRequest, opts ...http.CallOption) (*FileMeta, error) {
|
||||
var out FileMeta
|
||||
pattern := "/folders/{folder_id}/files"
|
||||
path := binding.EncodeURL(pattern, in, false)
|
||||
opts = append(opts, http.Operation(OperationFileServiceUploadToFolder))
|
||||
opts = append(opts, http.PathTemplate(pattern))
|
||||
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
103
api/google/api/annotations.pb.go
Normal file
103
api/google/api/annotations.pb.go
Normal file
@ -0,0 +1,103 @@
|
||||
// Copyright 2015 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: google/api/annotations.proto
|
||||
|
||||
package annotations
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
|
||||
reflect "reflect"
|
||||
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)
|
||||
)
|
||||
|
||||
var file_google_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{
|
||||
{
|
||||
ExtendedType: (*descriptorpb.MethodOptions)(nil),
|
||||
ExtensionType: (*HttpRule)(nil),
|
||||
Field: 72295728,
|
||||
Name: "google.api.http",
|
||||
Tag: "bytes,72295728,opt,name=http",
|
||||
Filename: "google/api/annotations.proto",
|
||||
},
|
||||
}
|
||||
|
||||
// Extension fields to descriptorpb.MethodOptions.
|
||||
var (
|
||||
// See `HttpRule`.
|
||||
//
|
||||
// optional google.api.HttpRule http = 72295728;
|
||||
E_Http = &file_google_api_annotations_proto_extTypes[0]
|
||||
)
|
||||
|
||||
var File_google_api_annotations_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_google_api_annotations_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1cgoogle/api/annotations.proto\x12\n" +
|
||||
"google.api\x1a\x15google/api/http.proto\x1a google/protobuf/descriptor.proto:K\n" +
|
||||
"\x04http\x12\x1e.google.protobuf.MethodOptions\x18\xb0ʼ\" \x01(\v2\x14.google.api.HttpRuleR\x04httpBn\n" +
|
||||
"\x0ecom.google.apiB\x10AnnotationsProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x04GAPIb\x06proto3"
|
||||
|
||||
var file_google_api_annotations_proto_goTypes = []any{
|
||||
(*descriptorpb.MethodOptions)(nil), // 0: google.protobuf.MethodOptions
|
||||
(*HttpRule)(nil), // 1: google.api.HttpRule
|
||||
}
|
||||
var file_google_api_annotations_proto_depIdxs = []int32{
|
||||
0, // 0: google.api.http:extendee -> google.protobuf.MethodOptions
|
||||
1, // 1: google.api.http:type_name -> google.api.HttpRule
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
1, // [1:2] is the sub-list for extension type_name
|
||||
0, // [0:1] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_google_api_annotations_proto_init() }
|
||||
func file_google_api_annotations_proto_init() {
|
||||
if File_google_api_annotations_proto != nil {
|
||||
return
|
||||
}
|
||||
file_google_api_http_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_annotations_proto_rawDesc), len(file_google_api_annotations_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 1,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_google_api_annotations_proto_goTypes,
|
||||
DependencyIndexes: file_google_api_annotations_proto_depIdxs,
|
||||
ExtensionInfos: file_google_api_annotations_proto_extTypes,
|
||||
}.Build()
|
||||
File_google_api_annotations_proto = out.File
|
||||
file_google_api_annotations_proto_goTypes = nil
|
||||
file_google_api_annotations_proto_depIdxs = nil
|
||||
}
|
||||
405
api/google/api/http.pb.go
Normal file
405
api/google/api/http.pb.go
Normal file
@ -0,0 +1,405 @@
|
||||
// Copyright 2015 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: google/api/http.proto
|
||||
|
||||
package annotations
|
||||
|
||||
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 Http struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
|
||||
FullyDecodeReservedExpansion bool `protobuf:"varint,2,opt,name=fully_decode_reserved_expansion,json=fullyDecodeReservedExpansion,proto3" json:"fully_decode_reserved_expansion,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Http) Reset() {
|
||||
*x = Http{}
|
||||
mi := &file_google_api_http_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Http) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Http) ProtoMessage() {}
|
||||
|
||||
func (x *Http) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_api_http_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 Http.ProtoReflect.Descriptor instead.
|
||||
func (*Http) Descriptor() ([]byte, []int) {
|
||||
return file_google_api_http_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Http) GetRules() []*HttpRule {
|
||||
if x != nil {
|
||||
return x.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Http) GetFullyDecodeReservedExpansion() bool {
|
||||
if x != nil {
|
||||
return x.FullyDecodeReservedExpansion
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type HttpRule struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector,proto3" json:"selector,omitempty"`
|
||||
// Types that are valid to be assigned to Pattern:
|
||||
//
|
||||
// *HttpRule_Get
|
||||
// *HttpRule_Put
|
||||
// *HttpRule_Post
|
||||
// *HttpRule_Delete
|
||||
// *HttpRule_Patch
|
||||
// *HttpRule_Custom
|
||||
Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
ResponseBody string `protobuf:"bytes,12,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"`
|
||||
AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *HttpRule) Reset() {
|
||||
*x = HttpRule{}
|
||||
mi := &file_google_api_http_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *HttpRule) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HttpRule) ProtoMessage() {}
|
||||
|
||||
func (x *HttpRule) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_api_http_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 HttpRule.ProtoReflect.Descriptor instead.
|
||||
func (*HttpRule) Descriptor() ([]byte, []int) {
|
||||
return file_google_api_http_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetSelector() string {
|
||||
if x != nil {
|
||||
return x.Selector
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetPattern() isHttpRule_Pattern {
|
||||
if x != nil {
|
||||
return x.Pattern
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetGet() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Get); ok {
|
||||
return x.Get
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetPut() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Put); ok {
|
||||
return x.Put
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetPost() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Post); ok {
|
||||
return x.Post
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetDelete() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Delete); ok {
|
||||
return x.Delete
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetPatch() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Patch); ok {
|
||||
return x.Patch
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetCustom() *CustomHttpPattern {
|
||||
if x != nil {
|
||||
if x, ok := x.Pattern.(*HttpRule_Custom); ok {
|
||||
return x.Custom
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetResponseBody() string {
|
||||
if x != nil {
|
||||
return x.ResponseBody
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HttpRule) GetAdditionalBindings() []*HttpRule {
|
||||
if x != nil {
|
||||
return x.AdditionalBindings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isHttpRule_Pattern interface {
|
||||
isHttpRule_Pattern()
|
||||
}
|
||||
|
||||
type HttpRule_Get struct {
|
||||
Get string `protobuf:"bytes,2,opt,name=get,proto3,oneof"`
|
||||
}
|
||||
|
||||
type HttpRule_Put struct {
|
||||
Put string `protobuf:"bytes,3,opt,name=put,proto3,oneof"`
|
||||
}
|
||||
|
||||
type HttpRule_Post struct {
|
||||
Post string `protobuf:"bytes,4,opt,name=post,proto3,oneof"`
|
||||
}
|
||||
|
||||
type HttpRule_Delete struct {
|
||||
Delete string `protobuf:"bytes,5,opt,name=delete,proto3,oneof"`
|
||||
}
|
||||
|
||||
type HttpRule_Patch struct {
|
||||
Patch string `protobuf:"bytes,6,opt,name=patch,proto3,oneof"`
|
||||
}
|
||||
|
||||
type HttpRule_Custom struct {
|
||||
Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*HttpRule_Get) isHttpRule_Pattern() {}
|
||||
|
||||
func (*HttpRule_Put) isHttpRule_Pattern() {}
|
||||
|
||||
func (*HttpRule_Post) isHttpRule_Pattern() {}
|
||||
|
||||
func (*HttpRule_Delete) isHttpRule_Pattern() {}
|
||||
|
||||
func (*HttpRule_Patch) isHttpRule_Pattern() {}
|
||||
|
||||
func (*HttpRule_Custom) isHttpRule_Pattern() {}
|
||||
|
||||
type CustomHttpPattern struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CustomHttpPattern) Reset() {
|
||||
*x = CustomHttpPattern{}
|
||||
mi := &file_google_api_http_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CustomHttpPattern) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CustomHttpPattern) ProtoMessage() {}
|
||||
|
||||
func (x *CustomHttpPattern) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_api_http_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 CustomHttpPattern.ProtoReflect.Descriptor instead.
|
||||
func (*CustomHttpPattern) Descriptor() ([]byte, []int) {
|
||||
return file_google_api_http_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CustomHttpPattern) GetKind() string {
|
||||
if x != nil {
|
||||
return x.Kind
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CustomHttpPattern) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_google_api_http_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_google_api_http_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x15google/api/http.proto\x12\n" +
|
||||
"google.api\"y\n" +
|
||||
"\x04Http\x12*\n" +
|
||||
"\x05rules\x18\x01 \x03(\v2\x14.google.api.HttpRuleR\x05rules\x12E\n" +
|
||||
"\x1ffully_decode_reserved_expansion\x18\x02 \x01(\bR\x1cfullyDecodeReservedExpansion\"\xda\x02\n" +
|
||||
"\bHttpRule\x12\x1a\n" +
|
||||
"\bselector\x18\x01 \x01(\tR\bselector\x12\x12\n" +
|
||||
"\x03get\x18\x02 \x01(\tH\x00R\x03get\x12\x12\n" +
|
||||
"\x03put\x18\x03 \x01(\tH\x00R\x03put\x12\x14\n" +
|
||||
"\x04post\x18\x04 \x01(\tH\x00R\x04post\x12\x18\n" +
|
||||
"\x06delete\x18\x05 \x01(\tH\x00R\x06delete\x12\x16\n" +
|
||||
"\x05patch\x18\x06 \x01(\tH\x00R\x05patch\x127\n" +
|
||||
"\x06custom\x18\b \x01(\v2\x1d.google.api.CustomHttpPatternH\x00R\x06custom\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\x12#\n" +
|
||||
"\rresponse_body\x18\f \x01(\tR\fresponseBody\x12E\n" +
|
||||
"\x13additional_bindings\x18\v \x03(\v2\x14.google.api.HttpRuleR\x12additionalBindingsB\t\n" +
|
||||
"\apattern\";\n" +
|
||||
"\x11CustomHttpPattern\x12\x12\n" +
|
||||
"\x04kind\x18\x01 \x01(\tR\x04kind\x12\x12\n" +
|
||||
"\x04path\x18\x02 \x01(\tR\x04pathBj\n" +
|
||||
"\x0ecom.google.apiB\tHttpProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3"
|
||||
|
||||
var (
|
||||
file_google_api_http_proto_rawDescOnce sync.Once
|
||||
file_google_api_http_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_google_api_http_proto_rawDescGZIP() []byte {
|
||||
file_google_api_http_proto_rawDescOnce.Do(func() {
|
||||
file_google_api_http_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_api_http_proto_rawDesc), len(file_google_api_http_proto_rawDesc)))
|
||||
})
|
||||
return file_google_api_http_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_google_api_http_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_google_api_http_proto_goTypes = []any{
|
||||
(*Http)(nil), // 0: google.api.Http
|
||||
(*HttpRule)(nil), // 1: google.api.HttpRule
|
||||
(*CustomHttpPattern)(nil), // 2: google.api.CustomHttpPattern
|
||||
}
|
||||
var file_google_api_http_proto_depIdxs = []int32{
|
||||
1, // 0: google.api.Http.rules:type_name -> google.api.HttpRule
|
||||
2, // 1: google.api.HttpRule.custom:type_name -> google.api.CustomHttpPattern
|
||||
1, // 2: google.api.HttpRule.additional_bindings:type_name -> google.api.HttpRule
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_google_api_http_proto_init() }
|
||||
func file_google_api_http_proto_init() {
|
||||
if File_google_api_http_proto != nil {
|
||||
return
|
||||
}
|
||||
file_google_api_http_proto_msgTypes[1].OneofWrappers = []any{
|
||||
(*HttpRule_Get)(nil),
|
||||
(*HttpRule_Put)(nil),
|
||||
(*HttpRule_Post)(nil),
|
||||
(*HttpRule_Delete)(nil),
|
||||
(*HttpRule_Patch)(nil),
|
||||
(*HttpRule_Custom)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_http_proto_rawDesc), len(file_google_api_http_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_google_api_http_proto_goTypes,
|
||||
DependencyIndexes: file_google_api_http_proto_depIdxs,
|
||||
MessageInfos: file_google_api_http_proto_msgTypes,
|
||||
}.Build()
|
||||
File_google_api_http_proto = out.File
|
||||
file_google_api_http_proto_goTypes = nil
|
||||
file_google_api_http_proto_depIdxs = nil
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: auth.proto
|
||||
// source: proto/auth.proto
|
||||
|
||||
package proto
|
||||
|
||||
@ -30,7 +30,7 @@ type ValidateTokenRequest struct {
|
||||
|
||||
func (x *ValidateTokenRequest) Reset() {
|
||||
*x = ValidateTokenRequest{}
|
||||
mi := &file_auth_proto_msgTypes[0]
|
||||
mi := &file_proto_auth_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -42,7 +42,7 @@ func (x *ValidateTokenRequest) String() string {
|
||||
func (*ValidateTokenRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_auth_proto_msgTypes[0]
|
||||
mi := &file_proto_auth_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -55,7 +55,7 @@ func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ValidateTokenRequest) Descriptor() ([]byte, []int) {
|
||||
return file_auth_proto_rawDescGZIP(), []int{0}
|
||||
return file_proto_auth_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ValidateTokenRequest) GetToken() string {
|
||||
@ -80,7 +80,7 @@ type ValidateTokenResponse struct {
|
||||
|
||||
func (x *ValidateTokenResponse) Reset() {
|
||||
*x = ValidateTokenResponse{}
|
||||
mi := &file_auth_proto_msgTypes[1]
|
||||
mi := &file_proto_auth_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -92,7 +92,7 @@ func (x *ValidateTokenResponse) String() string {
|
||||
func (*ValidateTokenResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_auth_proto_msgTypes[1]
|
||||
mi := &file_proto_auth_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -105,7 +105,7 @@ func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ValidateTokenResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ValidateTokenResponse) Descriptor() ([]byte, []int) {
|
||||
return file_auth_proto_rawDescGZIP(), []int{1}
|
||||
return file_proto_auth_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) GetValid() bool {
|
||||
@ -167,7 +167,7 @@ type CheckPermissionRequest struct {
|
||||
|
||||
func (x *CheckPermissionRequest) Reset() {
|
||||
*x = CheckPermissionRequest{}
|
||||
mi := &file_auth_proto_msgTypes[2]
|
||||
mi := &file_proto_auth_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -179,7 +179,7 @@ func (x *CheckPermissionRequest) String() string {
|
||||
func (*CheckPermissionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CheckPermissionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_auth_proto_msgTypes[2]
|
||||
mi := &file_proto_auth_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -192,7 +192,7 @@ func (x *CheckPermissionRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CheckPermissionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CheckPermissionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_auth_proto_rawDescGZIP(), []int{2}
|
||||
return file_proto_auth_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CheckPermissionRequest) GetToken() string {
|
||||
@ -220,7 +220,7 @@ type CheckPermissionResponse struct {
|
||||
|
||||
func (x *CheckPermissionResponse) Reset() {
|
||||
*x = CheckPermissionResponse{}
|
||||
mi := &file_auth_proto_msgTypes[3]
|
||||
mi := &file_proto_auth_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -232,7 +232,7 @@ func (x *CheckPermissionResponse) String() string {
|
||||
func (*CheckPermissionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CheckPermissionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_auth_proto_msgTypes[3]
|
||||
mi := &file_proto_auth_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -245,7 +245,7 @@ func (x *CheckPermissionResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CheckPermissionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CheckPermissionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_auth_proto_rawDescGZIP(), []int{3}
|
||||
return file_proto_auth_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *CheckPermissionResponse) GetAllowed() bool {
|
||||
@ -269,12 +269,11 @@ func (x *CheckPermissionResponse) GetRoles() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_auth_proto protoreflect.FileDescriptor
|
||||
var File_proto_auth_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_auth_proto_rawDesc = "" +
|
||||
const file_proto_auth_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"auth.proto\x12\x04auth\",\n" +
|
||||
"\x10proto/auth.proto\x12\x04auth\",\n" +
|
||||
"\x14ValidateTokenRequest\x12\x14\n" +
|
||||
"\x05token\x18\x01 \x01(\tR\x05token\"\xcf\x01\n" +
|
||||
"\x15ValidateTokenResponse\x12\x14\n" +
|
||||
@ -297,29 +296,28 @@ const file_auth_proto_rawDesc = "" +
|
||||
"\x05roles\x18\x03 \x03(\tR\x05roles2\xa7\x01\n" +
|
||||
"\vAuthService\x12H\n" +
|
||||
"\rValidateToken\x12\x1a.auth.ValidateTokenRequest\x1a\x1b.auth.ValidateTokenResponse\x12N\n" +
|
||||
"\x0fCheckPermission\x12\x1c.auth.CheckPermissionRequest\x1a\x1d.auth.CheckPermissionResponseB`\n" +
|
||||
"\bcom.authB\tAuthProtoP\x01Z\x19rag/file-system/api/proto\xa2\x02\x03AXX\xaa\x02\x04Auth\xca\x02\x04Auth\xe2\x02\x10Auth\\GPBMetadata\xea\x02\x04Authb\x06proto3"
|
||||
"\x0fCheckPermission\x12\x1c.auth.CheckPermissionRequest\x1a\x1d.auth.CheckPermissionResponseB\x1bZ\x19rag/file-system/api/protob\x06proto3"
|
||||
|
||||
var (
|
||||
file_auth_proto_rawDescOnce sync.Once
|
||||
file_auth_proto_rawDescData []byte
|
||||
file_proto_auth_proto_rawDescOnce sync.Once
|
||||
file_proto_auth_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_auth_proto_rawDescGZIP() []byte {
|
||||
file_auth_proto_rawDescOnce.Do(func() {
|
||||
file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc)))
|
||||
func file_proto_auth_proto_rawDescGZIP() []byte {
|
||||
file_proto_auth_proto_rawDescOnce.Do(func() {
|
||||
file_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)))
|
||||
})
|
||||
return file_auth_proto_rawDescData
|
||||
return file_proto_auth_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_auth_proto_goTypes = []any{
|
||||
var file_proto_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_proto_auth_proto_goTypes = []any{
|
||||
(*ValidateTokenRequest)(nil), // 0: auth.ValidateTokenRequest
|
||||
(*ValidateTokenResponse)(nil), // 1: auth.ValidateTokenResponse
|
||||
(*CheckPermissionRequest)(nil), // 2: auth.CheckPermissionRequest
|
||||
(*CheckPermissionResponse)(nil), // 3: auth.CheckPermissionResponse
|
||||
}
|
||||
var file_auth_proto_depIdxs = []int32{
|
||||
var file_proto_auth_proto_depIdxs = []int32{
|
||||
0, // 0: auth.AuthService.ValidateToken:input_type -> auth.ValidateTokenRequest
|
||||
2, // 1: auth.AuthService.CheckPermission:input_type -> auth.CheckPermissionRequest
|
||||
1, // 2: auth.AuthService.ValidateToken:output_type -> auth.ValidateTokenResponse
|
||||
@ -331,26 +329,26 @@ var file_auth_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_auth_proto_init() }
|
||||
func file_auth_proto_init() {
|
||||
if File_auth_proto != nil {
|
||||
func init() { file_proto_auth_proto_init() }
|
||||
func file_proto_auth_proto_init() {
|
||||
if File_proto_auth_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc)),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_auth_proto_goTypes,
|
||||
DependencyIndexes: file_auth_proto_depIdxs,
|
||||
MessageInfos: file_auth_proto_msgTypes,
|
||||
GoTypes: file_proto_auth_proto_goTypes,
|
||||
DependencyIndexes: file_proto_auth_proto_depIdxs,
|
||||
MessageInfos: file_proto_auth_proto_msgTypes,
|
||||
}.Build()
|
||||
File_auth_proto = out.File
|
||||
file_auth_proto_goTypes = nil
|
||||
file_auth_proto_depIdxs = nil
|
||||
File_proto_auth_proto = out.File
|
||||
file_proto_auth_proto_goTypes = nil
|
||||
file_proto_auth_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc (unknown)
|
||||
// source: auth.proto
|
||||
// source: proto/auth.proto
|
||||
|
||||
package proto
|
||||
|
||||
@ -155,5 +155,5 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "auth.proto",
|
||||
Metadata: "proto/auth.proto",
|
||||
}
|
||||
|
||||
18
buf.gen.yaml
18
buf.gen.yaml
@ -2,18 +2,12 @@ version: v2
|
||||
managed:
|
||||
enabled: false
|
||||
plugins:
|
||||
- remote: buf.build/protocolbuffers/go
|
||||
out: .
|
||||
- local: protoc-gen-go
|
||||
out: api
|
||||
opt: paths=source_relative
|
||||
- remote: buf.build/grpc/go
|
||||
out: .
|
||||
- local: protoc-gen-go-grpc
|
||||
out: api
|
||||
opt: paths=source_relative
|
||||
- remote: buf.build/grpc-ecosystem/gateway
|
||||
out: .
|
||||
- local: protoc-gen-go-http
|
||||
out: api
|
||||
opt: paths=source_relative
|
||||
# Kratos HTTP code generation uses local protoc-gen-go-http
|
||||
# Install: go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
|
||||
# Uncomment after installing kratos dependencies:
|
||||
# - local: protoc-gen-go-http
|
||||
# out: .
|
||||
# opt: paths=source_relative
|
||||
|
||||
1
buf.yaml
1
buf.yaml
@ -1,7 +1,6 @@
|
||||
version: v2
|
||||
modules:
|
||||
- path: api
|
||||
- path: internal/conf
|
||||
- path: third_party
|
||||
lint:
|
||||
use:
|
||||
|
||||
15
third_party/errors/errors.proto
vendored
Normal file
15
third_party/errors/errors.proto
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package errors;
|
||||
|
||||
option go_package = "github.com/go-kratos/kratos/v2/errors";
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
extend google.protobuf.EnumOptions {
|
||||
int32 default_code = 1108;
|
||||
}
|
||||
|
||||
extend google.protobuf.EnumValueOptions {
|
||||
int32 code = 1109;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user