2023-03-22 22:45:17 +08:00
|
|
|
|
package schema
|
|
|
|
|
|
|
|
|
|
import (
|
2023-03-23 13:52:44 +08:00
|
|
|
|
"net/url"
|
2023-03-22 22:45:17 +08:00
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DocFolder struct {
|
|
|
|
|
ID string `json:"id" oai:"description=文件夹ID"`
|
|
|
|
|
IsDeletable bool `json:"is_deletable" oai:"description=文件夹是否允许被删除"`
|
|
|
|
|
IsEditable bool `json:"is_editable" oai:"description=文件夹是否允许被修改"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at" oai:"description=创建时间"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at" oai:"description=更新时间"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocFolderID struct {
|
|
|
|
|
ID string `path:"id" oai:"description=文件夹ID"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CreateDocFolder struct {
|
|
|
|
|
Name string `json:"name" validate:"required" oai:"description=文件夹名称"`
|
|
|
|
|
ParentID string `json:"parent_id" oai:"description=父文件夹ID,空表示在根路径创建"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateDocFolder struct {
|
|
|
|
|
Name *string `json:"name" oai:"description=修改文件夹名称"`
|
|
|
|
|
ParentID *string `json:"parent_id" oai:"description=修改文件夹父级ID"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GetDocFolderTree struct {
|
|
|
|
|
ParentID *string `query:"parent_id" oai:"description=父文件夹ID,空表示获取根路径"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocFolderWithChildren struct {
|
|
|
|
|
ID string `json:"id" oai:"description=文件夹ID,**根文件夹无ID**"`
|
|
|
|
|
IsDeletable bool `json:"is_deletable" oai:"description=文件夹是否允许被删除"`
|
|
|
|
|
IsEditable bool `json:"is_editable" oai:"description=文件夹是否允许被修改"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at" oai:"description=创建时间"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at" oai:"description=更新时间"`
|
|
|
|
|
Children []*DocFolderWithChildren `json:"children" oai:"description=子文件夹"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Doc struct {
|
2023-03-23 15:44:57 +08:00
|
|
|
|
ID string `json:"id" oai:"description=文档ID"`
|
|
|
|
|
Folder *DocFolder `json:"folder" oai:"description=归属文件夹信息"`
|
|
|
|
|
PresignedURL *url.URL `json:"presigned_url" oai:"description=文档预签名下载URL(临时下载URL)"`
|
|
|
|
|
IsDeletable bool `json:"is_deletable" oai:"description=文件夹是否允许被删除"`
|
|
|
|
|
IsEditable bool `json:"is_editable" oai:"description=文件夹是否允许被修改"`
|
|
|
|
|
UploadedAt time.Time `json:"uploaded_at" oai:"description=上传时间"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at" oai:"description=创建时间"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at" oai:"description=更新时间"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocList struct {
|
|
|
|
|
Items []*Doc `json:"items" oai:"description=文档列表"`
|
|
|
|
|
Total int64 `json:"total" oai:"description=文档总数"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocID struct {
|
|
|
|
|
ID string `path:"id" oai:"description=文档ID"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CreateDoc struct {
|
2023-03-23 13:52:44 +08:00
|
|
|
|
Name string `json:"name" validate:"required" oai:"description=文档名称"`
|
|
|
|
|
ObjectName string `json:"object_name" validate:"required" oai:"description=对象存储中对应的文档对象名称"`
|
|
|
|
|
FolderID string `json:"folder_id" validate:"required" oai:"description=归属文件夹ID"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateDoc struct {
|
|
|
|
|
Name *string `json:"name" oai:"description=更新文档名称"`
|
|
|
|
|
FolderID *string `json:"folder_id" oai:"description=更新归属文件夹ID"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ListDocQuery struct {
|
|
|
|
|
PageableQuery
|
|
|
|
|
SortableQuery
|
2023-03-22 22:54:14 +08:00
|
|
|
|
FolderIDs *[]string `query:"folder_ids" oai:"description=筛选归属文件夹ID"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocsBatchDelete struct {
|
2023-03-22 22:54:14 +08:00
|
|
|
|
IDs []string `json:"ids" validate:"required" oai:"description=批量选择文件ID列表"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DocsBatchUpdate struct {
|
2023-03-22 22:54:14 +08:00
|
|
|
|
IDs []string `json:"ids" validate:"required" oai:"description=批量选择文件ID列表"`
|
|
|
|
|
FolderID string `json:"folder_id" validate:"required" oai:"description=更新归属文件夹ID"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-23 17:43:27 +08:00
|
|
|
|
type DocBatchResult struct {
|
|
|
|
|
ID string `json:"id" oai:"description=文档ID"`
|
|
|
|
|
Success bool `json:"success" oai:"description=操作是否成功"`
|
|
|
|
|
Error string `json:"message,omitempty" oai:"description=操作失败信息"`
|
2023-03-22 22:45:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-23 17:43:27 +08:00
|
|
|
|
type DocBatchResults []DocBatchResult
|
2023-03-23 13:52:44 +08:00
|
|
|
|
|
|
|
|
|
type CreateUploadURL struct {
|
|
|
|
|
FileName string `query:"file_name" validate:"required" oai:"description=上传文件名"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UploadURL struct {
|
|
|
|
|
URL url.URL `json:"url" oai:"description=生成的预签名上传URL"`
|
|
|
|
|
ObjectName string `json:"object_name" oai:"description=上传文件名"`
|
|
|
|
|
}
|