cloudpan

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2022 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Overview

电脑手机客户端API,例如MAC客户端

WEB网页端API

Index

Constants

View Source
const (
	WEB_URL  string = "https://cloud.189.cn"
	AUTH_URL string = "https://open.e.189.cn/api/logbox/oauth2"
	API_URL  string = "https://api.cloud.189.cn"
)
View Source
const (
	// BatchTaskStatusNotAction 无需任何操作
	BatchTaskStatusNotAction BatchTaskStatus = 2
	// BatchTaskStatusOk 成功
	BatchTaskStatusOk BatchTaskStatus = 4

	// BatchTaskTypeDelete 删除文件任务
	BatchTaskTypeDelete BatchTaskType = "DELETE"
	// BatchTaskTypeCopy 复制文件任务
	BatchTaskTypeCopy BatchTaskType = "COPY"
	// BatchTaskTypeMove 移动文件任务
	BatchTaskTypeMove BatchTaskType = "MOVE"

	// BatchTaskTypeRecycleRestore 还原回收站文件
	BatchTaskTypeRecycleRestore BatchTaskType = "RESTORE"

	// BatchTaskTypeShareSave 转录分享
	BatchTaskTypeShareSave BatchTaskType = "SHARE_SAVE"
)
View Source
const (
	// MediaTypeDefault 默认全部
	MediaTypeDefault MediaType = 0
	// MediaTypeMusic 音乐
	MediaTypeMusic MediaType = 1
	// MediaTypeVideo 视频
	MediaTypeVideo MediaType = 3
	// MediaTypeDocument 文档
	MediaTypeDocument MediaType = 4

	// OrderByName 文件名
	OrderByName OrderBy = 1
	// OrderBySize 大小
	OrderBySize OrderBy = 2
	// OrderByTime 时间
	OrderByTime OrderBy = 3

	// OrderAsc 升序
	OrderAsc OrderSort = "ASC"
	// OrderDesc 降序
	OrderDesc OrderSort = "DESC"
)
View Source
const (
	// 1天期限
	ShareExpiredTime1Day ShareExpiredTime = 1
	// 7天期限
	ShareExpiredTime7Day ShareExpiredTime = 7
	// 永久期限
	ShareExpiredTimeForever ShareExpiredTime = 2099

	// ShareModePrivate 私密分享
	ShareModePrivate ShareMode = 1
	// ShareModePublic 公开分享
	ShareModePublic ShareMode = 2
)
View Source
const (
	// PathSeparator 路径分隔符
	PathSeparator = "/"
)

Variables

This section is empty.

Functions

func GetCaptchaImage

func GetCaptchaImage() (savePath string, error *apierror.ApiError)

func RefreshCookieToken

func RefreshCookieToken(sessionKey string) string

Types

type AccessCount

type AccessCount struct {
	CopyCount     int `json:"copyCount"`
	DownloadCount int `json:"downloadCount"`
	PreviewCount  int `json:"previewCount"`
}

type ActivityTaskId

type ActivityTaskId string
const (
	ActivitySignin     ActivityTaskId = "TASK_SIGNIN"
	ActivitySignPhotos ActivityTaskId = "TASK_SIGNIN_PHOTOS"
)

type AppCheckBatchTaskResult

type AppCheckBatchTaskResult struct {
	TaskId       string `xml:"taskId"`
	TaskStatus   int    `xml:"taskStatus"`
	SubTaskCount int    `xml:"subTaskCount"`
	SuccessCount int    `xml:"successedCount"`
	FailedCount  int    `xml:"failedCount"`
	SkipCount    int    `xml:"skipCount"`
}

type AppCopyFileParam

type AppCopyFileParam struct {
	FileId       string
	DestFileName string
	DestFolderId string
}

type AppCreateBatchTaskResult

type AppCreateBatchTaskResult struct {
	TaskId string `xml:"taskId"`
}

type AppCreateUploadFileParam

type AppCreateUploadFileParam struct {
	FamilyId int64
	// ParentFolderId 存储云盘的目录ID
	ParentFolderId string
	// FileName 存储云盘的文件名
	FileName string
	// Size 文件总大小
	Size int64
	// Md5 文件MD5
	Md5 string
	// LastWrite 文件最后修改日期,格式:2018-11-18 09:12:13
	LastWrite string
	// LocalPath 文件存储的本地绝对路径
	LocalPath string
}

type AppCreateUploadFileResult

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

type AppFamilyInfo

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

AppGetFileInfoParam 获取文件信息参数

type AppFamilyInfoListResult

type AppFamilyInfoListResult struct {
	XMLName        xml.Name         `xml:"familyListResponse"`
	FamilyInfoList []*AppFamilyInfo `xml:"familyInfo" json:"familyInfoList"`
}

type AppFileDownloadRange

