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; }