Versions in this module Expand all Collapse all v1 v1.1.1 Jul 25, 2026 v1.1.0 Jul 25, 2026 Changes in this version type Client + func (c *Client) TokenInfo() (token string, expiredAt time.Time) v1.0.0 Jul 25, 2026 Changes in this version + const AuthBaseURL + const DefaultBaseURL + const OAuthScope + func IsRateLimited(err error) bool + func IsTokenExpired(err error) bool + func ShareURL(uid int64, shareKey string) string + type APIError struct + Code int + Message string + TraceID string + func (e *APIError) Error() string + type AccessTokenResult struct + AccessToken string + ExpiredAt time.Time + type BatchRenameResult struct + FailList []struct{ ... } + SuccessList []struct{ ... } + type Client struct + File *FileService + Link *LinkService + OAuth *OAuthService + Offline *OfflineService + Oss *OssService + Share *ShareService + Transcode *TranscodeService + Upload *UploadService + User *UserService + func New(clientID, clientSecret string, opts ...Option) *Client + func NewWithToken(accessToken string, opts ...Option) *Client + func (c *Client) RefreshToken(ctx context.Context) (*AccessTokenResult, error) + func (c *Client) SetToken(token string, expiredAt time.Time) + func (c *Client) Token() string + type CopyResult struct + SourceFileID int64 + TargetFileID int64 + type CopyTaskStatus int + const CopyTaskDone + const CopyTaskFailed + const CopyTaskPending + const CopyTaskRunning + type DeleteMode int + const DeleteOriginal + const DeleteOriginalAndTranscoded + type DeveloperInfo struct + EndTime string + StartTime string + type DownloadAllResult struct + DownloadURL string + IsDownloading bool + IsFull bool + type FileDetail struct + CreateAt string + Etag string + FileID int64 + Filename string + ParentFileID int64 + Size int64 + Status int + Trashed int + Type int + type FileInfo struct + Category int + CreateAt string + Etag string + FileID int64 + Filename string + ParentFileID int64 + PunishFlag int + S3KeyFlag string + Size int64 + Status int + StorageNode string + Trashed int + Type int + UpdateAt string + type FileInfoV1 struct + Category int + CreateAt string + DownloadURL string + Etag string + FileID int64 + Filename string + ParentFileID int64 + ParentName string + Size int64 + Status int + Thumbnail string + Type int + UpdateAt string + type FileListRequest struct + LastFileID int64 + Limit int + ParentFileID int64 + SearchData string + SearchMode int + type FileListResult struct + FileList []FileInfo + LastFileID int64 + type FileListV1Request struct + Limit int + OrderBy string + OrderDirection string + Page int + ParentFileID int64 + SearchData string + Trashed bool + type FileListV1Result struct + FileList []FileInfoV1 + Total int + type FileService struct + func (s *FileService) AsyncCopy(ctx context.Context, fileIDs []int64, targetDirID int64) (taskID int64, err error) + func (s *FileService) BatchRename(ctx context.Context, renames map[int64]string) (*BatchRenameResult, error) + func (s *FileService) Copy(ctx context.Context, fileID, targetDirID int64) (*CopyResult, error) + func (s *FileService) CopyProcess(ctx context.Context, taskID int64) (CopyTaskStatus, error) + func (s *FileService) Detail(ctx context.Context, fileID int64) (*FileDetail, error) + func (s *FileService) DownloadInfo(ctx context.Context, fileID int64) (string, error) + func (s *FileService) DownloadTo(ctx context.Context, fileID int64, w io.Writer) (int64, error) + func (s *FileService) Infos(ctx context.Context, fileIDs []int64) ([]FileInfo, error) + func (s *FileService) List(ctx context.Context, req *FileListRequest) (*FileListResult, error) + func (s *FileService) ListAll(ctx context.Context, parentFileID int64) ([]FileInfo, error) + func (s *FileService) ListV1(ctx context.Context, req *FileListV1Request) (*FileListV1Result, error) + func (s *FileService) Mkdir(ctx context.Context, parentID int64, name string) (int64, error) + func (s *FileService) Move(ctx context.Context, fileIDs []int64, toParentFileID int64) error + func (s *FileService) Recover(ctx context.Context, fileIDs []int64) (abnormalFileIDs []int64, err error) + func (s *FileService) RecoverTo(ctx context.Context, fileIDs []int64, parentFileID int64) error + func (s *FileService) Rename(ctx context.Context, fileID int64, newName string) error + func (s *FileService) SafeboxID(ctx context.Context, password string) (int64, error) + func (s *FileService) Trash(ctx context.Context, fileIDs []int64) error + type IPBlacklistStatus int + const IPBlacklistDisabled + const IPBlacklistEnabled + type LinkService struct + func (s *LinkService) Disable(ctx context.Context, folderID int64) (string, error) + func (s *LinkService) Enable(ctx context.Context, folderID int64) (string, error) + func (s *LinkService) IPBlacklist(ctx context.Context) (ips []string, status IPBlacklistStatus, err error) + func (s *LinkService) OfflineLogs(ctx context.Context, pageNum, pageSize int, startHour, endHour string) (*OfflineLogResult, error) + func (s *LinkService) RefreshCache(ctx context.Context) error + func (s *LinkService) SwitchIPBlacklist(ctx context.Context, status IPBlacklistStatus) (bool, error) + func (s *LinkService) TrafficLog(ctx context.Context, pageNum, pageSize int, startTime, endTime string) (*TrafficLogResult, error) + func (s *LinkService) URL(ctx context.Context, fileID int64) (string, error) + func (s *LinkService) UpdateIPBlacklist(ctx context.Context, ips []string) error + type OAuthService struct + func (s *OAuthService) AuthURL(clientID, redirectURI, state string) string + func (s *OAuthService) RefreshToken(ctx context.Context, clientID, clientSecret, refreshToken string) (*OAuthToken, error) + func (s *OAuthService) TokenByCode(ctx context.Context, clientID, clientSecret, code, redirectURI string) (*OAuthToken, error) + type OAuthToken struct + AccessToken string + ExpiresIn int64 + RefreshToken string + Scope string + TokenType string + type OfflineDownloadRequest struct + CallBackURL string + DirID int64 + FileName string + URL string + type OfflineLogEntry struct + DownloadURL string + FileName string + FileSize int64 + ID any + LogTimeRange string + type OfflineLogResult struct + List []OfflineLogEntry + Total int64 + type OfflineProcessResult struct + Process float64 + Status OfflineStatus + type OfflineService struct + func (s *OfflineService) Download(ctx context.Context, req *OfflineDownloadRequest) (taskID int64, err error) + func (s *OfflineService) Process(ctx context.Context, taskID int64) (*OfflineProcessResult, error) + type OfflineStatus int + const OfflineFailed + const OfflineRetrying + const OfflineRunning + const OfflineSuccess + type Option func(*Client) + func WithBaseURL(u string) Option + func WithHTTPClient(hc *http.Client) Option + func WithMaxRetries(n int) Option + func WithUserAgent(ua string) Option + func WithoutRateLimit() Option + type OssAsyncResult struct + Completed bool + FileID string + type OssCopyFailResult struct + List []struct{ ... } + Total int64 + type OssCopyStatus int + const OssCopyDone + const OssCopyFailed + const OssCopyRunning + const OssCopyWaiting + type OssCreateResult struct + FileID string + PreuploadID string + Reuse bool + SliceSize int64 + type OssFile struct + CreateAt string + DownloadURL string + Etag string + Extension string + FileID string + Filename string + ParentFileID string + ParentFilename string + Size int64 + Status int + TotalTraffic int64 + Type int + UpdateAt string + UserSelfURL string + type OssListRequest struct + EndTime int64 + LastFileID string + Limit int + ParentFileID string + StartTime int64 + type OssListResult struct + FileList []OssFile + LastFileID string + type OssService struct + func (s *OssService) CopyFailList(ctx context.Context, taskID string, page, limit int) (*OssCopyFailResult, error) + func (s *OssService) CopyFromDisk(ctx context.Context, fileIDs []int64, toParentFileID string) (taskID string, err error) + func (s *OssService) CopyProcess(ctx context.Context, taskID string) (OssCopyStatus, string, error) + func (s *OssService) CreateFile(ctx context.Context, parentFileID, filename, etag string, size int64) (*OssCreateResult, error) + func (s *OssService) Delete(ctx context.Context, fileIDs []string) error + func (s *OssService) Detail(ctx context.Context, fileID string) (*OssFile, error) + func (s *OssService) GetUploadURL(ctx context.Context, preuploadID string, sliceNo int64) (string, error) + func (s *OssService) List(ctx context.Context, req *OssListRequest) (*OssListResult, error) + func (s *OssService) Mkdir(ctx context.Context, parentID, name string) (string, error) + func (s *OssService) Move(ctx context.Context, fileIDs []string, toParentFileID string) error + func (s *OssService) OfflineDownload(ctx context.Context, req *OfflineDownloadRequest) (taskID int64, err error) + func (s *OssService) OfflineProcess(ctx context.Context, taskID int64) (*OfflineProcessResult, error) + func (s *OssService) UploadAsyncResult(ctx context.Context, preuploadID string) (*OssAsyncResult, error) + func (s *OssService) UploadComplete(ctx context.Context, preuploadID string) (*OssUploadCompleteResult, error) + func (s *OssService) UploadFile(ctx context.Context, parentFileID, filename string, r io.ReaderAt, size int64) (string, error) + func (s *OssService) UploadFromPath(ctx context.Context, parentFileID, path string) (string, error) + type OssUploadCompleteResult struct + Async bool + Completed bool + FileID string + type PaidShareCreateRequest struct + FileIDs []int64 + IsReward int + PayAmount int + ResourceDesc string + ShareName string + TrafficLimit int64 + TrafficLimitSwitch int + TrafficSwitch TrafficSwitch + type ResolutionsResult struct + CodecNames string + IsGetResolution bool + NowOrFinishedResolutions string + Resolutions string + VideoTime int64 + type Sha1ReuseResult struct + FileID int64 + Reuse bool + type ShareCreateRequest struct + FileIDs []int64 + ShareExpire int + ShareName string + SharePwd string + TrafficLimit int64 + TrafficLimitSwitch int + TrafficSwitch TrafficSwitch + type ShareCreateResult struct + ShareID int64 + ShareKey string + type ShareInfo struct + Amount float64 + BytesCharge int64 + DownloadCount int64 + Expiration string + Expired int + OrderCnt int64 + PayAmount float64 + PreviewCount int64 + SaveCount int64 + ShareID int64 + ShareKey string + ShareName string + SharePwd string + TrafficLimit int64 + TrafficLimitSwitch int + TrafficSwitch int + type ShareListResult struct + LastShareID int64 + ShareList []ShareInfo + type ShareService struct + func (s *ShareService) Create(ctx context.Context, req *ShareCreateRequest) (*ShareCreateResult, error) + func (s *ShareService) CreatePaid(ctx context.Context, req *PaidShareCreateRequest) (*ShareCreateResult, error) + func (s *ShareService) List(ctx context.Context, limit int, lastShareID int64) (*ShareListResult, error) + func (s *ShareService) ListPaid(ctx context.Context, limit int, lastShareID int64) (*ShareListResult, error) + func (s *ShareService) Update(ctx context.Context, req *ShareUpdateRequest) error + func (s *ShareService) UpdatePaid(ctx context.Context, req *ShareUpdateRequest) error + type ShareUpdateRequest struct + ShareIDs []int64 + TrafficLimit int64 + TrafficLimitSwitch int + TrafficSwitch TrafficSwitch + type SingleCreateResult struct + Completed bool + FileID int64 + type TrafficLogEntry struct + DirectLinkURL string + FileName string + FilePath string + FileSize int64 + FileSource int + TotalTraffic int64 + UniqueID string + type TrafficLogResult struct + List []TrafficLogEntry + Total int64 + type TrafficSwitch int + type TranscodeDownloadResult struct + DownloadURL string + IsFull bool + type TranscodeFile struct + CreateAt string + FileName string + FileSize string + Resolution string + URL string + type TranscodeRecord struct + CreateAt string + Link string + Resolution string + Status int + type TranscodeRequest struct + CodecName string + FileID int64 + Resolutions string + VideoTime int64 + type TranscodeResult struct + Files []TranscodeFile + Resolution string + Status int + UID int64 + type TranscodeService struct + func (s *TranscodeService) CloudVideoFiles(ctx context.Context, req *FileListRequest) (*FileListResult, error) + func (s *TranscodeService) Delete(ctx context.Context, fileID int64, mode DeleteMode) error + func (s *TranscodeService) DownloadAll(ctx context.Context, fileID int64, zipName string) (*DownloadAllResult, error) + func (s *TranscodeService) DownloadM3U8(ctx context.Context, fileID int64, resolution string) (*TranscodeDownloadResult, error) + func (s *TranscodeService) DownloadOriginal(ctx context.Context, fileID int64) (*TranscodeDownloadResult, error) + func (s *TranscodeService) DownloadTS(ctx context.Context, fileID int64, resolution, tsName string) (*TranscodeDownloadResult, error) + func (s *TranscodeService) FolderInfo(ctx context.Context) (int64, error) + func (s *TranscodeService) List(ctx context.Context, fileID int64) (*VideoTranscodeList, error) + func (s *TranscodeService) Records(ctx context.Context, fileID int64) ([]TranscodeRecord, error) + func (s *TranscodeService) Resolutions(ctx context.Context, fileID int64) (*ResolutionsResult, error) + func (s *TranscodeService) Results(ctx context.Context, fileID int64) ([]TranscodeResult, error) + func (s *TranscodeService) SpaceFiles(ctx context.Context, req *FileListRequest) (*FileListResult, error) + func (s *TranscodeService) Transcode(ctx context.Context, req *TranscodeRequest) error + func (s *TranscodeService) UploadFromCloudDisk(ctx context.Context, fileIDs []int64) error + type UploadCompleteResult struct + Completed bool + FileID int64 + type UploadCompleteResultV1 struct + Async bool + Completed bool + FileID int64 + type UploadCreateRequest struct + ContainDir bool + Duplicate int + Etag string + Filename string + ParentFileID int64 + Size int64 + type UploadCreateResult struct + FileID int64 + PreuploadID string + Reuse bool + Servers []string + SliceSize int64 + type UploadCreateResultV1 struct + FileID int64 + PreuploadID string + Reuse bool + SliceSize int64 + type UploadService struct + func (s *UploadService) AsyncResultV1(ctx context.Context, preuploadID string) (*UploadCompleteResult, error) + func (s *UploadService) Complete(ctx context.Context, preuploadID string) (*UploadCompleteResult, error) + func (s *UploadService) CompleteV1(ctx context.Context, preuploadID string) (*UploadCompleteResultV1, error) + func (s *UploadService) Create(ctx context.Context, req *UploadCreateRequest) (*UploadCreateResult, error) + func (s *UploadService) CreateV1(ctx context.Context, req *UploadCreateRequest) (*UploadCreateResultV1, error) + func (s *UploadService) Domains(ctx context.Context) ([]string, error) + func (s *UploadService) GetUploadURLV1(ctx context.Context, preuploadID string, sliceNo int64) (string, error) + func (s *UploadService) ListUploadPartsV1(ctx context.Context, preuploadID string) ([]UploadedPart, error) + func (s *UploadService) PutSliceV1(ctx context.Context, presignedURL string, slice io.Reader, size int64) error + func (s *UploadService) Sha1Reuse(ctx context.Context, parentFileID int64, filename, sha1 string, size int64, ...) (*Sha1ReuseResult, error) + func (s *UploadService) SingleCreate(ctx context.Context, server string, req *UploadCreateRequest, file io.Reader) (*SingleCreateResult, error) + func (s *UploadService) UploadFile(ctx context.Context, parentFileID int64, filename string, r io.ReaderAt, ...) (int64, error) + func (s *UploadService) UploadFromPath(ctx context.Context, parentFileID int64, path string) (int64, error) + func (s *UploadService) UploadSlice(ctx context.Context, server, preuploadID string, sliceNo int64, ...) error + type UploadedPart struct + Etag string + PartNumber json.Number + Size int64 + type UserInfo struct + DeveloperInfo *DeveloperInfo + DirectTraffic int64 + HTTPSCount int + HeadImage string + IsHideUID bool + Mail string + Nickname string + Passport string + SpacePermanent int64 + SpaceTemp int64 + SpaceTempExpr json.RawMessage + SpaceUsed int64 + UID int64 + Vip bool + VipInfoList []VipInfo + type UserService struct + func (s *UserService) Info(ctx context.Context) (*UserInfo, error) + type VideoTranscodeItem struct + BitRate int64 + Duration float64 + Height int + MC string + Progress int + Resolution string + Status int + URL string + UpdateAt string + type VideoTranscodeList struct + List []VideoTranscodeItem + Status int + type VipInfo struct + EndTime string + StartTime string + VipLabel string + VipLevel int