api

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieUrl = "https://115.com"

	CookieNameUID  = "UID"
	CookieNameCID  = "CID"
	CookieNameSEID = "SEID"
)
View Source
const (
	FileOrderByName       = "file_name"
	FileOrderBySize       = "file_size"
	FileOrderByType       = "file_type"
	FileOrderByCreateTime = "user_ptime"
	FileOrderByUpdateTime = "user_utime"
	FileOrderByOpenTime   = "user_otime"
	FileOrderDefault      = FileOrderByCreateTime

	FileListLimit = 32
)
View Source
const (
	LabelListLimit = 30

	LabelColorBlank  = "#000000"
	LabelColorRed    = "#FF4B30"
	LabelColorOrange = "#F78C26"
	LabelColorYellow = "#FFC032"
	LabelColorGreen  = "#43BA80"
	LabelColorBlue   = "#2670FC"
	LabelColorPurple = "#8B69FE"
	LabelColorGray   = "#CCCCCC"
)
View Source
const (
	ShareOneDay  ShareDuration = 1
	ShareOneWeek ShareDuration = 7
	ShareForever ShareDuration = -1

	ShareStateAuditing = 0
	ShareStateAccepted = 1
	ShareStateRejected = 6
)
View Source
const (
	UploadMaxSize       = 5 * 1024 * 1024 * 1024
	UploadMaxSizeSample = 200 * 1024 * 1024
)

Variables

View Source
var (
	CookieDomains = []string{
		".115.com",
		".anxia.com",
	}
)

Functions

func MakeUserAgent

func MakeUserAgent(name, appVer string) string

func ParseFileTime

func ParseFileTime(str string) time.Time

func QrcodeImageUrl

func QrcodeImageUrl(appType, userId string) string

Types

type AppVersionResult

type AppVersionResult struct {
	Android    _AppVersionInfo `json:"android"`
	LinuxApp   _AppVersionInfo `json:"linux_115"`
	MacBrowser _AppVersionInfo `json:"mac"`
	MacApp     _AppVersionInfo `json:"mac_115"`
	WinBrowser _AppVersionInfo `json:"win"`
	WinApp     _AppVersionInfo `json:"window_115"`
}

type AppVersionSpec

type AppVersionSpec struct {
	base.JsonpApiSpec[AppVersionResult, base.StandardResp]
}

func (*AppVersionSpec) Init

func (s *AppVersionSpec) Init() *AppVersionSpec

type DirCreateSpec

type DirCreateSpec struct {
	base.JsonApiSpec[string, _DirCreateResp]
}

func (*DirCreateSpec) Init

func (s *DirCreateSpec) Init(parentId, name string) *DirCreateSpec

type DirLocateSpec

type DirLocateSpec struct {
	base.JsonApiSpec[string, _DirLocateResp]
}

func (*DirLocateSpec) Init

func (s *DirLocateSpec) Init(path string) *DirLocateSpec

type DirSetOrderSpec

type DirSetOrderSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*DirSetOrderSpec) Init

func (s *DirSetOrderSpec) Init(dirId string, order string, asc bool) *DirSetOrderSpec

type DownloadResult

type DownloadResult map[string]*_DownloadInfo

type DownloadSpec

type DownloadSpec struct {
	base.M115ApiSpec[DownloadResult]
}

func (*DownloadSpec) Init

func (s *DownloadSpec) Init(pickcode string) *DownloadSpec

type FileCopySpec

type FileCopySpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileCopySpec) Init

func (s *FileCopySpec) Init(dirId string, fileIds []string) *FileCopySpec

type FileDeleteSpec

type FileDeleteSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileDeleteSpec) Init

func (s *FileDeleteSpec) Init(fileIds []string) *FileDeleteSpec

type FileGetResult

type FileGetResult []*FileInfo

type FileGetSpec

type FileGetSpec struct {
	base.JsonApiSpec[FileGetResult, base.StandardResp]
}

func (*FileGetSpec) Init

func (s *FileGetSpec) Init(fileId string) *FileGetSpec

type FileInfo

type FileInfo struct {
	AreaId     base.IntNumber `json:"aid"`
	CategoryId string         `json:"cid"`
	FileId     string         `json:"fid"`
	ParentId   string         `json:"pid"`

	Name     string         `json:"n"`
	Type     string         `json:"ico"`
	Size     base.IntNumber `json:"s"`
	Sha1     string         `json:"sha"`
	PickCode string         `json:"pc"`

	IsStar base.Boolean `json:"m"`
	Labels []LabelInfo  `json:"fl"`

	CreatedTime  string `json:"tp"`
	UpdatedTime  string `json:"te"`
	ModifiedTime string `json:"t"`

	// MediaDuration describes duration in seconds for audio/video.
	MediaDuration float64 `json:"play_long"`

	// Special fields for video
	VideoFlag       int `json:"iv"`
	VideoDefinition int `json:"vdi"`
}

type FileLabelSpec

type FileLabelSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileLabelSpec) Init

func (s *FileLabelSpec) Init(fileId string, labelIds []string) *FileLabelSpec

type FileListResult

type FileListResult struct {
	DirId  string
	Offset int

	Count int
	Files []*FileInfo

	// Order settings
	Order string
	Asc   int
}

type FileListSpec

type FileListSpec struct {
	base.JsonApiSpec[FileListResult, _FileListResp]
}

func (*FileListSpec) Init

func (s *FileListSpec) Init(dirId string, offset int) *FileListSpec

func (*FileListSpec) SetFileType

func (s *FileListSpec) SetFileType(fileType int)

func (*FileListSpec) SetOrder

func (s *FileListSpec) SetOrder(order string, asc int)

func (*FileListSpec) SetStared

func (s *FileListSpec) SetStared()

func (*FileListSpec) Url

func (s *FileListSpec) Url() string

type FileMoveSpec

type FileMoveSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileMoveSpec) Init

func (s *FileMoveSpec) Init(dirId string, fileIds []string) *FileMoveSpec

type FileRenameSpec

type FileRenameSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileRenameSpec) Add

func (s *FileRenameSpec) Add(fileId, newName string)

func (*FileRenameSpec) Init

func (s *FileRenameSpec) Init() *FileRenameSpec

type FileSearchSpec

type FileSearchSpec struct {
	base.JsonApiSpec[FileListResult, _FileSearchResp]
}

func (*FileSearchSpec) ByKeyword

func (s *FileSearchSpec) ByKeyword(dirId, keyword string)

func (*FileSearchSpec) ByLabelId

func (s *FileSearchSpec) ByLabelId(labelId string)

func (*FileSearchSpec) Init

func (s *FileSearchSpec) Init(offset int) *FileSearchSpec

func (*FileSearchSpec) SetFileType

func (s *FileSearchSpec) SetFileType(fileType int)

type FileStarSpec

type FileStarSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*FileStarSpec) Init

func (s *FileStarSpec) Init(fileId string, star bool) *FileStarSpec

type ImageGetResult

type ImageGetResult struct {
	FileName string `json:"file_name"`
	FileSha1 string `json:"file_sha1"`
	Pickcode string `json:"pick_code"`

	SourceUrl string   `json:"source_url"`
	OriginUrl string   `json:"origin_url"`
	ViewUrl   string   `json:"url"`
	ThumbUrls []string `json:"all_url"`
}

type ImageGetSpec

type ImageGetSpec struct {
	base.JsonApiSpec[ImageGetResult, base.StandardResp]
}

func (*ImageGetSpec) Init

func (s *ImageGetSpec) Init(pickcode string) *ImageGetSpec

type IndexInfoResult

type IndexInfoResult struct {
	SpaceInfo struct {
		Total  _SizeInfo `json:"all_total"`
		Remain _SizeInfo `json:"all_remain"`
		Used   _SizeInfo `json:"all_use"`
	} `json:"space_info"`
	LoginInfos struct {
		List []*_LoginInfo
	} `json:"login_devices_info"`
}

type IndexInfoSpec

type IndexInfoSpec struct {
	base.JsonApiSpec[IndexInfoResult, base.StandardResp]
}

func (*IndexInfoSpec) Init

func (s *IndexInfoSpec) Init() *IndexInfoSpec

type LabelCreateResult

type LabelCreateResult []*LabelInfo

type LabelCreateSpec

type LabelCreateSpec struct {
	base.JsonApiSpec[LabelCreateResult, base.StandardResp]
}

func (*LabelCreateSpec) Init

func (s *LabelCreateSpec) Init(name, color string) *LabelCreateSpec

type LabelDeleteSpec

type LabelDeleteSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*LabelDeleteSpec) Init

