Documentation ¶
Overview ¶
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
- Copyright 2022 chyroc *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Index ¶
- Constants
- type AliyunDrive
- func (r *AliyunDrive) CancelShare(ctx context.Context, req *CancelShareReq) error
- func (r *AliyunDrive) CreateFolder(ctx context.Context, request *CreateFolderReq) (*CreateFolderResp, error)
- func (r *AliyunDrive) CreateShare(ctx context.Context, req *CreateShareReq) (*ShareFile, error)
- func (r *AliyunDrive) DeviceList(ctx context.Context) (*DeviceListResp, error)
- func (r *AliyunDrive) DownloadURL(ctx context.Context, request *DownloadReq) (*DownloadResp, error)
- func (r *AliyunDrive) Get(ctx context.Context, request *GetFileReq) (*GetFileResp, error)
- func (r *AliyunDrive) GetSBox(ctx context.Context) (*GetSBoxResp, error)
- func (r *AliyunDrive) IsLogin(ctx context.Context) bool
- func (r *AliyunDrive) List(ctx context.Context, request *FileListReq) (*FileListResp, error)
- func (r *AliyunDrive) ListShare(ctx context.Context, req *ListShareReq) (*ListShareResp, error)
- func (r *AliyunDrive) Lists(ctx context.Context, request *FileListReq) (*FileListResp, error)
- func (r *AliyunDrive) Move(ctx context.Context, request *MoveReq) (*MoveResp, error)
- func (r *AliyunDrive) MySelf(ctx context.Context) (*GetSelfUserResp, error)
- func (r *AliyunDrive) Path(ctx context.Context, request *PathReq) (*PathResp, error)
- func (r *AliyunDrive) PersonalInfo(ctx context.Context) (*PersonalInfoResp, error)
- func (r *AliyunDrive) RefreshToken(ctx context.Context, request *RefreshTokenReq) (*RefreshTokenResp, error)
- func (r *AliyunDrive) Rename(ctx context.Context, request *RenameFileReq) (*RenameFileResp, error)
- func (r *AliyunDrive) Restore(ctx context.Context, request *RestoreFileReq) error
- func (r *AliyunDrive) Token(ctx context.Context, request *TokenReq) (*RefreshTokenResp, error)
- func (r *AliyunDrive) Trash(ctx context.Context, request *DeleteFileReq) error
- func (r *AliyunDrive) UpdateShare(ctx context.Context, req *UpdateShareReq) (*ShareFile, error)
- func (r *AliyunDrive) UploadFile(ctx context.Context, request *UploadFileReq) (*UploadFileResp, error)
- func (r *AliyunDrive) UploadStream(ctx context.Context, request *UploadFileReq, stream io.Reader, ...) (*UploadFileResp, error)
- type CancelShareReq
- type CreateFolderReq
- type CreateFolderResp
- type CreateShareReq
- type DeleteFileReq
- type DeleteFileResp
- type DeviceListResp
- type DownloadReq
- type DownloadResp
- type File
- type FileListReq
- type FileListResp
- type GetFileReq
- type GetFileResp
- type GetSBoxResp
- type GetSelfUserResp
- type ListShareReq
- type ListShareResp
- type MoveReq
- type MoveResp
- type OptionFunc
- type PathReq
- type PathResp
- type PersonalInfoResp
- type RefreshTokenReq
- type RefreshTokenResp
- type RenameFileReq
- type RenameFileResp
- type RestoreFileReq
- type ShareFile
- type Store
- type Token
- type TokenReq
- type UpdateShareReq
- type UploadFileReq
- type UploadFileResp
Constants ¶
View Source
const ( TypeFolder = "folder" TypeFile = "file" )
View Source
const ( ModeRefuse = "refuse" ModeAutoRename = "auto_rename" )
View Source
const KeyAccessToken = "aliyun_drive_access_token"
View Source
const KeyRefreshToken = "aliyun_drive_refresh_token"
View Source
const RootFileID = "root"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliyunDrive ¶
type AliyunDrive struct {
// contains filtered or unexported fields
}
func New ¶
func New(options ...OptionFunc) *AliyunDrive
func (*AliyunDrive) CancelShare ¶
func (r *AliyunDrive) CancelShare(ctx context.Context, req *CancelShareReq) error
func (*AliyunDrive) CreateFolder ¶
func (r *AliyunDrive) CreateFolder(ctx context.Context, request *CreateFolderReq) (*CreateFolderResp, error)
CreateFolder to create folder
func (*AliyunDrive) CreateShare ¶
func (r *AliyunDrive) CreateShare(ctx context.Context, req *CreateShareReq) (*ShareFile, error)
func (*AliyunDrive) DeviceList ¶
func (r *AliyunDrive) DeviceList(ctx context.Context) (*DeviceListResp, error)
func (*AliyunDrive) DownloadURL ¶
func (r *AliyunDrive) DownloadURL(ctx context.Context, request *DownloadReq) (*DownloadResp, error)
func (*AliyunDrive) Get ¶
func (r *AliyunDrive) Get(ctx context.Context, request *GetFileReq) (*GetFileResp, error)
func (*AliyunDrive) GetSBox ¶
func (r *AliyunDrive) GetSBox(ctx context.Context) (*GetSBoxResp, error)
func (*AliyunDrive) IsLogin ¶
func (r *AliyunDrive) IsLogin(ctx context.Context) bool
IsLogin to detect whether user is login
func (*AliyunDrive) List ¶
func (r *AliyunDrive) List(ctx context.Context, request *FileListReq) (*FileListResp, error)
@TODO
func (*AliyunDrive) ListShare ¶
func (r *AliyunDrive) ListShare(ctx context.Context, req *ListShareReq) (*ListShareResp, error)
func (*AliyunDrive) Lists ¶
func (r *AliyunDrive) Lists(ctx context.Context, request *FileListReq) (*FileListResp, error)
func (*AliyunDrive) MySelf ¶
func (r *AliyunDrive) MySelf(ctx context.Context) (*GetSelfUserResp, error)
func (*AliyunDrive) PersonalInfo ¶
func (r *AliyunDrive) PersonalInfo(ctx context.Context) (*PersonalInfoResp, error)
func (*AliyunDrive) RefreshToken ¶
func (r *AliyunDrive) RefreshToken(ctx context.Context, request *RefreshTokenReq) (*RefreshTokenResp, error)
func (*AliyunDrive) Rename ¶
func (r *AliyunDrive) Rename(ctx context.Context, request *RenameFileReq) (*RenameFileResp, error)
func (*AliyunDrive) Restore ¶
func (r *AliyunDrive) Restore(ctx context.Context, request *RestoreFileReq) error
func (*AliyunDrive) Token ¶
func (r *AliyunDrive) Token(ctx context.Context, request *TokenReq) (*RefreshTokenResp, error)
func (*AliyunDrive) Trash ¶
func (r *AliyunDrive) Trash(ctx context.Context, request *DeleteFileReq) error
func (*AliyunDrive) UpdateShare ¶
func (r *AliyunDrive) UpdateShare(ctx context.Context, req *UpdateShareReq) (*ShareFile, error)
func (*AliyunDrive) UploadFile ¶
func (r *AliyunDrive) UploadFile(ctx context.Context, request *UploadFileReq) (*UploadFileResp, error)
func (*AliyunDrive) UploadStream ¶
func (r *AliyunDrive) UploadStream(ctx context.Context, request *UploadFileReq, stream io.Reader, streamSize int64) (*UploadFileResp, error)
type CancelShareReq ¶
type CancelShareReq struct {
}type CreateFolderReq ¶
type CreateFolderResp ¶
type CreateShareReq ¶
type CreateShareReq struct {}
type DeleteFileReq ¶
type DeleteFileResp ¶
type DeviceListResp ¶
type DownloadReq ¶ added in v1.0.1
type DownloadResp ¶ added in v1.0.1
type DownloadResp struct { Method string `json:"method"` URL string `json:"url"` InternalURL string `json:"internal_url"` CdnURL string `json:"cdn_url"` Expiration string `json:"expiration"` Size int `json:"size"` RateLimit struct { PartSpeed int `json:"part_speed"` PartSize int `json:"part_size"` } `json:"ratelimit"` }
type File ¶
type File struct { DriveID string `json:"drive_id"` DomainID string `json:"domain_id"` FileID string `json:"file_id"` Name string `json:"name"` Type string `json:"type"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Hidden bool `json:"hidden"` Starred bool `json:"starred"` Status string `json:"status"` UserMeta string `json:"user_meta,omitempty"` ParentFileID string `json:"parent_file_id"` EncryptMode string `json:"encrypt_mode"` ContentType string `json:"content_type,omitempty"` FileExtension string `json:"file_extension,omitempty"` MimeType string `json:"mime_type,omitempty"` MimeExtension string `json:"mime_extension,omitempty"` Size int64 `json:"size,omitempty"` Crc64Hash string `json:"crc64_hash,omitempty"` ContentHash string `json:"content_hash,omitempty"` ContentHashName string `json:"content_hash_name,omitempty"` DownloadURL string `json:"download_url,omitempty"` URL string `json:"url,omitempty"` Thumbnail string `json:"thumbnail,omitempty"` Category string `json:"category,omitempty"` PunishFlag int `json:"punish_flag,omitempty"` }
type FileListReq ¶
type FileListReq struct { GetAll bool `json:"get_all"` DriveID string `json:"drive_id"` // drive_id 和 share_id 必选传其中一个 ParentFileID string `json:"parent_file_id"` Marker string `json:"marker"` Limit int `json:"limit"` All bool `json:"all"` URLExpireSec int `json:"url_expire_sec"` ImageThumbnailProcess string `json:"image_thumbnail_process"` ImageURLProcess string `json:"image_url_process"` VideoThumbnailProcess string `json:"video_thumbnail_process"` Fields string `json:"fields"` OrderBy string `json:"order_by"` OrderDirection string `json:"order_direction"` }
type FileListResp ¶
type GetFileReq ¶
type GetFileResp ¶
type GetSBoxResp ¶
type GetSBoxResp struct { DriveID string `json:"drive_id"` UsedSize int `json:"sbox_used_size"` RealUsedSize int `json:"sbox_real_used_size"` TotalSize int64 `json:"sbox_total_size"` RecommendVip string `json:"recommend_vip"` PinSetup bool `json:"pin_setup"` Locked bool `json:"locked"` InsuranceEnabled bool `json:"insurance_enabled"` }
type GetSelfUserResp ¶
type GetSelfUserResp struct { 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"` DenyChangePasswordBySelf bool `json:"deny_change_password_by_self"` NeedChangePasswordNextLogin bool `json:"need_change_password_next_login"` Permission interface{} `json:"permission"` }
type ListShareReq ¶
type ListShareReq struct {}
type ListShareResp ¶
type ListShareResp struct {}
type OptionFunc ¶
type OptionFunc func(*AliyunDrive)
func WithLogger ¶
func WithLogger(logger *logrus.Logger) OptionFunc
func WithStore ¶
func WithStore(store Store) OptionFunc
type PersonalInfoResp ¶
type PersonalInfoResp struct { RightsInfo struct { SpuId string `json:"spu_id"` Name string `json:"name"` IsExpires bool `json:"is_expires"` Privileges []struct { FeatureId string `json:"feature_id"` FeatureAttrId string `json:"feature_attr_id"` Quota int `json:"quota"` } `json:"privileges"` } `json:"personal_rights_info"` SpaceInfo struct { UsedSize uint `json:"used_size"` TotalSize uint `json:"total_size"` } `json:"personal_space_info"` }
type RefreshTokenReq ¶
type RefreshTokenResp ¶
type RefreshTokenResp struct { DefaultSboxDriveID string `json:"default_sbox_drive_id"` Role string `json:"role"` DeviceID string `json:"device_id"` UserName string `json:"user_name"` NeedLink bool `json:"need_link"` ExpireTime time.Time `json:"expire_time"` PinSetup bool `json:"pin_setup"` NeedRpVerify bool `json:"need_rp_verify"` Avatar string `json:"avatar"` UserData struct { // DingDingRobotURL string `json:"DingDingRobotUrl"` // EncourageDesc string `json:"EncourageDesc"` // FeedBackSwitch bool `json:"FeedBackSwitch"` // FollowingDesc string `json:"FollowingDesc"` DingDingRobotURL string `json:"ding_ding_robot_url"` EncourageDesc string `json:"encourage_desc"` FeedBackSwitch bool `json:"feed_back_switch"` FollowingDesc string `json:"following_desc"` } `json:"user_data"` TokenType string `json:"token_type"` AccessToken string `json:"access_token"` DefaultDriveID string `json:"default_drive_id"` RefreshToken string `json:"refresh_token"` IsFirstLogin bool `json:"is_first_login"` UserID string `json:"user_id"` NickName string `json:"nick_name"` ExistLink []interface{} `json:"exist_link"` State string `json:"state"` ExpiresIn int `json:"expires_in"` Status string `json:"status"` }
type RenameFileReq ¶
type RenameFileResp ¶
type RenameFileResp struct { DriveID string `json:"drive_id"` UsedSize int `json:"sbox_used_size"` RealUsedSize int `json:"sbox_real_used_size"` TotalSize int64 `json:"sbox_total_size"` RecommendVip string `json:"recommend_vip"` PinSetup bool `json:"pin_setup"` Locked bool `json:"locked"` InsuranceEnabled bool `json:"insurance_enabled"` }
type RestoreFileReq ¶
type ShareFile ¶
type ShareFile struct { bool `json:"trashed"` Category string `json:"category"` ContentHash string `json:"content_hash"` ContentHashName string `json:"content_hash_name"` ContentType string `json:"content_type"` Crc64Hash string `json:"crc64_hash"` CreatedAt time.Time `json:"created_at"` DomainId string `json:"domain_id"` DownloadUrl string `json:"download_url"` DriveId string `json:"drive_id"` EncryptMode string `json:"encrypt_mode"` FileExtension string `json:"file_extension"` FileId string `json:"file_id"` Hidden bool `json:"hidden"` ImageMediaMetadata struct { CroppingSuggestion []struct { AspectRatio string `json:"aspect_ratio"` CroppingBoundary struct { Height int `json:"height"` Left int `json:"left"` Top int `json:"top"` Width int `json:"width"` } `json:"cropping_boundary"` Score float64 `json:"score"` } `json:"cropping_suggestion"` Exif string `json:"exif"` Height int `json:"height"` ImageQuality struct { OverallScore float64 `json:"overall_score"` } `json:"image_quality"` ImageTags []struct { Confidence float64 `json:"confidence"` Name string `json:"name"` TagLevel int `json:"tag_level"` ParentName string `json:"parent_name,omitempty"` } `json:"image_tags"` Width int `json:"width"` } `json:"image_media_metadata"` Labels []string `json:"labels"` MimeType string `json:"mime_type"` Name string `json:"name"` ParentFileId string `json:"parent_file_id"` PunishFlag int `json:"punish_flag"` Size int `json:"size"` Starred bool `json:"starred"` Status string `json:"status"` Thumbnail string `json:"thumbnail"` Type string `json:"type"` UpdatedAt time.Time `json:"updated_at"` UploadId string `json:"upload_id"` Url string `json:"url"` UserMeta string `json:"user_meta"` } `json:"first_file"` }Trashed
type UpdateShareReq ¶
type UpdateShareReq struct {}
type UploadFileReq ¶
type UploadFileResp ¶
type UploadFileResp struct { DriveID string `json:"drive_id"` DomainID string `json:"domain_id"` FileID string `json:"file_id"` Name string `json:"name"` Type string `json:"type"` ContentType string `json:"content_type"` // application/oct-stream CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FileExtension string `json:"file_extension"` Hidden bool `json:"hidden"` Size int `json:"size"` Starred bool `json:"starred"` Status string `json:"status"` // available UploadID string `json:"upload_id"` ParentFileID string `json:"parent_file_id"` Crc64Hash string `json:"crc64_hash"` ContentHash string `json:"content_hash"` ContentHashName string `json:"content_hash_name"` // sha1 Category string `json:"category"` EncryptMode string `json:"encrypt_mode"` ImageMediaMetadata struct { ImageQuality struct{} `json:"image_quality"` } `json:"image_media_metadata"` Location string `json:"location"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.