Versions in this module Expand all Collapse all v0 v0.3.3 Jun 5, 2023 Changes in this version type UploadTasker + func (u *UploadTasker) GetExistFileMap() (map[string]FileInfoDto, error) v0.3.2 Jun 1, 2023 Changes in this version + func GetFileBytes(fsid uint64) ([]byte, error) v0.3.1 May 29, 2023 Changes in this version + const AsyncAsync + const AsyncSelfAdaptation + const AsyncSync + const DefaultUploadDir + const EnvDownloadDir + const FRAGMENT_MAX_SIZE + const OndupFail + const OndupNewCopy + const OndupOverwrite + const OndupSkip + const OperaCopy + const OperaDelete + const OperaMove + var DefaultDownloadDir = homedir.Expand("~/Downloads") + var ErrAccessFail error = errors.New("身份验证失败") + var ErrAccessTokenFail error = errors.New("access token 失效") + var ErrApiFrequent error = errors.New("接口请求过于频繁,注意控制") + var ErrParamError error = errors.New("参数错误") + var ErrPathExists error = errors.New("文件已存在") + var ErrPathNotFound error = errors.New("文件或目录不存在") + var ErrUserNoUse error = errors.New("不允许接入用户数据") + var Log *logrus.Logger + var PwdDir = os.Getwd() + func AddCredentail(c Credential) error + func CleanCache() error + func CopyFile(path, toPath string) error + func CreateAccessTokenByDeviceCode() error + func DeleteFile(path string) error + func DeleteSyncModel(id string) error + func Do2HTTPRequest(url string, body io.Reader, headers map[string]string) (string, int, error) + func Do2HTTPRequestToBytes(url string, body io.Reader, headers map[string]string) ([]byte, int, error) + func GetClient() *sdk.APIClient + func GetDefaultDownloadDir() string + func GetFileDLink(fsid uint64) (string, error) + func GetKey() ([]byte, error) + func GetLogger() *logrus.Logger + func GetModels() (m map[string]*SyncModel) + func GetUriBytes(uri string, rangeStart, rangeEnd int) ([]byte, error) + func IsLoggerDebug() bool + func JoinCache(elem ...string) string + func JoinDownload(elem ...string) string + func JoinStoage(elem ...string) string + func LogInfoString(w io.Writer, s string) + func MoveFile(path, toPath string) error + func NewRespError(r *http.Response) error + func PanInfo() (*openapi.Quotaresponse, error) + func PrintFileInfoList(files []*FileInfoDto) + func PrintSyncModelList() + func PromptConfirm(confirm string) bool + func PromptSelect(label string, actions []*SelectItem, hasSearch bool, limit int, ...) (err error) + func RefreshAccessToken() error + func SaveModels(m map[string]*SyncModel) error + func ScheRefreshAccessToken() error + func SetLogLevel(level logrus.Level) + func SetOutputFile() + func SplitFile(path, tmpdir string, fragmentSize int64) ([]string, error) + func TaskUploadDir(from, to string, isSync bool, isRecursion bool, isIncludeHide bool) error + func WalkDir(dir string, isRecursion bool, fn func(file *FileInfoDto) error) error + type AccessToken struct + AccessToken string + ExpiresIn int32 + RefreshTimestamp int64 + RefreshToken string + func GetConfigAccessToken() (*AccessToken, error) + func (t AccessToken) Print() + type Config struct + LoginAppId string + func GetConfig() (*Config, error) + func NewConfig(loginAppId string) *Config + type Credential struct + AppId string + AppKey string + SecretKey string + SignKey string + func GetConfigCredentail() (*Credential, error) + func GetCredentail(appId string) (*Credential, error) + func GetCredentails() ([]*Credential, error) + func (c *Credential) GetAccessToken() (*AccessToken, error) + type DownloadTaskInfo struct + From string + FromFile *FileInfoDto + To string + type DownloadTasker struct + Dir string + From string + FromFile *FileInfoDto + Froms []string + IsRecursion bool + IsSync bool + Path string + func NewDownloadTasker(file *FileInfoDto) *DownloadTasker + func (d *DownloadTasker) BuildTasks() error + func (d DownloadTasker) RunTask(task *tasker.Task) error + func (m *DownloadTasker) AfterRun() error + func (m *DownloadTasker) BeforeRun() error + func (m *DownloadTasker) Build() error + func (m *DownloadTasker) Exec() error + type Downloader struct + Dir string + DisableLog bool + IsNotCover bool + Out io.Writer + Path string + UseProgressBar bool + func NewDownloader() *Downloader + func (d *Downloader) DownloadFile(file *FileInfoDto) error + func (d *Downloader) DownloadFileWithPath(file *FileInfoDto, path string) error + func (d *Downloader) EnableVerbose() *Downloader + func (d *Downloader) Exec() error + func (d *Downloader) SetPath(path string) *Downloader + type ErrorResponse struct + Errno int32 + Erro string + ErrorCode int + ErrorDescription string + ErrorMsg string + func NewErrorResponse(r *http.Response) *ErrorResponse + func (e ErrorResponse) Err() error + func (e ErrorResponse) Error() string + func (e ErrorResponse) IsError() bool + func (e ErrorResponse) Print() + type FileInfoDto struct + Category int + Dlink string + FSID uint64 + FileType int + Filename string + LocalCTime int64 + LocalMTime int64 + MD5 string + Path string + ServerCTime int64 + ServerFilename string + ServerMTime int64 + Size int + Thumbs map[string]string + func GetDirAllFiles(dir string) ([]*FileInfoDto, error) + func GetFileByFSID(fsid uint64) (*FileInfoDto, error) + func GetFileByPath(path string) (*FileInfoDto, error) + func GetFilesByFSIDS(fsids []uint64) ([]*FileInfoDto, error) + func SearchFiles(dir, key string) ([]*FileInfoDto, error) + func UploadFile(fromPath, toPath string) (*FileInfoDto, error) + func (f FileInfoDto) BuildPretty() []pretty.Field + func (f FileInfoDto) GetCategory() string + func (f FileInfoDto) GetFileType() string + func (f FileInfoDto) GetFileTypeEmoji() string + func (f FileInfoDto) GetFileTypeIcon() string + func (f FileInfoDto) GetFilename() string + func (f FileInfoDto) GetLocalCTime() string + func (f FileInfoDto) GetLocalMTime() string + func (f FileInfoDto) GetPretty() string + func (f FileInfoDto) GetServerCTime() string + func (f FileInfoDto) GetServerMTime() string + func (f FileInfoDto) GetSize() string + func (f FileInfoDto) IsDir() bool + func (f FileInfoDto) PrettyPrint() + type FileInfoRequest struct + func NewFileInfoRequest(fsids []uint64) FileInfoRequest + func (r FileInfoRequest) Execute() (*FileListResponse, error) + func (r FileInfoRequest) FSID(fsid uint64) FileInfoRequest + func (r FileInfoRequest) FSIDs(fsids []uint64) FileInfoRequest + func (r FileInfoRequest) GetDlink() string + func (r FileInfoRequest) GetFSID() string + type FileListAllRequest struct + func NewFileListAllRequest(path string) FileListAllRequest + func (f FileListAllRequest) Desc(r int32) FileListAllRequest + func (f FileListAllRequest) Limit(r int32) FileListAllRequest + func (f FileListAllRequest) Order(order string) FileListAllRequest + func (f FileListAllRequest) Path(path string) FileListAllRequest + func (f FileListAllRequest) Recursion(r int32) FileListAllRequest + func (f FileListAllRequest) Start(r int32) FileListAllRequest + func (r FileListAllRequest) Execute() (*FileListAllResponse, error) + func (r FileListAllRequest) GetWeb() string + func (r FileListAllRequest) Web(web int) FileListAllRequest + type FileListAllResponse struct + Cursor int + Errmsg string + Errno int32 + HasMore int + List []*FileInfoDto + type FileListRequest struct + func NewFileListRequest() FileListRequest + func (r FileListRequest) Desc(d int32) FileListRequest + func (r FileListRequest) Dir(dir string) FileListRequest + func (r FileListRequest) Execute() (*FileListResponse, error) + func (r FileListRequest) GetStart() string + func (r FileListRequest) GetWeb() string + func (r FileListRequest) Limit(l int32) FileListRequest + func (r FileListRequest) Order(s string) FileListRequest + func (r FileListRequest) Page(page int) FileListRequest + func (r FileListRequest) Web(web int) FileListRequest + type FileListResponse struct + Errmsg string + GuidInfo string + List []*FileInfoDto + func NewFileListResponse(r *http.Response) (*FileListResponse, error) + func (f FileListResponse) Print() + type FileManageOpera int + type FileManagerFile struct + Dest string + Newname string + Ondup string + Path string + func NewFileManagerFile(path, dest, newname, ondup string) *FileManagerFile + type FileManagerInfo struct + Path string + type FileManagerRequest struct + Async int32 + Filelist []*FileManagerFile + Ondup string + Opera FileManageOpera + func NewFileManagerRequest(opera FileManageOpera, filelist []*FileManagerFile) *FileManagerRequest + func (f *FileManagerRequest) SetOndup(ondup string) *FileManagerRequest + func (fm FileManagerRequest) Execute() (*FileManagerResponse, error) + func (fm FileManagerRequest) GetFilelistString() string + type FileManagerResponse struct + Info []FileManagerInfo + RequestId int64 + Taskid int64 + type FileSearchRequest struct + func NewFileSearchRequest(key string) FileSearchRequest + func (f FileSearchRequest) GetRecursion() string + func (f FileSearchRequest) Recursion(r int) FileSearchRequest + func (r FileSearchRequest) Dir(dir string) FileSearchRequest + func (r FileSearchRequest) Execute() (*FileListResponse, error) + type IResponse interface + Err func() error + IsError func() bool + type Icon struct + Color string + Icon string + Name string + func GetDefaultFileIcon() Icon + func GetIconByExt(ext string) (Icon, bool) + func GetIconByPath(path string) (Icon, bool) + type LogFormatter struct + func (f *LogFormatter) Format(entry *logrus.Entry) ([]byte, error) + type Response struct + type SelectAction int + const ActionBack + const ActionDelete + const ActionSystem + type SelectFunc func(index int, s string) error + type SelectItem struct + Action SelectAction + Desc string + Icon string + Info interface{} + Name string + type SyncMode int + const ModeBackup + const ModeSync + type SyncModel struct + CreateTime time.Time + HasHide bool + Hash string + ID string + LastSyncTime time.Time + Local string + Mode SyncMode + Remote string + func MustGetModel(id string) (m *SyncModel) + func NewSyncModel(local, remote string, mode SyncMode) *SyncModel + func (s *SyncModel) Backup() error + func (s *SyncModel) Exec() error + func (s SyncModel) BuildPretty() []pretty.Field + func (s SyncModel) Desc() string + func (s SyncModel) GetCreateTime() string + func (s SyncModel) GetLastSyncTime() string + func (s SyncModel) GetMode() string + func (s SyncModel) IsBackup() bool + type SyncModelSlice []*SyncModel + func (s SyncModelSlice) GetWriter() io.Writer + func (s SyncModelSlice) Len() int + func (s SyncModelSlice) Less(i, j int) bool + func (s SyncModelSlice) List() []pretty.Pretty + func (s SyncModelSlice) Swap(i, j int) + type UFTaskInfo struct + From string + Index int + To string + type UploadFileRequest struct + func NewUploadFileRequest(fromPath, toPath string) *UploadFileRequest + func (r *UploadFileRequest) IsSync(s bool) *UploadFileRequest + func (r *UploadFileRequest) RType(t int32) *UploadFileRequest + func (r UploadFileRequest) Execute() (*UploadFileResponse, error) + func (r UploadFileRequest) FromPath(path string) UploadFileRequest + func (r UploadFileRequest) GetPartseq() string + func (r UploadFileRequest) ToPath(path string) UploadFileRequest + func (r UploadFileRequest) Type(typ string) UploadFileRequest + type UploadFileResponse struct + type UploadFragmentTasker struct + Fragments []string + IsSync bool + Request *UploadFileRequest + TmpDir string + To string + Token *AccessToken + UploadId string + func (u *UploadFragmentTasker) AfterRun() error + func (u *UploadFragmentTasker) BeforeRun() error + func (u *UploadFragmentTasker) Build() error + func (u *UploadFragmentTasker) BuildTasks() error + func (u *UploadFragmentTasker) Exec() error + func (u UploadFragmentTasker) RunTask(task *tasker.Task) error + type UploadTaskInfo struct + From string + To string + type UploadTasker struct + From string + IsIncludeHide bool + IsRecursion bool + IsSync bool + To string + func NewUploadDirTasker(from, to string) (*UploadTasker, error) + func NewUploadTasker(from, to string) *UploadTasker + func (m *UploadTasker) AfterRun() error + func (m *UploadTasker) BuildTasks() error + func (m UploadTasker) RunTask(task *tasker.Task) error + func (u *UploadTasker) BeforeRun() error + func (u *UploadTasker) Exec() error + func (u *UploadTasker) SetRegexp(pattern string) *UploadTasker + type UserInfoDto struct + func UserInfo() (*UserInfoDto, error) + func (u UserInfoDto) GetVipName() string