func (s *LabelDeleteSpec) Init(labelId string) *LabelDeleteSpec

type LabelEditSpec

type LabelEditSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*LabelEditSpec) Init

func (s *LabelEditSpec) Init(labelId, name, color string) *LabelEditSpec

type LabelInfo

type LabelInfo struct {
	Id         string         `json:"id"`
	Name       string         `json:"name"`
	Color      string         `json:"color"`
	Sort       base.IntNumber `json:"sort"`
	CreateTime int64          `json:"create_time"`
	UpdateTime int64          `json:"update_time"`
}

type LabelListResult

type LabelListResult struct {
	Total int          `json:"total"`
	List  []*LabelInfo `json:"list"`
	Sort  string       `json:"sort"`
	Order string       `json:"order"`
}

type LabelListSpec

type LabelListSpec struct {
	base.JsonApiSpec[LabelListResult, base.StandardResp]
}

func (*LabelListSpec) Init

func (s *LabelListSpec) Init(offset int) *LabelListSpec

type LabelSetOrderSpec

type LabelSetOrderSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*LabelSetOrderSpec) Init

func (s *LabelSetOrderSpec) Init(labelId string, order string, asc bool) *LabelSetOrderSpec

type OfflineAddUrlsResult

type OfflineAddUrlsResult []*OfflineTask

type OfflineAddUrlsSpec

type OfflineAddUrlsSpec struct {
	base.M115ApiSpec[OfflineAddUrlsResult]
}

func (*OfflineAddUrlsSpec) Init

func (s *OfflineAddUrlsSpec) Init(userId, appVer string, urls []string, saveDirId string) *OfflineAddUrlsSpec

type OfflineClearSpec

type OfflineClearSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*OfflineClearSpec) Init

func (s *OfflineClearSpec) Init(flag int) *OfflineClearSpec

type OfflineDeleteSpec

type OfflineDeleteSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*OfflineDeleteSpec) Init

func (s *OfflineDeleteSpec) Init(hashes []string, deleteFiles bool) *OfflineDeleteSpec

type OfflineListResult

type OfflineListResult struct {
	PageIndex int
	PageCount int
	PageSize  int

	TaskCount int
	Tasks     []*OfflineTask
}

type OfflineListSpec

type OfflineListSpec struct {
	base.JsonApiSpec[OfflineListResult, _OfflineListResp]
}

func (*OfflineListSpec) Init

func (s *OfflineListSpec) Init(page int) *OfflineListSpec

type OfflineTask

type OfflineTask struct {
	InfoHash string `json:"info_hash"`
	Name     string `json:"name"`
	Size     int64  `json:"size"`
	Url      string `json:"url"`
	AddTime  int64  `json:"add_time"`

	Status     int     `json:"status"`
	Percent    float64 `json:"percentDone"`
	UpdateTime int64   `json:"last_update"`

	FileId string `json:"file_id"`
	DirId  string `json:"wp_path_id"`
}

type QrcodeLoginResult

type QrcodeLoginResult 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"`
}

type QrcodeLoginSpec

type QrcodeLoginSpec struct {
	base.JsonApiSpec[QrcodeLoginResult, _QrcodeBaseResp]
}

func (*QrcodeLoginSpec) Init

func (s *QrcodeLoginSpec) Init(appType string, uid string) *QrcodeLoginSpec

type QrcodeStatusResult

type QrcodeStatusResult struct {
	Status  int    `json:"status,omitempty"`
	Message string `json:"msg,omitempty"`
	Version string `json:"version,omitempty"`
}

type QrcodeStatusSpec

type QrcodeStatusSpec struct {
	base.JsonApiSpec[QrcodeStatusResult, _QrcodeBaseResp]
}

func (*QrcodeStatusSpec) Init

func (s *QrcodeStatusSpec) Init(uid string, time int64, sign string) *QrcodeStatusSpec

type QrcodeTokenResult

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

type QrcodeTokenSpec

type QrcodeTokenSpec struct {
	base.JsonApiSpec[QrcodeTokenResult, _QrcodeBaseResp]
}

func (*QrcodeTokenSpec) Init

func (s *QrcodeTokenSpec) Init(appType string) *QrcodeTokenSpec

type RecycleBinCleanSpec

type RecycleBinCleanSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*RecycleBinCleanSpec) Init

func (s *RecycleBinCleanSpec) Init(password string) *RecycleBinCleanSpec