type AppFileDownloadRange struct {
	// 起始值,包含
	Offset int64
	// 结束值,包含
	End int64
}

type AppFileEntity

type AppFileEntity struct {
	// FileId 文件ID
	FileId string `xml:"id"`
	// ParentId 父文件夹ID
	ParentId string `xml:"parentId"`
	// FileMd5 文件MD5,文件夹为空,空文件默认为 D41D8CD98F00B204E9800998ECF8427E
	FileMd5 string `xml:"md5"`
	// FileName 名称
	FileName string `xml:"name"`
	// FileSize 文件大小
	FileSize int64 `xml:"size"`
	// LastOpTime 最后修改时间
	LastOpTime string `xml:"lastOpTime"`
	// CreateTime 创建时间
	CreateTime string `xml:"createDate"`
	// 文件完整路径
	Path string `xml:"path"`
	// MediaType 媒体类型
	MediaType MediaType `xml:"mediaType"`
	// IsFolder 是否是文件夹
	IsFolder bool
	// FileCount 文件夹子文件数量,对文件夹详情有效
	SubFileCount uint `xml:"fileCount"`

	StartLabel    int    `xml:"startLabel"`
	FavoriteLabel int    `xml:"favoriteLabel"`
	Orientation   int    `xml:"orientation"`
	Rev           string `xml:"rev"`
	FileCata      int    `xml:"fileCata"`
}

AppFileEntity 文件/文件夹信息

func NewAppFileEntityForRootDir

func NewAppFileEntityForRootDir() *AppFileEntity

func (*AppFileEntity) CreateFileEntity

func (f *AppFileEntity) CreateFileEntity() *FileEntity

func (*AppFileEntity) String

func (f *AppFileEntity) String() string

type AppFileList

type AppFileList []*AppFileEntity

func (AppFileList) Count

func (afl AppFileList) Count() (fileN, directoryN int64)

Count 获取文件总数和目录总数

func (AppFileList) TotalSize

func (afl AppFileList) TotalSize() int64

TotalSize 获取目录下文件的总大小

type AppFileListParam

type AppFileListParam struct {
	// 家庭云ID
	FamilyId int64
	// FileId 文件ID
	FileId string
	// OrderBy 排序字段
	OrderBy OrderBy
	// OrderSort 排序顺序
	OrderSort OrderSort
	// PageNum 页数量,从1开始
	PageNum uint
	// PageSize 页大小,默认60
	PageSize uint

	// 默认是不返回Path路径,是否构建
	ConstructPath bool
}

FileListParam 文件列表参数

func NewAppFileListParam

func NewAppFileListParam() *AppFileListParam

type AppFileListResult

type AppFileListResult struct {
	LastRev string
	// 总数量
	Count int
	// 文件列表
	FileList AppFileList
}

AppFileListResult 文件列表响应值

type AppFileUploadRange

type AppFileUploadRange struct {
	// 起始值,包含
	Offset int64
	// 总上传长度
	Len int64
}

type AppGetFileInfoParam

type AppGetFileInfoParam struct {
	// 家庭云ID
	FamilyId int64
	// FileId 文件ID,支持文件和文件夹
	FileId string
	// FilePath 文件绝对路径,支持文件和文件夹
	FilePath string
}

AppGetFileInfoParam 获取文件信息参数

type AppGetFileInfoResult

type AppGetFileInfoResult struct {
	//XMLName xml.Name `xml:"folderInfo"`
	FileId           string               `xml:"id"`
	ParentId         string               `xml:"parentFolderId"`
	FileName         string               `xml:"name"`
	CreateDate       string               `xml:"createDate"`
	LastOpTime       string               `xml:"lastOpTime"`
	Path             string               `xml:"path"`
	Rev              string               `xml:"rev"`
	ParentFolderList parentFolderListNode `xml:"parentFolderList"`
	GroupSpaceId     string               `xml:"groupSpaceId"`
}

AppGetFileInfoResult 文件信息响应值

type AppGetUploadFileStatusResult

type AppGetUploadFileStatusResult struct {
	XMLName xml.Name `xml:"uploadFile"`
	// 上传文件的ID
	UploadFileId string `xml:"uploadFileId"`
	// 已上传的大小
	Size           int64  `xml:"size"`
	FileUploadUrl  string `xml:"fileUploadUrl"`
	FileCommitUrl  string `xml:"fileCommitUrl"`
	FileDataExists int    `xml:"fileDataExists"`
}

type AppLoginToken

