types

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

This package contains all internal types that you needn't care about. :P

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Category ErrorCategory
	Code     int
	// contains filtered or unexported fields
}

Common API error

func MakeFileError

func MakeFileError(code int, message string) *ApiError

func MakeOfflineError

func MakeOfflineError(code int, message string) *ApiError

func MakeQrcodeError

func MakeQrcodeError(code int, message string) *ApiError

func (*ApiError) Error

func (ae *ApiError) Error() string

type ApiResult

type ApiResult interface {
	IsFailed() bool
}

type BaseApiResult

type BaseApiResult struct {
	State bool `json:"state"`
}

func (*BaseApiResult) IsFailed

func (r *BaseApiResult) IsFailed() bool

type CaptchaSignResult

type CaptchaSignResult struct {
	BaseApiResult
	Sign      string `json:"sign"`
	ErrorCode int    `json:"errno"`
	Error     string `json:"error"`
}

type CaptchaSubmitResult

type CaptchaSubmitResult struct {
	BaseApiResult
}

type DownloadInfoResult

type DownloadInfoResult struct {
	BaseApiResult
	UserId      int    `json:"user_id"`
	PickCode    string `json:"pick_code"`
	FileId      string `json:"file_id"`
	FileName    string `json:"file_name"`
	FileSize    string `json:"file_size"`
	FileUrl     string `json:"file_url"`
	IsVip       int    `json:"is_vip"`
	IsSnap      int    `json:"is_snap"`
	Is115Chrome int    `json:"is_115chrome"`
	MessageCode int    `json:"msg_code"`
	Message     string `json:"msg"`
}

type ErrorCategory

type ErrorCategory string
const (
	FileError    ErrorCategory = "file"
	OfflineError ErrorCategory = "offline"
	QrcodeError  ErrorCategory = "qrcode"
)

type FileAddResult

type FileAddResult struct {
	FileOperateResult
	AreaId       int    `json:"aid"`
	CategoryId   string `json:"cid"`
	CategoryName string `json:"cname"`
	FileId       string `json:"file_id"`
	FileName     string `json:"file_name"`
}

type FileData

type FileData struct {
	AreaId     IntString   `json:"aid"`
	FileId     string      `json:"fid"`
	CategoryId string      `json:"cid"`
	ParentId   string      `json:"pid"`
	Name       string      `json:"n"`
	Type       string      `json:"ico"`
	Size       StringInt64 `json:"s"`
	CreateTime string      `json:"tp"`
	UpdateTime string      `json:"te"`
	PickCode   string      `json:"pc"`
	Sha1       string      `json:"sha"`
	// Special fields for video
	VideoFlag     int     `json:"iv"`
	VideoDuration float64 `json:"play_long"`
}

type FileImageResult added in v0.1.4

type FileImageResult struct {
	BaseApiResult
	// Error information
	ErrorCode int    `json:"errNo"`
	Error     string `json:"error"`
	// Data
	Data struct {
		Url       string   `json:"url"`
		AllUrls   []string `json:"all_urls"`
		OriginUrl string   `json:"origin_url"`
		SourceUrl string   `json:"source_url"`
	} `json:"data"`
}

type FileIndexResult

type FileIndexResult struct {
	BaseApiResult
	Code  int    `json:"code"`
	Error string `json:"error"`
	Data  struct {
		SpaceInfo struct {
			AllTotal  StorageSizeInfo `json:"all_total"`
			AllRemain StorageSizeInfo `json:"all_remain"`
			AllUsed   StorageSizeInfo `json:"all_use"`
		} `json:"space_info"`
	} `json:"data"`
}

type FileListResult

type FileListResult struct {
	BaseApiResult
	Error      string      `json:"error"`
	ErrorCode  int         `json:"errNo"`
	AreaId     string      `json:"aid"`
	CategoryId IntString   `json:"cid"`
	Count      int         `json:"count"`
	SysCount   int         `json:"sys_count"`
	Path       []*FilePath `json:"path"`
	Data       []*FileData `json:"data"`
	Order      string      `json:"order"`
	IsAsc      int         `json:"is_asc"`
	Offset     int         `json:"offset"`
	Limit      int         `json:"limit"`
	PageSize   int         `json:"page_size"`
}

type FileOperateResult

type FileOperateResult struct {
	BaseApiResult
	ErrorCode StringInt `json:"errno"`
	Error     string    `json:"error"`
}

type FilePath

type FilePath struct {
	AreaId     IntString `json:"aid"`
	CategoryId IntString `json:"cid"`
	ParentId   IntString `json:"pid"`
	Name       string    `json:"name"`
}

type FileSearchResult

type FileSearchResult struct {
	BaseApiResult
	Error     string      `json:"error"`
	ErrorCode int         `json:"errCode"`
	Count     int         `json:"count"`
	Offset    int         `json:"offset"`
	PageSize  int         `json:"page_size"`
	Data      []*FileData `json:"data"`
}

type FileStatData

type FileStatData struct {
	Name        string          `json:"file_name"`
	FileType    string          `json:"file_category"`
	CreateTime  string          `json:"ptime"`
	UpdateTime  string          `json:"utime"`
	FileCount   StringInt       `json:"count"`
	FolderCount StringInt       `json:"folder_count"`
	FormatSize  string          `json:"size"`
	PickCode    string          `json:"pick_code"`
	Sha1        string          `json:"sha1"`
	Paths       []*FileStatPath `json:"paths"`
}

type FileStatPath

type FileStatPath struct {
	FileId   IntString `json:"file_id"`
	FileName string    `json:"file_name"`
}

type FileStatResult

type FileStatResult struct {
	BaseApiResult
	Data *FileStatData
}

func (*FileStatResult) UnmarshalJSON

func (r *FileStatResult) UnmarshalJSON(data []byte) (err error)

type FileVideoResult

type FileVideoResult struct {
	BaseApiResult
	ErrorCode  int           `json:"errNo"`
	Error      string        `json:"error"`
	FileId     string        `json:"file_id"`
	FileName   string        `json:"file_name"`
	FileSize   StringInt64   `json:"file_size"`
	FileStatus int           `json:"file_status"`
	ParentId   string        `json:"parent_id"`
	Width      StringInt     `json:"width"`
	Height     StringInt     `json:"height"`
	Duration   StringFloat64 `json:"play_long"`
	VideoUrl   string        `json:"video_url"`
}

type IntString

type IntString string

"IntString" uses for JSON field which's type may be int or string, and store it as string.

func (*IntString) UnmarshalJSON

func (v *IntString) UnmarshalJSON(b []byte) (err error)

type OfflineAddUrlResult

type OfflineAddUrlResult struct {
	OfflineBasicResult
	InfoHash string `json:"info_hash"`
	Name     string `json:"name"`
	Url      string `json:"url"`
}

type OfflineAddUrlsResult

type OfflineAddUrlsResult struct {
	OfflineBasicResult
	Result []*OfflineAddUrlResult `json:"result"`
}

type OfflineBasicResult

type OfflineBasicResult struct {
	BaseApiResult
	ErrorCode int    `json:"errcode"`
	ErrorType string `json:"errtype"`
	ErrorMsg  string `json:"error_msg"`
}

type OfflineListResult

type OfflineListResult struct {
	OfflineBasicResult
	Count       int                `json:"count"`
	Page        int                `json:"page"`
	PageCount   int                `json:"page_count"`
	PageSize    int                `json:"page_row"`
	QuotaRemain int                `json:"quota"`
	QuotaTotal  int                `json:"total"`
	Tasks       []*OfflineTaskData `json:"tasks"`
}

type OfflineSpaceResult

type OfflineSpaceResult struct {
	BaseApiResult
	Data  float64 `json:"data"`
	Size  string  `json:"size"`
	Limit int64   `json:"limit"`
	Url   string  `json:"url"`
	BtUrl string  `json:"bt_url"`
	Sign  string  `json:"sign"`
	Time  int64   `json:"time"`
}

type OfflineTaskData

