_189pc

package
v4.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PC  = "TELEPC"  // PC客户端标识
	MAC = "TELEMAC" // MAC客户端标识

)

常量定义,包含189云盘的账户类型、应用ID、客户端类型、版本号及相关URL

Variables

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

Functions

func AesECBEncrypt

func AesECBEncrypt(data, key string) string

AesECBEncrypt 使用AES-ECB模式加密数据 参数:

  • data: 要加密的数据
  • key: 加密密钥

返回值: 大写的十六进制加密字符串

func BoolToNumber

func BoolToNumber(b bool) int

BoolToNumber 将布尔值转换为数字 参数:

  • b: 布尔值

返回值: 布尔值对应的数字(true=1, false=0)

func IF

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

IF 泛型条件选择函数 根据条件选择两个值中的一个 参数:

  • o: 条件
  • t: 条件为true时返回的值
  • f: 条件为false时返回的值

返回值: 根据条件选择的值

func MustParseTime

func MustParseTime(str string) *time.Time

MustParseTime 解析时间字符串为时间对象 参数:

  • str: 时间字符串,格式为 "2006-01-02 15:04:05"

返回值: 解析后的时间对象指针

func MustString

func MustString(str string, err error) string

MustString 忽略错误获取字符串 参数:

  • str: 字符串值
  • err: 错误对象(被忽略)

返回值: 原始字符串

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding 实现PKCS#7填充 参数:

  • ciphertext: 要填充的数据
  • blockSize: 块大小

返回值: 填充后的数据

func ParseHttpHeader

func ParseHttpHeader(str string) map[string]string

ParseHttpHeader 解析HTTP头部字符串为映射 参数:

  • str: HTTP头部字符串,格式为 "key1=value1&key2=value2"

返回值: 解析后的头部映射

func RsaEncrypt

func RsaEncrypt(publicKey, origData string) string

RsaEncrypt 使用RSA加密数据 使用公钥对原始数据进行加密 参数:

  • publicKey: PEM格式的RSA公钥
  • origData: 要加密的原始数据

返回值: 大写的十六进制加密字符串

Types

type Addition

type Addition struct {
	driver.RootID
	Username       string `json:"username" required:"true"`                                                         // 用户名,用于登录189云盘
	Password       string `json:"password" required:"true"`                                                         // 密码,用于登录189云盘
	ValidateCode   string `json:"validate_code"`                                                                    // 验证码,用于额外的身份验证
	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"`                                                                        // 家庭ID,当类型为家庭时使用
	UploadMethod   string `json:"upload_method" type:"select" options:"stream,rapid,old" default:"stream"`          // 上传方法,流式、快速或旧版
	UploadThread   string `json:"upload_thread" default:"3" help:"1<=thread<=32"`                                   // 上传线程数,范围1到32
	FamilyTransfer bool   `json:"family_transfer"`                                                                  // 是否启用家庭账户文件转移
	RapidUpload    bool   `json:"rapid_upload"`                                                                     // 是否启用快速上传模式
	NoUseOcr       bool   `json:"no_use_ocr"`                                                                       // 是否禁用OCR功能
}

Addition 存储189云盘的配置信息,包含用户凭据、排序规则、上传方式等设置。

type AppSessionResp

type AppSessionResp struct {
	UserSessionResp

	IsSaveName string `json:"isSaveName"` // 是否保存用户名

	// 会话刷新令牌
	AccessToken string `json:"accessToken"` // 访问令牌,用于API调用
	// 令牌刷新
	RefreshToken string `json:"refreshToken"` // 刷新令牌,用于更新访问令牌
}

AppSessionResp 登录返回的会话信息,包含访问令牌和刷新令牌。

type BatchTaskConflictTaskInfoResp

type BatchTaskConflictTaskInfoResp struct {
	SessionKey     string          `json:"sessionKey"`     // 会话密钥
	TargetFolderID int             `json:"targetFolderId"` // 目标文件夹ID
	TaskID         string          `json:"taskId"`         // 任务ID
	TaskInfos      []BatchTaskInfo // 任务信息列表
	TaskType       int             `json:"taskType"` // 任务类型
}

BatchTaskConflictTaskInfoResp 批量任务冲突信息响应,包含任务ID和冲突文件信息。

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

BatchTaskInfo 批量任务信息

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 完成
}

BatchTaskStateResp 批量任务状态响应

type Cloud189File

type Cloud189File struct {
	ID   String `json:"id"`   // 文件ID
	Name string `json:"name"` // 文件名称
	Size int64  `json:"size"` // 文件大小
	Md5  string `json:"md5"`  // 文件MD5值

	LastOpTime Time `json:"lastOpTime"` // 最后操作时间
	CreateDate Time `json:"createDate"` // 创建时间
	Icon       struct {
		// iconOption 5
		SmallURL string `json:"smallUrl"` // 小图标URL
		LargeURL string `json:"largeUrl"` // 大图标URL

		// iconOption 10
		Max600    string `json:"max600"`    // 最大600尺寸图标URL
		MediumURL string `json:"mediumUrl"` // 中等尺寸图标URL
	} `json:"icon"` // 图标信息

}

Cloud189File 表示189云盘中的文件,包含文件的基本信息和图标链接。

func (*Cloud189File) CreateTime

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

CreateTime 获取文件的创建时间。

func (*Cloud189File) GetHash

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

GetHash 获取文件的哈希信息。

func (*Cloud189File) GetID

func (c *Cloud189File) GetID() string

GetID 获取文件ID。

func (*Cloud189File) GetName

func (c *Cloud189File) GetName() string

GetName 获取文件名称。

func (*Cloud189File) GetPath

func (c *Cloud189File) GetPath() string

GetPath 获取文件路径。

func (*Cloud189File) GetSize

func (c *Cloud189File) GetSize() int64

GetSize 获取文件大小。

func (*Cloud189File) IsDir

func (c *Cloud189File) IsDir() bool

IsDir 判断是否为目录。

func (*Cloud189File) ModTime

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

ModTime 获取文件修改时间。

func (*Cloud189File) Thumb

func (c *Cloud189File) Thumb() string

Thumb 获取文件缩略图URL。

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

Cloud189FilesResp 文件列表响应

type Cloud189Folder

type Cloud189Folder struct {
	ID       String `json:"id"`       // 文件夹ID
	ParentID int64  `json:"parentId"` // 父文件夹ID
	Name     string `json:"name"`     // 文件夹名称

	LastOpTime Time `json:"lastOpTime"` // 最后操作时间
	CreateDate Time `json:"createDate"` // 创建时间

}

Cloud189Folder 表示189云盘中的文件夹,包含文件夹的基本信息。

func (*Cloud189Folder) CreateTime

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

CreateTime 获取文件夹的创建时间。

func (*Cloud189Folder) GetHash

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

GetHash 获取文件夹的哈希信息(文件夹没有哈希)。

func (*Cloud189Folder) GetID

func (c *Cloud189Folder) GetID() string

GetID 获取文件夹ID

func (*Cloud189Folder) GetName

func (c *Cloud189Folder) GetName() string

GetName 获取文件夹名称。

func (*Cloud189Folder) GetPath

func (c *Cloud189Folder) GetPath() string

GetPath 获取文件夹路径

func (*Cloud189Folder) GetSize

func (c *Cloud189Folder) GetSize() int64

GetSize 获取文件夹大小(文件夹大小为0)。

func (*Cloud189Folder) IsDir

func (c *Cloud189Folder) IsDir() bool

IsDir 判断是否为目录

func (*Cloud189Folder) ModTime

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

ModTime 获取文件夹修改时间

type Cloud189PC

type Cloud189PC struct {
	model.Storage
	Addition
	// contains filtered or unexported fields
}

Cloud189PC 天翼云盘PC客户端驱动实现

func (*Cloud189PC) CheckBatchTask

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

CheckBatchTask 检测任务状态

func (*Cloud189PC) Config

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

Config 获取驱动配置 返回值: 驱动配置信息

func (*Cloud189PC) Copy

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

Copy 复制文件或文件夹 将文件或文件夹复制到新的目录 参数:

  • ctx: 上下文
  • srcObj: 源文件或文件夹对象
  • dstDir: 目标目录对象

返回值: 错误信息

func (*Cloud189PC) CreateBatchTask

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

func (*Cloud189PC) Delete

func (y *Cloud189PC) Delete(ctx context.Context, familyID string, srcObj model.Obj) error

Delete 永久删除文件

func (*Cloud189PC) Drop

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

Drop 清除引用 参数:

  • ctx: 上下文

返回值: 错误信息

func (*Cloud189PC) EncryptParams

func (y *Cloud189PC) EncryptParams(params Params, isFamily bool) string

EncryptParams 加密请求参数,使用AES-ECB算法。 params: 待加密的参数 isFamily: 是否为家庭账户请求,决定使用哪个密钥

func (*Cloud189PC) FastUpload

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

FastUpload 快传

func (*Cloud189PC) GetAddition

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

GetAddition 获取附加配置 返回值: 驱动附加配置

func (*Cloud189PC) GetConflictTaskInfo

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

GetConflictTaskInfo 获取冲突的任务信息

func (*Cloud189PC) GetMultiUploadUrls

func (y *Cloud189PC) GetMultiUploadUrls(ctx context.Context, isFamily bool, uploadFileId string, partInfo ...string) ([]UploadUrlInfo, error)

GetMultiUploadUrls 获取上传切片信息 对http body有大小限制,分片信息太多会出错

func (*Cloud189PC) Init