type AppLoginToken struct {
	SessionKey          string `json:"sessionKey"`
	SessionSecret       string `json:"sessionSecret"`
	FamilySessionKey    string `json:"familySessionKey"`
	FamilySessionSecret string `json:"familySessionSecret"`
	AccessToken         string `json:"accessToken"`
	RefreshToken        string `json:"refreshToken"`
	// 有效期的token
	SskAccessToken string `json:"sskAccessToken"`
	// token 过期时间点,时间戳ms
	SskAccessTokenExpiresIn int64  `json:"sskAccessTokenExpiresIn"`
	RsaPublicKey            string `json:"rsaPublicKey"`
}

func AppLogin

func AppLogin(username, password string) (result *AppLoginToken, error *apierror.ApiError)

type AppMkdirResult

type AppMkdirResult struct {
	//XMLName xml.Name `xml:"folder"`
	// fileId 文件ID
	FileId string `xml:"id"`
	// ParentId 父文件夹ID
	ParentId string `xml:"parentId"`
	// FileName 名称
	FileName string `xml:"name"`
	// LastOpTime 最后修改时间
	LastOpTime string `xml:"lastOpTime"`
	// CreateTime 创建时间
	CreateTime string `xml:"createDate"`
	Rev        string `xml:"rev"`
	FileCata   int    `xml:"fileCata"`
}

type AppMoveFileResult

type AppMoveFileResult struct {
	XMLName xml.Name `xml:"fileList"`
	// 总数量
	Count int `xml:"count"`
	// 文件夹列表
	FolderList AppFileList `xml:"folder"`
	// 文件列表
	FileList AppFileList `xml:"file"`
}

type AppOrderBy

type AppOrderBy string
const (
	// AppOrderByName 文件名
	AppOrderByName AppOrderBy = "filename"
	// AppOrderBySize 大小
	AppOrderBySize AppOrderBy = "filesize"
	// AppOrderByTime 时间
	AppOrderByTime AppOrderBy = "lastOpTime"

	// 空文件夹默认MD5
	DefaultEmptyFileMd5 = "D41D8CD98F00B204E9800998ECF8427E"
)

type AppUploadFileCommitResult

type AppUploadFileCommitResult struct {
	XMLName    xml.Name `xml:"file"`
	Id         string   `xml:"id"`
	Name       string   `xml:"name"`
	Size       string   `xml:"size"`
	Md5        string   `xml:"md5"`
	CreateDate string   `xml:"createDate"`
	Rev        string   `xml:"rev"`
	UserId     string   `xml:"userId"`
	RequestId  string   `xml:"requestId"`
	IsSafe     string   `xml:"isSafe"`
}

type AppUserSignResult

type AppUserSignResult struct {
	Status AppUserSignStatus
	Tip    string
}

type AppUserSignStatus

type AppUserSignStatus int
const (
	AppUserSignStatusFailed  AppUserSignStatus = 0
	AppUserSignStatusSuccess AppUserSignStatus = 1
	AppUserSignStatusHasSign AppUserSignStatus = -1
)

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

TaskInfo 任务信息

type BatchTaskInfoList

type BatchTaskInfoList []*BatchTaskInfo

type BatchTaskParam

type BatchTaskParam struct {
	TypeFlag       BatchTaskType     `json:"type"`
	TaskInfos      BatchTaskInfoList `json:"taskInfos"`
	TargetFolderId string            `json:"targetFolderId"`
	ShareId        int64             `json:"shareId"`
}

BatchTaskParam 任务参数

type BatchTaskStatus

type BatchTaskStatus int

type BatchTaskType

type BatchTaskType string

type CheckTaskResult

type CheckTaskResult struct {
	FailedCount         int     `json:"failedCount" xml:"failedCount"`
	SkipCount           int     `json:"skipCount" xml:"skipCount"`
	SubTaskCount        int     `json:"subTaskCount" xml:"subTaskCount"`
	SuccessedCount      int     `json:"successedCount" xml:"successedCount"`
	SuccessedFileIdList []int64 `json:"successedFileIdList" xml:"successedFileIdList"`
	TaskId              string  `json:"taskId" xml:"taskId"`
	// TaskStatus 任务状态, 4-成功
	TaskStatus BatchTaskStatus `json:"taskStatus" xml:"taskStatus"`
}

CheckTaskResult 检查任务结果

type DownloadFuncCallback

type DownloadFuncCallback func(httpMethod, fullUrl string, headers map[string]string) (resp *http.Response, err error)

type FileEntity

type FileEntity struct {
	// FileId 文件ID
	FileId string `json:"fileId"`
	// ParentId 父文件ID
	ParentId string `json:"parentId"`
	// FileIdDigest 文件ID指纹
	FileIdDigest string `json:"fileIdDigest"`
	// FileName 文件名
	FileName string `json:"fileName"`
	// FileSize 文件大小,文件夹为0
	FileSize int64 `json:"fileSize"`
	// LastOpTime 最后修改时间
	LastOpTime string `json:"lastOpTime"`
	// CreateTime 创建时间
	CreateTime string `json:"createTime"`
	// FilePath 文件的完整路径
	Path string `json:"path"`
	// MediaType 媒体类型
	MediaType MediaType `json:"mediaType"`
	// IsFolder 是否是文件夹
	IsFolder bool `json:"isFolder"`
	// SubFileCount 文件夹子文件数量,对文件夹详情有效
	SubFileCount uint `json:"subFileCount"`

	// FileType 文件类型,后缀名,例如:"dmg",没有则为空
	FileType string `json:"fileType"`
	// DownloadUrl 下载路径,只有文件才有
	DownloadUrl string `json:"downloadUrl"`
	// IsStarred 是否是星标文件
	IsStarred bool `json:"isStarred"`
}

FileEntity 文件/文件夹信息

func NewFileEntityForRootDir

func NewFileEntityForRootDir() *FileEntity

NewFileEntityForRootDir 创建根目录"/"的默认文件信息

func (*FileEntity) CreateFileEntity

func (f *FileEntity) CreateFileEntity() *AppFileEntity

func (*FileEntity) String

func (f *FileEntity) String() string

type FileList

type FileList []*FileEntity

func (FileList) Count

func (fl FileList) Count() (fileN, directoryN int64)

Count 获取文件总数和目录总数

func (FileList) TotalSize

func (fl FileList) TotalSize() int64

TotalSize 获取目录下文件的总大小

type FileListParam

type FileListParam struct {
	// FileId 文件ID
	FileId string
	// MediaType 媒体文件过滤
	MediaType MediaType
	// InGroupSpace ???
	InGroupSpace bool
	// OrderBy 排序字段
	OrderBy OrderBy
	// OrderSort 排序顺序
	OrderSort OrderSort
	// PageNum 页数量,从1开始
	PageNum uint
	// PageSize 页大小,默认60
	PageSize uint
}

FileListParam 文件列表参数

func NewFileListParam

func NewFileListParam() *FileListParam

type FileSearchParam

type FileSearchParam struct {
	FileListParam
	// FileId 文件ID
	// Keyword 搜索关键字
	Keyword string
}

FileSearchParam 文件搜索参数

func NewFileSearchParam

func NewFileSearchParam() *FileSearchParam

NewFileSearchParam 创建默认搜索参数

type FileSearchResult

type FileSearchResult struct {
	// Data 数据
	Data FileList `json:"data"`
	// PageNum 页数量,从1开始
	PageNum uint `json:"pageNum"`
	// PageSize 页大小,默认60
	PageSize uint `json:"pageSize"`
	// Path 路径
	Path PathList `json:"path"`
	// RecordCount 文件总数量
	RecordCount uint `json:"recordCount"`
}

FileSearchResult 文件搜索返回结果

type HandleAppFileDirectoryFunc

type HandleAppFileDirectoryFunc func(depth int, fdPath string, fd *AppFileEntity, apierr *apierror.ApiError) bool

HandleFileDirectoryFunc 处理文件或目录的元信息, 返回值控制是否退出递归

type HandleFileDirectoryFunc

type HandleFileDirectoryFunc func(depth int, fdPath string, fd *FileEntity, apierr *apierror.ApiError) bool

HandleFileDirectoryFunc 处理文件或目录的元信息, 返回值控制是否退出递归

type MediaType

type MediaType uint

type MkdirResult

type MkdirResult struct {
	// fileId 文件ID
	FileId string `json:"fileId"`
	// isNew 是否创建成功。true为成功,false或者没有返回则为失败,失败原因基本是已存在该文件夹
	IsNew bool `json:"isNew"`
}

type OrderBy

type OrderBy uint

type OrderSort

type OrderSort string

type PanClient

type PanClient struct {
	// contains filtered or unexported fields
}

func NewPanClient

func NewPanClient(webToken WebLoginToken, appToken AppLoginToken) *PanClient

func (*PanClient) AppCheckBatchTask

func (p *PanClient) AppCheckBatchTask(typeFlag BatchTaskType, taskId string) (result *CheckTaskResult, error *apierror.ApiError)

AppCheckBatchTask 检测批量任务状态和结果

func (*PanClient) AppCopyFile

func (p *PanClient) AppCopyFile(param *AppCopyFileParam) (*AppFileEntity, *apierror.ApiError)

AppCopyFile 复制文件到目标文件夹

func (*PanClient) AppCreateBatchTask

func (p *PanClient) AppCreateBatchTask(familyId int64, param *BatchTaskParam) (taskId string, error *apierror.ApiError)

AppCreateBatchTask 创建批量处理任务

func (*PanClient) AppCreateUploadFile

func (*PanClient) AppDeleteFile

func (p *PanClient) AppDeleteFile(fileIdList []string) (bool, *apierror.ApiError)

AppDeleteFile 删除文件/文件夹

func (*PanClient) AppDownloadFileData

func (p *PanClient) AppDownloadFileData(downloadFileUrl string, fileRange AppFileDownloadRange, downloadFunc DownloadFuncCallback) *apierror.ApiError

func (*PanClient) AppFamilyCreateUploadFile

func (p *PanClient) AppFamilyCreateUploadFile(param *AppCreateUploadFileParam) (*AppCreateUploadFileResult, *apierror.ApiError)

func (*PanClient) AppFamilyDownloadFileData

func (p *PanClient) AppFamilyDownloadFileData(downloadFileUrl string, fileRange AppFileDownloadRange, downloadFunc DownloadFuncCallback) *apierror.ApiError

func (*PanClient) AppFamilyGetFamilyList

func (p *PanClient) AppFamilyGetFamilyList() (*AppFamilyInfoListResult, *apierror.ApiError)

AppGetFamilyList 获取用户的家庭列表

func (*PanClient) AppFamilyGetFileDownloadUrl

func (p *PanClient) AppFamilyGetFileDownloadUrl(familyId int64, fileId string) (string, *apierror.ApiError)

func (*PanClient) AppFamilyGetUploadFileStatus

func (p *PanClient) AppFamilyGetUploadFileStatus(familyId int64, uploadFileId string) (*AppGetUploadFileStatusResult, *apierror.ApiError)

AppFamilyGetUploadFileStatus 查询上传的文件状态

func (*PanClient) AppFamilyMoveFile

func (p *PanClient) AppFamilyMoveFile(familyId int64, fileId string, destParentId string) (*AppFileEntity, *apierror.ApiError)

AppFamilyMoveFile 移动文件/文件夹

func (*PanClient) AppFamilyRenameFile

func (p *PanClient) AppFamilyRenameFile(familyId int64, renameFileId, newName string) (*AppFileEntity, *apierror.ApiError)

func (*PanClient) AppFamilySaveFileToPersonCloud

func (p *PanClient) AppFamilySaveFileToPersonCloud(familyId int64, familyFileIdList []string) (bool, *apierror.ApiError)

AppFamilySaveFileToPersonCloud 复制家庭共享文件文件到个人云

func (*PanClient) AppFamilyUploadFileCommit

func (p *PanClient) AppFamilyUploadFileCommit(familyId int64, uploadCommitUrl, uploadFileId, xRequestId string) (*AppUploadFileCommitResult, *apierror.ApiError)

func (*PanClient) AppFamilyUploadFileData

func (p *PanClient) AppFamilyUploadFileData(familyId int64, uploadUrl, uploadFileId, xRequestId string, fileRange *AppFileUploadRange, uploadFunc UploadFunc) *apierror.ApiError

func (*PanClient) AppFileInfoById

func (p *PanClient) AppFileInfoById(familyId int64, fileId string) (fileInfo *AppFileEntity, error *apierror.ApiError)

AppFileInfoById 通过FileId获取文件详情

func (*PanClient) AppFileInfoByPath

func (p *PanClient) AppFileInfoByPath(familyId int64, pathStr string) (fileInfo *AppFileEntity, error *apierror.ApiError)

AppFileInfoByPath 通过路径获取文件详情,pathStr是绝对路径

func (*PanClient) AppFileList

func (p *PanClient) AppFileList(param *AppFileListParam) (*AppFileListResult, *apierror.ApiError)

AppFileList 获取文件列表

func (*PanClient) AppFilePathById

func (p *PanClient) AppFilePathById(familyId int64, fileId string) (string, *apierror.ApiError)

AppGetFilePathById 通过FileId获取文件的绝对路径

func (*PanClient) AppFilesDirectoriesRecurseList

func (p *PanClient) AppFilesDirectoriesRecurseList(familyId int64, path string, handleAppFileDirectoryFunc HandleAppFileDirectoryFunc) AppFileList

FilesDirectoriesRecurseList 递归获取目录下的文件和目录列表

func (*PanClient) AppGetAllFileList

func (p *PanClient) AppGetAllFileList(param *AppFileListParam) (*AppFileListResult, *apierror.ApiError)

AppGetAllFileList 获取指定目录下的所有文件列表

func (*PanClient) AppGetBasicFileInfo

func (p *PanClient) AppGetBasicFileInfo(param *AppGetFileInfoParam) (*AppGetFileInfoResult, *apierror.ApiError)

AppGetBasicFileInfo 根据文件ID或者文件绝对路径获取文件信息,支持文件和文件夹

func (*PanClient) AppGetFileDownloadUrl

func (p *PanClient) AppGetFileDownloadUrl(fileId string) (string, *apierror.ApiError)

func (*PanClient) AppGetUploadFileStatus

func (p *PanClient) AppGetUploadFileStatus(uploadFileId string) (*AppGetUploadFileStatusResult, *apierror.ApiError)

AppGetUploadFileStatus 查询上传的文件状态

func (*PanClient) AppMkdir

func (p *PanClient) AppMkdir(familyId int64, parentFileId, dirName string) (*AppMkdirResult, *apierror.ApiError)

AppMkdir 创建文件夹

func (*PanClient) AppMkdirRecursive

func (p *PanClient) AppMkdirRecursive(familyId int64, parentFileId string, fullPath string, index int, pathSlice []string) (*AppMkdirResult, *apierror.ApiError)

func (*PanClient) AppMoveFile

func (p *PanClient) AppMoveFile(fileIdList []string, targetFolderId string) (*AppMoveFileResult, *apierror.ApiError)

AppMoveFile 移动文件/文件夹

func (*PanClient) AppRenameFile

func (p *PanClient) AppRenameFile(renameFileId, newName string) (*AppFileEntity, *apierror.ApiError)

AppRenameFile 重命名文件/文件夹

func (*PanClient) AppSaveFileToFamilyCloud

func (p *PanClient) AppSaveFileToFamilyCloud(familyId int64, personFileIdList []string) (bool, *apierror.ApiError)

AppSaveFileToFamilyCloud 复制个人云文件文件到家庭云

func (*PanClient) AppUploadFileCommit

func (p *PanClient) AppUploadFileCommit(uploadCommitUrl, uploadFileId, xRequestId string) (*AppUploadFileCommitResult, *apierror.ApiError)

AppUploadFileCommit 上传文件完成提交接口

func (*PanClient) AppUploadFileCommitOverwrite

func (p *PanClient) AppUploadFileCommitOverwrite(uploadCommitUrl, uploadFileId, xRequestId string, overwrite bool) (*AppUploadFileCommitResult, *apierror.ApiError)

AppUploadFileCommitOverwrite 上传文件完成提交接口 如果 overwrite=true,则会覆盖同名文件,否则如遇到同名文件新上传的文件会自动重命名

func (*PanClient) AppUploadFileData

func (p *PanClient) AppUploadFileData(uploadUrl, uploadFileId, xRequestId string, fileRange *AppFileUploadRange, uploadFunc UploadFunc) *apierror.ApiError

func (*PanClient) AppUserSign

func (p *PanClient) AppUserSign() (*AppUserSignResult, *apierror.ApiError)

AppUserSign 用户签到

func (*PanClient) CheckBatchTask

func (p *PanClient) CheckBatchTask(typeFlag BatchTaskType, taskId string) (result *CheckTaskResult, error *apierror.ApiError)

func (*PanClient) CreateBatchTask

func (p *PanClient) CreateBatchTask(param *BatchTaskParam) (taskId string, error *apierror.ApiError)

func (*PanClient) FileInfoById

func (p *PanClient) FileInfoById(fileId string) (fileInfo *FileEntity, error *apierror.ApiError)

func (*PanClient) FileInfoByPath

func (p *PanClient) FileInfoByPath(pathStr string) (fileInfo *FileEntity, error *apierror.ApiError)

FileInfoByPath 通过路径获取文件详情,pathStr是绝对路径

func (*PanClient) FileList

func (p *PanClient) FileList(param *FileListParam) (result *FileSearchResult, error *apierror.ApiError)

func (*PanClient) FileSearch

func (p *PanClient) FileSearch(param *FileSearchParam) (result *FileSearchResult, error *apierror.ApiError)

func (*PanClient) FilesDirectoriesRecurseList

func (p *PanClient) FilesDirectoriesRecurseList(path string, handleFileDirectoryFunc HandleFileDirectoryFunc) FileList

FilesDirectoriesRecurseList 递归获取目录下的文件和目录列表

func (*PanClient) GetUserDetailInfo

func (p *PanClient) GetUserDetailInfo() (userDetailInfo *UserDetailInfo, error *apierror.ApiError)

func (*PanClient) GetUserInfo

func (p *PanClient) GetUserInfo() (userInfo *UserInfo, error *apierror.ApiError)

func (*PanClient) Heartbeat

func (p *PanClient) Heartbeat() bool

Heartbeat WEB端心跳包,周期默认1分钟

func (*PanClient) Mkdir

func (p *PanClient) Mkdir(parentFileId, dirName string) (*MkdirResult, *apierror.ApiError)

func (*PanClient) MkdirRecursive

func (p *PanClient) MkdirRecursive(parentFileId string, fullPath string, index int, pathSlice []string) (*MkdirResult, *apierror.ApiError)

func (*PanClient) RecycleClear

func (p *PanClient) RecycleClear(familyId int64) *apierror.ApiError

func (*PanClient) RecycleDelete

func (p *PanClient) RecycleDelete(familyId int64, fileIdList []string) *apierror.ApiError

RecycleDelete 删除回收站文件或目录

func (*PanClient) RecycleList

func (p *PanClient) RecycleList(pageNum, pageSize int) (result *RecycleFileListResult, error *apierror.ApiError)

RecycleList 列出回收站文件列表

func (*PanClient) RecycleRestore

func (p *PanClient) RecycleRestore(fileList []*RecycleFileInfo) (taskId string, err *apierror.ApiError)

func (*PanClient) Rename

func (p *PanClient) Rename(renameFileId, newName string) (bool, *apierror.ApiError)

func (*PanClient) ShareCancel

func (p *PanClient) ShareCancel(shareIdList []int64) (bool, *apierror.ApiError)

func (*PanClient) ShareList

func (p *PanClient) ShareList(param *ShareListParam) (*ShareListResult, *apierror.ApiError)

func (*PanClient) SharePrivate

func (p *PanClient) SharePrivate(fileId string, expiredTime ShareExpiredTime) (*PrivateShareResult, *apierror.ApiError)

func (*PanClient) SharePublic

func (p *PanClient) SharePublic(fileId string, expiredTime ShareExpiredTime) (*PublicShareResult, *apierror.ApiError)

func (*PanClient) ShareSave

func (p *PanClient) ShareSave(accessUrl string, accessCode string, savePanDirId string) (bool, *apierror.ApiError)

ShareSave 转存分享到对应的文件夹

func (*PanClient) UserDrawPrize

func (p *PanClient) UserDrawPrize(taskId ActivityTaskId) (*UserDrawPrizeResult, *apierror.ApiError)

抽奖

type PathEntity

type PathEntity struct {
	// FileId 文件ID
	FileId string `json:"fileId"`
	// FileName 文件名
	FileName string `json:"fileName"`
	// IsCoShare ???
	IsCoShare uint `json:"isCoShare"`
}

type PathList

type PathList []*PathEntity

type PrivateShareResult

type PrivateShareResult struct {
	AccessCode    string `json:"accessCode"`
	ShortShareUrl string `json:"shortShareUrl"`
}

type PublicShareResult

type PublicShareResult struct {
	ShareId       int64  `json:"shareId"`
	ShortShareUrl string `json:"shortShareUrl"`
}

type RecycleFileActResult

type RecycleFileActResult struct {
	Success bool `json:"success"`
}

type RecycleFileInfo

type RecycleFileInfo struct {
	// CreateTime 创建时间
	CreateTime string `json:"createTime"`
	// FileId 文件ID
	FileId string `json:"fileId"`
	// FileName 文件名
	FileName string `json:"fileName"`
	// FileSize 文件大小,文件夹为0
	FileSize int64 `json:"fileSize"`
	// FileType 文件类型,后缀名,例如:"dmg",没有则为空
	FileType string `json:"fileType"`
	// IsFolder 是否是文件夹
	IsFolder bool `json:"isFolder"`
	// IsFamilyFile 是否是家庭云文件
	IsFamilyFile bool `json:"isFamilyFile"`
	// LastOpTime 最后修改时间
	LastOpTime string `json:"lastOpTime"`
	// ParentId 父文件ID
	ParentId string `json:"parentId"`
	// DownloadUrl 下载路径,只有文件才有
	DownloadUrl string `json:"downloadUrl"`
	// MediaType 媒体类型
	MediaType MediaType `json:"mediaType"`
	// PathStr 文件的完整路径
	PathStr string `json:"pathStr"`
}

RecycleFileInfo 回收站中文件/目录信息

type RecycleFileInfoList

type RecycleFileInfoList []*RecycleFileInfo

type RecycleFileListResult

type RecycleFileListResult struct {
	// Data 数据
	Data RecycleFileInfoList `json:"data"`
	// PageNum 页数量,从1开始
	PageNum uint `json:"pageNum"`
	// PageSize 页大小,默认60
	PageSize uint `json:"pageSize"`
	// RecordCount 文件总数量
	RecordCount uint   `json:"recordCount"`
	FamilyId    int64  `json:"familyId"`
	FamilyName  string `json:"familyName"`
}

type ShareExpiredTime

type ShareExpiredTime int

type ShareItem

