Documentation
¶
Overview ¶
Package iclouddrive provides access to iCloud Drive and Photos
Package iclouddrive implements the iCloud Drive backend
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) Disconnect(ctx context.Context) 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) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryType), ...)
- func (f *PhotosFs) CreateDir(ctx context.Context, pathID, leaf string) (newID string, err error)
- func (f *PhotosFs) DirCacheFlush()
- func (f *PhotosFs) Disconnect(ctx context.Context) 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) ListR(ctx context.Context, dir string, callback fs.ListRCallback) 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) Metadata(ctx context.Context) (fs.Metadata, 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 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 ¶ added in v1.74.0
NewFsPhotos constructs an Fs for Photos from the path, container:path
func NewServiceFs ¶ added in v1.74.0
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) Disconnect ¶ added in v1.74.0
Disconnect clears authentication state and removes disk caches
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"`
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 ¶ added in v1.74.0
type PhotosFs struct {
// contains filtered or unexported fields
}
PhotosFs represents a remote iCloud Photos server
func (*PhotosFs) ChangeNotify ¶ added in v1.74.0
func (f *PhotosFs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryType), pollIntervalChan <-chan time.Duration)
ChangeNotify polls for changes and notifies the VFS when directories are modified
func (*PhotosFs) CreateDir ¶ added in v1.74.0
CreateDir makes a directory with pathID as parent and name leaf
func (*PhotosFs) DirCacheFlush ¶ added in v1.74.0
func (f *PhotosFs) DirCacheFlush()
DirCacheFlush resets the directory cache - used in testing as an optional interface
func (*PhotosFs) Disconnect ¶ added in v1.74.0
Disconnect clears authentication state and removes disk caches
func (*PhotosFs) FindLeaf ¶ added in v1.74.0
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) ListR ¶ added in v1.74.0
ListR lists the objects and directories of the Fs starting from dir recursively into out, calling callback for each batch of entries Albums are listed in parallel using a goroutine pool
func (*PhotosFs) NewObject ¶ added in v1.74.0
NewObject finds the Object at remote. If it can't be found it returns the error fs.ErrorObjectNotFound
func (*PhotosFs) Put ¶ added in v1.74.0
func (f *PhotosFs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
Put is not supported for this read-only backend
type PhotosObject ¶ added in v1.74.0
type PhotosObject struct {
// contains filtered or unexported fields
}
PhotosObject describes an iCloud Photos object
func (*PhotosObject) Fs ¶ added in v1.74.0
func (o *PhotosObject) Fs() fs.Info
Fs returns the parent Fs
func (*PhotosObject) Hash ¶ added in v1.74.0
Hash returns the hash of an object returning a lowercase hex string
func (*PhotosObject) ModTime ¶ added in v1.74.0
func (o *PhotosObject) ModTime(ctx context.Context) time.Time
ModTime returns the modification time of the object
func (*PhotosObject) Open ¶ added in v1.74.0
func (o *PhotosObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
Open an object for read, fetching a fresh download URL via records/lookup
func (*PhotosObject) Remote ¶ added in v1.74.0
func (o *PhotosObject) Remote() string
Remote returns the remote path
func (*PhotosObject) Remove ¶ added in v1.74.0
func (o *PhotosObject) Remove(ctx context.Context) error
Remove is not supported for this read-only backend
func (*PhotosObject) SetModTime ¶ added in v1.74.0
SetModTime sets the modification time of the object
func (*PhotosObject) Size ¶ added in v1.74.0
func (o *PhotosObject) Size() int64
Size returns the size of an object in bytes
func (*PhotosObject) Storable ¶ added in v1.74.0
func (o *PhotosObject) Storable() bool
Storable returns a boolean as to whether this object is storable
func (*PhotosObject) String ¶ added in v1.74.0
func (o *PhotosObject) String() string
Return a string version
func (*PhotosObject) Update ¶ added in v1.74.0
func (o *PhotosObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
Update is not supported for this read-only backend
type ServiceOptions ¶ added in v1.74.0
type ServiceOptions struct {
Service string `config:"service"`
}
ServiceOptions defines the configuration for service selection