_189_tv

package
v4.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: AGPL-3.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TVAppKey            = "600100885"
	TVAppSignatureSecre = "fe5734c74c2f96a38157f420b32dc995"
	TvVersion           = "6.5.5"
	AndroidTV           = "FAMILY_TV"
	TvChannelId         = "home02"

	ApiUrl = "https://api.cloud.189.cn"
)

Variables

View Source
var ErrIsConflict = errors.New("there is a conflict with the target object")

Functions

func AppKeySignatureOfHmac

func AppKeySignatureOfHmac(sessionSecret, appKey, operate, fullUrl string, timestamp int64) string

AppKeySignatureOfHmac HMAC签名

func BoolToNumber

func BoolToNumber(b bool) int

func IF

func IF[V any](o bool, t V, f V) V

func MustString

func MustString(str string, err error) string

func ParseHttpHeader

func ParseHttpHeader(str string) map[string]string

func SessionKeySignatureOfHmac

func SessionKeySignatureOfHmac(sessionSecret, sessionKey, operate, fullUrl, dateOfGmt string) string

SessionKeySignatureOfHmac HMAC签名

Types

type Addition

type Addition struct {
	driver.RootID
	AccessToken    string `json:"access_token"`
	OrderBy        string `json:"order_by" type:"select" options:"filename,filesize,lastOpTime" default:"filename"`
	OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
	Type           string `json:"type" type:"select" options:"personal,family" default:"personal"`
	FamilyID       string `json:"family_id"`
	UploadThread   string `json:"upload_thread" default:"3" help:"1<=thread<=32"`
	RapidUpload    bool   `json:"rapid_upload"`
}

type AppSessionResp

type AppSessionResp struct {
	UserSessionResp

	IsSaveName string `json:"isSaveName"`

	// 会话刷新Token
	AccessToken string `json:"accessToken"`
	//Token刷新
	RefreshToken string `json:"refreshToken"`
}

登录返回

type BatchTaskConflictTaskInfoResp

type BatchTaskConflictTaskInfoResp struct {
	SessionKey     string `json:"sessionKey"`
	TargetFolderID int    `json:"targetFolderId"`
	TaskID         string `json:"taskId"`
	TaskInfos      []BatchTaskInfo
	TaskType       int `json:"taskType"`
}

type BatchTaskInfo

type BatchTaskInfo struct {
	// FileId 文件ID
	FileId string `json:"fileId"`
	// FileName 文件名
	FileName string `json:"fileName"`
	// IsFolder 是否是文件夹,0-否,1-是
	IsFolder int `json:"isFolder"`
	// SrcParentId 文件所在父目录ID
	SrcParentId string `json:"srcParentId,omitempty"`

	/* 冲突管理 */
	// 1 -> 跳过 2 -> 保留 3 -> 覆盖
	DealWay    int `json:"dealWay,omitempty"`
	IsConflict int `json:"isConflict,omitempty"`
}

TaskInfo 任务信息

type BatchTaskStateResp

type BatchTaskStateResp struct {
	FailedCount         int     `json:"failedCount"`
	Process             int     `json:"process"`
	SkipCount           int     `json:"skipCount"`
	SubTaskCount        int     `json:"subTaskCount"`
	SuccessedCount      int     `json:"successedCount"`
	SuccessedFileIDList []int64 `json:"successedFileIdList"`
	TaskID              string  `json:"taskId"`
	TaskStatus          int     `json:"taskStatus"` //1 初始化 2 存在冲突 3 执行中,4 完成
}

type CapacityResp added in v4.1.4

type CapacityResp struct {
	ResCode           int    `json:"res_code"`
	ResMessage        string `json:"res_message"`
	Account           string `json:"account"`
	CloudCapacityInfo struct {
		FreeSize     int64 `json:"freeSize"`
		MailUsedSize int64 `json:"mail189UsedSize"`
		TotalSize    int64 `json:"totalSize"`
		UsedSize     int64 `json:"usedSize"`
	} `json:"cloudCapacityInfo"`
	FamilyCapacityInfo struct {
		FreeSize  int64 `json:"freeSize"`
		TotalSize int64 `json:"totalSize"`
		UsedSize  int64 `json:"usedSize"`
	} `json:"familyCapacityInfo"`
	TotalSize uint64 `json:"totalSize"`
}