type ShareItem struct {
	// AccessCode 提取码,私密分享才有
	AccessCode string `json:"accessCode"`
	// AccessURL 分享链接
	AccessURL string `json:"accessURL"`
	// AccessCount 分享被查看下载次数
	AccessCount AccessCount `json:"accessCount"`
	// DownloadUrl 下载路径,文件才会有
	DownloadUrl string `json:"downloadUrl"`
	// DownloadUrl 下载路径,文件才会有
	LongDownloadUrl string `json:"longDownloadUrl"`
	// FileId 文件ID
	FileId string `json:"fileId"`
	// FileIdDigest 文件指纹
	FileIdDigest string `json:"fileIdDigest"`
	// FileName 文件名
	FileName string `json:"fileName"`
	// FilePath 路径
	FilePath string `json:"filePath"`
	// FileSize 文件大小,文件夹为0
	FileSize int64 `json:"fileSize"`
	// IconURL 缩略图路径???
	IconURL string `json:"iconURL"`
	// IsFolder 是否是文件夹
	IsFolder bool `json:"isFolder"`
	// MediaType 文件类别
	MediaType      MediaType `json:"mediaType"`
	NeedAccessCode int       `json:"needAccessCode"`
	// NickName 分享者账号昵称
	NickName string `json:"nickName"`
	// ReviewStatus 审查状态,1-正常
	ReviewStatus int `json:"reviewStatus"`
	// ShareDate 分享日期
	ShareDate int64 `json:"shareDate"`
	// ShareId 分享项目ID,唯一标识该分享项
	ShareId int64 `json:"shareId"`
	// ShareMode 分享模式,1-私密,2-公开
	ShareMode ShareMode `json:"shareMode"`
	// ShareTime 分享时间
	ShareTime int64 `json:"shareTime"`
	// ShareType 分享类别,默认都是1
	ShareType int `json:"shareType"`
	// ShortShareUrl 分享的访问路径,和 AccessURL 一致
	ShortShareUrl string `json:"shortShareUrl"`
}

type ShareItemList

type ShareItemList []*ShareItem

type ShareListParam

type ShareListParam struct {
	ShareType int `json:"shareType"`
	PageNum   int `json:"pageNum"`
	PageSize  int `json:"pageSize"`
}

func NewShareListParam

func NewShareListParam() *ShareListParam

type ShareListResult

type ShareListResult struct {
	Data        ShareItemList `json:"data"`
	PageNum     int           `json:"pageNum"`
	PageSize    int           `json:"pageSize"`
	RecordCount int           `json:"recordCount"`
}

ShareListResult 获取分享项目列表响应体

type ShareMode

type ShareMode int

type UploadFunc

type UploadFunc func(httpMethod, fullUrl string, headers map[string]string) (resp *http.Response, err error)

UploadFunc 上传文件处理函数

type UserDetailInfo

type UserDetailInfo struct {
	// 性别 F-女 M-男
	Gender string `json:"gender"`
	// 省代码
	ProvinceCode string `json:"provinceCode"`
	// 城市代码
	CityCode string `json:"cityCode"`
	// 登录名
	UserAccount string `json:"userAccount"`
	// 手机号,模糊处理过的,没有设定则为空
	SafeMobile string `json:"safeMobile"`
	// 域名称
	DomainName string `json:"domainName"`
	// 昵称
	Nickname string `json:"nickname"`
	// 邮箱,没有设定则为空
	Email string `json:"email"`
}

type UserDrawPrizeResult

type UserDrawPrizeResult struct {
	Success bool
	Tip     string
}

type UserInfo

type UserInfo struct {
	// 用户UID
	UserId uint64 `json:"userId"`
	// 用户登录名,一般为 [email protected]
	UserAccount string `json:"userAccount"`
	// 昵称,如果没有设置则为空
	Nickname string `json:"nickname"`
	// 域名称,默认和UserId一样
	DomainName string `json:"domainName"`
	// 189邮箱已使用空间大小
	Used189Size uint64 `json:"used189Size"`
	// 已使用个人空间大小
	UsedSize uint64 `json:"usedSize"`
	// 个人空间总大小
	Quota uint64 `json:"quota"`
	// 会员开始时间
	SuperBeginTime string `json:"superBeginTime"`
	// 会员结束时间
	SuperEndTime string `json:"superEndTime"`
	// 今天是否已签到
	IsSign bool `json:"isSign"`
	// VIP会员标志位
	SuperVip UserVip `json:"superVip"`
}

type UserVip

type UserVip int
const (
	// VipFamilyGold 家庭黄金会员
	VipFamilyGold UserVip = 99

	// VipGold 黄金会员
	VipGold UserVip = 100

	// VipFamilyPlatnum 家庭铂金会员
	VipFamilyPlatnum UserVip = 199

	// VipPlatnum 铂金会员
	VipPlatnum UserVip = 200

	// VipUser 普通会员
	VipUser UserVip = 0
)

type WebLoginToken

type WebLoginToken struct {
	CookieLoginUser string `json:"cookieLoginUser"`
}

func Login

func Login(username, password string) (webToken *WebLoginToken, error *apierror.ApiError)

func LoginWithCaptcha

func LoginWithCaptcha(username, password, captchaCode string) (webToken *WebLoginToken, error *apierror.ApiError)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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