Documentation ¶
Overview ¶
Package drive helps you to manage you aliyun drive files.
Index ¶
- Constants
- Variables
- func CalcSha1(in *os.File) (*os.File, string, error)
- type AlbumInfo
- type Config
- type CreateDeviceSessionResult
- type DownloadUrl
- type Drive
- func (drive *Drive) About(ctx context.Context) (*PersonalSpaceInfo, error)
- func (drive *Drive) CalcProof(fileSize int64, in *os.File) (string, error)
- func (drive *Drive) CancelShareLink(ctx context.Context, shareID string) error
- func (drive *Drive) Copy(ctx context.Context, nodeId string, dstParentNodeId string, dstName string) (string, error)
- func (drive *Drive) CreateFile(ctx context.Context, node Node, in io.Reader) (string, error)
- func (drive *Drive) CreateFileWithProof(ctx context.Context, node Node, in io.Reader, sha1Code string, ...) (string, error)
- func (drive *Drive) CreateFolder(ctx context.Context, node Node) (string, error)
- func (drive *Drive) CreateFolderRecursively(ctx context.Context, fullPath string) (string, error)
- func (drive *Drive) CreateShareLink(ctx context.Context, node []Node, pwd string, expiresIn int64) (string, string, string, error)
- func (drive *Drive) Get(ctx context.Context, nodeId string) (*Node, error)
- func (drive *Drive) GetByPath(ctx context.Context, fullPath string, kind string) (*Node, error)
- func (drive *Drive) GetShareInfo(ctx context.Context, shareID string) (string, string, string, []string, error)
- func (drive *Drive) GetShareLinkByAnonymous(ctx context.Context, shareID string) (Expiration string, Creator string, err error)
- func (drive *Drive) GetShareToken(ctx context.Context, pwd string, shareID string) (shareToken string, error error)
- func (drive *Drive) List(nodeId string) Pager
- func (drive *Drive) ListAll(ctx context.Context, nodeId string) ([]Node, error)
- func (drive *Drive) ListShareLinks(ctx context.Context) ([]SharedFile, string, error)
- func (drive *Drive) Move(ctx context.Context, nodeId string, dstParentNodeId string, dstName string) (string, error)
- func (drive *Drive) Open(ctx context.Context, node *Node, headers map[string]string) (io.ReadCloser, error)
- func (drive *Drive) Remove(ctx context.Context, nodeId string) error
- func (drive *Drive) Search(ctx context.Context, name string) ([]Node, error)
- func (drive *Drive) String() string
- func (drive *Drive) Update(ctx context.Context, node Node) (string, error)
- type FileProof
- type Fs
- type HTTPStatusError
- type ListNodes
- type ListSharedFile
- type Node
- type NodeId
- type Pager
- type PartInfo
- type PersonalInfo
- type PersonalSpaceInfo
- type ProofResult
- type ShareToken
- type SharedFile
- type Token
- type User
Constants ¶
View Source
const ( FolderKind = "folder" FileKind = "file" AnyKind = "any" MaxPartSize = 1024 * 1024 * 1024 // 1 GiB Hour = 60 * 60 )
Variables ¶
Functions ¶
Types ¶
type AlbumInfo ¶
type AlbumInfo struct { Data struct { DriveId string `json:"driveId"` } `json:"data"` }
type Config ¶
type CreateDeviceSessionResult ¶
type CreateDeviceSessionResult struct {
Success bool `json:"success"`
}
type DownloadUrl ¶
type Drive ¶
type Drive struct {
// contains filtered or unexported fields
}
func (*Drive) CancelShareLink ¶
cancel shareLink by shareID
func (*Drive) Copy ¶
func (drive *Drive) Copy(ctx context.Context, nodeId string, dstParentNodeId string, dstName string) (string, error)
https://help.aliyun.com/document_detail/175927.html#pdscopyfilerequest
func (*Drive) CreateFile ¶
func (*Drive) CreateFileWithProof ¶
func (*Drive) CreateFolder ¶
func (*Drive) CreateFolderRecursively ¶
func (*Drive) CreateShareLink ¶
func (drive *Drive) CreateShareLink(ctx context.Context, node []Node, pwd string, expiresIn int64) (string, string, string, error)
create share link, para: ctx, file node list, pwd, expiresIn(second) return shareID, pwd, expiration
func (*Drive) GetByPath ¶
https://help.aliyun.com/document_detail/175927.html#pdsgetfilebypathrequest
func (*Drive) GetShareInfo ¶
func (drive *Drive) GetShareInfo(ctx context.Context, shareID string) (string, string, string, []string, error)
get share info by shareID return value may vary
func (*Drive) GetShareLinkByAnonymous ¶
func (*Drive) GetShareToken ¶
func (drive *Drive) GetShareToken(ctx context.Context, pwd string, shareID string) (shareToken string, error error)
get share_token using pwd and shareID How to use share_token: https://help.aliyun.com/document_detail/397603.html
func (*Drive) ListShareLinks ¶
type FileProof ¶
type FileProof struct { DriveID string `json:"drive_id"` PartInfoList []*PartInfo `json:"part_info_list"` ParentFileID string `json:"parent_file_id"` Name string `json:"name"` Type string `json:"type"` CheckNameMode string `json:"check_name_mode"` Size int64 `json:"size"` ContentHash string `json:"content_hash"` ContentHashName string `json:"content_hash_name"` ProofCode string `json:"proof_code"` ProofVersion string `json:"proof_version"` Meta string `json:"meta,omitempty"` }
type Fs ¶
type Fs interface { About(ctx context.Context) (*PersonalSpaceInfo, error) Get(ctx context.Context, nodeId string) (*Node, error) GetByPath(ctx context.Context, fullPath string, kind string) (*Node, error) List(nodeId string) Pager ListAll(ctx context.Context, nodeId string) ([]Node, error) // CreateFolder creates a folder to aliyun drive. // // required Node fields: ParentId, Name. // // may return ErrorMissingFields if required fields are missing. CreateFolder(ctx context.Context, node Node) (nodeIdOut string, err error) Move(ctx context.Context, nodeId string, dstParentNodeId string, dstName string) (nodeIdOut string, err error) Remove(ctx context.Context, nodeId string) error Open(ctx context.Context, node *Node, headers map[string]string) (io.ReadCloser, error) // CreateFile puts a file to aliyun drive. // // required Node fields: ParentId, Name. // // may return ErrorMissingFields if required fields are missing. CreateFile(ctx context.Context, node Node, in io.Reader) (nodeIdOut string, err error) CalcProof(fileSize int64, in *os.File) (proof string, err error) // CreateFileWithProof puts a file to aliyun drive. // // required Node fields: ParentId, Name. // // may return ErrorMissingFields if required fields are missing. CreateFileWithProof(ctx context.Context, node Node, in io.Reader, sha1Code string, proofCode string) (nodeIdOut string, err error) Copy(ctx context.Context, nodeId string, dstParentNodeId string, dstName string) (nodeIdOut string, err error) CreateFolderRecursively(ctx context.Context, fullPath string) (nodeIdOut string, err error) Update(ctx context.Context, node Node) (nodeIdOut string, err error) Search(ctx context.Context, name string) ([]Node, error) }
type HTTPStatusError ¶
type ListSharedFile ¶
type ListSharedFile struct {}
type Node ¶
type Node struct { Url string `json:"url,omitempty"` Type string `json:"type"` // folder | file Hash string `json:"content_hash,omitempty"` // sha1 Name string `json:"name"` NodeId string `json:"file_id"` ParentId string `json:"parent_file_id,omitempty"` Size int64 `json:"size,omitempty"` Updated string `json:"updated_at"` Meta string `json:"meta,omitempty"` // contains filtered or unexported fields }
func (*Node) IsDirectory ¶
type PersonalInfo ¶
type PersonalInfo struct {
PersonalSpaceInfo PersonalSpaceInfo `json:"personal_space_info"`
}
type PersonalSpaceInfo ¶
type ProofResult ¶
type ShareToken ¶
type ShareToken struct {
// contains filtered or unexported fields
}
type SharedFile ¶
type SharedFile struct {}
Click to show internal directories.
Click to hide internal directories.