type Cloud189File

type Cloud189File struct {
	ID   String `json:"id"`
	Name string `json:"name"`
	Size int64  `json:"size"`
	Md5  string `json:"md5"`

	LastOpTime Time `json:"lastOpTime"`
	CreateDate Time `json:"createDate"`
	Icon       struct {
		//iconOption 5
		SmallUrl string `json:"smallUrl"`
		LargeUrl string `json:"largeUrl"`

		// iconOption 10
		Max600    string `json:"max600"`
		MediumURL string `json:"mediumUrl"`
	} `json:"icon"`
}

文件部分 文件

func (*Cloud189File) CreateTime

func (c *Cloud189File) CreateTime() time.Time

func (*Cloud189File) GetHash

func (c *Cloud189File) GetHash() utils.HashInfo

func (*Cloud189File) GetID

func (c *Cloud189File) GetID() string

func (*Cloud189File) GetName

func (c *Cloud189File) GetName() string

func (*Cloud189File) GetPath

func (c *Cloud189File) GetPath() string

func (*Cloud189File) GetSize

func (c *Cloud189File) GetSize() int64

func (*Cloud189File) IsDir

func (c *Cloud189File) IsDir() bool

func (*Cloud189File) ModTime

func (c *Cloud189File) ModTime() time.Time

func (*Cloud189File) Thumb

func (c *Cloud189File) Thumb() string

type Cloud189FilesResp

type Cloud189FilesResp struct {
	//ResCode    int    `json:"res_code"`
	//ResMessage string `json:"res_message"`
	FileListAO struct {
		Count      int              `json:"count"`
		FileList   []Cloud189File   `json:"fileList"`
		FolderList []Cloud189Folder `json:"folderList"`
	} `json:"fileListAO"`
}

type Cloud189Folder

type Cloud189Folder struct {
	ID       String `json:"id"`
	ParentID int64  `json:"parentId"`
	Name     string `json:"name"`

	LastOpTime Time `json:"lastOpTime"`
	CreateDate Time `json:"createDate"`
}

文件夹

func (*Cloud189Folder) CreateTime

func (c *Cloud189Folder) CreateTime() time.Time

func (*Cloud189Folder) GetHash

func (c *Cloud189Folder) GetHash() utils.HashInfo

func (*Cloud189Folder) GetID

func (c *Cloud189Folder) GetID() string

func (*Cloud189Folder) GetName

func (c *Cloud189Folder) GetName() string

func (*Cloud189Folder) GetPath

func (c *Cloud189Folder) GetPath() string

func (*Cloud189Folder) GetSize

func (c *Cloud189Folder) GetSize() int64

func (*Cloud189Folder) IsDir

func (c *Cloud189Folder) IsDir() bool

func (*Cloud189Folder) ModTime

func (c *Cloud189Folder) ModTime() time.Time

type Cloud189TV

type Cloud189TV struct {
	model.Storage
	Addition

	TempUuid string
	// contains filtered or unexported fields
}

func (*Cloud189TV) AppKeySignatureHeader

func (y *Cloud189TV) AppKeySignatureHeader(url, method string) map[string]string

func (*Cloud189TV) CheckBatchTask

func (y *Cloud189TV) CheckBatchTask(aType string, taskID string) (*BatchTaskStateResp, error)

检测任务状态

func (*Cloud189TV) Config

func (y *Cloud189TV) Config() driver.Config

func (*Cloud189TV) Copy

func (y *Cloud189TV) Copy(ctx context.Context, srcObj, dstDir model.Obj) error

func (*Cloud189TV) CreateBatchTask