type RecycleBinItem

type RecycleBinItem struct {
	FileId     string         `json:"id"`
	FileName   string         `json:"file_name"`
	FileSize   base.IntNumber `json:"file_size"`
	ParentId   string         `json:"cid"`
	ParentName string         `json:"parent_name"`
	DeleteTime base.IntNumber `json:"dtime"`
}

type RecycleBinListResult

type RecycleBinListResult struct {
	Count int
	Item  []*RecycleBinItem
}

type RecycleBinListSpec

type RecycleBinListSpec struct {
	base.JsonApiSpec[RecycleBinListResult, _RecycleBinListResp]
}

func (*RecycleBinListSpec) Init

func (s *RecycleBinListSpec) Init(offset int) *RecycleBinListSpec

type ShareCancelSpec

type ShareCancelSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*ShareCancelSpec) Init

func (s *ShareCancelSpec) Init(shareCode string) *ShareCancelSpec

type ShareDuration

type ShareDuration int

type ShareGetSpec

type ShareGetSpec struct {
	base.JsonApiSpec[ShareInfo, base.StandardResp]
}

func (*ShareGetSpec) Init

func (s *ShareGetSpec) Init(shareCode string) *ShareGetSpec

type ShareInfo

type ShareInfo struct {
	ShareCode string `json:"share_code"`

	ShareState    base.IntNumber `json:"share_state"`
	ShareTitle    string         `json:"share_title"`
	ShareUrl      string         `json:"share_url"`
	ShareDuration base.IntNumber `json:"share_ex_time"`
	ReceiveCode   string         `json:"receive_code"`

	ReceiveCount base.IntNumber `json:"receive_count"`

	FileCount   int            `json:"file_count"`
	FolderCount int            `json:"folder_count"`
	TotalSize   base.IntNumber `json:"total_size"`
}

type ShareListResult

type ShareListResult struct {
	Count int
	Items []*ShareInfo
}

type ShareListSpec

type ShareListSpec struct {
	base.JsonApiSpec[ShareListResult, _ShareListResp]
}

func (*ShareListSpec) Init

func (s *ShareListSpec) Init(offset int, userId string) *ShareListSpec

type ShareSendSpec

type ShareSendSpec struct {
	base.JsonApiSpec[ShareInfo, base.StandardResp]
}

func (*ShareSendSpec) Init

func (s *ShareSendSpec) Init(fileIds []string, userId string) *ShareSendSpec

type ShareUpdateSpec

type ShareUpdateSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*ShareUpdateSpec) Init

func (s *ShareUpdateSpec) Init(
	shareCode string, receiveCode string, duration ShareDuration,
) *ShareUpdateSpec

type ShortcutAddSpec added in v0.5.2

type ShortcutAddSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*ShortcutAddSpec) Init added in v0.5.2

func (s *ShortcutAddSpec) Init(fileId string) *ShortcutAddSpec

type ShortcutDeleteSpec added in v0.5.2

type ShortcutDeleteSpec struct {
	base.JsonApiSpec[base.VoidResult, base.BasicResp]
}

func (*ShortcutDeleteSpec) Init added in v0.5.2

func (s *ShortcutDeleteSpec) Init(fileId string) *ShortcutDeleteSpec

type ShortcutInfo added in v0.5.2

type ShortcutInfo struct {
	FileId   string `json:"file_id"`
	FileName string `json:"file_name"`
	Sort     string `json:"sort"`
}

type ShortcutListResult added in v0.5.2

type ShortcutListResult struct {
	List []ShortcutInfo `json:"list"`
}

type ShortcutListSpec added in v0.5.2

type ShortcutListSpec struct {
	base.JsonApiSpec[ShortcutListResult, base.StandardResp]
}

func (*ShortcutListSpec) Init added in v0.5.2

func (s *ShortcutListSpec) Init(fileId string) *ShortcutListSpec

type UploadHelper

type UploadHelper struct {
	AppVer string
	UserId string
	// contains filtered or unexported fields
}

func (*UploadHelper) CalcSign

func (h *UploadHelper) CalcSign(fileId, target string) string

func (*UploadHelper) CalcToken

func (h *UploadHelper) CalcToken(
	fileId string, fileSize int64,
	signKey, signValue string,
	timestamp int64,
) string

func (*UploadHelper) SetUserParams

