Documentation ¶
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- func NewHttpClient() *http.Client
- type AddTaskOptions
- type CancelTaskOptions
- type Client
- func (c *Client) AddOfflineDownloadTask(opt *AddTaskOptions) (int64, *http.Response, error)
- func (c *Client) BatchCopy(pairs []*FTPair) (*MoveCopyResponse, *http.Response, error)
- func (c *Client) BatchDelete(paths []string) (*http.Response, error)
- func (c *Client) BatchGetMeta(paths []string) ([]*FileMeta, *http.Response, error)
- func (c *Client) BatchMove(pairs []*FTPair) (*MoveCopyResponse, *http.Response, error)
- func (c *Client) BatchRestore(fsIds []string) (*RestoreResponse, *http.Response, error)
- func (c *Client) BlockUpload(srcPath string) (*File, *http.Response, error)
- func (c *Client) CancelOfflineDownloadTask(opt *CancelTaskOptions) (*http.Response, error)
- func (c *Client) Copy(from, to string) (*MoveCopyResponse, *http.Response, error)
- func (c *Client) CreateSuperFile(targetPath string, md5 []string, opt *FileOptions) (*File, *http.Response, error)
- func (c *Client) Delete(path string) (*http.Response, error)
- func (c *Client) Diff(cursor string) (*http.Response, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Download(path string) (*http.Response, error)
- func (c *Client) DownloadStream(path string) (*http.Response, error)
- func (c *Client) EmptyRecycle() (*http.Response, error)
- func (c *Client) Get(url string, v interface{}) (*http.Response, error)
- func (c *Client) GetMeta(path string) (*FileMeta, *http.Response, error)
- func (c *Client) GetQuota() (*Quota, *http.Response, error)
- func (c *Client) ListFiles(opt *ListFilesOptions) ([]*File, *http.Response, error)
- func (c *Client) ListOfflineDownloadTask(opt *ListTaskOptions) (*http.Response, error)
- func (c *Client) ListRecycle(opt *ListRecycleOptions) (*ListRecycleResponse, *http.Response, error)
- func (c *Client) ListStream(opt *ListStreamOptions) (*StreamFile, *http.Response, error)
- func (c *Client) Mkdir(path string) (*File, *http.Response, error)
- func (c *Client) Move(from, to string) (*MoveCopyResponse, *http.Response, error)
- func (c *Client) NewDownloadRequest(method, urlStr string, body io.Reader) (*http.Request, error)
- func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error)
- func (c *Client) NewUploadRequest(method, urlStr string, body io.Reader) (*http.Request, error)
- func (c *Client) PartialDownload(path string, start, end int64) (*http.Response, error)
- func (c *Client) Post(url string, contentType string, body io.Reader, v interface{}) (*http.Response, error)
- func (c *Client) PostForm(url string, data url.Values, v interface{}) (*http.Response, error)
- func (c *Client) QueryOfflineDownloadTask(opt *QueryTaskOptions) (*http.Response, error)
- func (c *Client) RapidUpload(opt *RapiduUploadOptions) (*File, *http.Response, error)
- func (c *Client) Restore(fsId string) (*RestoreResponse, *http.Response, error)
- func (c *Client) Search(opt *SearchOptions) ([]*File, *http.Response, error)
- func (c *Client) Streaming(path, typ string) (*http.Response, error)
- func (c *Client) SumFile(path string) (contentLen int, contentMd5, sliceMd5 string, contentCrc32 uint32, err error)
- func (c *Client) Thumbnail(opt *ThumbnailOptions) (*http.Response, error)
- func (c *Client) Upload(srcPath string, opt *FileOptions) (*File, *http.Response, error)
- type ErrorResponse
- type FTPair
- type File
- type FileMeta
- type FileOptions
- type ListFilesOptions
- type ListRecycleOptions
- type ListRecycleResponse
- type ListStreamOptions
- type ListTaskOptions
- type MoveCopyResponse
- type QueryTaskOptions
- type Quota
- type RapiduUploadOptions
- type RestoreResponse
- type SearchOptions
- type StreamFile
- type ThumbnailOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckResponse ¶
func NewHttpClient ¶
Types ¶
type AddTaskOptions ¶
type AddTaskOptions struct { // 请求失效时间,如果有,则会校验 Expires int `url:"expires,omitempty"` // 下载后的文件保存路径 SavePath string `url:"save_path"` // 源文件的URL SourceURL string `url:"source_url"` // 下载限速,默认不限速 RateLimit int `url:"rate_limit,omitempty"` // 下载超时时间,默认3600秒 Timeout int `url:"timeout,omitempty"` // 下载完毕后的回调,默认为空 Callback string `url:"callback,omitempty"` }
type CancelTaskOptions ¶
type Client ¶
type Client struct { BaseURL *url.URL UploadURL *url.URL DownloadURL *url.URL UserAgent string AccessToken string // contains filtered or unexported fields }
func (*Client) AddOfflineDownloadTask ¶
添加离线下载任务
func (*Client) BatchDelete ¶
批量删除文件/目录
func (*Client) BatchGetMeta ¶
批量获取文件/目录的元信息
func (*Client) BatchRestore ¶
批量还原文件或目录
func (*Client) BlockUpload ¶
分片上传—文件分片及上传
func (*Client) CancelOfflineDownloadTask ¶
func (c *Client) CancelOfflineDownloadTask(opt *CancelTaskOptions) (*http.Response, error)
取消离线下载任务
func (*Client) CreateSuperFile ¶
func (c *Client) CreateSuperFile(targetPath string, md5 []string, opt *FileOptions) (*File, *http.Response, error)
分片上传—合并分片文件 与分片文件上传的upload方法配合使用,可实现超大文件(>2G)上传,同时也可用于断点续传的场景。
func (*Client) DownloadStream ¶
下载流式文件
func (*Client) ListOfflineDownloadTask ¶
func (c *Client) ListOfflineDownloadTask(opt *ListTaskOptions) (*http.Response, error)
查询离线下载任务列表
func (*Client) ListRecycle ¶
func (c *Client) ListRecycle(opt *ListRecycleOptions) (*ListRecycleResponse, *http.Response, error)
查询回收站文件,获取回收站中的文件及目录列表
func (*Client) ListStream ¶
func (c *Client) ListStream(opt *ListStreamOptions) (*StreamFile, *http.Response, error)
获取流式文件列表
func (*Client) NewDownloadRequest ¶
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) NewUploadRequest ¶
func (*Client) PartialDownload ¶
下载单个文件: 支持断点下载 start: byte end: byte
func (*Client) QueryOfflineDownloadTask ¶
func (c *Client) QueryOfflineDownloadTask(opt *QueryTaskOptions) (*http.Response, error)
精确查询离线下载任务
func (*Client) RapidUpload ¶
秒传一个文件。
func (*Client) Streaming ¶
为当前用户进行视频转码并实现在线实时观看 path: 格式必须为m3u8,m3u,asf,avi,flv,gif,mkv,mov,mp4,m4a,3gp,3g2,mj2,mpeg,ts,rm,rmvb,webm typ: 目前支持以下格式:
M3U8_320_240、M3U8_480_224、M3U8_480_360、M3U8_640_480和M3U8_854_480
func (*Client) SumFile ¶
func (c *Client) SumFile(path string) (contentLen int, contentMd5, sliceMd5 string, contentCrc32 uint32, err error)
计算文件的各种值
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"error_msg"` // error message Code int `json:"error_code"` // error code }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type File ¶
type File struct { Path string `json:"path"` // 文件的绝对路径 Size uint64 `json:"size"` // 文件大小(以字节为单位) Ctime uint64 `json:"ctime"` // 文件创建时间 Mtime uint64 `json:"mtime"` // 文件修改时间 Md5 string `json:"md5"` // 文件的md5签名 FsId uint64 `json:"fs_id"` // 文件在PCS的临时唯一标识ID IsDir uint `json:"isdir"` // 是否是目录的标识符: “0”为文件, “1”为目录 }
type FileOptions ¶
type ListFilesOptions ¶
type ListFilesOptions struct { // 需要list的目录,以/开头的绝对路径。 Path string `url:"path"` // “asc”或“desc”,缺省采用降序排序。 // asc(升序) // desc(降序) Order string `url:"order,omitempty"` // 排序字段,缺省根据文件类型排序: // time(修改时间) // name(文件名) // size(大小,注意目录无大小) By string `url:"by,omitempty"` // 返回条目控制,参数格式为:n1-n2。 // 返回结果集的[n1, n2)之间的条目,缺省返回所有条目;n1从0开始。 Limit string `url:"limit,omitempty"` }
type ListRecycleOptions ¶
type ListRecycleResponse ¶
type ListRecycleResponse struct {
List []*File `json:"list"`
}
type ListStreamOptions ¶
type ListTaskOptions ¶
type ListTaskOptions struct { // 请求失效时间,如果有,则会校验 Expires int `url:"expires,omitempty"` // 查询任务起始位置,默认为0 Start int `url:"start,omitempty"` // 设定返回任务数量,默认为10 Limit int `url:"limit,omitempty"` // 0:降序,默认值 // 1:升序 Asc int `url:"asc,omitempty"` // 源地址URL,默认为空 SourceURL string `url:"source_url,omitempty"` // 文件保存路径,默认为空 SavePath string `url:"save_path,omitempty"` // 任务创建时间,默认为空 CreateTime int `url:"create_time,omitempty"` // 任务状态,默认为空 Status int `url:"status,omitempty"` // 是否需要返回任务信息: // 0:不需要 // 1:需要,默认为1 NeedTaskInfo int `url:"need_task_info,omitempty"` }
type MoveCopyResponse ¶
type QueryTaskOptions ¶
type RapiduUploadOptions ¶
type RapiduUploadOptions struct { // 上传文件的全路径名 Path string `url:"path"` // 待秒传的文件长度 ContentLength int `url:"content-length"` // 待秒传的文件的MD5 ContentMd5 string `url:"content-md5"` // 待秒传文件校验段的MD5 SliceMd5 string `url:"slice-md5"` // 待秒传文件CRC32 ContentCrc32 string `url:"content-crc32"` // overwrite:表示覆盖同名文件; // newcopy:表示生成文件副本并进行重命名,命名规则为“文件名_日期.后缀”。 Ondup string `url:"ondup,omitempty"` }
type RestoreResponse ¶
type RestoreResponse struct { Extra struct { List []struct { FsID string `json:"fs_id"` } `json:"list"` } `json:"extra"` }
type SearchOptions ¶
type StreamFile ¶
Click to show internal directories.
Click to hide internal directories.