func (y *Cloud189TV) CreateBatchTask(aType string, familyID string, targetFolderId string, other map[string]string, taskInfos ...BatchTaskInfo) (*CreateBatchTaskResp, error)

func (*Cloud189TV) Drop

func (y *Cloud189TV) Drop(ctx context.Context) error

func (*Cloud189TV) GetAddition

func (y *Cloud189TV) GetAddition() driver.Additional

func (*Cloud189TV) GetConflictTaskInfo

func (y *Cloud189TV) GetConflictTaskInfo(aType string, taskID string) (*BatchTaskConflictTaskInfoResp, error)

获取冲突的任务信息

func (*Cloud189TV) GetDetails added in v4.1.4

func (y *Cloud189TV) GetDetails(ctx context.Context) (*model.StorageDetails, error)

func (*Cloud189TV) Init

func (y *Cloud189TV) Init(ctx context.Context) (err error)
func (y *Cloud189TV) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*Cloud189TV) List

func (y *Cloud189TV) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

func (*Cloud189TV) MakeDir

func (y *Cloud189TV) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)

func (*Cloud189TV) ManageBatchTask

func (y *Cloud189TV) ManageBatchTask(aType string, taskID string, targetFolderId string, taskInfos ...BatchTaskInfo) error

处理冲突

func (*Cloud189TV) Move

func (y *Cloud189TV) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)

func (*Cloud189TV) OldUpload

func (y *Cloud189TV) OldUpload(ctx context.Context, dstDir model.Obj, file model.FileStreamer, up driver.UpdateProgress, isFamily bool, overwrite bool) (model.Obj, error)

旧版本上传,家庭云不支持覆盖

func (*Cloud189TV) OldUploadCommit

func (y *Cloud189TV) OldUploadCommit(ctx context.Context, fileCommitUrl string, uploadFileID int64, isFamily bool, overwrite bool) (model.Obj, error)

提交上传文件

func (*Cloud189TV) OldUploadCreate

func (y *Cloud189TV) OldUploadCreate(ctx context.Context, parentID string, fileMd5, fileName, fileSize string, isFamily bool) (*CreateUploadFileResp, error)

创建上传会话

func (*Cloud189TV) Put

func (y *Cloud189TV) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) (newObj model.Obj, err error)

func (*Cloud189TV) RapidUpload

func (y *Cloud189TV) RapidUpload(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, isFamily bool, overwrite bool) (model.Obj, error)

func (*Cloud189TV) Remove

func (y *Cloud189TV) Remove(ctx context.Context, obj model.Obj) error

func (*Cloud189TV) Rename

func (y *Cloud189TV) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)

func (*Cloud189TV) SignatureHeader

func (y *Cloud189TV) SignatureHeader(url, method string, isFamily bool) map[string]string

func (*Cloud189TV) WaitBatchTask

func (y *Cloud189TV) WaitBatchTask(aType string, taskID string, t time.Duration) error

等待任务完成

type CommitMultiUploadFileResp

type CommitMultiUploadFileResp struct {
	File struct {
		UserFileID String `json:"userFileId"`
		FileName   string `json:"fileName"`
		FileSize   int64  `json:"fileSize"`
		FileMd5    string `json:"fileMd5"`
		CreateDate Time   `json:"createDate"`
	} `json:"file"`
}

type CreateBatchTaskResp

type CreateBatchTaskResp struct {
	TaskID string `json:"taskId"`
}

type CreateUploadFileResp

type CreateUploadFileResp struct {
	// 上传文件请求ID
	UploadFileId int64 `json:"uploadFileId"`
	// 上传文件数据的URL路径
	FileUploadUrl string `json:"fileUploadUrl"`
	// 上传文件完成后确认路径
	FileCommitUrl string `json:"fileCommitUrl"`
	// 文件是否已存在云盘中,0-未存在,1-已存在
	FileDataExists int `json:"fileDataExists"`
}

第二种上传方式

type E189AccessTokenResp

