action

package
v2.19.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadAction

type DownloadAction struct {
	// contains filtered or unexported fields
}

DownloadAction is used to download files through Reva. WebDAV will be used automatically if the endpoint supports it.

func MustNewDownloadAction

func MustNewDownloadAction(session *sdk.Session) *DownloadAction

MustNewDownloadAction creates a new download action and panics on failure.

func NewDownloadAction

func NewDownloadAction(session *sdk.Session) (*DownloadAction, error)

NewDownloadAction creates a new download action.

func (*DownloadAction) Download

func (action *DownloadAction) Download(fileInfo *storage.ResourceInfo) ([]byte, error)

Download retrieves the data of the provided resource.

func (*DownloadAction) DownloadFile

func (action *DownloadAction) DownloadFile(path string) ([]byte, error)

DownloadFile retrieves the data of the provided file path. The method first tries to retrieve information about the remote file by performing a "stat" on it.

type EnumFilesAction

type EnumFilesAction struct {
	// contains filtered or unexported fields
}

EnumFilesAction offers functions to enumerate files and directories.

func MustNewEnumFilesAction

func MustNewEnumFilesAction(session *sdk.Session) *EnumFilesAction

MustNewEnumFilesAction creates a new enum files action and panics on failure.

func NewEnumFilesAction

func NewEnumFilesAction(session *sdk.Session) (*EnumFilesAction, error)

NewEnumFilesAction creates a new enum files action.

func (*EnumFilesAction) ListAll

func (action *EnumFilesAction) ListAll(path string, includeSubdirectories bool) ([]*storage.ResourceInfo, error)

ListAll retrieves all files and directories contained in the provided path.

func (*EnumFilesAction) ListAllWithFilter

func (action *EnumFilesAction) ListAllWithFilter(path string, includeSubdirectories bool, filter func(*storage.ResourceInfo) bool) ([]*storage.ResourceInfo, error)

ListAllWithFilter retrieves all files and directories that fulfill the provided predicate.

func (*EnumFilesAction) ListDirs

func (action *EnumFilesAction) ListDirs(path string, includeSubdirectories bool) ([]*storage.ResourceInfo, error)

ListDirs retrieves all directories contained in the provided path.

func (*EnumFilesAction) ListFiles

func (action *EnumFilesAction) ListFiles(path string, includeSubdirectories bool) ([]*storage.ResourceInfo, error)

ListFiles retrieves all files contained in the provided path.

type FileOperationsAction

type FileOperationsAction struct {
	// contains filtered or unexported fields
}

FileOperationsAction offers basic file operations.

func MustNewFileOperationsAction

func MustNewFileOperationsAction(session *sdk.Session) *FileOperationsAction

MustNewFileOperationsAction creates a new file operations action and panics on failure.

func NewFileOperationsAction

func NewFileOperationsAction(session *sdk.Session) (*FileOperationsAction, error)

NewFileOperationsAction creates a new file operations action.

func (*FileOperationsAction) DirExists

func (action *FileOperationsAction) DirExists(path string) bool

DirExists checks whether the specified directory exists.

func (*FileOperationsAction) FileExists

func (action *FileOperationsAction) FileExists(path string) bool

FileExists checks whether the specified file exists.

func (*FileOperationsAction) MakePath

func (action *FileOperationsAction) MakePath(path string) error

MakePath creates the entire directory tree specified by the given path.

func (*FileOperationsAction) Move

func (action *FileOperationsAction) Move(source string, target string) error

Move moves the specified source to a new location. The caller must ensure that the target directory exists.

func (*FileOperationsAction) MoveTo

func (action *FileOperationsAction) MoveTo(source string, path string) error

MoveTo moves the specified source to the target directory, creating it if necessary.

func (*FileOperationsAction) Remove

func (action *FileOperationsAction) Remove(path string) error

Remove deletes the specified resource.

func (*FileOperationsAction) ResourceExists

func (action *FileOperationsAction) ResourceExists(path string) bool

ResourceExists checks whether the specified resource exists (w/o checking for its actual type).

func (*FileOperationsAction) Stat

func (action *FileOperationsAction) Stat(path string) (*storage.ResourceInfo, error)

Stat queries the file information of the specified remote resource.

type UploadAction

type UploadAction struct {
	EnableTUS bool
	// contains filtered or unexported fields
}

UploadAction is used to upload files through Reva. WebDAV will be used automatically if the endpoint supports it. The EnableTUS flag specifies whether to use TUS if WebDAV is not supported.

func MustNewUploadAction

func MustNewUploadAction(session *sdk.Session) *UploadAction

MustNewUploadAction creates a new upload action and panics on failure.

func NewUploadAction

func NewUploadAction(session *sdk.Session) (*UploadAction, error)

NewUploadAction creates a new upload action.

func (*UploadAction) Upload

func (action *UploadAction) Upload(data io.Reader, size int64, target string) (*storage.ResourceInfo, error)

Upload uploads data from the provided reader to the target.

func (*UploadAction) UploadBytes

func (action *UploadAction) UploadBytes(data []byte, target string) (*storage.ResourceInfo, error)

UploadBytes uploads the provided byte data to the target.

func (*UploadAction) UploadFile

func (action *UploadAction) UploadFile(file *os.File, target string) (*storage.ResourceInfo, error)

UploadFile uploads the provided file to the target.

func (*UploadAction) UploadFileTo

func (action *UploadAction) UploadFileTo(file *os.File, path string) (*storage.ResourceInfo, error)

UploadFileTo uploads the provided file to the target directory, keeping the original file name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL