Documentation ¶
Index ¶
- Constants
- func BoolToIntStr(b bool) string
- func MustString(str string, err error) string
- type Addition
- type Album
- type AlbumFile
- type AlbumFileListResp
- type AlbumListResp
- type BaiduPhoto
- func (d *BaiduPhoto) AddAlbumFile(ctx context.Context, album *Album, file *File) (*AlbumFile, error)
- func (d *BaiduPhoto) Config() driver.Config
- func (d *BaiduPhoto) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)
- func (d *BaiduPhoto) CopyAlbumFile(ctx context.Context, file *AlbumFile) (*File, error)
- func (d *BaiduPhoto) CreateAlbum(ctx context.Context, name string) (*Album, error)
- func (d *BaiduPhoto) DeleteAlbum(ctx context.Context, album *Album) error
- func (d *BaiduPhoto) DeleteAlbumFile(ctx context.Context, file *AlbumFile) error
- func (d *BaiduPhoto) DeleteFile(ctx context.Context, file *File) error
- func (d *BaiduPhoto) Drop(ctx context.Context) error
- func (d *BaiduPhoto) Get(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
- func (d *BaiduPhoto) GetAddition() driver.Additional
- func (d *BaiduPhoto) GetAlbumDetail(ctx context.Context, albumID string) (*Album, error)
- func (d *BaiduPhoto) GetAllAlbum(ctx context.Context) (albums []Album, err error)
- func (d *BaiduPhoto) GetAllAlbumFile(ctx context.Context, album *Album, passwd string) (files []AlbumFile, err error)
- func (d *BaiduPhoto) GetAllFile(ctx context.Context) (files []File, err error)
- func (d *BaiduPhoto) GetRoot(ctx context.Context) (model.Obj, error)
- func (d *BaiduPhoto) Init(ctx context.Context) error
- func (d *BaiduPhoto) JoinAlbum(ctx context.Context, code string) (*Album, error)
- func (d *BaiduPhoto) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
- func (d *BaiduPhoto) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)
- func (d *BaiduPhoto) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)
- func (d *BaiduPhoto) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)
- func (d *BaiduPhoto) Post(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
- func (d *BaiduPhoto) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, ...) (model.Obj, error)
- func (d *BaiduPhoto) Remove(ctx context.Context, obj model.Obj) error
- func (d *BaiduPhoto) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)
- func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
- func (d *BaiduPhoto) SetAlbumName(ctx context.Context, album *Album, name string) (*Album, error)
- type CopyFile
- type CopyFileResp
- type CreateFileResp
- type Erron
- type File
- type FileListResp
- type InviteResp
- type JoinOrCreateAlbumResp
- type Page
- type PrecreateResp
- type Root
- type TokenErrResp
- type UInfo
- type UploadFile
Constants ¶
View Source
const ( API_URL = "https://photo.baidu.com/youai" USER_API_URL = API_URL + "/user/v1" ALBUM_API_URL = API_URL + "/album/v1" FILE_API_URL_V1 = API_URL + "/file/v1" FILE_API_URL_V2 = API_URL + "/file/v2" )
Variables ¶
This section is empty.
Functions ¶
func BoolToIntStr ¶
func MustString ¶
Types ¶
type Addition ¶
type Addition struct { RefreshToken string `json:"refresh_token" required:"true"` ShowType string `json:"show_type" type:"select" options:"root,root_only_album,root_only_file" default:"root"` AlbumID string `json:"album_id"` //AlbumPassword string `json:"album_password"` DeleteOrigin bool `json:"delete_origin"` ClientID string `json:"client_id" required:"true" default:"iYCeC9g08h5vuP9UqvPHKKSVrKFXGa1v"` ClientSecret string `json:"client_secret" required:"true" default:"jXiFMOPVPCWlO2M5CwWQzffpNPaGTRBG"` UploadThread string `json:"upload_thread" default:"3" help:"1<=thread<=32"` }
type Album ¶
type Album struct { AlbumID string `json:"album_id"` Tid int64 `json:"tid"` Title string `json:"title"` JoinTime int64 `json:"join_time"` CreationTime int64 `json:"create_time"` Mtime int64 `json:"mtime"` // contains filtered or unexported fields }
相册部分
func (*Album) CreateTime ¶
type AlbumFile ¶
type AlbumFile struct { File AlbumID string `json:"album_id"` Tid int64 `json:"tid"` Uk int64 `json:"uk"` }
相册部分
type AlbumFileListResp ¶
type AlbumFileListResp struct { Page List []AlbumFile `json:"list"` Reset int64 `json:"reset"` TotalCount int64 `json:"total_count"` }
相册部分
type AlbumListResp ¶
type AlbumListResp struct { Page List []Album `json:"list"` Reset int64 `json:"reset"` TotalCount int64 `json:"total_count"` }
相册部分
type BaiduPhoto ¶
type BaiduPhoto struct { model.Storage Addition AccessToken string Uk int64 // contains filtered or unexported fields }
func (*BaiduPhoto) AddAlbumFile ¶
func (d *BaiduPhoto) AddAlbumFile(ctx context.Context, album *Album, file *File) (*AlbumFile, error)
增加相册文件
func (*BaiduPhoto) Config ¶
func (d *BaiduPhoto) Config() driver.Config
func (*BaiduPhoto) CopyAlbumFile ¶
保存相册文件为根文件
func (*BaiduPhoto) CreateAlbum ¶
创建相册
func (*BaiduPhoto) DeleteAlbum ¶
func (d *BaiduPhoto) DeleteAlbum(ctx context.Context, album *Album) error
删除相册
func (*BaiduPhoto) DeleteAlbumFile ¶
func (d *BaiduPhoto) DeleteAlbumFile(ctx context.Context, file *AlbumFile) error
删除相册文件
func (*BaiduPhoto) DeleteFile ¶
func (d *BaiduPhoto) DeleteFile(ctx context.Context, file *File) error
删除根文件
func (*BaiduPhoto) Get ¶
func (d *BaiduPhoto) Get(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
func (*BaiduPhoto) GetAddition ¶
func (d *BaiduPhoto) GetAddition() driver.Additional
func (*BaiduPhoto) GetAlbumDetail ¶
获取相册详细信息
func (*BaiduPhoto) GetAllAlbum ¶
func (d *BaiduPhoto) GetAllAlbum(ctx context.Context) (albums []Album, err error)
获取所有相册
func (*BaiduPhoto) GetAllAlbumFile ¶
func (d *BaiduPhoto) GetAllAlbumFile(ctx context.Context, album *Album, passwd string) (files []AlbumFile, err error)
获取相册中所有文件
func (*BaiduPhoto) GetAllFile ¶
func (d *BaiduPhoto) GetAllFile(ctx context.Context) (files []File, err error)
获取所有文件
func (*BaiduPhoto) Post ¶
func (d *BaiduPhoto) Post(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
func (*BaiduPhoto) Put ¶
func (d *BaiduPhoto) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) (model.Obj, error)
func (*BaiduPhoto) Request ¶
func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) (*resty.Response, error)
func (*BaiduPhoto) SetAlbumName ¶
相册改名
type CopyFileResp ¶
type CopyFileResp struct {
List []CopyFile `json:"list"`
}
type File ¶
type File struct { Fsid int64 `json:"fsid"` // 文件ID Path string `json:"path"` // 文件路径 Size int64 `json:"size"` Ctime int64 `json:"ctime"` // 创建时间 s Mtime int64 `json:"mtime"` // 修改时间 s Thumburl []string `json:"thumburl"` Md5 string `json:"md5"` }
func (*File) CreateTime ¶
type FileListResp ¶
type InviteResp ¶
type InviteResp struct { Pdata struct { // 邀请码 InviteCode string `json:"invite_code"` // 有效时间 ExpireTime int `json:"expire_time"` ShareID string `json:"share_id"` } `json:"pdata"` }
共享相册部分
type JoinOrCreateAlbumResp ¶
type JoinOrCreateAlbumResp struct { AlbumID string `json:"album_id"` AlreadyExists int `json:"already_exists"` }
加入相册部分
type Page ¶
func (Page) HasNextPage ¶
type PrecreateResp ¶
type PrecreateResp struct { ReturnType int `json:"return_type"` //存在返回2 不存在返回1 已经保存3 //存在返回 CreateFileResp //不存在返回 Path string `json:"path"` UploadID string `json:"uploadid"` BlockList []int `json:"block_list"` }
上传部分
type TokenErrResp ¶
type TokenErrResp struct { ErrorDescription string `json:"error_description"` ErrorMsg string `json:"error"` }
func (*TokenErrResp) Error ¶
func (e *TokenErrResp) Error() string
type UploadFile ¶
type UploadFile struct { FsID int64 `json:"fs_id"` Size int64 `json:"size"` Md5 string `json:"md5"` ServerFilename string `json:"server_filename"` Path string `json:"path"` Ctime int64 `json:"ctime"` Mtime int64 `json:"mtime"` Isdir int `json:"isdir"` Category int `json:"category"` ServerMd5 string `json:"server_md5"` ShootTime int `json:"shoot_time"` }
上传部分
Click to show internal directories.
Click to hide internal directories.