type E189AccessTokenResp struct {
	E189AccessToken string `json:"accessToken"`
	ExpiresIn       int64  `json:"expiresIn"`
}

type FamilyInfoListResp

type FamilyInfoListResp struct {
	FamilyInfoResp []FamilyInfoResp `json:"familyInfoResp"`
}

家庭云账户

type FamilyInfoResp

type FamilyInfoResp struct {
	Count      int    `json:"count"`
	CreateTime string `json:"createTime"`
	FamilyID   int64  `json:"familyId"`
	RemarkName string `json:"remarkName"`
	Type       int    `json:"type"`
	UseFlag    int    `json:"useFlag"`
	UserRole   int    `json:"userRole"`
}

type GetUploadFileStatusResp

type GetUploadFileStatusResp struct {
	CreateUploadFileResp

	// 已上传的大小
	DataSize int64 `json:"dataSize"`
	Size     int64 `json:"size"`
}

func (*GetUploadFileStatusResp) GetSize

func (r *GetUploadFileStatusResp) GetSize() int64

type InitMultiUploadResp

type InitMultiUploadResp struct {
	//Code string `json:"code"`
	Data struct {
		UploadType     int    `json:"uploadType"`
		UploadHost     string `json:"uploadHost"`
		UploadFileID   string `json:"uploadFileId"`
		FileDataExists int    `json:"fileDataExists"`
	} `json:"data"`
}

上传部分

type OldCommitUploadFileResp

type OldCommitUploadFileResp struct {
	XMLName    xml.Name `xml:"file"`
	ID         String   `xml:"id"`
	Name       string   `xml:"name"`
	Size       int64    `xml:"size"`
	Md5        string   `xml:"md5"`
	CreateDate Time     `xml:"createDate"`
}

type RespErr

type RespErr struct {
	ResCode    any    `json:"res_code"` // int or string
	ResMessage string `json:"res_message"`

	Error_ string `json:"error"`

	XMLName xml.Name `xml:"error"`
	Code    string   `json:"code" xml:"code"`
	Message string   `json:"message" xml:"message"`
	Msg     string   `json:"msg"`

	ErrorCode string `json:"errorCode"`
	ErrorMsg  string `json:"errorMsg"`
}

居然有四种返回方式

func (*RespErr) Error

func (e *RespErr) Error() string

func (*RespErr) HasError

func (e *RespErr) HasError() bool

type String

type String string

func (*String) Unmarshal

func (s *String) Unmarshal(b []byte) error

func (*String) UnmarshalJSON

func (t *String) UnmarshalJSON(b []byte) error

func (*String) UnmarshalXML

func (t *String) UnmarshalXML(e *xml.Decoder, ee xml.StartElement) error

type Time

type Time time.Time

func (*Time) Unmarshal

func (t *Time) Unmarshal(b []byte) error

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

func (*Time) UnmarshalXML

func (t *Time) UnmarshalXML(e *xml.Decoder, ee xml.StartElement) error

type UploadUrlsData

type UploadUrlsData struct {
	RequestURL    string `json:"requestURL"`
	RequestHeader string `json:"requestHeader"`
}

type UploadUrlsResp

type UploadUrlsResp struct {
	Code string                    `json:"code"`
	Data map[string]UploadUrlsData `json:"uploadUrls"`
}

type UserSessionResp

type UserSessionResp struct {
	ResCode    int    `json:"res_code"`
	ResMessage string `json:"res_message"`

	LoginName string `json:"loginName"`

	KeepAlive       int `json:"keepAlive"`
	GetFileDiffSpan int `json:"getFileDiffSpan"`
	GetUserInfoSpan int `json:"getUserInfoSpan"`

	// 个人云
	SessionKey    string `json:"sessionKey"`
	SessionSecret string `json:"sessionSecret"`
	// 家庭云
	FamilySessionKey    string `json:"familySessionKey"`
	FamilySessionSecret string `json:"familySessionSecret"`
}

刷新session返回

type UuidInfoResp

type UuidInfoResp struct {
	Uuid string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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