Documentation ¶
Overview ¶
Package fichier provides an interface to the 1Fichier storage system.
Index ¶
- func NewFs(ctx context.Context, name string, root string, config configmap.Mapper) (fs.Fs, error)
- type AccountInfo
- type CopyFileRequest
- type CopyFileResponse
- type DownloadRequest
- type EndFileUploadResponse
- type File
- type FileCopy
- type FileInfoRequest
- type FilesList
- type Folder
- type FoldersList
- type Fs
- func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error)
- 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) (newID string, err error)
- func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error
- func (f *Fs) Features() *fs.Features
- func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)
- func (f *Fs) Hashes() hash.Set
- 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) Precision() time.Duration
- func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, unlink bool) (string, error)
- func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *Fs) PutUnchecked(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 GenericOKResponse
- type GetTokenResponse
- type GetUploadNodeResponse
- type ListFilesRequest
- type ListFolderRequest
- type MakeFolderRequest
- type MakeFolderResponse
- type MoveDirRequest
- type MoveDirResponse
- type MoveFileRequest
- type MoveFileResponse
- 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) MimeType(ctx context.Context) string
- func (o *Object) ModTime(ctx 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(context.Context, 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 RemoveFileRequest
- type RemoveFolderRequest
- type RenameFileRequest
- type RenameFileResponse
- type RenameFileURL
- type RmFile
- type SharedFile
- type SharedFolderResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountInfo ¶ added in v1.58.0
type AccountInfo struct { StatsDate string `json:"stats_date"` MailRM string `json:"mail_rm"` DefaultQuota int64 `json:"default_quota"` UploadForbidden string `json:"upload_forbidden"` PageLimit int `json:"page_limit"` ColdStorage int64 `json:"cold_storage"` Status string `json:"status"` UseCDN string `json:"use_cdn"` AvailableColdStorage int64 `json:"available_cold_storage"` DefaultPort string `json:"default_port"` DefaultDomain int `json:"default_domain"` Email string `json:"email"` DownloadMenu string `json:"download_menu"` FTPDID int `json:"ftp_did"` DefaultPortFiles string `json:"default_port_files"` FTPReport string `json:"ftp_report"` OverQuota int64 `json:"overquota"` AvailableStorage int64 `json:"available_storage"` CDN string `json:"cdn"` Offer string `json:"offer"` SubscriptionEnd string `json:"subscription_end"` TFA string `json:"2fa"` AllowedColdStorage int64 `json:"allowed_cold_storage"` HotStorage int64 `json:"hot_storage"` DefaultColdStorageQuota int64 `json:"default_cold_storage_quota"` FTPMode string `json:"ftp_mode"` RUReport string `json:"ru_report"` }
AccountInfo is the structure how 1Fichier returns user info
type CopyFileRequest ¶ added in v1.55.0
type CopyFileRequest struct { URLs []string `json:"urls"` FolderID int `json:"folder_id"` Rename string `json:"rename,omitempty"` }
CopyFileRequest is the request structure of the corresponding request
type CopyFileResponse ¶ added in v1.55.0
type CopyFileResponse struct { Status string `json:"status"` Message string `json:"message"` Copied int `json:"copied"` URLs []FileCopy `json:"urls"` }
CopyFileResponse is the response structure of the corresponding request
type DownloadRequest ¶
type DownloadRequest struct { URL string `json:"url"` Single int `json:"single"` Pass string `json:"pass,omitempty"` CDN int `json:"cdn,omitempty"` }
DownloadRequest is the request structure of the corresponding request
type EndFileUploadResponse ¶
type EndFileUploadResponse struct { Incoming int `json:"incoming"` Links []struct { Download string `json:"download"` Filename string `json:"filename"` Remove string `json:"remove"` Size string `json:"size"` Whirlpool string `json:"whirlpool"` } `json:"links"` }
EndFileUploadResponse is the response structure of the corresponding request
type File ¶
type File struct { CDN int `json:"cdn"` Checksum string `json:"checksum"` ContentType string `json:"content-type"` Date string `json:"date"` Filename string `json:"filename"` Pass int `json:"pass"` Size int64 `json:"size"` URL string `json:"url"` }
File is the structure how 1Fichier returns a File
type FileInfoRequest ¶ added in v1.55.0
type FileInfoRequest struct {
URL string `json:"url"`
}
FileInfoRequest is the request structure of the corresponding request
type Folder ¶
type Folder struct { CreateDate string `json:"create_date"` ID int `json:"id"` Name string `json:"name"` Pass int `json:"pass"` }
Folder is the structure how 1Fichier returns a Folder
type FoldersList ¶
type FoldersList struct { FolderID int `json:"folder_id"` Name string `json:"name"` Status string `json:"Status"` SubFolders []Folder `json:"sub_folders"` }
FoldersList is the structure how 1Fichier returns a list of Folders
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs is the interface a cloud storage system must provide
func (*Fs) DirMove ¶ added in v1.64.0
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.
This is complicated by the fact that we can't use moveDir to move to a different directory AND rename at the same time as it can overwrite files in the source directory.
func (*Fs) FindLeaf ¶
func (f *Fs) 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 (*Fs) List ¶
List the objects and directories in dir into entries. The entries can be returned in any order but should be for a complete directory.
dir should be "" to list the root, and should not have trailing slashes.
This should return ErrDirNotFound if the directory isn't found.
func (*Fs) Mkdir ¶
Mkdir makes the directory (container, bucket)
Shouldn't return an error if it already exists
func (*Fs) NewObject ¶
NewObject finds the Object at remote. If it can't be found it returns the error ErrorObjectNotFound.
func (*Fs) PublicLink ¶ added in v1.55.0
func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, unlink bool) (string, error)
PublicLink adds a "readable by anyone with link" permission on the given file or folder.
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
func (*Fs) PutUnchecked ¶
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
PutUnchecked uploads the object
This will create a duplicate if we upload a new file without checking to see if there is one already - use Put() for that.
type GenericOKResponse ¶
GenericOKResponse is the response structure of the corresponding request
type GetTokenResponse ¶
type GetTokenResponse struct { URL string `json:"url"` Status string `json:"Status"` Message string `json:"Message"` }
GetTokenResponse is the response structure of the corresponding request
type GetUploadNodeResponse ¶
GetUploadNodeResponse is the response structure of the corresponding request
type ListFilesRequest ¶
type ListFilesRequest struct {
FolderID int `json:"folder_id"`
}
ListFilesRequest is the request structure of the corresponding request
type ListFolderRequest ¶
type ListFolderRequest struct {
FolderID int `json:"folder_id"`
}
ListFolderRequest is the request structure of the corresponding request
type MakeFolderRequest ¶
MakeFolderRequest is the request structure of the corresponding request
type MakeFolderResponse ¶
MakeFolderResponse is the response structure of the corresponding request
type MoveDirRequest ¶ added in v1.64.0
type MoveDirRequest struct { FolderID int `json:"folder_id"` DestinationFolderID int `json:"destination_folder_id,omitempty"` DestinationUser string `json:"destination_user"` Rename string `json:"rename,omitempty"` }
MoveDirRequest is the request structure of the corresponding request
type MoveDirResponse ¶ added in v1.64.0
type MoveDirResponse struct { Status string `json:"status"` Message string `json:"message"` OldName string `json:"old_name"` NewName string `json:"new_name"` }
MoveDirResponse is the response structure of the corresponding request
type MoveFileRequest ¶ added in v1.55.0
type MoveFileRequest struct { URLs []string `json:"urls"` FolderID int `json:"destination_folder_id"` Rename string `json:"rename,omitempty"` }
MoveFileRequest is the request structure of the corresponding request
type MoveFileResponse ¶ added in v1.55.0
type MoveFileResponse struct { Status string `json:"status"` Message string `json:"message"` URLs []string `json:"urls"` }
MoveFileResponse is the response structure of the corresponding request
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object is a filesystem like object provided by an Fs
func (*Object) Hash ¶
Hash returns the selected checksum of the file If no checksum is available it returns ""
func (*Object) ModTime ¶
ModTime returns the modification date of the file It should return a best guess if one isn't available
func (*Object) Open ¶
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
Open opens the file for read. Call Close() on the returned io.ReadCloser
func (*Object) SetModTime ¶
SetModTime sets the metadata on the object to set the modification date
func (*Object) Update ¶
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
Update in to the object 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), Upload should either return an error or update the object properly (rather than e.g. calling panic).
type Options ¶
type Options struct { APIKey string `config:"api_key"` FilePassword string `config:"file_password"` FolderPassword string `config:"folder_password"` CDN bool `config:"cdn"` Enc encoder.MultiEncoder `config:"encoding"` }
Options defines the configuration for this backend
type RemoveFileRequest ¶
type RemoveFileRequest struct {
Files []RmFile `json:"files"`
}
RemoveFileRequest is the request structure of the corresponding request
type RemoveFolderRequest ¶
type RemoveFolderRequest struct {
FolderID int `json:"folder_id"`
}
RemoveFolderRequest is the request structure of the corresponding request
type RenameFileRequest ¶ added in v1.56.0
type RenameFileRequest struct { URLs []RenameFileURL `json:"urls"` Pretty int `json:"pretty"` }
RenameFileRequest is the request structure of the corresponding request
type RenameFileResponse ¶ added in v1.56.0
type RenameFileResponse struct { Status string `json:"status"` Message string `json:"message"` Renamed int `json:"renamed"` URLs []struct { URL string `json:"url"` OldFilename string `json:"old_filename"` NewFilename string `json:"new_filename"` } `json:"urls"` }
RenameFileResponse is the response structure of the corresponding request
type RenameFileURL ¶ added in v1.56.0
RenameFileURL is the data structure to rename a single file
type RmFile ¶
type RmFile struct {
URL string `json:"url"`
}
RmFile is the request structure of the corresponding request
type SharedFile ¶
type SharedFile struct {}
SharedFile is the structure how 1Fichier returns a shared File
type SharedFolderResponse ¶
type SharedFolderResponse []SharedFile
SharedFolderResponse is the response structure of the corresponding request