rest

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

func (*File) Close

func (file *File) Close() error

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) ReadDir

func (f *File) ReadDir(n int) ([]fs.DirEntry, error)

func (*File) Readdir

func (file *File) Readdir(count int) ([]fs.FileInfo, error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Size added in v1.0.1

func (f *File) Size() int64

func (*File) Stat

func (f *File) Stat() (fs.FileInfo, error)

func (*File) Write

func (f *File) Write(p []byte) (n int, err error)

type FileRESTAPI

type FileRESTAPI interface {
	GetContent(ctx context.Context, name string) (io.ReadCloser, error)
	Stat(ctx context.Context, name string) (fs.FileInfo, error)
	GetChildren(ctx context.Context, name string) ([]fs.FileInfo, error)
	MkDir(ctx context.Context, name string, perm os.FileMode) error
	Update(ctx context.Context, name string, rc io.Reader) error
	NewFile(ctx context.Context, name string, rc io.Reader) error
	RemoveAll(ctx context.Context, name string) error
	Rename(ctx context.Context, oldname string, newname string) error
}

type RESTFileSystem

type RESTFileSystem struct {
	API FileRESTAPI
}

A simple webdav.FileSystem implementation that simplifies working with REST interfaces

func (*RESTFileSystem) Mkdir

func (restfilesystem *RESTFileSystem) Mkdir(ctx context.Context, name string, perm os.FileMode) error

Create a new directory

func (*RESTFileSystem) Open

func (restfilesystem *RESTFileSystem) Open(name string) (fs.File, error)

Open implements fs.FS.

func (*RESTFileSystem) OpenFile

func (restfilesystem *RESTFileSystem) OpenFile(
	ctx context.Context,
	name string,
	flag int,
	perm os.FileMode,
) (webdav.File, error)

func (*RESTFileSystem) ReadDir

func (restfilesystem *RESTFileSystem) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir reads the named directory and returns a list of directory entries sorted by filename.

func (*RESTFileSystem) RemoveAll

func (restfilesystem *RESTFileSystem) RemoveAll(ctx context.Context, name string) error

func (*RESTFileSystem) Rename

func (restfilesystem *RESTFileSystem) Rename(ctx context.Context, oldName string, newName string) error

func (*RESTFileSystem) Stat

func (restfilesystem *RESTFileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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