Documentation
¶
Index ¶
- Variables
- type AccessTokenResp
- type Addition
- type ApiInfo
- type BaseResp
- type DirectLinkResp
- type DownloadInfoResp
- type File
- type FileListResp
- type Open123
- func (d *Open123) Config() driver.Config
- func (d *Open123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error
- func (d *Open123) Drop(ctx context.Context) error
- func (d *Open123) GetAddition() driver.Additional
- func (d *Open123) Init(ctx context.Context) error
- func (d *Open123) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
- func (d *Open123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)
- func (d *Open123) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error
- func (d *Open123) Move(ctx context.Context, srcObj, dstDir model.Obj) error
- func (d *Open123) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, ...) (model.Obj, error)
- func (d *Open123) Remove(ctx context.Context, obj model.Obj) error
- func (d *Open123) Rename(ctx context.Context, srcObj model.Obj, newName string) error
- func (d *Open123) Request(apiInfo *ApiInfo, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)
- func (d *Open123) SignURL(originURL, privateKey string, uid uint64, validDuration time.Duration) (newURL string, err error)
- func (d *Open123) Upload(ctx context.Context, file model.FileStreamer, createResp *UploadCreateResp, ...) error
- type RefreshTokenResp
- type UploadCompleteResp
- type UploadCreateResp
- type UserInfoResp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Api = "https://open-api.123pan.com" AccessToken = InitApiInfo(Api+"/api/v1/access_token", 1) RefreshToken = InitApiInfo(Api+"/api/v1/oauth2/access_token", 1) UserInfo = InitApiInfo(Api+"/api/v1/user/info", 1) FileList = InitApiInfo(Api+"/api/v2/file/list", 3) DownloadInfo = InitApiInfo(Api+"/api/v1/file/download_info", 5) DirectLink = InitApiInfo(Api+"/api/v1/direct-link/url", 5) Mkdir = InitApiInfo(Api+"/upload/v1/file/mkdir", 2) Move = InitApiInfo(Api+"/api/v1/file/move", 1) Rename = InitApiInfo(Api+"/api/v1/file/name", 1) Trash = InitApiInfo(Api+"/api/v1/file/trash", 2) UploadCreate = InitApiInfo(Api+"/upload/v2/file/create", 2) UploadComplete = InitApiInfo(Api+"/upload/v2/file/upload_complete", 0) )
Functions ¶
This section is empty.
Types ¶
type AccessTokenResp ¶
type Addition ¶
type Addition struct {
// refresh_token方式的AccessToken 【对个人开发者暂未开放】
RefreshToken string `json:"RefreshToken" required:"false"`
// 通过 https://www.123pan.com/developer 申请
ClientID string `json:"ClientID" required:"false"`
ClientSecret string `json:"ClientSecret" required:"false"`
// 直接写入AccessToken
AccessToken string `json:"AccessToken" required:"false"`
// 上传线程数
UploadThread int `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
// 使用直链
DirectLink bool `json:"DirectLink" type:"bool" default:"false" required:"false" help:"use direct link when download file"`
DirectLinkPrivateKey string `json:"DirectLinkPrivateKey" required:"false" help:"private key for direct link, if URL authentication is enabled"`
DirectLinkValidDuration int64 `json:"DirectLinkValidDuration" type:"number" default:"30" required:"false" help:"minutes, if URL authentication is enabled"`
driver.RootID
}
type DirectLinkResp ¶ added in v4.1.2
type DownloadInfoResp ¶
type File ¶
type File struct {
FileName string `json:"filename"`
Size int64 `json:"size"`
CreateAt string `json:"createAt"`
UpdateAt string `json:"updateAt"`
FileId int64 `json:"fileId"`
Type int `json:"type"`
Etag string `json:"etag"`
S3KeyFlag string `json:"s3KeyFlag"`
ParentFileId int `json:"parentFileId"`
Category int `json:"category"`
Status int `json:"status"`
Trashed int `json:"trashed"`
}
func (File) CreateTime ¶
type FileListResp ¶
type Open123 ¶
func (*Open123) GetAddition ¶
func (d *Open123) GetAddition() driver.Additional
func (*Open123) Upload ¶
func (d *Open123) Upload(ctx context.Context, file model.FileStreamer, createResp *UploadCreateResp, up driver.UpdateProgress) error
上传分片 V2
type RefreshTokenResp ¶
type UploadCompleteResp ¶
type UploadCompleteResp struct {
BaseResp
Data struct {
Completed bool `json:"completed"`
FileID int64 `json:"fileID"`
} `json:"data"`
}
上传完毕V2返回
type UploadCreateResp ¶
type UploadCreateResp struct {
BaseResp
Data struct {
FileID int64 `json:"fileID"`
PreuploadID string `json:"preuploadID"`
Reuse bool `json:"reuse"`
SliceSize int64 `json:"sliceSize"`
Servers []string `json:"servers"`
} `json:"data"`
}
创建文件V2返回
type UserInfoResp ¶
Click to show internal directories.
Click to hide internal directories.