Documentation ¶
Index ¶
- Constants
- type Downloader
- func NewDownloader(accessToken string, downloadLink string, localFilePath string) *Downloader
- func NewDownloaderWithFsID(accessToken string, fsID uint64, localFilePath string) *Downloader
- func NewDownloaderWithFsIDAndPath(accessToken string, fsID uint64, path string, localFilePath string) *Downloader
- func NewDownloaderWithPath(accessToken string, path string, localFilePath string) *Downloader
- type File
- func (f *File) List(dir string, start, limit int) (ListResponse, error)
- func (f *File) Listall(path string, recursion, start, limit int) (ListallResponse, error)
- func (f *File) Metas(fsIDs []uint64, path string) (MetasResponse, error)
- func (f *File) Streaming(path string, transcodingType string) (string, error)
- type ListResponse
- type ListallResponse
- type LocalFileInfo
- type ManagerResponse
- type MetasResponse
- type PreCreateResponse
- type SuperFile2UploadResponse
- type UploadResponse
- type Uploader
- func (u *Uploader) Create(uploadID string, blockList []string) (UploadResponse, error)
- func (u *Uploader) PreCreate() (PreCreateResponse, error)
- func (u *Uploader) SuperFile2Upload(uploadID string, partSeq int, partByte []byte) (SuperFile2UploadResponse, error)
- func (u *Uploader) Upload() (UploadResponse, error)
- type WebFile
- type WebMetasResponse
Constants ¶
View Source
const ( ListUri = "/rest/2.0/xpan/file?method=list" ListallUri = "/rest/2.0/xpan/multimedia?method=listall" MetasUri = "/rest/2.0/xpan/multimedia?method=filemetas" StreamingUri = "/rest/2.0/xpan/file?method=streaming" )
View Source
const ( PreCreateUri = "/rest/2.0/xpan/file?method=precreate" CreateUri = "/rest/2.0/xpan/file?method=create" Superfile2UploadUri = "/rest/2.0/pcs/superfile2?method=upload" )
View Source
const (
PcsFileDownloadUri = "/rest/2.0/pcs/file?method=download"
)
View Source
const (
WebMetasUri = "/api/sharedownload?sign=×tamp=&clienttype=0&app_id=%s&web=1&dp-logid=17724300763630380079"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct { LocalFilePath string DownloadLink string FsID uint64 Path string AccessToken string TotalPart int }
func NewDownloader ¶
func NewDownloader(accessToken string, downloadLink string, localFilePath string) *Downloader
func NewDownloaderWithFsID ¶
func NewDownloaderWithFsID(accessToken string, fsID uint64, localFilePath string) *Downloader
func NewDownloaderWithFsIDAndPath ¶ added in v0.0.2
func NewDownloaderWithFsIDAndPath(accessToken string, fsID uint64, path string, localFilePath string) *Downloader
func NewDownloaderWithPath ¶
func NewDownloaderWithPath(accessToken string, path string, localFilePath string) *Downloader
非开放平台公开接口,生产环境谨慎使用
type File ¶
type File struct {
AccessToken string
}
func NewFileClient ¶
func (*File) Listall ¶
func (f *File) Listall(path string, recursion, start, limit int) (ListallResponse, error)
递归获取文件列表
Listall ¶
@param path 目录名称绝对路径,必须/开头;路径包含中文时需要UrlEncode编码。 @param recursion 是否递归,0为否,1为是,默认为0。 @param start 查询起点,默认为0,当返回has_more=1时,应使用返回的cursor作为下一次查询的起点。 @param limit 查询数目,默认为1000;如果设置start和limit参数,则建议最大设置为1000。
@return ListallResponse
type ListResponse ¶
type ListResponse struct { conf.CloudDiskResponseBase List []struct { FsID uint64 `json:"fs_id"` Path string `json:"path"` ServerFileName string `json:"server_filename"` Size int `json:"size"` IsDir int `json:"isdir"` Category int `json:"category"` Md5 string `json:"md5"` DirEmpty string `json:"dir_empty"` Thumbs map[string]string `json:"thumbs"` LocalCtime int `json:"local_ctime"` LocalMtime int `json:"local_mtime"` ServerCtime int `json:"server_ctime"` ServerMtime int `json:"server_mtime"` } }
type ListallResponse ¶
type ListallResponse struct { conf.ListallResponse List []struct { FsID uint64 `json:"fs_id"` Path string `json:"path"` ServerFileName string `json:"server_filename"` Size int `json:"size"` IsDir int `json:"isdir"` Category int `json:"category"` Md5 string `json:"md5"` DirEmpty string `json:"dir_empty"` Thumbs map[string]string `json:"thumbs"` LocalCtime int `json:"local_ctime"` LocalMtime int `json:"local_mtime"` ServerCtime int `json:"server_ctime"` ServerMtime int `json:"server_mtime"` } }
type LocalFileInfo ¶
type ManagerResponse ¶
type ManagerResponse struct { conf.CloudDiskResponseBase Info []struct { Path string TaskID int Errno int } }
type MetasResponse ¶
type MetasResponse struct { ErrorCode int `json:"errno"` ErrorMsg string `json:"errmsg"` RequestID int RequestIDStr string `json:"request_id"` List []struct { FsID uint64 `json:"fs_id"` Path string `json:"path"` Category int `json:"category"` FileName string `json:"filename"` IsDir int `json:"isdir"` Size int `json:"size"` Md5 string `json:"md5"` DLink string `json:"dlink"` Thumbs map[string]string `json:"thumbs"` ServerCtime int `json:"server_ctime"` ServerMtime int `json:"server_mtime"` DateTaken int `json:"date_taken"` Width int `json:"width"` Height int `json:"height"` } }
type PreCreateResponse ¶
type PreCreateResponse struct { conf.CloudDiskResponseBase UploadID string `json:"uploadid"` Path string `json:"path"` ReturnType int `json:"return_type"` BlockList []int `json:"block_list"` Info UploadResponse `json:"info"` }
type SuperFile2UploadResponse ¶
type SuperFile2UploadResponse struct { conf.PcsResponseBase Md5 string `json:"md5"` UploadID string `json:"uploadid"` PartSeq string `json:"partseq"` //pcsapi PHP版本返回的是int类型,Go版本返回的是string类型 }
type UploadResponse ¶
type Uploader ¶
func NewUploader ¶
func (*Uploader) Create ¶
func (u *Uploader) Create(uploadID string, blockList []string) (UploadResponse, error)
file create
func (*Uploader) SuperFile2Upload ¶
func (u *Uploader) SuperFile2Upload(uploadID string, partSeq int, partByte []byte) (SuperFile2UploadResponse, error)
superfile2 upload
func (*Uploader) Upload ¶
func (u *Uploader) Upload() (UploadResponse, error)
上传文件到网盘,包括预创建、分片上传、创建3个步骤
type WebFile ¶
type WebMetasResponse ¶
type WebMetasResponse struct { ErrorCode int `json:"errno"` ServerTime int64 `json:"server_time"` RequestID int `json:"request_id"` RequestIDStr string List []struct { FsID uint64 `json:"fs_id"` Path string `json:"path"` Category int `json:"category"` FileName string `json:"server_filename"` IsDir int `json:"isdir"` Size int `json:"size"` Md5 string `json:"md5"` PathMd5 string `json:"path_md5"` DLink string `json:"dlink"` Thumbs map[string]string `json:"thumbs"` ServerCtime int `json:"server_ctime"` ServerMtime int `json:"server_mtime"` } }
Click to show internal directories.
Click to hide internal directories.