Versions in this module Expand all Collapse all v0 v0.0.1 Dec 5, 2024 Changes in this version + const ApiAddOfflineUrl + const ApiClearOfflineUrl + const ApiDelOfflineUrl + const ApiDirAdd + const ApiDownloadGetShareUrl + const ApiDownloadGetUrl + const ApiFileCopy + const ApiFileDelete + const ApiFileInfo + const ApiFileList + const ApiFileListByName + const ApiFileMove + const ApiFileRename + const ApiFileStat + const ApiGetUploadEndpoint + const ApiGetVersion + const ApiListOfflineUrl + const ApiLoginCheck + const ApiQrcodeImage + const ApiQrcodeLogin + const ApiQrcodeLoginWithApp + const ApiQrcodeStatus + const ApiQrcodeToken + const ApiRecycleClean + const ApiRecycleList + const ApiRecycleRevert + const ApiShareSnap + const ApiUploadInfo + const ApiUploadInit + const ApiUploadOSSToken + const ApiUserInfo + const CookieDomain115 + const CookieNameCid + const CookieNameSeid + const CookieNameUid + const CookieNamekid + const CookieUrl + const FileListLimit + const FileOrderByName + const FileOrderBySize + const FileOrderByTime + const FileOrderByType + const GB + const KB + const MB + const MaxDirPageLimit + const OSSEndpoint + const OSSRegionID + const OSSUserAgent + const OssSecurityTokenHeaderName + const UA115Browser + const UA115Desktop + const UA115Disk + const UADefalut + const UAIosApp + var ErrAccountNotBindMobile = errors.New("account not binds mobile") + var ErrBadCookie = errors.New("bad cookie") + var ErrCredentialInvalid = errors.New("credential invalid") + var ErrCyclicCopy = errors.New("cyclic copy") + var ErrCyclicMove = errors.New("cyclic move") + var ErrDoesLoggedOut = errors.New("you have been kicked out by multi-device login management") + var ErrDownloadDirectory = errors.New("can not download directory") + var ErrDownloadEmpty = errors.New("can not get download URL") + var ErrDownloadFileNotExistOrHasDeleted = errors.New("target file does not exist or has deleted") + var ErrDownloadFileTooBig = errors.New("target file is too big to download") + var ErrExist = errors.New("target already exists") + var ErrFailedToLogin = errors.New("failed to login") + var ErrImportDirectory = errors.New("can not import directory") + var ErrInvalidCursor = errors.New("invalid cursor") + var ErrLoginTwoStepVerify = errors.New("requires two-step verification") + var ErrNotExist = errors.New("target does not exist") + var ErrNotLogin = errors.New("user not login") + var ErrOfflineInvalidLink = errors.New("invalid download link") + var ErrOfflineNoTimes = errors.New(...) + var ErrOfflineTaskExisted = errors.New("offline task existed") + var ErrOrderNotSupport = errors.New("file order not supported") + var ErrPasswordIncorrect = errors.New("password incorrect") + var ErrPickCodeIsEmpty = errors.New("empty pickcode") + var ErrPickCodeNotExist = errors.New("pickcode does not exist") + var ErrQrcodeExpired = errors.New("qrcode expired") + var ErrRepeatLogin = errors.New("repeat login") + var ErrSessionExited = errors.New("session exited") + var ErrSharedInvalid = errors.New("shared link invalid") + var ErrSharedNotFound = errors.New("shared link not found") + var ErrUnexpected = errors.New("unexpected error") + var ErrUploadFailed = errors.New("upload failed") + var ErrUploadSH1Invalid = errors.New("userid/filesize/target/pickcode/ invalid") + var ErrUploadSigInvalid = errors.New("sig invalid") + var ErrUploadTooLarge = errors.New("upload reach the limit") + var ErrVideoNotReady = errors.New("video is not ready") + var ErrWrongParams = errors.New("wrong parameters") + var LabelColorMap = map[string]int + var LabelColors = []string + func BoolToInt(b bool) int + func CheckErr(err error, result ResultWithErr, restyResp *resty.Response) error + func Date() string + func GetErr(code int, respBody ...string) error + func OssOption(params *UploadOSSParams, ossToken *UploadOSSTokenResp) []oss.Option + func SplitFile(filePath string, fileSize int64) (chunks []oss.FileChunk, err error) + type AppVersion struct + AppName string + Version string + type BasicResp struct + ErrNo int + Errno StringInt + Error string + Errtype string + Msg string + State bool + func (resp *BasicResp) Err(respBody ...string) error + type BoolInt int + func (v *BoolInt) UnmarshalJSON(b []byte) (err error) + type Credential struct + CID string + KID string + SEID string + UID string + func (cr *Credential) FromCookie(cookie string) error + type DataString string + func (v *DataString) UnmarshalJSON(b []byte) (err error) + type DirInfo struct + ID string + Name string + type DownloadData map[string]*DownloadInfo + type DownloadInfo struct + FileName string + FileSize StringInt64 + Header http.Header + PickCode string + Url FileDownloadUrl + func (info *DownloadInfo) Get() (io.ReadSeeker, error) + type DownloadResp struct + EncodedData DataString + type File struct + CreateTime time.Time + FileID string + IsDirectory bool + Labels []*Label + Name string + ParentID string + PickCode string + Sha1 string + Size int64 + Star bool + UpdateTime time.Time + func (f *File) From(fileInfo *FileInfo) *File + func (f File) GetID() string + func (f File) GetName() string + func (f File) GetPath() string + func (f File) GetSize() int64 + func (f File) IsDir() bool + func (f File) ModTime() time.Time + type FileDownloadUrl struct + Client float64 + OSSID string + Url string + type FileInfo struct + AreaID IntString + CategoryID IntString + CreateTime StringInt64 + FileID string + IsStar StringInt + Labels []*LabelInfo + Name string + ParentID string + PickCode string + Sha1 string + Size StringInt64 + Type string + UpdateTime string + type FileListResp struct + AreaID string + CategoryID IntString + Count int + Files []FileInfo + IsAsc int + Limit int + Offset int + Order string + PageSize int + func GetFiles(req *resty.Request, dirID string, opts ...GetFileOptions) (*FileListResp, error) + type FileParentInfo struct + FileID int + FileName string + type FileStatInfo struct + CreateTime time.Time + DirCount int + FileCount int + IsDirectory bool + Name string + Parents []*DirInfo + PickCode string + Sha1 string + UpdateTime time.Time + type FileStatResponse struct + CreateTime StringInt64 + FileCount StringInt + FileName string + FolderCount StringInt + IsFile StringInt + IsMark StringInt + IsShare StringInt + OpenTime int64 + Paths []*FileParentInfo + PickCode string + Sha1 string + Size string + UpdateTime StringInt64 + func (r *FileStatResponse) Err(respBody ...string) error + type GetFileInfoResponse struct + Files []*FileInfo + type GetFileOption struct + func DefaultGetFileOptions() *GetFileOption + func (o *GetFileOption) GetAsc() string + func (o *GetFileOption) GetOffset() string + func (o *GetFileOption) GetOrder() string + func (o *GetFileOption) GetPageSize() string + func (o *GetFileOption) GetshowDir() string + type GetFileOptions func(o *GetFileOption) + func WithAsc(d bool) GetFileOptions + func WithLimit(pageSize int64) GetFileOptions + func WithOffset(offset int64) GetFileOptions + func WithOrder(order string) GetFileOptions + func WithShowDirEnable(e bool) GetFileOptions + type IntString string + func (v *IntString) UnmarshalJSON(b []byte) (err error) + type Label struct + Color LabelColor + ID string + Name string + type LabelColor int + type LabelInfo struct + Color string + CreateTime int64 + ID string + Name string + Sort StringInt + UpdateTime int64 + type LoginApp string + const LoginAppAlipayMini + const LoginAppAndroid + const LoginAppIOS + const LoginAppTV + const LoginAppWeb + const LoginAppWechatMini + const LoginQAppAndroid + type LoginResp struct + CheckSsd bool + Code int + Data struct{ ... } + Errno int + Error string + Expire int + Message string + State int + func (resp *LoginResp) Err(respBody ...string) error + type MkdirResp struct + AreaID IntString + CategoryID IntString + CategoryName string + FileID string + FileName string + type OfflineAddUrlResponse struct + Result []OfflineTaskResponse + type OfflineTask struct + AddTime int64 + DelFileId string + DirId string + FileId string + InfoHash string + LeftTime int64 + Move int + Name string + Peers int64 + Percent float64 + RateDownload float64 + Size int64 + Status int + UpdateTime int64 + Url string + func (t *OfflineTask) GetStatus() string + func (t *OfflineTask) IsDone() bool + func (t *OfflineTask) IsFailed() bool + func (t *OfflineTask) IsRunning() bool + func (t *OfflineTask) IsTodo() bool + type OfflineTaskResp struct + Count int64 + Page int64 + PageCount int64 + PageRow int64 + Quota int64 + Tasks []*OfflineTask + Total int64 + type OfflineTaskResponse struct + InfoHash string + Url string + type Option func(c *Pan115Client) + func InsecureSkipVerify(insecureSkipVerify bool) Option + func UA(userAgent ...string) Option + func WithClient(hc *http.Client) Option + func WithDebug() Option + func WithProxy(proxy string) Option + func WithRestyClient(resty *resty.Client) Option + func WithTrace() Option + type Pan115Client struct + Client *resty.Client + Request *resty.Request + UploadMetaInfo *UploadMetaInfo + UseInternalUpload bool + UserID int64 + Userkey string + func Defalut() *Pan115Client + func New(opts ...Option) *Pan115Client + func (c *Pan115Client) AddOfflineTaskURIs(uris []string, saveDirID string) (hashes []string, err error) + func (c *Pan115Client) CleanRecycleBin(password string, rIDs ...string) error + func (c *Pan115Client) ClearOfflineTasks(clearFlag int64) error + func (c *Pan115Client) Copy(dirID string, fileIDs ...string) error + func (c *Pan115Client) Delete(fileIDs ...string) error + func (c *Pan115Client) DeleteOfflineTasks(hashes []string, deleteFiles bool) error + func (c *Pan115Client) Download(pickCode string) (*DownloadInfo, error) + func (c *Pan115Client) DownloadByShareCode(shareCode, receiveCode, fileID string) (*SharedDownloadInfo, error) + func (c *Pan115Client) DownloadWithUA(pickCode, ua string) (*DownloadInfo, error) + func (c *Pan115Client) EnableTrace() *Pan115Client + func (c *Pan115Client) GenerateSignature(fileID, target string) string + func (c *Pan115Client) GenerateToken(fileID, preID, timeStamp, fileSize, signKey, signVal string) string + func (c *Pan115Client) GetAppVersion() ([]AppVersion, error) + func (c *Pan115Client) GetDigestResult(r io.Reader) (*hash.DigestResult, error) + func (c *Pan115Client) GetFile(fileID string) (*File, error) + func (c *Pan115Client) GetOSSEndpoint(enableInternalUpload bool) string + func (c *Pan115Client) GetOSSToken() (*UploadOSSTokenResp, error) + func (c *Pan115Client) GetRequest() *resty.Request + func (c *Pan115Client) GetShareSnap(shareCode, receiveCode, dirID string, Queries ...Query) (*ShareSnapResp, error) + func (c *Pan115Client) GetUploadEndpoint(endpoint *UploadEndpointResp) error + func (c *Pan115Client) GetUploadInfo() error + func (c *Pan115Client) GetUser() (*UserInfo, error) + func (c *Pan115Client) ImportCookies(cookies map[string]string, domains ...string) + func (c *Pan115Client) ImportCredential(cr *Credential) *Pan115Client + func (c *Pan115Client) List(dirID string) (*[]File, error) + func (c *Pan115Client) ListOfflineTask(page int64) (OfflineTaskResp, error) + func (c *Pan115Client) ListPage(dirID string, offset, limit int64) (*[]File, error) + func (c *Pan115Client) ListRecycleBin(offset, limit int) ([]RecycleBinItem, error) + func (c *Pan115Client) ListWithLimit(dirID string, limit int64) (*[]File, error) + func (c *Pan115Client) LoginCheck() error + func (c *Pan115Client) Mkdir(parentID string, name string) (string, error) + func (c *Pan115Client) Move(dirID string, fileIDs ...string) error + func (c *Pan115Client) NewRequest() *resty.Request + func (c *Pan115Client) QRCodeLogin(s *QRCodeSession) (*Credential, error) + func (c *Pan115Client) QRCodeLoginWithApp(s *QRCodeSession, app LoginApp) (*Credential, error) + func (c *Pan115Client) QRCodeStart() (*QRCodeSession, error) + func (c *Pan115Client) QRCodeStatus(s *QRCodeSession) (*QRCodeStatus, error) + func (c *Pan115Client) RapidUpload(fileSize int64, fileName, dirID, preID, fileID string, r io.ReadSeeker) (*UploadInitResp, error) + func (c *Pan115Client) RapidUploadOrByMultipart(dirID, fileName string, fileSize int64, r *os.File, ...) error + func (c *Pan115Client) RapidUploadOrByOSS(dirID, fileName string, fileSize int64, r io.ReadSeeker) error + func (c *Pan115Client) Rename(fileID, newName string) error + func (c *Pan115Client) RevertRecycleBin(rIDs ...string) error + func (c *Pan115Client) SetCookies(cs ...*http.Cookie) *Pan115Client + func (c *Pan115Client) SetDebug(d bool) *Pan115Client + func (c *Pan115Client) SetHttpClient(httpClient *http.Client) *Pan115Client + func (c *Pan115Client) SetProxy(proxy string) *Pan115Client + func (c *Pan115Client) SetUserAgent(userAgent string) *Pan115Client + func (c *Pan115Client) Stat(fileID string) (*FileStatInfo, error) + func (c *Pan115Client) UploadAvailable() (bool, error) + func (c *Pan115Client) UploadByMultipart(params *UploadOSSParams, fileSize int64, f *os.File, dirID string, ...) error + func (c *Pan115Client) UploadByOSS(params *UploadOSSParams, r io.Reader, dirID string) error + func (c *Pan115Client) UploadDigestRange(r io.ReadSeeker, rangeSpec string) (result string, err error) + func (c *Pan115Client) UploadFastOrByMultipart(dirID, fileName string, fileSize int64, r *os.File, ...) error + func (c *Pan115Client) UploadFastOrByOSS(dirID, fileName string, fileSize int64, r io.ReadSeeker) error + func (c *Pan115Client) UploadSHA1(fileSize int64, fileName, dirID, preID, fileID string, r io.ReadSeeker) (*UploadInitResp, error) + type QRCodeBasicResp struct + Code int + Errno int + Error string + Message string + State int + func (resp *QRCodeBasicResp) Err(respBody ...string) error + type QRCodeLoginResp struct + Data struct{ ... } + type QRCodeSession struct + QrcodeContent string + Sign string + Time int64 + UID string + func (s *QRCodeSession) QRCode() ([]byte, error) + func (s *QRCodeSession) QRCodeByApi() ([]byte, error) + type QRCodeStatus struct + Msg string + Status int + Version string + func (s *QRCodeStatus) IsAllowed() bool + func (s *QRCodeStatus) IsCanceled() bool + func (s *QRCodeStatus) IsExpired() bool + func (s *QRCodeStatus) IsScanned() bool + func (s *QRCodeStatus) IsWaiting() bool + type QRCodeStatusResp struct + Data QRCodeStatus + type QRCodeTokenResp struct + Data QRCodeSession + type Query func(query *map[string]string) + func QueryLimit(limit int) Query + func QueryOffset(offset int) Query + type RecycleBinItem struct + DeleteTime StringInt64 + FileId string + FileName string + FileSize StringInt64 + ParentId IntString + ParentName string + type RecycleListResponse struct + Data []RecycleBinItem + type ResultWithErr interface + Err func(respBody ...string) error + type ShareFile struct + CategoryID IntString + FileID string + FileName string + IsFile int + Labels []*LabelInfo + ParentID string + Sha1 string + Size StringInt64 + Type string + UID int + UpdateTime string + type ShareSnapResp struct + Data struct{ ... } + type SharedDownloadInfo struct + FileID string + FileName string + FileSize StringInt64 + URL struct{ ... } + type StringFloat64 float64 + func (v *StringFloat64) UnmarshalJSON(b []byte) (err error) + type StringInt int64 + func (v *StringInt) UnmarshalJSON(b []byte) (err error) + type StringInt64 int64 + func (v *StringInt64) UnmarshalJSON(b []byte) (err error) + type StringTime int64 + func (v *StringTime) UnmarshalJSON(b []byte) (err error) + type Time int64 + func Now() Time + func NowMilli() Time + func (t Time) String() string + func (t Time) ToInt64() int64 + type UploadEndpointResp struct + Endpoint string + GetTokenURL string + type UploadInfoResp struct + UserID int64 + Userkey string + type UploadInitResp struct + ErrorCode int + ErrorMsg string + FileID int + FileInfo string + PickCode string + Request string + SignCheck string + SignKey string + Status BoolInt + Target string + Version string + func (r *UploadInitResp) Err(respBody ...string) error + func (r *UploadInitResp) Ok() (bool, error) + type UploadMetaInfo struct + AppID int64 + AppVersion int64 + IspType int64 + MaxDirLevel int64 + MaxDirLevelYun int64 + MaxFileNum int64 + MaxFileNumYun int64 + SizeLimit int64 + SizeLimitYun int64 + TypeLimit []string + UploadAllowed bool + UploadAllowedMsg string + type UploadMultipartOption func(o *UploadMultipartOptions) + func UploadMultipartWithThreadsNum(n int) UploadMultipartOption + func UploadMultipartWithTimeout(timeout time.Duration) UploadMultipartOption + func UploadMultipartWithTokenRefreshTime(refreshTime time.Duration) UploadMultipartOption + type UploadMultipartOptions struct + ThreadsNum int + Timeout time.Duration + TokenRefreshTime time.Duration + func DefalutUploadMultipartOptions() *UploadMultipartOptions + type UploadOSSParams struct + Bucket string + Callback struct{ ... } + Object string + SHA1 string + type UploadOSSTokenResp struct + AccessKeyID string + AccessKeySecret string + Expiration time.Time + SecurityToken string + StatusCode string + func (r *UploadOSSTokenResp) Err(respBody ...string) error + type UserInfo struct + Device int + Expire int + Face string + Forever int + Global int + IsPrivilege bool + Liang int + Mark int + Mark1 int + Privilege []interface{} + Rank int + UserID int64 + UserName string + Vip int + type UserInfoResp struct + UserInfo UserInfo + type VersionResp struct + Data Versions + type Versions map[string]map[string]any + func (v Versions) GetAppVersions() []AppVersion