Documentation ¶
Overview ¶
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 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
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 configures the iCloud remote.
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