type OfflineTaskData struct {
	InfoHash     string  `json:"info_hash"`
	Name         string  `json:"name"`
	Size         int64   `json:"size"`
	Url          string  `json:"url"`
	Status       int     `json:"status"`
	AddTime      int64   `json:"add_time"`
	LeftTime     int64   `json:"left_time"`
	UpdateTime   int64   `json:"last_update"`
	Precent      float64 `json:"percentDone"`
	Move         int     `json:"move"`
	FileId       string  `json:"file_id"`
	DeleteFileId string  `json:"delete_file_id"`
	DeletePath   string  `json:"del_path"`
}

type OfflineToken

type OfflineToken struct {
	Sign string
	Time int64
}

type QrcodeApiResult

type QrcodeApiResult struct {
	State   int             `json:"state"`
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

func (*QrcodeApiResult) IsFailed

func (r *QrcodeApiResult) IsFailed() bool

type QrcodeLoginData

type QrcodeLoginData struct {
	Cookie struct {
		CID  string `json:"CID"`
		SEID string `json:"SEID"`
		UID  string `json:"UID"`
	} `json:"cookie"`
	UserId   int    `json:"user_id"`
	UserName string `json:"user_name"`
	Email    string `json:"email"`
	Mobile   string `json:"mobile"`
	Country  string `json:"country"`
	From     string `json:"from"`
}

type QrcodeStatusData

type QrcodeStatusData struct {
	Status  int    `json:"status"`
	Msg     string `json:"msg"`
	Version string `json:"version"`
}

type QrcodeTokenData

type QrcodeTokenData struct {
	Uid    string `json:"uid"`
	Time   int64  `json:"time"`
	Sign   string `json:"sign"`
	Qrcode string `json:"qrcode"`
}

type StorageSizeInfo

type StorageSizeInfo struct {
	Size       float64 `json:"size"`
	SizeFormat string  `json:"size_format"`
}

type StringFloat64

type StringFloat64 float64

func (*StringFloat64) UnmarshalJSON

func (v *StringFloat64) UnmarshalJSON(b []byte) (err error)

type StringInt

type StringInt int

"IntString" uses for JSON field which's type may be string or int, and store it as int.

func (*StringInt) UnmarshalJSON

func (v *StringInt) UnmarshalJSON(b []byte) (err error)

type StringInt64

type StringInt64 int64

"StringInt64" uses for JSON field which's type may be int64 or string, and store it as int64.

func (*StringInt64) UnmarshalJSON

func (v *StringInt64) UnmarshalJSON(b []byte) (err error)

type UploadData

type UploadData struct {
	AreaId     int         `json:"aid"`
	CategoryId string      `json:"cid"`
	FileId     string      `json:"file_id"`
	FileName   string      `json:"file_name"`
	FileSize   StringInt64 `json:"file_size"`
	FileStatus int         `json:"file_status"`
	FileType   int         `json:"file_type"`
	CreateTime int64       `json:"file_ptime"`
	IsVideo    int         `json:"is_video"`
	PickCode   string      `json:"pick_code"`
	Sha1       string      `json:"sha1"`
}

type UploadInitResult

type UploadInitResult struct {
	Host        string `json:"host"`
	Policy      string `json:"policy"`
	AccessKeyId string `json:"accessid"`
	ObjectKey   string `json:"object"`
	Callback    string `json:"callback"`
	Signature   string `json:"signature"`
	Expire      int64  `json:"expire"`
}

type UploadResult

type UploadResult struct {
	BaseApiResult
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    *UploadData `json:"data"`
}

type UserInfoResult

type UserInfoResult struct {
	BaseApiResult
	Data struct {
		UserId      int    `json:"user_id"`
		UserName    string `json:"user_name"`
		UserAvatar  string `json:"face"`
		Device      int    `json:"device"`
		Rank        int    `json:"rank"`
		VipFlag     int    `json:"vip"`
		VipExpire   int64  `json:"expire"`
		Global      int    `json:"global"`
		Forever     int    `json:"forever"`
		IsPrivilege bool   `json:"is_privilege"`
		Privilege   struct {
			State  bool `json:"state"`
			Start  int  `json:"start"`
			Expire int  `json:"expire"`
		} `json:"privilege"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL