Files

152 lines
4.3 KiB
Go

package file
// UploadResponse represents the response body for successful file upload.
// UploadResponse 表示成功上传文件的响应体。
//
// Fields:
// - Message: A success message.
// - File: The storage path of the uploaded file.
// - Size: The file size in bytes.
//
// 字段:
// - Message: 成功消息。
// - File: 上传文件的存储路径。
// - Size: 文件大小(字节)。
type UploadResponse struct {
Message string `json:"message"`
File string `json:"file"`
Size int64 `json:"size"`
}
// FileItem represents a single file in the listing.
// FileItem 表示列表中的单个文件。
//
// Fields:
// - Key: The storage key/path of the file.
// - Size: The file size in bytes.
// - LastModified: The timestamp when the file was last modified.
//
// 字段:
// - Key: 文件的存储键/路径。
// - Size: 文件大小(字节)。
// - LastModified: 文件最后修改的时间戳。
type FileItem struct {
Key string `json:"key"`
Size int64 `json:"size"`
LastModified string `json:"last_modified"`
}
// ListResponse represents the response body for file listing.
// ListResponse 表示文件列表的响应体。
//
// Fields:
// - Files: A list of file items with metadata.
//
// 字段:
// - Files: 包含元数据的文件项列表。
type ListResponse struct {
Files []FileItem `json:"files"`
}
// DeleteResponse represents the response body for successful file deletion.
// DeleteResponse 表示成功删除文件的响应体。
//
// Fields:
// - Message: A success message.
//
// 字段:
// - Message: 成功消息。
type DeleteResponse struct {
Message string `json:"message"`
}
// FavoriteResponse represents the response body for favorite operations.
// FavoriteResponse 表示收藏操作的响应体。
//
// Fields:
// - Message: A success message.
// - FileKey: The file key that was favorited/unfavorited.
//
// 字段:
// - Message: 成功消息。
// - FileKey: 被收藏/取消收藏的文件键。
type FavoriteResponse struct {
Message string `json:"message"`
FileKey string `json:"file_key"`
}
// FavoriteListResponse represents the response body for favorite list.
// FavoriteListResponse 表示收藏列表的响应体。
//
// Fields:
// - Favorites: A list of favorite file information.
//
// 字段:
// - Favorites: 收藏文件信息列表。
type FavoriteListResponse struct {
Favorites []FavoriteItem `json:"favorites"`
}
// FavoriteItem represents a single favorite file.
// FavoriteItem 表示单个收藏文件。
//
// Fields:
// - FileKey: The storage key of the file.
// - FileName: The original filename.
// - CreatedAt: Timestamp when the file was favorited.
//
// 字段:
// - FileKey: 文件的存储键。
// - FileName: 原始文件名。
// - CreatedAt: 文件被收藏的时间戳。
type FavoriteItem struct {
FileKey string `json:"file_key"`
FileName string `json:"file_name"`
Size int64 `json:"size"`
CreatedAt string `json:"created_at"`
}
// RecycleBinResponse represents the response body for recycle bin list.
// RecycleBinResponse 表示回收站列表的响应体。
//
// Fields:
// - Files: A list of deleted file information.
//
// 字段:
// - Files: 已删除文件信息列表。
type RecycleBinResponse struct {
Files []DeletedFileItem `json:"files"`
}
// DeletedFileItem represents a single deleted file.
// DeletedFileItem 表示单个已删除文件。
//
// Fields:
// - FileKey: The storage key of the file.
// - FileName: The original filename.
// - Size: The file size in bytes.
// - DeletedAt: Timestamp when the file was deleted.
//
// 字段:
// - FileKey: 文件的存储键。
// - FileName: 原始文件名。
// - Size: 文件大小(字节)。
// - DeletedAt: 文件被删除的时间戳。
type DeletedFileItem struct {
FileKey string `json:"file_key"`
FileName string `json:"file_name"`
Size int64 `json:"size"`
DeletedAt string `json:"deleted_at"`
}
// PreviewResponse represents the response body for file preview info.
// PreviewResponse 表示文件预览信息的响应体。
//
// Fields:
// - FileType: The type of file (image, text, pdf, other).
//
// 字段:
// - FileType: 文件类型(image, text, pdf, other)。
type PreviewResponse struct {
FileType string `json:"file_type"`
}