Documentation ¶
Index ¶
- Constants
- func WithToken(request http.Request, token string)
- type BatchRequest
- type BatchRequestItem
- type BatchResponse
- type CheckNameMode
- type CompleteFileUploadRequest
- type CompleteFileUploadResponse
- type CreateFileRequest
- type CreateWithFolders
- type CreateWithFoldersPreHashRequest
- type CreateWithFoldersPreHashResponse
- type CreateWithFoldersWithProofRequest
- type CreateWithFoldersWithProofResponse
- type DownloadURLRequest
- type DownloadURLResponse
- type File
- type FileItem
- type FileRequest
- type FileResponse
- type FileType
- type Files
- type FolderFilesRequest
- type FolderFilesResponse
- type GetFileByPathRequest
- type GetPathRequest
- type GetPathResponse
- type GetUploadUrlRequest
- type GetUploadUrlResponse
- type MoveFileRequest
- type OfficePreviewUrlRequest
- type PartInfo
- type Path
- type RefreshTokenRequest
- type RefreshTokenResponse
- type RemoveFileRequest
- type RenameFileRequest
- type RenameFileResponse
- type SearchRequest
- type SearchResponse
- type UserInfo
- type UserInfoRequest
- type VideoPreviewPlayInfoRequest
- type VideoPreviewPlayInfoResponse
- type VideoPreviewUrlRequest
- type VideoPreviewUrlResponse
Constants ¶
View Source
const ( AliyunDriveEndpoint = "https://api.aliyundrive.com" AliyunDriveAuthEndpoint = "https://auth.aliyundrive.com" CodeAccessTokenInvalid = "AccessTokenInvalid" CodePreHashMatched = "PreHashMatched" )
View Source
const ( OrderDirectionTypeDescend = "DESC" OrderDirectionTypeAscend = "ASC" )
View Source
const ( ImageUrlProcessDefault = "image/resize,w_1920/format,jpeg" ImageThumbnailProcessDefault = "image/resize,w_400/format,jpeg" VideoThumbnailProcessDefault = "video/snapshot,t_0,f_jpg,ar_auto,w_300" SearchResultOrderDefault = "type ASC,updated_at DESC" )
View Source
const (
FileStatusAvailable = "available"
)
View Source
const PreviewCategoryDefault = "live_transcoding"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchRequest ¶
type BatchRequest struct { http.BaseRequest Requests []*BatchRequestItem `json:"requests"` Resource string `json:"resource"` }
func NewBatchMoveRequest ¶
func NewBatchMoveRequest(requests []*MoveFileRequest) *BatchRequest
NewBatchMoveRequest 创建批量移动文件请求
type BatchRequestItem ¶
type BatchResponse ¶
type BatchResponse struct { http.BaseResponse Responses []*struct { Body map[string]interface{} `json:"body"` Id string `json:"id"` Status int `json:"status"` } `json:"responses"` }
type CheckNameMode ¶
type CheckNameMode string
const ( CheckNameModeAutoRename CheckNameMode = "auto_rename" CheckNameModeRefuse CheckNameMode = "refuse" )
type CompleteFileUploadRequest ¶
type CompleteFileUploadRequest struct { http.BaseRequest DriveId string `json:"drive_id"` UploadId string `json:"upload_id"` // 上传 ID FileId string `json:"file_id"` // 文件 ID }
func NewCompleteFileUploadRequest ¶
func NewCompleteFileUploadRequest() *CompleteFileUploadRequest
type CompleteFileUploadResponse ¶
type CompleteFileUploadResponse struct { http.BaseResponse File UploadId string `json:"upload_id"` // 上传 ID }
type CreateFileRequest ¶
type CreateWithFolders ¶
type CreateWithFoldersPreHashRequest ¶
type CreateWithFoldersPreHashRequest struct { http.BaseRequest CreateWithFolders PreHash string `json:"pre_hash"` }
CreateWithFoldersPreHashRequest 使用 PreHash 进行 Proof 前校验
func NewCreateWithFoldersPreHashRequest ¶
func NewCreateWithFoldersPreHashRequest() *CreateWithFoldersPreHashRequest
type CreateWithFoldersPreHashResponse ¶
type CreateWithFoldersPreHashResponse struct { http.BaseResponse CreateWithFoldersWithProofResponse PreHash string `json:"pre_hash"` }
type CreateWithFoldersWithProofRequest ¶
type CreateWithFoldersWithProofRequest struct { http.BaseRequest CreateWithFolders ContentHash string `json:"content_hash"` ContentHashName string `json:"content_hash_name"` ProofCode string `json:"proof_code"` ProofVersion string `json:"proof_version"` }
CreateWithFoldersWithProofRequest 带 Proof 信息上传,可用于秒传
func NewCreateWithFoldersWithProofRequest ¶
func NewCreateWithFoldersWithProofRequest() *CreateWithFoldersWithProofRequest
type CreateWithFoldersWithProofResponse ¶
type CreateWithFoldersWithProofResponse struct { http.BaseResponse DriveId string `json:"drive_id"` DomainId string `json:"domain_id"` EncryptMode string `json:"encrypt_mode"` // 加密模式 FileId string `json:"file_id"` // 文件 ID FileName string `json:"file_name"` // 文件名 Location string `json:"location"` // 存储区域 ParentFileId string `json:"parent_file_id"` // 父文件 ID RapidUpload bool `json:"rapid_upload"` // 是否秒传 Type string `json:"type"` // 操作类型 UploadId string `json:"upload_id"` // 上传 ID PartInfoList []*PartInfo `json:"part_info_list"` // 文件上传分片信息 }
type DownloadURLRequest ¶
type DownloadURLRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` // 文件 ID ExpireSec int `json:"expire_sec"` // 下载链接超时时间(秒) FileName string `json:"file_name"` // 文件名 }
func NewDownloadURLRequest ¶
func NewDownloadURLRequest() *DownloadURLRequest
type DownloadURLResponse ¶
type File ¶
type File struct { http.BaseResponse DriveId string `json:"drive_id"` Name string `json:"name"` Type FileType `json:"type"` DomainId string `json:"domain_id"` EncryptMode string `json:"encrypt_mode"` FileId string `json:"file_id"` Hidden bool `json:"hidden"` ParentFileId string `json:"parent_file_id"` Starred bool `json:"starred"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Paths []Path `json:"paths"` FileItem }
File 文件对象
type FileItem ¶
type FileItem struct { Category string `json:"category"` // 文件类型 ContentHash string `json:"content_hash"` // 内容 HASH ContentHashName string `json:"content_hash_name"` // HASH 方法 Crc64Hash string `json:"crc64_hash"` // CRC64 HASH ContentType string `json:"content_type"` // 内容类型 MimeType string `json:"mime_type"` // MIME Type MimeExtension string `json:"mime_extension"` // MIME 后缀 FileExtension string `json:"file_extension"` // 文件后缀 Size int64 `json:"size"` // 大小 DownloadUrl *string `json:"download_url"` // 下载地址 Thumbnail *string `json:"thumbnail"` // 缩略图地址 Url *string `json:"url"` // URL ImageMediaMetadata map[string]interface{} `json:"image_media_metadata"` // 图像媒体元信息 VideoMediaMetadata map[string]interface{} `json:"video_media_metadata"` // 视频媒体元信息 VideoPreviewMetadata map[string]interface{} `json:"video_preview_metadata"` // 视频预览元信息 Labels []*string `json:"labels"` // 标签 PunishFlag int64 `json:"punish_flag"` }
FileItem 文件项信息
type FileRequest ¶
type FileRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` ImageThumbnailProcess string `json:"image_thumbnail_process"` VideoThumbnailProcess string `json:"video_thumbnail_process"` }
func NewFileRequest ¶
func NewFileRequest() *FileRequest
type FileResponse ¶
type FileResponse struct { http.BaseResponse *File }
type FolderFilesRequest ¶
type FolderFilesRequest struct { http.BaseRequest DriveId string `json:"drive_id"` Fields string `json:"fields"` // 字段 ImageThumbnailProcess string `json:"image_thumbnail_process"` // 图片缩略图处理器 ImageUrlProcess string `json:"image_url_process"` // 图片处理器 UrlExpireSec int `json:"url_expire_sec"` // Url 超时时间(秒) Limit int `json:"limit"` // 单次拉取数量 Marker string `json:"marker"` // 分页拉新标记 OrderBy string `json:"order_by"` // 排序字段 OrderDirection string `json:"order_direction"` // 排序方向,DESC/ASC ParentFileId string `json:"parent_file_id"` // 目录 ID VideoThumbnailProcess string `json:"video_thumbnail_process"` // 视频缩略图处理器 }
FolderFilesRequest 获取目录下文件列表
func NewFolderFilesRequest ¶
func NewFolderFilesRequest() *FolderFilesRequest
type FolderFilesResponse ¶
type FolderFilesResponse struct { http.BaseResponse Files }
type GetFileByPathRequest ¶
type GetFileByPathRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FilePath string `json:"file_path"` }
func NewGetFileByPathRequest ¶
func NewGetFileByPathRequest() *GetFileByPathRequest
type GetPathRequest ¶
type GetPathRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` }
func NewGetPathRequest ¶
func NewGetPathRequest() *GetPathRequest
NewGetPathRequest 创建查询路径请求,返回从当前 FileId 到根路径
type GetPathResponse ¶
type GetPathResponse struct { http.BaseResponse Items []*File `json:"items"` }
type GetUploadUrlRequest ¶
type GetUploadUrlRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` // 文件 ID ParentFileId string `json:"parent_file_id"` // 父文件 ID Type string `json:"type"` Name string `json:"name"` // 文件名字 ContentType string `json:"content_type"` // 内容类型 PartInfoList []*PartInfo `json:"part_info_list"` // 文件上传分片信息 }
GetUploadUrlRequest 获取文件分片上传路径
type GetUploadUrlResponse ¶
type GetUploadUrlResponse struct { http.BaseResponse PartInfoList []*PartInfo `json:"part_info_list"` // 文件上传分片信息 }
type MoveFileRequest ¶
type MoveFileRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` ToDriveId string `json:"to_drive_id"` ToParentFileId string `json:"to_parent_file_id"` }
func NewMoveFileRequest ¶
func NewMoveFileRequest() *MoveFileRequest
type OfficePreviewUrlRequest ¶
type OfficePreviewUrlRequest struct { http.BaseRequest AccessToken string `json:"access_token"` DriveId string `json:"drive_id"` FileId string `json:"file_id"` }
type PartInfo ¶
type PartInfo struct { PartSize int64 `json:"part_size"` // 分片大小 PartNumber int8 `json:"part_number"` // 分片序号 ContentType string `json:"content_type"` // 内容类型 InternalUploadUrl *string `json:"internal_upload_url"` // 内部上传地址 UploadUrl *string `json:"upload_url"` // 分片上传路径 Id int // 分片 ID StartOffset int64 // 当前分片开始位置 EndOffset int64 // 分片结束位置 IsUploaded bool // 是否已经上传 }
func NewPartInfoList ¶
NewPartInfoList 基于文件大小和分片大小创建分片信息
type RefreshTokenRequest ¶
type RefreshTokenRequest struct { http.BaseRequest RefreshToken string `json:"refresh_token"` GrantType string `json:"grant_type"` }
func NewRefreshTokenRequest ¶
func NewRefreshTokenRequest() *RefreshTokenRequest
NewRefreshTokenRequest create RefreshTokenRequest with api
type RefreshTokenResponse ¶
type RefreshTokenResponse struct { http.BaseResponse UserInfo AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` TokenType string `json:"token_type"` DefaultSboxDriveId string `json:"default_sbox_drive_id"` ExpireTime *time.Time `json:"expire_time"` State string `json:"state"` ExistLink []interface{} `json:"exist_link"` NeedLink bool `json:"need_link"` PinSetup bool `json:"pin_setup"` IsFirstLogin bool `json:"is_first_login"` NeedRpVerify bool `json:"need_rp_verify"` DeviceId string `json:"device_id"` }
type RemoveFileRequest ¶
type RemoveFileRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` // 文件 ID }
func NewRemoveFileRequest ¶
func NewRemoveFileRequest() *RemoveFileRequest
NewRemoveFileRequest 创建删除文件请求
type RenameFileRequest ¶
type RenameFileRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` CheckNameMode CheckNameMode `json:"check_name_mode"` Name string `json:"name"` }
func NewRenameFileRequest ¶
func NewRenameFileRequest() *RenameFileRequest
NewRenameFileRequest 创建重命名请求
type RenameFileResponse ¶
type RenameFileResponse struct { http.BaseResponse File }
type SearchRequest ¶
type SearchRequest struct { http.BaseRequest DriveId string `json:"drive_id"` Limit int `json:"limit"` Marker string `json:"marker"` OrderBy string `json:"order_by"` // "type ASC,updated_at DESC" Query string `json:"query"` // "name match '测试文件'" ImageThumbnailProcess string `json:"image_thumbnail_process"` ImageUrlProcess string `json:"image_url_process"` VideoThumbnailProcess string `json:"video_thumbnail_process"` }
func NewSearchRequest ¶
func NewSearchRequest() *SearchRequest
type SearchResponse ¶
type SearchResponse struct { http.BaseResponse Files }
type UserInfo ¶
type UserInfo struct { http.BaseResponse DomainId string `json:"domain_id"` UserId string `json:"user_id"` Avatar string `json:"avatar"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` Email string `json:"email"` NickName string `json:"nick_name"` Phone string `json:"phone"` Role string `json:"role"` Status string `json:"status"` UserName string `json:"user_name"` Description string `json:"description"` DefaultDriveId string `json:"default_drive_id"` UserData map[string]interface{} `json:"user_data"` }
type UserInfoRequest ¶
type UserInfoRequest struct {
http.BaseRequest
}
func NewUserInfoRequest ¶
func NewUserInfoRequest() *UserInfoRequest
type VideoPreviewPlayInfoRequest ¶
type VideoPreviewPlayInfoRequest struct { http.BaseRequest Category string `json:"category"` DriveId string `json:"drive_id"` FileId string `json:"file_id"` TemplateId string `json:"template_id"` }
func NewVideoPreviewPlayInfoRequest ¶
func NewVideoPreviewPlayInfoRequest() *VideoPreviewPlayInfoRequest
type VideoPreviewPlayInfoResponse ¶
type VideoPreviewPlayInfoResponse struct { http.BaseResponse VideoPreviewPlayInfo struct { LiveTranscodingTaskList []struct { TemplateId string `json:"template_id"` Status string `json:"status"` Url string `json:"url"` Stage string `json:"stage"` } `json:"live_transcoding_task_list"` Meta struct { Duration float64 `json:"duration"` Height int `json:"height"` Width int `json:"width"` LiveTranscodingMeta map[string]interface{} `json:"live_transcoding_meta"` } `json:"meta"` } `json:"video_preview_play_info"` }
type VideoPreviewUrlRequest ¶
type VideoPreviewUrlRequest struct { http.BaseRequest DriveId string `json:"drive_id"` FileId string `json:"file_id"` ExpireSec int `json:"expire_sec"` }
func NewVideoPreviewUrlRequest ¶
func NewVideoPreviewUrlRequest() *VideoPreviewUrlRequest
type VideoPreviewUrlResponse ¶
type VideoPreviewUrlResponse struct { http.BaseResponse TemplateList []struct { TemplateId string `json:"template_id"` Status string `json:"status"` Url string `json:"url"` } `json:"template_list"` }
Click to show internal directories.
Click to hide internal directories.