func (h *UploadHelper) SetUserParams(userId int, userKey string)

type UploadInfoResult

type UploadInfoResult struct {
	UserId  int
	UserKey string
}

type UploadInfoSpec

type UploadInfoSpec struct {
	base.JsonApiSpec[UploadInfoResult, _UploadInfoResp]
}

func (*UploadInfoSpec) Init

func (s *UploadInfoSpec) Init() *UploadInfoSpec

type UploadInitParams

type UploadInitParams struct {
	// File metadata
	FileId   string
	FileName string
	FileSize int64
	// Target directory
	Target string
	// Upload signature
	Signature string
	// Sign parameters for 2nd-pass
	SignKey   string
	SignValue string
}

type UploadInitResult

type UploadInitResult struct {
	Exists bool
	// Upload parameters
	Oss struct {
		Bucket      string
		Object      string
		Callback    string
		CallbackVar string
	}
	SignKey   string
	SignCheck string
}

type UploadInitSpec

type UploadInitSpec struct {
	base.JsonApiSpec[UploadInitResult, _UploadInitResp]
}

func (*UploadInitSpec) Init

func (s *UploadInitSpec) Init(params *UploadInitParams, helper *UploadHelper) *UploadInitSpec

type UploadSampleInitResult

type UploadSampleInitResult struct {
	Host        string
	Object      string
	Callback    string
	AccessKeyId string
	Policy      string
	Signature   string
}

type UploadSampleInitSpec

type UploadSampleInitSpec struct {
	base.JsonApiSpec[UploadSampleInitResult, _UploadSampleInitResp]
}

func (*UploadSampleInitSpec) Init

func (s *UploadSampleInitSpec) Init(userId string, fileName string, fileSize int64, target string) *UploadSampleInitSpec

type UploadSampleResult

type UploadSampleResult struct {
	AreaId     base.IntNumber `json:"aid"`
	CategoryId string         `json:"cid"`
	FileId     string         `json:"file_id"`
	FileName   string         `json:"file_name"`
	FileSize   base.IntNumber `json:"file_size"`
	FileSha1   string         `json:"sha1"`
	PickCode   string         `json:"pick_code"`
	CreateTime base.IntNumber `json:"file_ptime"`
}

type UploadSampleSpec

type UploadSampleSpec struct {
	base.JsonApiSpec[UploadSampleResult, base.StandardResp]
	// contains filtered or unexported fields
}

func (*UploadSampleSpec) Init

func (s *UploadSampleSpec) Init(url string, payload protocol.Payload) *UploadSampleSpec

func (*UploadSampleSpec) Payload

func (s *UploadSampleSpec) Payload() protocol.Payload

type UploadTokenResult

type UploadTokenResult struct {
	AccessKeyId     string
	AccessKeySecret string
	SecurityToken   string
	Expiration      time.Time
}

type UploadTokenSpec

type UploadTokenSpec struct {
	base.JsonApiSpec[UploadTokenResult, _UploadTokenResp]
}

func (*UploadTokenSpec) Init

func (s *UploadTokenSpec) Init() *UploadTokenSpec

type UserInfoResult

type UserInfoResult struct {
	UserId    int    `json:"user_id"`
	UserName  string `json:"user_name"`
	AvatarUrl string `json:"face"`
	IsVip     int    `json:"vip"`
}

type UserInfoSpec

type UserInfoSpec struct {
	base.JsonApiSpec[UserInfoResult, base.StandardResp]
}

func (*UserInfoSpec) Init

func (s *UserInfoSpec) Init() *UserInfoSpec

type VideoPlayPcSpec

type VideoPlayPcSpec struct {
	base.M115ApiSpec[VideoPlayResult]
}

func (*VideoPlayPcSpec) Init

func (s *VideoPlayPcSpec) Init(userId, appVer, pickcode string) *VideoPlayPcSpec

type VideoPlayResult

type VideoPlayResult struct {
	IsReady       bool
	FileId        string
	FileName      string
	FileSize      int64
	VideoDuration float64
	VideoWidth    int
	VideoHeight   int
	VideoUrl      string
}

type VideoPlayWebSpec

type VideoPlayWebSpec struct {
	base.JsonApiSpec[VideoPlayResult, _VideoPlayWebResp]
}

func (*VideoPlayWebSpec) Init

func (s *VideoPlayWebSpec) Init(pickcode string) *VideoPlayWebSpec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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