func (y *Cloud189PC) Init(ctx context.Context) (err error)

Init 初始化驱动 初始化客户端、登录状态、家庭云ID等 参数:

  • ctx: 上下文

返回值: 错误信息

func (*Cloud189PC) InitReference

func (y *Cloud189PC) InitReference(storage driver.Driver) error

InitReference 初始化引用 用于在多个存储实例之间共享登录状态 参数:

  • storage: 要引用的驱动实例

返回值: 错误信息

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

Link 获取文件下载链接 参数:

  • ctx: 上下文
  • file: 文件对象
  • args: 链接参数

返回值: 下载链接,错误信息

func (*Cloud189PC) List

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

List 列出目录内容 获取指定目录下的所有文件和文件夹 参数:

  • ctx: 上下文
  • dir: 目录对象
  • args: 列表参数

返回值: 文件和文件夹对象列表,错误信息

func (*Cloud189PC) MakeDir

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

MakeDir 创建目录 在指定目录下创建新的文件夹 参数:

  • ctx: 上下文
  • parentDir: 父目录对象
  • dirName: 新目录名称

返回值: 新创建的目录对象,错误信息

func (*Cloud189PC) ManageBatchTask

func (y *Cloud189PC) ManageBatchTask(aType string, taskID string, targetFolderID string, taskInfos ...BatchTaskInfo) error

ManageBatchTask 处理冲突

func (*Cloud189PC) Move

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

Move 移动文件或文件夹 将文件或文件夹移动到新的目录 参数:

  • ctx: 上下文
  • srcObj: 源文件或文件夹对象
  • dstDir: 目标目录对象

返回值: 移动后的对象,错误信息

func (*Cloud189PC) OldUpload

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

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

func (*Cloud189PC) OldUploadCommit

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

OldUploadCommit 提交上传文件

func (*Cloud189PC) OldUploadCreate

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

OldUploadCreate 创建上传会话

func (*Cloud189PC) Put

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

Put 上传文件 将文件上传到指定目录 参数:

  • ctx: 上下文
  • dstDir: 目标目录对象
  • stream: 文件流
  • up: 上传进度回调

返回值: 上传后的文件对象,错误信息

func (*Cloud189PC) RapidUpload

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

func (*Cloud189PC) Remove

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

Remove 删除文件或文件夹 参数:

  • ctx: 上下文
  • obj: 要删除的文件或文件夹对象

返回值: 错误信息

func (*Cloud189PC) Rename

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

Rename 重命名文件或文件夹 参数:

  • ctx: 上下文
  • srcObj: 要重命名的文件或文件夹对象
  • newName: 新名称

返回值: 重命名后的对象,错误信息

func (*Cloud189PC) SaveFamilyFileToPersonCloud

func (y *Cloud189PC) SaveFamilyFileToPersonCloud(ctx context.Context, familyID string, srcObj, dstDir model.Obj, overwrite bool) error

SaveFamilyFileToPersonCloud 保存家庭云中的文件到个人云

func (*Cloud189PC) SignatureHeader

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

SignatureHeader 生成请求签名头,用于189云盘API的身份验证。 url: 请求的目标URL method: HTTP请求方法(如GET、POST) params: 请求参数的加密字符串 isFamily: 是否为家庭账户请求

func (*Cloud189PC) StreamUpload

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

StreamUpload 普通上传 无法上传大小为0的文件

func (*Cloud189PC) WaitBatchTask

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

WaitBatchTask 等待任务完成

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

CommitMultiUploadFileResp 提交分片上传文件的响应

type CreateBatchTaskResp

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

CreateBatchTaskResp 创建批量任务的响应

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

CreateUploadFileResp 创建上传文件的响应

type EncryptConfResp

type EncryptConfResp struct {
	Result int `json:"result"` // 请求结果代码,0表示成功
	Data   struct {
		UpSmsOn   string `json:"upSmsOn"`   // 是否需要短信验证
		Pre       string `json:"pre"`       // 前缀信息
		PreDomain string `json:"preDomain"` // 前缀域名
		PubKey    string `json:"pubKey"`    // RSA公钥,用于加密用户名和密码
	} `json:"data"` // 响应数据
}

EncryptConfResp 登录加密相关配置响应,包含加密公钥等信息。

type FamilyInfoListResp

type FamilyInfoListResp struct {
	FamilyInfoResp []FamilyInfoResp `json:"familyInfoResp"` // 家庭账户信息列表
}

FamilyInfoListResp 家庭云账户列表响应,包含多个家庭账户信息。

type FamilyInfoResp

type FamilyInfoResp struct {
	Count      int    `json:"count"`      // 成员数量
	CreateTime string `json:"createTime"` // 创建时间
	FamilyID   int64  `json:"familyId"`   // 家庭ID
	RemarkName string `json:"remarkName"` // 备注名称
	Type       int    `json:"type"`       // 账户类型
	UseFlag    int    `json:"useFlag"`    // 使用标志
	UserRole   int    `json:"userRole"`   // 用户角色
}

