Documentation
¶
Index ¶
- func DelCache(key string) error
- func GetCache[V any](key string, val V) error
- func SetCache(key string, value interface{}) error
- type CloudreveClient
- func (c *CloudreveClient) Config() (*RespData[SiteConfig], error)
- func (c *CloudreveClient) CreateDirectory(path string) (*Resp, error)
- func (c *CloudreveClient) Download(req OneStepDownloadReq) error
- func (c *CloudreveClient) FileArchive(req ItemReq) (*RespData[string], error)
- func (c *CloudreveClient) FileCreateDownloadSession(id string) (*RespData[string], error)
- func (c *CloudreveClient) FileCreateFile(path string) (*Resp, error)
- func (c *CloudreveClient) FileGetSource(req ItemReq) (*RespData[[]Sources], error)
- func (c *CloudreveClient) FileUploadDeleteAllUploadSession() (*Resp, error)
- func (c *CloudreveClient) FileUploadDeleteUploadSession(sessionId string) (*Resp, error)
- func (c *CloudreveClient) FileUploadGetUploadSession(req CreateUploadSessionReq) (*RespData[UploadCredential], error)
- func (c *CloudreveClient) ListDirectory(path string) (*RespData[ObjectList], error)
- func (c *CloudreveClient) ObjectCopy(req ItemMoveReq) (*Resp, error)
- func (c *CloudreveClient) ObjectDelete(req ItemReq) (*Resp, error)
- func (c *CloudreveClient) ObjectGetProperty(req ItemPropertyReq) (*RespData[ObjectProps], error)
- func (c *CloudreveClient) ObjectMove(req ItemMoveReq) (*Resp, error)
- func (c *CloudreveClient) ObjectRename(req ItemRenameReq) (*Resp, error)
- func (c *CloudreveClient) OneDriveCallback(sessionId string) (*Resp, error)
- func (c *CloudreveClient) OneDriveUpload(req OneDriveUploadReq) (int64, error)
- func (c *CloudreveClient) Rename(path string, fn RenameDealFunc) error
- func (c *CloudreveClient) ShareCreateShare(req ShareCreateReq) (*RespData[string], error)
- func (c *CloudreveClient) ShareDeleteShare(id string) (*Resp, error)
- func (c *CloudreveClient) ShareGetShare(id, password string) (*RespData[Share], error)
- func (c *CloudreveClient) ShareGetShareDownload(id, path string) (*RespData[string], error)
- func (c *CloudreveClient) ShareListShare() (*RespData[ShareList], error)
- func (c *CloudreveClient) ShareListSharedFolder(id, path string) (*RespData[ObjectList], error)
- func (c *CloudreveClient) ShareSearchShare(req ShareListReq) (*RespData[ShareList], error)
- func (c *CloudreveClient) ShareSearchSharedFolder(id, keyword, path string, searchType SearchType) (*RespData[ObjectList], error)
- func (c *CloudreveClient) ShareUpdateShare(req ShareUpdateReq) (*RespData[string], error)
- func (c *CloudreveClient) UploadFile(req OneStepUploadFileReq) error
- func (c *CloudreveClient) UploadPath(req OneStepUploadPathReq) error
- func (c *CloudreveClient) UserStorage() (*RespData[Storage], error)
- type CreateUploadSessionReq
- type DownloadCallback
- type Item
- type ItemMoveReq
- type ItemPropertyReq
- type ItemRenameReq
- type ItemReq
- type Json
- type MyShareItem
- type Object
- type ObjectList
- type ObjectProps
- type OneDriveUploadReq
- type OneStepDownloadReq
- type OneStepUploadFileReq
- type OneStepUploadPathReq
- type PolicySummary
- type ProgressReader
- type RenameDealFunc
- type Resp
- type RespData
- type SearchOrder
- type SearchOrderBy
- type SearchType
- type SessionRefresh
- type Share
- type ShareCreateReq
- type ShareCreator
- type ShareList
- type ShareListReq
- type ShareSource
- type ShareUpdateReq
- type ShareUpdateReqProp
- type SiteConfig
- type Sources
- type Storage
- type Tag
- type UploadCredential
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloudreveClient ¶
type CloudreveClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cloudreveUrl, cloudreveSession string) *CloudreveClient
func NewClientWithLogin ¶
func NewClientWithLogin(cloudreveUrl, username, password string) *CloudreveClient
func NewClientWithRefresh ¶
func NewClientWithRefresh(cloudreveUrl, cloudreveSession string, sessionRefresh SessionRefresh) *CloudreveClient
func (*CloudreveClient) Config ¶
func (c *CloudreveClient) Config() (*RespData[SiteConfig], error)
func (*CloudreveClient) CreateDirectory ¶
func (c *CloudreveClient) CreateDirectory(path string) (*Resp, error)
func (*CloudreveClient) Download ¶ added in v1.0.4
func (c *CloudreveClient) Download(req OneStepDownloadReq) error
func (*CloudreveClient) FileArchive ¶
func (c *CloudreveClient) FileArchive(req ItemReq) (*RespData[string], error)
func (*CloudreveClient) FileCreateDownloadSession ¶
func (c *CloudreveClient) FileCreateDownloadSession(id string) (*RespData[string], error)
func (*CloudreveClient) FileCreateFile ¶
func (c *CloudreveClient) FileCreateFile(path string) (*Resp, error)
func (*CloudreveClient) FileGetSource ¶
func (c *CloudreveClient) FileGetSource(req ItemReq) (*RespData[[]Sources], error)
func (*CloudreveClient) FileUploadDeleteAllUploadSession ¶
func (c *CloudreveClient) FileUploadDeleteAllUploadSession() (*Resp, error)
func (*CloudreveClient) FileUploadDeleteUploadSession ¶
func (c *CloudreveClient) FileUploadDeleteUploadSession(sessionId string) (*Resp, error)
func (*CloudreveClient) FileUploadGetUploadSession ¶
func (c *CloudreveClient) FileUploadGetUploadSession(req CreateUploadSessionReq) (*RespData[UploadCredential], error)
func (*CloudreveClient) ListDirectory ¶
func (c *CloudreveClient) ListDirectory(path string) (*RespData[ObjectList], error)
func (*CloudreveClient) ObjectCopy ¶
func (c *CloudreveClient) ObjectCopy(req ItemMoveReq) (*Resp, error)
func (*CloudreveClient) ObjectDelete ¶
func (c *CloudreveClient) ObjectDelete(req ItemReq) (*Resp, error)
func (*CloudreveClient) ObjectGetProperty ¶
func (c *CloudreveClient) ObjectGetProperty(req ItemPropertyReq) (*RespData[ObjectProps], error)
func (*CloudreveClient) ObjectMove ¶
func (c *CloudreveClient) ObjectMove(req ItemMoveReq) (*Resp, error)
func (*CloudreveClient) ObjectRename ¶
func (c *CloudreveClient) ObjectRename(req ItemRenameReq) (*Resp, error)
func (*CloudreveClient) OneDriveCallback ¶
func (c *CloudreveClient) OneDriveCallback(sessionId string) (*Resp, error)
func (*CloudreveClient) OneDriveUpload ¶
func (c *CloudreveClient) OneDriveUpload(req OneDriveUploadReq) (int64, error)
OneDriveUpload 分片上传 返回已上传的字节数和错误信息
func (*CloudreveClient) Rename ¶ added in v1.0.4
func (c *CloudreveClient) Rename(path string, fn RenameDealFunc) error
Rename 一键重命名
func (*CloudreveClient) ShareCreateShare ¶
func (c *CloudreveClient) ShareCreateShare(req ShareCreateReq) (*RespData[string], error)
func (*CloudreveClient) ShareDeleteShare ¶
func (c *CloudreveClient) ShareDeleteShare(id string) (*Resp, error)
func (*CloudreveClient) ShareGetShare ¶
func (c *CloudreveClient) ShareGetShare(id, password string) (*RespData[Share], error)
func (*CloudreveClient) ShareGetShareDownload ¶
func (c *CloudreveClient) ShareGetShareDownload(id, path string) (*RespData[string], error)
func (*CloudreveClient) ShareListShare ¶
func (c *CloudreveClient) ShareListShare() (*RespData[ShareList], error)
func (*CloudreveClient) ShareListSharedFolder ¶
func (c *CloudreveClient) ShareListSharedFolder(id, path string) (*RespData[ObjectList], error)
func (*CloudreveClient) ShareSearchShare ¶
func (c *CloudreveClient) ShareSearchShare(req ShareListReq) (*RespData[ShareList], error)
func (*CloudreveClient) ShareSearchSharedFolder ¶
func (c *CloudreveClient) ShareSearchSharedFolder(id, keyword, path string, searchType SearchType) (*RespData[ObjectList], error)
func (*CloudreveClient) ShareUpdateShare ¶
func (c *CloudreveClient) ShareUpdateShare(req ShareUpdateReq) (*RespData[string], error)
func (*CloudreveClient) UploadFile ¶
func (c *CloudreveClient) UploadFile(req OneStepUploadFileReq) error
UploadFile 一键上传文件
func (*CloudreveClient) UploadPath ¶
func (c *CloudreveClient) UploadPath(req OneStepUploadPathReq) error
UploadPath 一键上传路径
func (*CloudreveClient) UserStorage ¶
func (c *CloudreveClient) UserStorage() (*RespData[Storage], error)
type CreateUploadSessionReq ¶
type CreateUploadSessionReq struct {
Path string `json:"path"`
Size uint64 `json:"size"`
Name string `json:"name" `
PolicyID string `json:"policy_id" `
LastModified int64 `json:"last_modified"`
MimeType string `json:"mime_type"`
}
CreateUploadSessionReq 获取上传凭证服务
type DownloadCallback ¶ added in v1.0.4
type DownloadCallback func(localPath, localFile string)
type ItemMoveReq ¶
type ItemMoveReq struct {
SrcDir string `json:"src_dir"`
Src Item `json:"src"`
Dst string `json:"dst" `
}
ItemMoveReq 处理多文件/目录移动
type ItemPropertyReq ¶
ItemPropertyReq 获取对象属性服务
type ItemRenameReq ¶
ItemRenameReq 处理多文件/目录重命名
type Object ¶
type Object struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Thumb bool `json:"thumb"`
Size uint64 `json:"size"`
Type string `json:"type"`
Date time.Time `json:"date"`
CreateDate time.Time `json:"create_date"`
Key string `json:"key,omitempty"`
SourceEnabled bool `json:"source_enabled"`
}
Object 文件或者目录
type ObjectList ¶
type ObjectList struct {
Parent string `json:"parent,omitempty"`
Objects []Object `json:"objects"`
Policy *PolicySummary `json:"policy,omitempty"`
}
ObjectList 文件、目录列表
type ObjectProps ¶
type ObjectProps struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Policy string `json:"policy"`
Size uint64 `json:"size"`
ChildFolderNum int `json:"child_folder_num"`
ChildFileNum int `json:"child_file_num"`
Path string `json:"path"`
QueryDate time.Time `json:"query_date"`
}
ObjectProps 文件、目录对象的详细属性信息
type OneDriveUploadReq ¶
type OneStepDownloadReq ¶ added in v1.0.4
type OneStepDownloadReq struct {
Remote string
LocalPath string
IsParallel bool
SegmentSize int64
DownloadCallback DownloadCallback
}
type OneStepUploadFileReq ¶
type OneStepUploadPathReq ¶
type PolicySummary ¶
type PolicySummary struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
MaxSize uint64 `json:"max_size"`
FileType []string `json:"file_type"`
}
PolicySummary 用于前端组件使用的存储策略概况
type ProgressReader ¶
type ProgressReader struct {
io.ReadCloser
// contains filtered or unexported fields
}
type RenameDealFunc ¶
type Resp ¶
type Resp struct {
Code int `json:"code"`
Msg string `json:"msg"`
Error string `json:"error,omitempty"`
}
Resp 基础序列化器
type RespData ¶
type RespData[T any] struct { Code int `json:"code"` Msg string `json:"msg"` Error string `json:"error,omitempty"` Data T `json:"data,omitempty"` }
RespData 基础序列化器
type SearchOrder ¶
type SearchOrder string
SearchOrder 排序
const ( DESC SearchOrder = "DESC" ASC SearchOrder = "ASC" )
查询类型枚举值
type SearchOrderBy ¶
type SearchOrderBy string
SearchOrderBy 排序
const ( CREATED_AT SearchOrderBy = "created_at" DOWNLOADS SearchOrderBy = "downloads" VIEWS SearchOrderBy = "views" )
查询类型枚举值
type SearchType ¶
type SearchType string
SearchType 查询类型
const ( KEYWORDS SearchType = "keywords" IMAGE SearchType = "image" VIDEO SearchType = "video" AUDIO SearchType = "audio" DOC SearchType = "doc" TAG SearchType = "tag" )
查询类型枚举值
type SessionRefresh ¶
type SessionRefresh func(session string)
type ShareCreator ¶
type ShareCreator struct {
}
type ShareSource ¶
type ShareSource struct {
}
type ShareUpdateReqProp ¶
type ShareUpdateReqProp string
定义枚举类型
const ( Password ShareUpdateReqProp = "password" PreviewEnabled ShareUpdateReqProp = "preview_enabled" )
定义枚举值
type SiteConfig ¶
type SiteConfig struct {
SiteName string `json:"title"`
LoginCaptcha bool `json:"loginCaptcha"`
RegCaptcha bool `json:"regCaptcha"`
ForgetCaptcha bool `json:"forgetCaptcha"`
EmailActive bool `json:"emailActive"`
Themes string `json:"themes"`
DefaultTheme string `json:"defaultTheme"`
HomepageViewMethod string `json:"home_view_method"`
Authn bool `json:"authn"`
User User `json:"user"`
ReCaptchaKey string `json:"captcha_ReCaptchaKey"`
CaptchaType string `json:"captcha_type"`
TCaptchaCaptchaAppId string `json:"tcaptcha_captcha_app_id"`
RegisterEnabled bool `json:"registerEnabled"`
AppPromotion bool `json:"app_promotion"`
WopiExts []string `json:"wopi_exts"`
}
type Sources ¶
type Sources struct {
URL string `json:"url"`
Name string `json:"name"`
Parent uint `json:"parent"`
Error string `json:"error,omitempty"`
}
Sources 获取外链的结果响应
type UploadCredential ¶
type UploadCredential struct {
SessionID string `json:"sessionID"`
ChunkSize uint64 `json:"chunkSize"` // 分块大小,0 为部分快
Expires int64 `json:"expires"` // 上传凭证过期时间, Unix 时间戳
UploadURLs []string `json:"uploadURLs,omitempty"`
Credential string `json:"credential,omitempty"`
UploadID string `json:"uploadID,omitempty"`
Callback string `json:"callback,omitempty"` // 回调地址
Path string `json:"path,omitempty"` // 存储路径
AccessKey string `json:"ak,omitempty"`
KeyTime string `json:"keyTime,omitempty"` // COS用有效期
Policy string `json:"policy,omitempty"`
CompleteURL string `json:"completeURL,omitempty"`
}
UploadCredential 返回给客户端的上传凭证
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"user_name"`
Nickname string `json:"nickname"`
Status int `json:"status"`
Avatar string `json:"avatar"`
CreatedAt time.Time `json:"created_at"`
PreferredTheme string `json:"preferred_theme"`
Anonymous bool `json:"anonymous"`
Group group `json:"group"`
Tags []Tag `json:"tags"`
}
User 用户序列化器
Click to show internal directories.
Click to hide internal directories.