Documentation ¶
Index ¶
- Constants
- Variables
- 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 BasicResp
- type BoolInt
- type Credential
- type DirInfo
- type DownloadData
- type DownloadInfo
- type DownloadReap
- type File
- type FileDownloadUrl
- type FileInfo
- type FileListResp
- type FileParentInfo
- type FileStatInfo
- type FileStatResponse
- type GetFileInfoResponse
- type GetFileOption
- type GetFileOptions
- type IntString
- type Label
- type LabelColor
- type LabelInfo
- type LoginResp
- type MkdirResp
- type Option
- type Pan115Client
- func (c *Pan115Client) Copy(dirID string, fileIDs ...string) error
- func (c *Pan115Client) Delete(fileIDs ...string) error
- func (c *Pan115Client) Download(pickCode string) (*DownloadInfo, error)
- func (c *Pan115Client) EnableTrace() *Pan115Client
- func (c *Pan115Client) GenerateSignature(fileID, target string) string
- func (c *Pan115Client) GenerateToken(fileID, preID, timeStamp, fileSize string) string
- func (c *Pan115Client) GetDigestResult(r io.Reader) (*hash.DigestResult, error)
- func (c *Pan115Client) GetFile(fileID string) (*File, error)
- func (c *Pan115Client) GetOSSToken() (*UploadOSSTokenResp, error)
- func (c *Pan115Client) GetRequest() *resty.Request
- 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) ListPage(dirID string, offset, limit int64) (*[]File, 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) QRCodeStart() (*QRCodeSession, error)
- func (c *Pan115Client) QRCodeStatus(s *QRCodeSession) (*QRCodeStatus, error)
- func (c *Pan115Client) Rename(fileID, newName 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) 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) (*UploadInitResp, error)
- type QRCodeBasicResp
- type QRCodeLoginResp
- type QRCodeSession
- type QRCodeStatus
- type QRCodeStatusResp
- type QRCodeTokenResp
- type ResultWithErr
- type StringFloat64
- type StringInt
- type StringInt64
- type StringTime
- type Time
- type UploadInfoResp
- type UploadInitResp
- type UploadMetaInfo
- type UploadMultipartOption
- type UploadMultipartOptions
- type UploadOSSParams
- type UploadOSSTokenResp
- type UserInfo
- type UserInfoResp
Examples ¶
Constants ¶
const ( // login ApiLoginCheck = "https://passportapi.115.com/app/1.0/web/1.0/check/sso" ApiUserInfo = "https://my.115.com/?ct=ajax&ac=nav" // dir ApiDirAdd = "https://webapi.115.com/files/add" // file ApiFileDelete = "https://webapi.115.com/rb/delete" ApiFileMove = "https://webapi.115.com/files/move" ApiFileCopy = "https://webapi.115.com/files/copy" ApiFileRename = "https://webapi.115.com/files/batch_rename" ApiFileList = "https://webapi.115.com/files" ApiFileListByName = "https://aps.115.com/natsort/files.php" ApiFileStat = "https://webapi.115.com/category/get" ApiFileInfo = "https://webapi.115.com/files/get_info" // download ApiDownloadGetUrl = "https://proapi.115.com/app/chrome/downurl" // upload ApiUploadInfo = "https://proapi.115.com/app/uploadinfo" ApiUploadInit = "https://uplb.115.com/4.0/initupload.php" // oss ApiUploadOSSToken = "https://uplb.115.com/3.0/gettoken.php" // qrcode ApiQrcodeToken = "https://qrcodeapi.115.com/api/1.0/web/1.0/token" ApiQrcodeStatus = "https://qrcodeapi.115.com/get/status/" ApiQrcodeLogin = "https://passportapi.115.com/app/1.0/web/1.0/login/qrcode" )
const ( UADefalut = "Mozilla/5.0" UA115Browser = "Mozilla/5.0 115Browser/23.9.3.2" UA115Disk = "Mozilla/5.0 115disk/30.1.0" UAIosApp = "Mozilla/5.0; Darwin/10.0; UDown/30.1.0" )
const ( CookieDomain115 = ".115.com" CookieUrl = "https://115.com" CookieNameUid = "UID" CookieNameCid = "CID" CookieNameSeid = "SEID" )
const ( OSSRegionID = "oss-cn-shenzhen" OSSEndpoint = "cn-shenzhen.oss.aliyuncs.com" OSSUserAgent = "aliyun-sdk-android/2.9.1" OssSecurityTokenHeaderName = "X-OSS-Security-Token" )
const ( KB = 1 << (10 * (iota + 1)) MB GB )
const ( FileOrderByTime = "user_ptime" FileOrderByType = "file_type" FileOrderBySize = "file_size" FileOrderByName = "file_name" FileListLimit = int64(56) )
Variables ¶
var ( ErrNotLogin = errors.New("user not login") ErrOfflineInvalidLink = errors.New("invalid download link") ErrOfflineTaskExisted = errors.New("offline task existed") ErrOrderNotSupport = errors.New("file order not supported") ErrPasswordIncorrect = errors.New("password incorrect") ErrLoginTwoStepVerify = errors.New("requires two-step verification") ErrAccountNotBindMobile = errors.New("account not binds mobile") ErrCredentialInvalid = errors.New("credential invalid") ErrSessionExited = errors.New("session exited") ErrQrcodeExpired = errors.New("qrcode expired") // ErrUnexpected is the fall-back error whose code is not handled. ErrUnexpected = errors.New("unexpected error") // ErrExist means an item which you want to create is already existed. ErrExist = errors.New("target already exists") // ErrNotExist means an item which you find is not existed. ErrNotExist = errors.New("target does not exist") ErrInvalidCursor = errors.New("invalid cursor") ErrUploadTooLarge = errors.New("upload reach the limit") ErrUploadFailed = errors.New("upload failed") ErrImportDirectory = errors.New("can not import directory") ErrDownloadEmpty = errors.New("can not get download URL") ErrDownloadDirectory = errors.New("can not download directory") ErrDownloadFileNotExistOrHasDeleted = errors.New("target file does not exist or has deleted") ErrDownloadFileTooBig = errors.New("target file is too big to download") ErrCyclicCopy = errors.New("cyclic copy") ErrCyclicMove = errors.New("cyclic move") ErrVideoNotReady = errors.New("video is not ready") ErrWrongParams = errors.New("wrong parameters") ErrRepeatLogin = errors.New("repeat login") ErrFailedToLogin = errors.New("failed to login") ErrDoesLoggedOut = errors.New("you have been kicked out by multi-device login management") ErrPickCodeNotExist = errors.New("pickcode does not exist") ErrPickCodeisEmpty = errors.New("empty pickcode") ErrUploadSH1Invalid = errors.New("userid/filesize/target/pickcode invalid") )
var ( LabelColors = []string{ "#000000", "#FF4B30", "#F78C26", "#FFC032", "#43BA80", "#2670FC", "#8B69FE", "#CCCCCC", } LabelColorMap = map[string]int{ "#000000": 0, "#FF4B30": 1, "#F78C26": 2, "#FFC032": 3, "#43BA80": 4, "#2670FC": 5, "#8B69FE": 6, "#CCCCCC": 7, } )
var (
ErrBadCookie = errors.New("bad cookie")
)
cookie err
Functions ¶
func CheckErr ¶
func CheckErr(err error, result ResultWithErr, restyResp *resty.Response) error
func OssOption ¶
func OssOption(params *UploadOSSParams, ossToken *UploadOSSTokenResp) []oss.Option
OssOption get options
Types ¶
type BasicResp ¶
type Credential ¶
type Credential struct { UID string `json:"UID"` CID string `json:"CID"` SEID string `json:"SEID"` }
func (*Credential) FromCookie ¶
func (cr *Credential) FromCookie(cookie string) error
FromCookie get uid, cid, seid from cookie string
type DownloadData ¶
type DownloadData map[string]*DownloadInfo
type DownloadInfo ¶
type DownloadInfo struct { FileName string `json:"file_name"` FileSize StringInt64 `json:"file_size"` PickCode string `json:"pick_code"` Url FileDownloadUrl `json:"url"` Header http.Header }
func (*DownloadInfo) Get ¶
func (info *DownloadInfo) Get() (io.ReadSeeker, error)
Get Download file from download info url
type DownloadReap ¶
type File ¶
type File struct { // Marks is the file a directory. IsDirectory bool // Unique identifier of the file on the cloud storage. FileID string // FileID of the parent directory. ParentID string // Base name of the file. Name string // Size in bytes of the file. Size int64 // IDentifier used for downloading or playing the file. PickCode string // SHA1 hash of file content, in HEX format. Sha1 string // Is file stared Star bool // File labels Labels []*Label // Create time of the file. CreateTime time.Time // Update time of the file. UpdateTime time.Time }
type FileDownloadUrl ¶
type FileInfo ¶
type FileInfo struct { AreaID IntString `json:"aid"` CategoryID string `json:"cid"` FileID string `json:"fid"` ParentID string `json:"pid"` Name string `json:"n"` Type string `json:"ico"` Size StringInt64 `json:"s"` Sha1 string `json:"sha"` PickCode string `json:"pc"` IsStar StringInt `json:"m"` Labels []*LabelInfo `json:"fl"` CreateTime StringInt64 `json:"tp"` UpdateTime string `json:"t"` }
type FileListResp ¶
type FileListResp struct { BasicResp AreaID string `json:"aid"` CategoryID IntString `json:"cid"` Count int `json:"count"` Order string `json:"order"` IsAsc int `json:"is_asc"` Offset int `json:"offset"` Limit int `json:"limit"` PageSize int `json:"page_size"` Files []FileInfo `json:"data"` }
func GetFiles ¶
func GetFiles(req *resty.Request, dirID string, opts ...GetFileOptions) (*FileListResp, error)
type FileParentInfo ¶
type FileStatInfo ¶
type FileStatInfo struct { // Base name of the file. Name string // Identifier used for downloading or playing the file. PickCode string // SHA1 hash of file content, in HEX format. Sha1 string // Marks is file a directory. IsDirectory bool // Files count under this directory. FileCount int // Subdirectories count under this directory. DirCount int // Create time of the file. CreateTime time.Time // Last update time of the file. UpdateTime time.Time // Parent directory list. Parents []*DirInfo }
type FileStatResponse ¶
type FileStatResponse struct { FileCount StringInt `json:"count"` Size string `json:"size"` FolderCount StringInt `json:"folder_count"` CreateTime StringInt64 `json:"ptime"` UpdateTime StringInt64 `json:"utime"` FileName string `json:"file_name"` PickCode string `json:"pick_code"` Sha1 string `json:"sha1"` IsMark StringInt `json:"is_mark"` OpenTime int64 `json:"open_time"` IsFile StringInt `json:"file_category"` Paths []*FileParentInfo `json:"paths"` }
func (*FileStatResponse) Err ¶
func (r *FileStatResponse) Err(respBody ...string) error
type GetFileInfoResponse ¶
type GetFileOption ¶
type GetFileOption struct {
// contains filtered or unexported fields
}
GetFileOption get file options
func DefaultGetFileOptions ¶
func DefaultGetFileOptions() *GetFileOption
func (*GetFileOption) GetAsc ¶
func (o *GetFileOption) GetAsc() string
func (*GetFileOption) GetOffset ¶
func (o *GetFileOption) GetOffset() string
func (*GetFileOption) GetOrder ¶
func (o *GetFileOption) GetOrder() string
func (*GetFileOption) GetPageSize ¶
func (o *GetFileOption) GetPageSize() string
func (*GetFileOption) GetshowDir ¶
func (o *GetFileOption) GetshowDir() string
type GetFileOptions ¶
type GetFileOptions func(o *GetFileOption)
func WithAsc ¶
func WithAsc(d bool) GetFileOptions
func WithLimit ¶
func WithLimit(pageSize int64) GetFileOptions
func WithOffset ¶
func WithOffset(offset int64) GetFileOptions
func WithOrder ¶
func WithOrder(order string) GetFileOptions
func WithShowDirEnable ¶
func WithShowDirEnable(e bool) GetFileOptions
type Label ¶
type Label struct { ID string Name string Color LabelColor }
type LabelColor ¶
type LabelColor int
type LoginResp ¶
type LoginResp struct { Code int `json:"code"` CheckSsd bool `json:"check_ssd"` Data struct { Expire int `json:"expire"` Link string `json:"link"` UserID int64 `json:"user_id"` } `json:"data"` Errno int `json:"errno"` Error string `json:"error"` Message string `json:"message"` State int `json:"state"` Expire int `json:"expire"` }
type Option ¶
type Option func(c *Pan115Client)
Option driver client options
func WithClient ¶
func WithRestyClient ¶
func WithRestyClient(resty *resty.Client) Option
type Pan115Client ¶
type Pan115Client struct { Client *resty.Client Request *resty.Request UserID int64 Userkey string UploadMetaInfo *UploadMetaInfo }
Pan115Client driver client
func (*Pan115Client) Copy ¶
func (c *Pan115Client) Copy(dirID string, fileIDs ...string) error
Copy copy files or directory into another directory with directroy id
Example ¶
client := Defalut() err := client.Copy("dirID", "fileID") if err != nil { log.Fatalf("Copy file error: %s", err) }
Output:
func (*Pan115Client) Delete ¶
func (c *Pan115Client) Delete(fileIDs ...string) error
Delete delete files or directory from file ids
Example ¶
client := Defalut() err := client.Delete("fileID") if err != nil { log.Fatalf("Delete file error: %s", err) }
Output:
func (*Pan115Client) Download ¶
func (c *Pan115Client) Download(pickCode string) (*DownloadInfo, error)
Download get download info with pickcode
Example ¶
client := Defalut() info, err := client.Download("pickcode") if err != nil { log.Fatalf("Get download info error: %s", err) } rs, err := info.Get() if err != nil { log.Fatalf("Get io reader error: %s", err) } f, _ := os.Create("test.mp4") // save to test.mp4 defer func() { f.Close() }() _, err = f.ReadFrom(rs) if err != nil { log.Fatalf("Copy reader error: %s", err) }
Output:
func (*Pan115Client) EnableTrace ¶
func (c *Pan115Client) EnableTrace() *Pan115Client
func (*Pan115Client) GenerateSignature ¶
func (c *Pan115Client) GenerateSignature(fileID, target string) string
func (*Pan115Client) GenerateToken ¶
func (c *Pan115Client) GenerateToken(fileID, preID, timeStamp, fileSize string) string
func (*Pan115Client) GetDigestResult ¶
func (c *Pan115Client) GetDigestResult(r io.Reader) (*hash.DigestResult, error)
GetDigestResult get digest of file or stream
func (*Pan115Client) GetFile ¶
func (c *Pan115Client) GetFile(fileID string) (*File, error)
GetInfo gets information of a file or directory by its ID.
func (*Pan115Client) GetOSSToken ¶
func (c *Pan115Client) GetOSSToken() (*UploadOSSTokenResp, error)
GetOSSToken get oss token for oss upload
func (*Pan115Client) GetRequest ¶
func (c *Pan115Client) GetRequest() *resty.Request
func (*Pan115Client) GetUploadInfo ¶
func (c *Pan115Client) GetUploadInfo() error
GetUploadInfo get some info for upload
func (*Pan115Client) GetUser ¶
func (c *Pan115Client) GetUser() (*UserInfo, error)
GetUser get user information
func (*Pan115Client) ImportCookies ¶
func (c *Pan115Client) ImportCookies(cookies map[string]string, domains ...string)
func (*Pan115Client) ImportCredential ¶
func (c *Pan115Client) ImportCredential(cr *Credential) *Pan115Client
ImportCredential import uid, cid, seid
Example ¶
cr := &Credential{} if err := cr.FromCookie("UID=xxx;CID=xxxx;SEID=xxx;other=xxxx"); err != nil { log.Fatalf("Import credentail error: %s", err) } client := Defalut().ImportCredential(cr) if err := client.LoginCheck(); err != nil { log.Fatalf("Login error: %s", err) }
Output:
func (*Pan115Client) List ¶
func (c *Pan115Client) List(dirID string) (*[]File, error)
List list all files and directories
Example ¶
client := Defalut() files, err := client.List("dirID") if err != nil { log.Fatalf("List file error: %s", err) } for _, file := range *files { log.Printf("file %v", file) }
Output:
func (*Pan115Client) ListPage ¶
func (c *Pan115Client) ListPage(dirID string, offset, limit int64) (*[]File, error)
List list all files and directories with offset and limit
func (*Pan115Client) ListWithLimit ¶
func (c *Pan115Client) ListWithLimit(dirID string, limit int64) (*[]File, error)
List list all files and directories with limit
func (*Pan115Client) LoginCheck ¶
func (c *Pan115Client) LoginCheck() error
LoginCheck check login status
func (*Pan115Client) Mkdir ¶
func (c *Pan115Client) Mkdir(parentID string, name string) (string, error)
Mkdir make a new directory which name and parent directory id, return directory id
Example ¶
client := Defalut() cid, err := client.Mkdir("parentID", "name") if err != nil { log.Fatalf("Make directory error: %s", err) } log.Printf("cid is %s", cid)
Output:
func (*Pan115Client) Move ¶
func (c *Pan115Client) Move(dirID string, fileIDs ...string) error
Move move files or directory into another directory with directroy id
Example ¶
client := Defalut() err := client.Move("dirID", "fileID") if err != nil { log.Fatalf("Move file error: %s", err) }
Output:
func (*Pan115Client) NewRequest ¶
func (c *Pan115Client) NewRequest() *resty.Request
func (*Pan115Client) QRCodeLogin ¶
func (c *Pan115Client) QRCodeLogin(s *QRCodeSession) (*Credential, error)
QrcodeLogin logins user through QRCode. You SHOULD call this method ONLY when `QRCodeStatus.IsAllowed()` is true.
func (*Pan115Client) QRCodeStart ¶
func (c *Pan115Client) QRCodeStart() (*QRCodeSession, error)
QrcodeStart starts a QRCode login session.
func (*Pan115Client) QRCodeStatus ¶
func (c *Pan115Client) QRCodeStatus(s *QRCodeSession) (*QRCodeStatus, error)
QRCodeStatus
There will be 4 kinds of status:
- Waiting
- Scanned
- Allowed
- Canceled
func (*Pan115Client) Rename ¶
func (c *Pan115Client) Rename(fileID, newName string) error
Rename rename a file or directory with file id and name
Example ¶
client := Defalut() err := client.Rename("fileID", "newname") if err != nil { log.Fatalf("Rename file error: %s", err) }
Output:
func (*Pan115Client) SetCookies ¶
func (c *Pan115Client) SetCookies(cs ...*http.Cookie) *Pan115Client
func (*Pan115Client) SetDebug ¶
func (c *Pan115Client) SetDebug(d bool) *Pan115Client
func (*Pan115Client) SetHttpClient ¶
func (c *Pan115Client) SetHttpClient(httpClient *http.Client) *Pan115Client
func (*Pan115Client) SetProxy ¶
func (c *Pan115Client) SetProxy(proxy string) *Pan115Client
func (*Pan115Client) SetUserAgent ¶
func (c *Pan115Client) SetUserAgent(userAgent string) *Pan115Client
func (*Pan115Client) Stat ¶
func (c *Pan115Client) Stat(fileID string) (*FileStatInfo, error)
Stat get statistic information of a file or directory
func (*Pan115Client) UploadAvailable ¶
func (c *Pan115Client) UploadAvailable() (bool, error)
UploadAvailable check and prepare to upload
func (*Pan115Client) UploadByMultipart ¶
func (c *Pan115Client) UploadByMultipart(params *UploadOSSParams, fileSize int64, f *os.File, dirID string, opts ...UploadMultipartOption) error
UploadByMultipart upload by mutipart blocks
func (*Pan115Client) UploadByOSS ¶
func (c *Pan115Client) UploadByOSS(params *UploadOSSParams, r io.Reader, dirID string) error
UploadByOSS use aliyun sdk to upload
func (*Pan115Client) UploadFastOrByMultipart ¶
func (c *Pan115Client) UploadFastOrByMultipart(dirID, fileName string, fileSize int64, r *os.File, opts ...UploadMultipartOption) error
UploadFastOrByMultipart check sha1 then upload by mutipart blocks
func (*Pan115Client) UploadFastOrByOSS ¶
func (c *Pan115Client) UploadFastOrByOSS(dirID, fileName string, fileSize int64, r io.ReadSeeker) error
UploadFastOrByOSS check sha1 then upload by oss
Example ¶
client := Defalut() file, err := os.Open("/path/to/file") if err != nil { log.Fatalf("Open file error: %s", err) } s, _ := file.Stat() err = client.UploadFastOrByOSS("dirID", s.Name(), s.Size(), file) if err != nil { log.Fatalf("Upload by oss error: %s", err) }
Output:
func (*Pan115Client) UploadSHA1 ¶
func (c *Pan115Client) UploadSHA1(fileSize int64, fileName, dirID, preID, fileID string) (*UploadInitResp, error)
UploadSHA1 upload a sha1 for upload
Example ¶
client := Defalut() file, err := os.Open("/path/to/file") if err != nil { log.Fatalf("Open file error: %s", err) } d, _ := client.GetDigestResult(file) resp, err := client.UploadSHA1(d.Size, "filename", "dirID", d.PreID, d.QuickID) if err != nil { log.Fatalf("Fastupload error: %s", err) } success, err := resp.Ok() if err != nil { log.Fatalf("Fastupload error: %s", err) } if !success { log.Printf("file is not exist, need upload") }
Output:
type QRCodeBasicResp ¶
type QRCodeBasicResp struct { Code int `json:"code"` Message string `json:"message"` State int `json:"state"` Errno int `json:"errno"` Error string `json:"error"` }
func (*QRCodeBasicResp) Err ¶
func (resp *QRCodeBasicResp) Err(respBody ...string) error
type QRCodeLoginResp ¶
type QRCodeLoginResp struct { QRCodeBasicResp Data struct { Alert string `json:"alert"` BindMobile int `json:"bind_mobile"` Credential Credential `json:"cookie"` Country string `json:"country"` Email string `json:"email"` Face struct { FaceL string `json:"face_l"` FaceM string `json:"face_m"` FaceS string `json:"face_s"` } `json:"face"` From string `json:"from"` IsChangPasswd int `json:"is_chang_passwd"` IsFirstLogin int `json:"is_first_login"` IsTrusted interface{} `json:"is_trusted"` IsVip int `json:"is_vip"` Mark int `json:"mark"` Mobile string `json:"mobile"` UserID int `json:"user_id"` UserName string `json:"user_name"` } `json:"data"` }
type QRCodeSession ¶
type QRCodeSession struct { // The raw data of QRCode, caller should use third-party tools/libraries // to convert it into QRCode matrix or image. QrcodeContent string `json:"qrcode"` Sign string `json:"sign"` Time int64 `json:"time"` UID string `json:"uid"` }
func (*QRCodeSession) QRCode ¶
func (s *QRCodeSession) QRCode() ([]byte, error)
QRCode get QRCode matrix or image.
type QRCodeStatus ¶
type QRCodeStatus struct { Msg string `json:"msg"` Status int `json:"status"` Version string `json:"version"` }
func (*QRCodeStatus) IsAllowed ¶
func (s *QRCodeStatus) IsAllowed() bool
func (*QRCodeStatus) IsCanceled ¶
func (s *QRCodeStatus) IsCanceled() bool
func (*QRCodeStatus) IsScanned ¶
func (s *QRCodeStatus) IsScanned() bool
func (*QRCodeStatus) IsWaiting ¶
func (s *QRCodeStatus) IsWaiting() bool
type QRCodeStatusResp ¶
type QRCodeStatusResp struct { QRCodeBasicResp Data QRCodeStatus `json:"data"` }
type QRCodeTokenResp ¶
type QRCodeTokenResp struct { QRCodeBasicResp Data QRCodeSession `json:"data"` }
type ResultWithErr ¶
type StringFloat64 ¶
type StringFloat64 float64
StringFloat64 uses for json field which maybe a string or a float64.
func (*StringFloat64) UnmarshalJSON ¶
func (v *StringFloat64) UnmarshalJSON(b []byte) (err error)
type StringInt ¶
type StringInt int64
StringInt uses for json field which maybe a string or an int.
func (*StringInt) UnmarshalJSON ¶
type StringInt64 ¶
type StringInt64 int64
StringInt64 uses for json field which maybe a string or an int64.
func (*StringInt64) UnmarshalJSON ¶
func (v *StringInt64) UnmarshalJSON(b []byte) (err error)
type StringTime ¶
type StringTime int64
func (*StringTime) UnmarshalJSON ¶
func (v *StringTime) UnmarshalJSON(b []byte) (err error)
type UploadInfoResp ¶
type UploadInfoResp struct { BasicResp UploadMetaInfo UserID int64 `json:"user_id"` Userkey string `json:"userkey"` }
type UploadInitResp ¶
type UploadInitResp struct { Request string `json:"request"` ErrorCode int `json:"statuscode"` ErrorMsg string `json:"statusmsg"` Status BoolInt `json:"status"` PickCode string `json:"pickcode"` Target string `json:"target"` Version string `json:"version"` // OSS upload fields UploadOSSParams // Useless fields FileID int `json:"fileid"` FileInfo string `json:"fileinfo"` }
func (*UploadInitResp) Err ¶
func (r *UploadInitResp) Err(respBody ...string) error
func (*UploadInitResp) Ok ¶
func (r *UploadInitResp) Ok() (bool, error)
Ok if fastupload is successful will return true, otherwise return false
type UploadMetaInfo ¶
type UploadMetaInfo struct { AppID int64 `json:"app_id"` AppVersion int64 `json:"app_version"` IspType int64 `json:"isp_type"` MaxDirLevel int64 `json:"max_dir_level"` MaxDirLevelYun int64 `json:"max_dir_level_yun"` MaxFileNum int64 `json:"max_file_num"` MaxFileNumYun int64 `json:"max_file_num_yun"` SizeLimit int64 `json:"size_limit"` SizeLimitYun int64 `json:"size_limit_yun"` TypeLimit []string `json:"type_limit"` UploadAllowed bool `json:"upload_allowed"` UploadAllowedMsg string `json:"upload_allowed_msg"` }
type UploadMultipartOption ¶
type UploadMultipartOption func(o *UploadMultipartOptions)
func UploadMultipartWithThreadsNum ¶
func UploadMultipartWithThreadsNum(n int) UploadMultipartOption
func UploadMultipartWithTimeout ¶
func UploadMultipartWithTimeout(timeout time.Duration) UploadMultipartOption
func UploadMultipartWithTokenRefreshTime ¶
func UploadMultipartWithTokenRefreshTime(refreshTime time.Duration) UploadMultipartOption
type UploadMultipartOptions ¶
type UploadMultipartOptions struct { ThreadsNum int Timeout time.Duration TokenRefreshTime time.Duration }
func DefalutUploadMultipartOptions ¶
func DefalutUploadMultipartOptions() *UploadMultipartOptions
type UploadOSSParams ¶
type UploadOSSTokenResp ¶
type UploadOSSTokenResp struct { AccessKeyID string `json:"AccessKeyID"` AccessKeySecret string `json:"AccessKeySecret"` Expiration time.Time `json:"Expiration"` SecurityToken string `json:"SecurityToken"` StatusCode string `json:"StatusCode"` }
func (*UploadOSSTokenResp) Err ¶
func (r *UploadOSSTokenResp) Err(respBody ...string) error
type UserInfo ¶
type UserInfo struct { Device int `json:"device"` Rank int `json:"rank"` Liang int `json:"liang"` Mark int `json:"mark"` Mark1 int `json:"mark1"` Vip int `json:"vip"` Expire int `json:"expire"` Global int `json:"global"` Forever int `json:"forever"` IsPrivilege bool `json:"is_privilege"` Privilege []interface{} `json:"privilege"` UserName string `json:"user_name"` Face string `json:"face"` UserID int64 `json:"user_id"` }