FamilyInfoResp 家庭云账户信息,包含账户的基本信息和角色。

type GetUploadFileStatusResp

type GetUploadFileStatusResp struct {
	CreateUploadFileResp

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

GetUploadFileStatusResp 获取上传文件状态的响应

func (*GetUploadFileStatusResp) GetSize

func (r *GetUploadFileStatusResp) GetSize() int64

GetSize 获取文件大小

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"`
}
上传部分

InitMultiUploadResp 初始化分片上传的响应

type LoginParam

type LoginParam struct {
	// 加密后的用户名和密码
	RsaUsername string // 经过RSA加密的用户名
	RsaPassword string // 经过RSA加密的密码

	// RSA密钥
	JRsaKey string `json:"jRsaKey"` // RSA公钥标识

	// 请求头参数
	Lt    string // 登录令牌
	ReqID string `json:"ReqId"` // 请求ID

	// 表单参数
	ParamID string `json:"ParamId"` // 参数ID

	// 验证码相关
	CaptchaToken string // 验证码令牌
	ValidateCode string // 验证码值
}

LoginParam 存储登录所需的参数信息,包括加密后的凭据和相关令牌。

type LoginResp

type LoginResp struct {
	Msg    string `json:"msg"`    // 响应消息
	Result int    `json:"result"` // 结果代码,0表示成功
	ToUrl  string `json:"toUrl"`  // 登录成功后的跳转URL
}

LoginResp 登录响应,包含登录结果和跳转URL。

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

OldCommitUploadFileResp 旧版上传文件提交响应

type Params

type Params map[string]string

Params 请求参数映射,用于构建URL查询字符串。

func (Params) Encode

func (p Params) Encode() string

Encode 将参数编码为URL查询字符串。

func (Params) Set

func (p Params) Set(k, v string)

Set 设置参数键值对。

type RespErr

type RespErr struct {
	ResponseCode    any    `json:"res_code"`    // 响应代码,可能是整数或字符串
	ResponseMessage string `json:"res_message"` // 响应消息,描述错误详情

	ErrorDesc string `json:"error"` // 错误描述,另一种格式的错误字段

	XMLName xml.Name `xml:"error"`                  // XML根元素名称
	Code    string   `json:"code" xml:"code"`       // 错误代码
	Message string   `json:"message" xml:"message"` // 错误消息
	Msg     string   `json:"msg"`                   // 错误消息,另一种格式

	ErrorCode string `json:"errorCode"` // 错误代码,另一种格式
	ErrorMsg  string `json:"errorMsg"`  // 错误消息,另一种格式
}

RespErr 表示API响应中的错误信息,兼容189云盘API的多种错误返回格式。

func (*RespErr) Error

func (e *RespErr) Error() string

Error 实现error接口,返回格式化的错误信息。

func (*RespErr) HasError

func (e *RespErr) HasError() bool

HasError 检查响应是否包含错误,根据不同的错误格式进行判断。

type String

type String string

String 自定义字符串类型,用于处理特殊格式的字符串解析

func (*String) Unmarshal

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

Unmarshal 通用反序列化方法,去除字符串两端的引号

func (*String) UnmarshalJSON

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

UnmarshalJSON 实现JSON反序列化接口

func (*String) UnmarshalXML

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

UnmarshalXML 实现XML反序列化接口

type Time

type Time time.Time

Time 自定义时间类型,用于处理多种格式的时间解析

func (*Time) Unmarshal

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

Unmarshal 通用反序列化方法,支持多种时间格式

func (*Time) UnmarshalJSON

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

UnmarshalJSON 实现JSON反序列化接口

func (*Time) UnmarshalXML

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

UnmarshalXML 实现XML反序列化接口

type UploadProgress

type UploadProgress struct {
	UploadInfo  InitMultiUploadResp
	UploadParts []string
}

UploadProgress 上传进度信息

type UploadUrlInfo

type UploadUrlInfo struct {
	PartNumber int
	Headers    map[string]string
	UploadUrlsData
}

UploadUrlInfo 上传URL信息,包含分片序号和请求头

type UploadUrlsData

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

UploadUrlsData 上传URL数据

type UploadUrlsResp

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

UploadUrlsResp 上传URL响应

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"` // 家庭云会话秘钥
}

UserSessionResp 刷新会话时返回的响应,包含会话密钥等信息。

type WrapFileStreamer

type WrapFileStreamer struct {
	model.FileStreamer
	Name string
}

WrapFileStreamer 文件流包装器

func (*WrapFileStreamer) GetName

func (w *WrapFileStreamer) GetName() string

GetName 获取文件名 返回值: 文件名

Jump to

Keyboard shortcuts

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