Documentation
¶
Index ¶
- Constants
- func GetApi(rawUrl string) string
- type Addition
- type File
- type Files
- type Pan123
- func (d *Pan123) APIRateLimit(ctx context.Context, api string) error
- func (d *Pan123) Config() driver.Config
- func (d *Pan123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error
- func (d *Pan123) Drop(ctx context.Context) error
- func (d *Pan123) GetAddition() driver.Additional
- func (d *Pan123) Init(ctx context.Context) error
- func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
- func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)
- func (d *Pan123) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error
- func (d *Pan123) Move(ctx context.Context, srcObj, dstDir model.Obj) error
- func (d *Pan123) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, ...) error
- func (d *Pan123) Remove(ctx context.Context, obj model.Obj) error
- func (d *Pan123) Rename(ctx context.Context, srcObj model.Obj, newName string) error
- func (d *Pan123) Request(url string, method string, callback base.ReqCallback, resp any) ([]byte, error)
- type S3PreSignedURLs
- type UploadResp
Constants ¶
View Source
const ( Api = "https://www.123pan.com/api" AApi = "https://www.123pan.com/a/api" BApi = "https://www.123pan.com/b/api" LoginApi = "https://login.123pan.com/api" MainApi = BApi SignIn = LoginApi + "/user/sign_in" Logout = MainApi + "/user/logout" UserInfo = MainApi + "/user/info" FileList = MainApi + "/file/list/new" DownloadInfo = MainApi + "/file/download_info" Mkdir = MainApi + "/file/upload_request" Move = MainApi + "/file/mod_pid" Rename = MainApi + "/file/rename" Trash = MainApi + "/file/trash" UploadRequest = MainApi + "/file/upload_request" UploadComplete = MainApi + "/file/upload_complete" S3PreSignedUrls = MainApi + "/file/s3_repare_upload_parts_batch" S3Auth = MainApi + "/file/s3_upload_object/auth" UploadCompleteV2 = MainApi + "/file/upload_complete/v2" S3Complete = MainApi + "/file/s3_complete_multipart_upload" )
API端点常量定义
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Addition ¶
type Addition struct {
// 用户名(必填)
Username string `json:"username" required:"true"`
// 密码(必填)
Password string `json:"password" required:"true"`
// 根目录ID
driver.RootID
// 排序字段(已注释掉,可能为未来功能预留)
// OrderBy string `json:"order_by" type:"select" options:"file_id,file_name,size,update_at" default:"file_name"`
// 排序方向(已注释掉,可能为未来功能预留)
// OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
// 访问令牌,由登录过程获取
AccessToken string
UploadThread int `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
}
Addition 定义123网盘驱动的额外配置参数
type File ¶
type File struct {
// 文件名
FileName string `json:"FileName"`
// 文件大小(字节)
Size int64 `json:"Size"`
// 更新时间
UpdateAt time.Time `json:"UpdateAt"`
// 文件ID
FileId int64 `json:"FileId"`
// 类型:0-文件,1-目录
Type int `json:"Type"`
// 文件的ETag
Etag string `json:"Etag"`
// S3存储的键标志
S3KeyFlag string `json:"S3KeyFlag"`
// 下载URL
DownloadUrl string `json:"DownloadUrl"`
}
File 表示123网盘中的文件或目录
func (File) CreateTime ¶
CreateTime 返回文件的创建时间 注:123网盘API不提供创建时间,使用更新时间代替
type Files ¶
type Files struct {
Data struct {
// 下一页标识符
Next string `json:"Next"`
// 总文件数
Total int `json:"Total"`
// 文件列表
InfoList []File `json:"InfoList"`
} `json:"data"`
}
Files 表示文件列表响应
type Pan123 ¶
Pan123 实现123网盘的驱动
func (*Pan123) APIRateLimit ¶
APIRateLimit 实现API请求速率限制
func (*Pan123) Link ¶
func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
Link 获取文件的下载链接
func (*Pan123) Put ¶
func (d *Pan123) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, up driver.UpdateProgress) error
Put 上传文件
type S3PreSignedURLs ¶
type S3PreSignedURLs struct {
Data struct {
// 预签名URL映射,键为分片编号,值为URL
PreSignedUrls map[string]string `json:"presignedUrls"`
} `json:"data"`
}
S3PreSignedURLs 表示S3预签名URL响应
type UploadResp ¶
type UploadResp struct {
Data struct {
// S3访问密钥ID
AccessKeyId string `json:"AccessKeyId"`
// S3存储桶名称
Bucket string `json:"Bucket"`
// S3对象键
Key string `json:"Key"`
// S3访问密钥
SecretAccessKey string `json:"SecretAccessKey"`
// S3会话令牌
SessionToken string `json:"SessionToken"`
// 文件ID
FileId int64 `json:"FileId"`
// 是否重用现有文件
Reuse bool `json:"Reuse"`
// S3端点URL
EndPoint string `json:"EndPoint"`
// 存储节点
StorageNode string `json:"StorageNode"`
// 上传ID
UploadId string `json:"UploadId"`
} `json:"data"`
}
UploadResp 表示上传请求的响应
Click to show internal directories.
Click to hide internal directories.