mopan

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

README

mopan-sdk-go

mopan SDK for the Go programming language

Installation

go get github.com/foxxorcat/mopan-sdk-go

Usage

package main

import (
	"fmt"
	"github.com/foxxorcat/mopan-sdk-go"
)

func main() {
	m := mopan.NewClient().SetAuthorization("ZR7Lxxx")
	res, err := m.GetUserInfo()
	if err != nil {
		fmt.Printf("GetUserInfo() error = %v", err)
	} else {
		fmt.Printf("GetUserInfo() = %+v", res)
	}
}

Documentation

Index

Constants

View Source
const (
	AllType fileType = iota
	FileType
	FolderType
	ImageType
	AudioType
	VideoType
	DocumentType
)
View Source
const (
	U_Rename    updloadOpertype = 1
	U_Overwrite updloadOpertype = 3
)
View Source
const (
	HomeUrl       = "https://mopan.sc.189.cn"
	MoPanProxyUrl = HomeUrl + "/mopanproxy"

	MoPanProxyUpdload = MoPanProxyUrl + "/fileupload"
	MoPanProxyFamily  = MoPanProxyUrl + "/family"
	MoPanProxyAuthUrl = MoPanProxyUrl + "/auth"
)
View Source
const DefaultPublicKey = `` /* 452-byte string literal not displayed */

Variables

View Source
var DefaultDeviceInfo = DeviceInfo{
	DeviceNo: "1104a897925070c638d",

	MpRemoteType:    "3",
	MpRemoteChannel: "100",

	MpVersion:     "1.1.201",
	MpVersionCode: 145,

	MpDeviceSerialNum: strings.ReplaceAll(uuid.NewString(), "-", ""),
	MpManufcaturer:    "Windows端",
	MpModel:           "",

	MpOs:         "windows",
	MpOsVersion:  "31",
	MpOsVersion2: "12",
}

默认设备信息 根据windwos信息构建

Functions

func AesDecrypt

func AesDecrypt(data, key []byte) ([]byte, error)

AesDecrypt 解密

func AesDecryptBase64

func AesDecryptBase64(data, key []byte) ([]byte, error)

AesDecryptBase64 使用 base64 解码和 ase 解密数据

func AesEncrypt

func AesEncrypt(data, key []byte) ([]byte, error)

AesEncrypt 加密

func AesEncryptBase64

func AesEncryptBase64(data, key []byte) ([]byte, error)

AesEncryptBase64 使用 ase 加密和 base64 编码数据

func Bool2Int

func Bool2Int(b bool) int8

返回[0,1]

func GetSecretKey

func GetSecretKey() string

func Int2Bool

func Int2Bool(i int8) bool

仅为1时返回true

func Md5Hex

func Md5Hex(v string) string

计算 md5 并 hex 编码

func MustAesDecryptBase64Str

func MustAesDecryptBase64Str(data, key string) string

MustAesDecryptBase64Str 使用 base64 解码和 ase 解密数据

func MustAesEncryptBase64Str

func MustAesEncryptBase64Str(data, key string) string

MustAesEncryptBase64Str 使用 ase 加密和 base64 编码数据

func MustRsaEncryptBase64Str

func MustRsaEncryptBase64Str(data, key string) string

MustRsaEncryptBase64Str 使用 rsa 加密和 base64 编码数据

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic codebook (ECB) mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in elecronic codebook (ECB) mode, using the given Block (Cipher).

func RsaEncrypt

func RsaEncrypt(data, key []byte) ([]byte, error)

RsaEncrypt 加密

func RsaEncryptBase64

func RsaEncryptBase64(data, key []byte) ([]byte, error)

RsaEncryptBase64 使用 rsa 加密和 base64 编码数据

Types

type Bool

type Bool bool

func (*Bool) UnmarshalJSON

func (i *Bool) UnmarshalJSON(b []byte) error

type CloudCircleInfo

type CloudCircleInfo struct {
	AlbumFolderID string `json:"albumFolderId"` // 相册ID
	AlbumName     string `json:"albumName"`     // 相册名称
	AlbumPath     string `json:"albumPath"`     // 相册路径

	CloudCircleName  string `json:"cloudCircleName"` // 空间名称
	CloudID          string `json:"cloudId"`         // 空间ID
	CloudRelationID  string `json:"cloudRelationId"` // 关联ID
	CreateUser       string `json:"createUser"`      // 创建用户
	DynamicCoverType int    `json:"dynamicCoverType"`

	FileFolderID string `json:"fileFolderId"` // 目录ID
	FileName     string `json:"fileName"`     // 文件名称
	FilePath     string `json:"filePath"`     // 文件路径

	IsDisturb Bool `json:"isDisturb"` // 消息免打扰
	IsTop     Bool `json:"isTop"`     // 是否置顶
	IsTv      Bool `json:"isTv"`      // 是否在TV上展示

	Aliss         string `json:"aliss"`        // 用户昵称
	JoinOrCreate  int    `json:"joinOrCreate"` // (1:creare,2:join)
	JoinType      int    `json:"joinType"`     // 加入权限(1:允许任何人加入,2:管理员审核加入,3:不允许任何人加入)
	PublishFlag   int    `json:"publishFlag"`  // 发布权限(1:仅限管理员,2:所有成员)
	MemberFlag    int    `json:"memberFlag"`
	OperationFlag int    `json:"operationFlag"`
	PackageFlag   int    `json:"packageFlag"`

	UserList []CloudCircleUser `json:"userList"`          // 用户列表
	TopTime  Time3             `json:"topTime,omitempty"` // 置顶操作时间
}

共享空间

type CloudCircleUser

type CloudCircleUser struct {
	UserID           string `json:"userId"`           // 用户ID
	Phone            string `json:"phone"`            // 手机号(完整)
	Aliss            string `json:"aliss"`            // 昵称
	CircleRelationID string `json:"circleRelationId"` // 共享云ID
	Type             int    `json:"type"`
}

type CommitMultiUploadData

type CommitMultiUploadData struct {
	CreateDate Time4  `json:"createDate"`
	FileMd5    string `json:"fileMd5"`
	FileName   string `json:"fileName"`
	FileSize   Int64  `json:"fileSize"`
	Rev        Time2  `json:"rev"`
	UserFileID string `json:"userFileId"`
	UserID     string `json:"userId"`
}

type DeleteTaskData

type DeleteTaskData struct {
	NotDeleteFileIds []string `json:"notDeleteFileIds"`
	TaskBaseInfo
}

type DeviceInfo

type DeviceInfo struct {
	DeviceNo string `json:"deviceNo"` //(PC:1104a897925070c638d,Android:140fe1da9fbf4b719f1)

	MpRemoteType    string `json:"mp_remoteType"`    // android:1,windows:3,mac:5
	MpRemoteChannel string `json:"mp_remoteChannel"` // android:203,PC:100

	MpVersion     string `json:"mp_version"`      // 程序版本
	MpVersionCode int    `json:"mp_version_code"` // 程序版本Code

	MpDeviceSerialNum string `json:"mp_deviceSerialNum"` // 设备编号 uuid len:32
	MpManufcaturer    string `json:"mp_manufcaturer"`    // (Windows端,Mac端,{设备品牌})
	MpModel           string `json:"mp_model"`           // 手机型号

	MpOs         string `json:"mp_os"`         // (Android,Windows,macOS)
	MpOsVersion  string `json:"mp_osVersion"`  // 31
	MpOsVersion2 string `json:"mp_osVersion2"` // 12
}

func (*DeviceInfo) Decrypt

func (e *DeviceInfo) Decrypt(v string, key string) error

func (*DeviceInfo) Encrypt

func (e *DeviceInfo) Encrypt(key string) string

type File

type File struct {
	ID   String `json:"id"`
	Name string `json:"name"` // 文件名
	Size Int64  `json:"size"` // 文件大小
	Md5  string `json:"md5"`

	IconBase

	MediaType int  `json:"mediaType"` // 媒体类型
	IsCollect bool `json:"isCollect"` // 是否收藏
	IsJuBao   bool `json:"isJuBao"`   // 被举报??

	Rev        Time2 `json:"rev"` // 查询时间
	CreateDate Time1 `json:"createDate"`
	LastOpTime Time1 `json:"lastOpTime"`

	StarLabel   int `json:"starLabel"`
	FileCata    int `json:"fileCata"`
	Orientation int `json:"orientation,omitempty"`
}

type FileInfo

type FileInfo struct {
	ID       String `json:"id"`       // 文件ID
	ParentID String `json:"parentId"` // 父ID
	Name     string `json:"name"`     // 文件名
	Size     Int64  `json:"size"`     // 文件大小
	Md5      string `json:"md5"`

	NickName string `json:"nickName"` // 用户名称
	FilePath string `json:"filePath"` // 文件路径

	IconBase

	FileDownloadURL string `json:"fileDownloadUrl"` // 下载链接

	MediaType int  `json:"mediaType"` // 媒体类型
	IsCollect bool `json:"isCollect"` // 是否收藏
	IsJuBao   bool `json:"isJuBao"`   // 被举报??

	Rev           Time2 `json:"rev"`                 // 查询时间
	CreateDate    Time1 `json:"createDate"`          // 创建时间
	LastOpTime    Time3 `json:"lastOpTime"`          // 修改时间
	LastOpTimeStr Time1 `json:"lastOpTimeStr"`       // 修改时间
	ShootTime     Time1 `json:"shootTime,omitempty"` // 拍摄时间
}

type Folder

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

	FileListSize Int `json:"fileListSize"` // 列表大小

	IsCollect bool `json:"isCollect"` // 是否收藏

	Rev        Time2 `json:"rev"`        // 查询时间
	CreateDate Time1 `json:"createDate"` // 创建时间
	LastOpTime Time1 `json:"lastOpTime"` // 修改时间

	StarLabel Int `json:"starLabel"`
	FileCata  Int `json:"fileCata"`
}

type FolderInfo

type FolderInfo struct {
	FileID   String `json:"fileId"`   // 文件夹ID
	ParentID String `json:"parentId"` // 父ID
	FileName string `json:"fileName"` // 文件夹名称

	FilePath string `json:"filePath"` // 文件夹路径

	Rev           Time2 `json:"rev"`           // 查询时间
	CreateTime    Time3 `json:"createTime"`    // 创建时间
	CreateDate    Time1 `json:"createDate"`    // 创建时间
	LastOpTime    Time3 `json:"lastOpTime"`    // 修改时间
	LastOpTimeStr Time1 `json:"lastOpTimeStr"` // 修改时间

	IsCollect bool `json:"isCollect"` // 是否收藏
}

type GetConflictTaskInfoData

type GetConflictTaskInfoData struct {
	TaskID    string `json:"taskId"`
	TaskInfos string `json:"taskInfos"`
}

type GetFileDownloadUrlData

type GetFileDownloadUrlData struct {
	DownloadUrl string `json:"downloadUrl"`
	FileID      string `json:"fileId"`
}

type GetMultiUploadData

type GetMultiUploadData struct {
	HTTPMethod string `json:"httpMethod"`
	HTTPURL    string `json:"httpURL"`

	ContentType   string `json:"contentType"`
	Authorization string `json:"authorization"`
	Date          string `json:"date"`
	Limitrate     string `json:"limitrate"`

	PartMD5    string `json:"partMD5"`
	PartNumber int    `json:"partNumber"`

	UploadID   string `json:"uploadId"`
	ExpireTime Time3  `json:"expireTime"`
}

func (*GetMultiUploadData) Headers

func (m *GetMultiUploadData) Headers() map[string]string

func (*GetMultiUploadData) NewRequest

func (m *GetMultiUploadData) NewRequest(ctx context.Context, body io.Reader) (*http.Request, error)

type GetUploadedPartsInfoData

type GetUploadedPartsInfoData struct {
	UploadFileID     string `json:"uploadFileId"`
	UploadedPartList string `json:"uploadedPartList"`
}

type IconBase

type IconBase struct {
	Icon struct {
		SmallURL  string `json:"smallUrl,omitempty"`  // icon:1|3|5|7|9|11|13|15
		MediumUrl string `json:"mediumUrl,omitempty"` // icon:2|3|6|7|10|11|14|15
		LargeUrl  string `json:"largeUrl,omitempty"`  // icon:4|5|6|7|12|13|14|15
		Max600    string `json:"max600,omitempty"`    // icon:8|9|10|11|12|13|14|15
	} `json:"icon,omitempty"`
}

type IconOption

type IconOption int8
const (
	IconSmall IconOption = (1 << iota)
	IconMedium
	IconLarge
	IconMax600
)

type InitMultiUploadData

type InitMultiUploadData struct {
	FileDataExists Bool   `json:"fileDataExists"`
	UploadFileID   string `json:"uploadFileId"`
	UploadType     Int    `json:"uploadType"`
	UploadHost     string `json:"uploadHost"`

	UploadFilePartData `json:"-"`
}

type Int

type Int int

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(b []byte) error

type Int64

type Int64 int64

func (*Int64) UnmarshalJSON

func (i *Int64) UnmarshalJSON(b []byte) error

type Json

type Json map[string]any

func ApplyParamOption

func ApplyParamOption(param Json, option ...ParamOption) Json

type LoginResp

type LoginResp struct {
	Token string `json:"token"`

	ExpiresIn string `json:"expiresIn"`

	AutoToken TokenData `json:"autoToken"`

	UserID   string `json:"userId"`   // 用户ID
	NickName string `json:"nickName"` // 昵称

	UserCloudStorageRelations []UserCloudStorageRelation `json:"userCloudStorageRelations"` // 用户空间信息
}

type MoClient

type MoClient struct {
	Authorization string
	DeviceInfo    DeviceInfo

	Client *resty.Client
	// contains filtered or unexported fields
}

func NewMoClient

func NewMoClient() *MoClient

func NewMoClientWithAuthorization

func NewMoClientWithAuthorization(authorization string) *MoClient

func NewMoClientWithRestyClient added in v0.1.2

func NewMoClientWithRestyClient(client *resty.Client) *MoClient

func (*MoClient) AddBatchTask

func (c *MoClient) AddBatchTask(task TaskParam, option ...RestyOption) (*TaskData, error)

增加批量任务

func (*MoClient) CancelBatchTask

func (c *MoClient) CancelBatchTask(taskId string, taskType TaskType, option ...RestyOption) error

取消批量任务

func (*MoClient) CheckBatchTask

func (c *MoClient) CheckBatchTask(task TaskCheckParam, option ...RestyOption) (*TaskStatus, error)

检查批量任务状态

func (*MoClient) CloudCircleUserDetail

func (c *MoClient) CloudCircleUserDetail(cloudId string, option ...RestyOption) (*CloudCircleInfo, error)

查询单个空间信息

func (*MoClient) CloudCircleUserQuit

func (c *MoClient) CloudCircleUserQuit(cloudId string, option ...RestyOption) error

退出空间

func (*MoClient) CloudDiskStartBusiness

func (c *MoClient) CloudDiskStartBusiness() error

宽带提速(不知道是不是真的)

func (*MoClient) CommitMultiUploadFile

func (c *MoClient) CommitMultiUploadFile(uploadFileId string, paramOption []ParamOption, option ...RestyOption) (*CommitMultiUploadData, error)

提交上传文件

func (*MoClient) CreateCloudCircle

func (c *MoClient) CreateCloudCircle(cloudName string, option ...RestyOption) (*CloudCircleInfo, error)

创建空间

func (*MoClient) CreateFolder

func (c *MoClient) CreateFolder(folderName, parentFolderId string, paramOption []ParamOption, option ...RestyOption) (*Folder, error)

创建文件夹

func (*MoClient) CreateFolderNotCheck

func (c *MoClient) CreateFolderNotCheck(folderName, parentFolderId string, paramOption []ParamOption, option ...RestyOption) (*Folder, error)

创建文件夹(不检查是否存在)

func (*MoClient) DeleteToRecycle

func (c *MoClient) DeleteToRecycle(file []TaskFileParam, paramOption []ParamOption, option ...RestyOption) (*DeleteTaskData, error)

删除文件到回收站

func (*MoClient) DismissCloudCircle

func (c *MoClient) DismissCloudCircle(cloudID string, option ...RestyOption) error

解散空间

func (*MoClient) ForgotPassword

func (c *MoClient) ForgotPassword(phone string, option ...RestyOption) (func(code, newPassword string) error, error)

忘记密码

func (*MoClient) ForgotPasswordStep2

func (c *MoClient) ForgotPasswordStep2(phone, code, newPassword string, option ...RestyOption) error

忘记密码步骤2

func (*MoClient) GetAllMultiUploadUrls

func (c *MoClient) GetAllMultiUploadUrls(uploadFileId string, partInfo []string, option ...RestyOption) ([]GetMultiUploadData, error)

获取分片上传信息

func (*MoClient) GetCloudToken

func (c *MoClient) GetCloudToken(cloudID string, option ...RestyOption) (*TokenData, error)

func (*MoClient) GetConflictTaskInfo

func (c *MoClient) GetConflictTaskInfo(taskID string, taskType TaskType, option ...RestyOption) (*GetConflictTaskInfoData, error)

获取任务冲突信息

func (*MoClient) GetDeviceInfo

func (c *MoClient) GetDeviceInfo() DeviceInfo

func (*MoClient) GetFileDownloadUrl

func (c *MoClient) GetFileDownloadUrl(fileID string, paramOption []ParamOption, option ...RestyOption) (*GetFileDownloadUrlData, error)

获取下载链接

func (*MoClient) GetFileInfo

func (c *MoClient) GetFileInfo(fileId string, paramOption []ParamOption, option ...RestyOption) (*FileInfo, error)

获取文件详细信息 可用选项 QueryFileOptionIconOption QueryFileOptionMediaAttr QueryFileOptionShareFile

func (*MoClient) GetFolderInfo

func (c *MoClient) GetFolderInfo(folderId string, paramOption []ParamOption, option ...RestyOption) (*FolderInfo, error)

获取文件详细信息

func (*MoClient) GetShareFileDownloadUrl

func (c *MoClient) GetShareFileDownloadUrl(shareId, fileId string, option ...RestyOption) (*GetFileDownloadUrlData, error)

func (*MoClient) GetShareInfo

func (c *MoClient) GetShareInfo(accessCode string, option ...RestyOption) (*ShareInfoData, error)

func (*MoClient) GetUploadedPartsInfo

func (c *MoClient) GetUploadedPartsInfo(uploadFileId string, option ...RestyOption) (*GetUploadedPartsInfoData, error)

查询分片上传情况

func (*MoClient) GetUserInfo

func (c *MoClient) GetUserInfo(option ...RestyOption) (*UserInfo, error)

获取用户详细信息

func (*MoClient) InitMultiUpload

func (c *MoClient) InitMultiUpload(ctx context.Context, data UploadFilePartData, paramOption []ParamOption, option ...RestyOption) (*InitMultiUploadData, error)

初始化上传

func (*MoClient) InviteCloudCircleUser

func (c *MoClient) InviteCloudCircleUser(code string, option ...RestyOption) error

加入空间

func (*MoClient) Login

func (c *MoClient) Login(phone, password string, option ...RestyOption) (*LoginResp, error)

通过手机号密码登录

func (*MoClient) LoginBySms

func (c *MoClient) LoginBySms(phone string, option ...RestyOption) (func(code string) (*LoginResp, error), error)

短信登陆

func (*MoClient) LoginBySmsStep2

func (c *MoClient) LoginBySmsStep2(phone, smsCode string, option ...RestyOption) (*LoginResp, error)

短信登陆步骤2

func (*MoClient) Logout

func (c *MoClient) Logout(option ...RestyOption) error

登出当前账号

func (*MoClient) LogoutOnline

func (c *MoClient) LogoutOnline(random, remoteType string, option ...RestyOption) error

登出在线设备(错误的参数可能导致当前账号登出)

func (*MoClient) ManageBatchTask added in v0.1.1

func (c *MoClient) ManageBatchTask(task TaskManageParam, option ...RestyOption) error

处理冲突任务

func (*MoClient) Online

func (c *MoClient) Online(option ...RestyOption) ([]OnlineData, error)

获取所有在线设备

func (*MoClient) QueryAllCloudCircleApp

func (c *MoClient) QueryAllCloudCircleApp(option ...RestyOption) ([]CloudCircleInfo, error)

查询所有共享空间信息

func (*MoClient) QueryFiles

func (c *MoClient) QueryFiles(folderId string, pageNum int, paramOption []ParamOption, option ...RestyOption) (*QueryFilesData, error)

查询文件、文件夹 当folderId == -11时列出所有文件夹

func (*MoClient) QueryUserCloudStorage

func (c *MoClient) QueryUserCloudStorage(option ...RestyOption) ([]UserCloudStorageData, error)

查询所有用户空间

func (*MoClient) RenameFile

func (c *MoClient) RenameFile(fileID, fileName string, paramOption []ParamOption, option ...RestyOption) (*RenameFileData, error)

重命名文件

func (*MoClient) RenameFolder

func (c *MoClient) RenameFolder(fileID, fileName string, paramOption []ParamOption, option ...RestyOption) (*RenameFolderData, error)

重命名文件夹

func (*MoClient) Request

func (c *MoClient) Request(url string, data Json, resp any, option ...RestyOption) ([]byte, error)

func (*MoClient) SearchFiles

func (c *MoClient) SearchFiles(filename, folderId string, pageNum int, paramOption []ParamOption, option ...RestyOption) (*SearchFileData, error)

搜索文件、文件夹

func (*MoClient) SetAuthorization

func (c *MoClient) SetAuthorization(authorization string) *MoClient

func (*MoClient) SetClient

func (c *MoClient) SetClient(client *http.Client) *MoClient

func (*MoClient) SetDeviceInfo

func (c *MoClient) SetDeviceInfo(info *DeviceInfo) *MoClient

func (*MoClient) SetOnAuthorizationExpired

func (c *MoClient) SetOnAuthorizationExpired(f func(err error) error) *MoClient

当Token失效时回调

func (*MoClient) SetProxy

func (c *MoClient) SetProxy(proxy string) *MoClient

func (*MoClient) SetRestyClient

func (c *MoClient) SetRestyClient(client *resty.Client) *MoClient

func (*MoClient) UsedSpace

func (c *MoClient) UsedSpace(option ...RestyOption) (*UsedSpaceData, error)

使用空间查询

type OnlineData

type OnlineData struct {
	DeviceNo     string `json:"deviceNo"` // 设备编号
	IP           string `json:"ip"`
	LoginAccount string `json:"loginAccount"`
	LoginDevice  string `json:"loginDevice"`
	LoginOs      string `json:"loginOs"`
	LoginPlat    string `json:"loginPlat"`
	LoginTime    Time3  `json:"loginTime"`

	Random string `json:"random"`

	UserID      string `json:"userId"`
	Username    string `json:"username"`
	Phone       string `json:"phone"`
	NickName    string `json:"nickName"`
	Authorities []any  `json:"authorities"`
	Roles       []any  `json:"roles"`

	AccountNonExpired     bool  `json:"accountNonExpired"`     // 帐户未过期
	AccountNonLocked      bool  `json:"accountNonLocked"`      // 帐户未锁定
	CredentialsNonExpired bool  `json:"credentialsNonExpired"` // 证书未过期
	ExpireTime            Time3 `json:"expireTime"`            // 过期时间

	Token   string `json:"token,omitempty"` // 当前设备返回Token
	Enabled bool   `json:"enabled"`
}

type OrderBy

type OrderBy int8
const (
	S_FileName OrderBy = iota
	S_LastOpTime
	S_FileSize
)

type ParamOption

type ParamOption func(Json)

func ParamOptionShareFile

func ParamOptionShareFile(cloudId string) ParamOption

通用: 查询共享空间 如果 cloudId 为空则不做任何操作

func QueryFileOptionFileType

func QueryFileOptionFileType(fileType fileType) ParamOption

func QueryFileOptionIconOption

func QueryFileOptionIconOption(icon IconOption) ParamOption

返回icon方案 关闭: icon 0

func QueryFileOptionMediaAttr

func QueryFileOptionMediaAttr(flag bool) ParamOption

查询媒体信息 似乎没用

func QueryFileOptionPageSize

func QueryFileOptionPageSize(size int) ParamOption

查询每页大小

func QueryFileOptionSort

func QueryFileOptionSort(orderBy OrderBy, desc bool) ParamOption

数据排序

func SearchFilesOptionRecursive

func SearchFilesOptionRecursive(recursive bool) ParamOption

是否递归搜索

func UpdloadOptionOpertype

func UpdloadOptionOpertype(opertype updloadOpertype) ParamOption

func WarpParamOption

func WarpParamOption(option ...ParamOption) []ParamOption

type QueryFilesData

type QueryFilesData struct {
	LastRev    Time2 `json:"lastRev"` // 查询时间
	FileListAO struct {
		FileListSize int      `json:"fileListSize"` // 返回文件(非文件夹)数量
		Count        int      `json:"count"`        // 所有文件/文件夹数量
		FolderList   []Folder `json:"folderList"`
		FileList     []File   `json:"fileList"`
	} `json:"fileListAO"`
}

type RenameFileData

type RenameFileData struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Md5  string `json:"md5"`
	Size Int64  `json:"size"`

	FileCata  int `json:"fileCata"`
	MediaType int `json:"mediaType"`

	Rev        Time2 `json:"rev"`        // 查询时间
	CreateDate Time1 `json:"createDate"` // 创建时间
	LastOpTime Time1 `json:"lastOpTime"` // 修改时间
}

type RenameFolderData

type RenameFolderData struct {
	ID       string `json:"id"`
	ParentID string `json:"parentId"`
	Name     string `json:"name"`

	FileListSize int `json:"fileListSize"`
	FileCata     int `json:"fileCata"`

	Rev        Time2 `json:"rev"`        // 查询时间
	CreateDate Time1 `json:"createDate"` // 创建时间
	LastOpTime Time1 `json:"lastOpTime"` // 修改时间
}

type Resp

type Resp struct {
	Code    int64           `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
	Status  bool            `json:"status"`
}

func (*Resp) Error

func (r *Resp) Error() string

type RestyOption

type RestyOption func(request *resty.Request)

type SearchFileData

type SearchFileData struct {
	Count      int    `json:"count"`
	FolderList Folder `json:"folderList"`
	FileList   File   `json:"fileList"`
}

type ShareInfoData

type ShareInfoData struct {
	ID         string `json:"id"`
	AccessCode string `json:"accessCode"`
	Code       string `json:"code"`

	SendName  string `json:"sendName"`
	SendType  int    `json:"sendType"`
	Status    int    `json:"status"`
	URL       string `json:"url"`
	TotleSize Int64  `json:"totleSize"`

	UserID    string `json:"userId"`    // 分享用户ID
	ShareName string `json:"shareName"` // 分享用户名称(不完整)
	UserPic   string `json:"userPic"`

	IsPerpetual Bool `json:"isPerpetual"`
	IsDel       Bool `json:"isDel"`

	ViewCount   int `json:"viewCount"`
	DownCount   int `json:"downCount"`
	ExportCount int `json:"exportCount"`

	CreateTime string `json:"createTime"`
	UpdateTime string `json:"updateTime"`
}

type String

type String string

func (*String) UnmarshalJSON

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

type TaskBaseInfo

type TaskBaseInfo struct {
	TaskIDList []string `json:"taskIdList"`
	TaskType   TaskType `json:"taskType"`
}

type TaskCheckParam

type TaskCheckParam struct {
	TaskId              string   `json:"taskId"`
	TaskType            TaskType `json:"taskType"`            // 操作
	TargetType          int      `json:"targetType"`          // 1
	TargetFolderID      string   `json:"targetFolderId"`      // 目标文件夹
	TargetSource        int      `json:"targetSource"`        // 目标 (1:用户,2:共享)
	TargetUserOrCloudID string   `json:"targetUserOrCloudId"` // 目标用户ID或共享空间ID
}

type TaskData

type TaskData struct {
	TargetFolderID string `json:"targetFolderId"`
	TaskBaseInfo
}

type TaskFileParam

type TaskFileParam struct {
	FileID   string `json:"fileId"`
	IsFolder bool   `json:"isFolder"`
	FileName string `json:"fileName"`
}

type TaskManageFileParam added in v0.1.1

type TaskManageFileParam struct {
	DealWay int `json:"dealWay"` // 处理方法(1:跳过,2:同时存在,3:覆盖)
	TaskFileParam
}

type TaskManageParam added in v0.1.1

type TaskManageParam struct {
	TaskID         string                `json:"taskId"`
	TaskType       TaskType              `json:"taskType"`       // 操作
	TargetFolderID string                `json:"targetFolderId"` // 目标文件夹
	Type           int                   `json:"type"`           // 1
	TaskInfos      []TaskManageFileParam `json:"taskInfos"`
}

type TaskParam

type TaskParam struct {
	UserOrCloudID           string          `json:"userOrCloudId"`       // 用户ID或共享空间ID
	Source                  int             `json:"source"`              // (1:用户,2:共享)
	TaskType                TaskType        `json:"taskType"`            // 操作
	TargetUserOrCloudID     string          `json:"targetUserOrCloudId"` // 目标用户ID或共享空间ID
	TargetSource            int             `json:"targetSource"`        // 目标 (1:用户,2:共享)
	TargetType              int             `json:"targetType"`          // 1
	TargetFolderID          string          `json:"targetFolderId"`      // 目标文件夹
	TaskStatusDetailDTOList []TaskFileParam `json:"taskStatusDetailDTOList"`
}

type TaskStatus

type TaskStatus struct {
	TaskID              string            `json:"taskId"`                       // 任务ID
	TaskStatus          int               `json:"taskStatus"`                   // 任务状态(1-4,4:完成,2:存在冲突)
	SubTaskCount        int               `json:"subTaskCount"`                 // 任务数量
	SuccessedCount      int               `json:"successedCount"`               // 成功数量
	FailedCount         int               `json:"failedCount"`                  // 失败数量
	SkipCount           int               `json:"skipCount"`                    // 跳过数量
	SuccessedFileIDList []string          `json:"successedFileIdList"`          // 成功文件ID
	SuccessedFileIdMap  map[string]string `json:"successedFileIdMap,omitempty"` // only copy
}

批量任务信息

type TaskType

type TaskType string
const (
	TASK_COPY TaskType = "COPY"
	TASK_MOVE TaskType = "MOVE"

	TASK_SHARE_SAVE TaskType = "SHARE_SAVE"

	TASK_DELETE TaskType = "DELETE"
)

type Time1

type Time1 time.Time

2006-01-02 15:04:05

func (*Time1) UnmarshalJSON

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

type Time2

type Time2 time.Time

20060102150405 时间戳

func (*Time2) UnmarshalJSON

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

type Time3

type Time3 time.Time

时间戳

func (*Time3) UnmarshalJSON

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

type Time4

type Time4 time.Time

func (*Time4) UnmarshalJSON

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

type TokenData

type TokenData struct {
	AccessToken string `json:"accessToken"` // 可能用于文档预览
}

type UpdloadFileParam

type UpdloadFileParam struct {
	ParentFolderId string
	FileName       string
	FileSize       int64
	File           io.Reader

	PartSize int64
}

type UploadFilePartData added in v0.1.3

type UploadFilePartData struct {
	ParentFolderId string
	FileName       string
	FileSize       int64

	FileMd5   string
	SliceMd5  string
	PartInfos []string // sliceMd5Base64s (i_md5base64)

	PartTotal    int
	PartSize     int64
	LastPartSize int64
}

func InitUploadPartData added in v0.1.3

func InitUploadPartData(ctx context.Context, file UpdloadFileParam) (*UploadFilePartData, error)

初始化上传参数

type UsedSpaceData

type UsedSpaceData struct {
	Capacity          Int64 `json:"capacity"`
	Used              Int64 `json:"used"`
	UserCloudSizeList []struct {
		UserID string `json:"userId"`
		Name   string `json:"name"`
		Phone  string `json:"phone"`
		Type   int    `json:"type"`
		Used   Int64  `json:"used"`
	} `json:"userCloudSizeList"`
}

type UserCloudStorageData

type UserCloudStorageData struct {
	ID string `json:"id"` // 数据库ID

	FolderID string `json:"folderId"` // 目录ID
	Name     string `json:"name"`     // 名称

	CatalogueType int    `json:"catalogueType"` // 分类 (1:文件|私密空间,2:相册,4:视频,5:音频,6:文档,9:同步盘)
	CloudType     int    `json:"cloudType"`     // (1:普通文件,2:私密空间)
	FileOrAlbum   int    `json:"fileOrAlbum"`   // 文件或相册(1:文件,2:相册)
	Path          string `json:"path"`          // 路径

	UserID     string `json:"userId"`     // 用户ID
	CreateTime string `json:"createTime"` // 创建时间
	UpdateTime string `json:"updateTime"` // 更新时间
	IsDel      Bool   `json:"isDel"`      // 软删除
}

type UserCloudStorageRelation added in v0.1.4

type UserCloudStorageRelation struct {
	CatalogueType int    `json:"catalogueType"`
	CloudType     int    `json:"cloudType"`
	CreateTime    string `json:"createTime"`
	FileOrAlbum   int    `json:"fileOrAlbum"`
	FolderID      string `json:"folderId"`
	ID            string `json:"id"`
	IsDel         int    `json:"isDel"`
	Name          string `json:"name"`
	Path          string `json:"path"`
	UpdateTime    string `json:"updateTime"`
	UserID        string `json:"userId"`
}

type UserInfo

type UserInfo struct {
	UserID   string `json:"userId"`   // 用户ID
	KickName string `json:"kickName"` // 昵称
	Name     string `json:"name"`     // 手机号(省略)
	Phone    string `json:"phone"`    // 手机号(完整)

	RemoteChannel string `json:"remoteChannel"` // 与 DeviceInfo 相同

	IsTag   Bool `json:"isTag"`
	Isp     Bool `json:"isp"`
	Status  int  `json:"status"`
	Version int  `json:"version"`

	ArrearsFlag Bool `json:"arrearsFlag"` // 欠费标识
	FreezeFlag  int  `json:"freezeFlag"`  // 冻结标识
	PackageFlag int  `json:"packageFlag"`
	PrimaryFlag int  `json:"primaryFlag"`
	VipFlag     int  `json:"vipFlag"` // vip标识
	VirtualFlag int  `json:"virtualFlag"`

	CreateTime string `json:"createTime"` // 创建时间
	UpdateTime string `json:"updateTime"` // 更新时间
	IsDel      Bool   `json:"isDel"`      // 软删除
}

用户详细信息

Jump to

Keyboard shortcuts

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