Documentation
¶
Overview ¶
Package iclouddrive provides access to iCloud Drive and Photos
Package iclouddrive implements the iCloud Drive backend ¶
iCloud Photos backend implementation
Index ¶
- func Config(ctx context.Context, name string, m configmap.Mapper, config fs.ConfigIn) (*fs.ConfigOut, error)
- func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)
- func NewFsPhotos(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)
- func NewServiceFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)
- func ReadCookies(raw string) []*http.Cookie
- type Fs
- func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error)
- func (f *Fs) CreateDir(ctx context.Context, pathID, leaf string) (string, error)
- func (f *Fs) DirCacheFlush()
- func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error
- func (f *Fs) Features() *fs.Features
- func (f *Fs) FindDir(ctx context.Context, path string, create bool) (pathID string, etag string, err error)
- func (f *Fs) FindLeaf(ctx context.Context, pathID string, leaf string) (pathIDOut string, found bool, err error)
- func (f *Fs) FindPath(ctx context.Context, remote string, create bool) (leaf, directoryID, etag string, err error)
- func (f *Fs) Hashes() hash.Set
- func (f *Fs) IDJoin(id string, etag string) string
- func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)
- func (f *Fs) Mkdir(ctx context.Context, dir string) error
- func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error)
- func (f *Fs) Name() string
- func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)
- func (f *Fs) NewObjectFromDriveItem(ctx context.Context, remote string, item *api.DriveItem) (fs.Object, error)
- func (f *Fs) Precision() time.Duration
- func (f *Fs) Purge(ctx context.Context, dir string) error
- func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *Fs) Rmdir(ctx context.Context, dir string) error
- func (f *Fs) Root() string
- func (f *Fs) String() string
- type Object
- func (o *Object) Fs() fs.Info
- func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error)
- func (o *Object) ID() string
- func (o *Object) ModTime(context.Context) time.Time
- func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
- func (o *Object) Remote() string
- func (o *Object) Remove(ctx context.Context) error
- func (o *Object) SetModTime(ctx context.Context, t time.Time) error
- func (o *Object) Size() int64
- func (o *Object) Storable() bool
- func (o *Object) String() string
- func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
- type Options
- type PhotosFs
- func (f *PhotosFs) CreateDir(ctx context.Context, pathID, leaf string) (newID string, err error)
- func (f *PhotosFs) Features() *fs.Features
- func (f *PhotosFs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)
- func (f *PhotosFs) Hashes() hash.Set
- func (f *PhotosFs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)
- func (f *PhotosFs) Mkdir(ctx context.Context, dir string) error
- func (f *PhotosFs) Name() string
- func (f *PhotosFs) NewObject(ctx context.Context, remote string) (fs.Object, error)
- func (f *PhotosFs) Precision() time.Duration
- func (f *PhotosFs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *PhotosFs) Rmdir(ctx context.Context, dir string) error
- func (f *PhotosFs) Root() string
- func (f *PhotosFs) String() string
- type PhotosObject
- func (o *PhotosObject) Fs() fs.Info
- func (o *PhotosObject) Hash(ctx context.Context, ty hash.Type) (string, error)
- func (o *PhotosObject) ModTime(ctx context.Context) time.Time
- func (o *PhotosObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
- func (o *PhotosObject) Remote() string
- func (o *PhotosObject) Remove(ctx context.Context) error
- func (o *PhotosObject) SetModTime(ctx context.Context, modTime time.Time) error
- func (o *PhotosObject) Size() int64
- func (o *PhotosObject) Storable() bool
- func (o *PhotosObject) String() string
- func (o *PhotosObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
- type PhotosOptions
- type ServiceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Config ¶
func Config(ctx context.Context, name string, m configmap.Mapper, config fs.ConfigIn) (*fs.ConfigOut, error)
Config handles the authentication and configuration flow
func NewFsPhotos ¶
NewFsPhotos constructs an Fs for Photos from the path, container:path
func NewServiceFs ¶
NewServiceFs creates a filesystem instance for the selected service
func ReadCookies ¶
ReadCookies parses the raw cookie string and returns an array of http.Cookie objects.
Types ¶
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs represents a remote icloud drive
func (*Fs) Copy ¶
Copy src to this remote using server-side copy operations.
This is stored with the remote path given.
It returns the destination Object and a possible error.
Will only be called if src.Fs().Name() == f.Name()
If it isn't possible then return fs.ErrorCantCopy
func (*Fs) CreateDir ¶
CreateDir makes a directory with pathID as parent and name leaf
This should be implemented by the backend and will be called by the dircache package when appropriate.
func (*Fs) DirCacheFlush ¶
func (f *Fs) DirCacheFlush()
DirCacheFlush resets the directory cache - used in testing as an optional interface
func (*Fs) DirMove ¶
DirMove moves src, srcRemote to this remote at dstRemote using server-side move operations.
Will only be called if src.Fs().Name() == f.Name()
If it isn't possible then return fs.ErrorCantDirMove
If destination exists then return fs.ErrorDirExists
func (*Fs) FindDir ¶
func (f *Fs) FindDir(ctx context.Context, path string, create bool) (pathID string, etag string, err error)
FindDir finds the directory passed in returning the directory ID starting from pathID
func (*Fs) FindLeaf ¶
func (f *Fs) FindLeaf(ctx context.Context, pathID string, leaf string) (pathIDOut string, found bool, err error)
FindLeaf finds a directory of name leaf in the folder with ID pathID
func (*Fs) FindPath ¶
func (f *Fs) FindPath(ctx context.Context, remote string, create bool) (leaf, directoryID, etag string, err error)
FindPath finds the leaf and directoryID from a normalized path
func (*Fs) NewObject ¶
NewObject creates a new fs.Object from a given remote string.
ctx: The context.Context for the function. remote: The remote string representing the object's location. Returns an fs.Object and an error.
func (*Fs) NewObjectFromDriveItem ¶
func (f *Fs) NewObjectFromDriveItem(ctx context.Context, remote string, item *api.DriveItem) (fs.Object, error)
NewObjectFromDriveItem creates a new fs.Object from a given remote string and DriveItem.
ctx: The context.Context for the function. remote: The remote string representing the object's location. item: The optional DriveItem to use for initializing the Object. If nil, the function will read the metadata from the remote location. Returns an fs.Object and an error.
func (*Fs) Purge ¶
Purge all files in the directory specified
Implement this if you have a way of deleting all the files quicker than just running Remove() on the result of List()
Return an error if it doesn't exist
func (*Fs) Put ¶
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
Put in to the remote path with the modTime given of the given size
When called from outside an Fs by rclone, src.Size() will always be >= 0. But for unknown-sized objects (indicated by src.Size() == -1), Put should either return an error or upload it properly (rather than e.g. calling panic).
May create the object even if it returns an error - if so will return the object and the error, otherwise will return nil and the error
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object describes an icloud drive object
func (*Object) Open ¶
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
Open implements fs.Object.
func (*Object) SetModTime ¶
SetModTime implements fs.Object.
type Options ¶
type Options struct {
AppleID string `config:"apple_id"`
Password string `config:"password"`
Photos bool `config:"photos"`
TrustToken string `config:"trust_token"`
Cookies string `config:"cookies"`
ClientID string `config:"client_id"`
Enc encoder.MultiEncoder `config:"encoding"`
}
Options defines the configuration for this backend
type PhotosFs ¶
type PhotosFs struct {
// contains filtered or unexported fields
}
PhotosFs represents a remote iCloud Photos server
func (*PhotosFs) FindLeaf ¶
func (f *PhotosFs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)
FindLeaf finds a directory of name leaf in the folder with ID pathID
func (*PhotosFs) Put ¶
func (f *PhotosFs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
Put implements fs.Fs (read-only)
type PhotosObject ¶
type PhotosObject struct {
// contains filtered or unexported fields
}
PhotosObject describes an iCloud Photos object
func (*PhotosObject) ModTime ¶
func (o *PhotosObject) ModTime(ctx context.Context) time.Time
ModTime implements fs.Object
func (*PhotosObject) Open ¶
func (o *PhotosObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
Open implements fs.Object
func (*PhotosObject) Remove ¶
func (o *PhotosObject) Remove(ctx context.Context) error
Remove implements fs.Object (read-only)
func (*PhotosObject) SetModTime ¶
SetModTime implements fs.Object (read-only)
func (*PhotosObject) Storable ¶
func (o *PhotosObject) Storable() bool
Storable implements fs.Object
func (*PhotosObject) Update ¶
func (o *PhotosObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
Update implements fs.Object (read-only)
type PhotosOptions ¶
type PhotosOptions struct {
AppleID string `config:"apple_id"`
Password string `config:"password"`
TrustToken string `config:"trust_token"`
Cookies string `config:"cookies"`
ClientID string `config:"client_id"`
Enc encoder.MultiEncoder `config:"encoding"`
}
PhotosOptions defines the configuration for the Photos backend
type ServiceOptions ¶
type ServiceOptions struct {
Service string `config:"service"`
}
ServiceOptions defines the configuration for service selection