nextcloud

package
v0.0.0-...-e3b7ee5 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package nextcloud is a client library for NextCloud. It only supports files via Webdav for the moment.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAccountNotFound is used when the no account can be found with the
	// given ID.
	ErrAccountNotFound = errors.New("account not found")
	// ErrInvalidAccount is used when the account cannot be used to connect to
	// NextCloud.
	ErrInvalidAccount = errors.New("invalid NextCloud account")
)

Functions

This section is empty.

Types

type File

type File struct {
	DocID       string `json:"id,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Path        string `json:"path"`
	Size        uint64 `json:"size,omitempty"`
	Mime        string `json:"mime,omitempty"`
	Class       string `json:"class,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	ETag        string `json:"etag,omitempty"`
	RestorePath string `json:"restore_path,omitempty"`
	// contains filtered or unexported fields
}

func (*File) Clone

func (f *File) Clone() couchdb.Doc

func (*File) DocType

func (f *File) DocType() string

func (*File) ID

func (f *File) ID() string

func (*File) Included

func (f *File) Included() []jsonapi.Object
func (f *File) Links() *jsonapi.LinksList

func (*File) Relationships

func (f *File) Relationships() jsonapi.RelationshipMap

func (*File) Rev

func (f *File) Rev() string

func (*File) SetID

func (f *File) SetID(id string)

func (*File) SetRev

func (f *File) SetRev(id string)

type NextCloud

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

func New

func New(inst *instance.Instance, accountID string) (*NextCloud, error)

func (*NextCloud) Copy

func (nc *NextCloud) Copy(oldPath, newPath string) error

func (*NextCloud) Delete

func (nc *NextCloud) Delete(path string) error

func (*NextCloud) DeleteTrash

func (nc *NextCloud) DeleteTrash(path string) error

func (*NextCloud) Download

func (nc *NextCloud) Download(path string) (*webdav.Download, error)

func (*NextCloud) Downstream

func (nc *NextCloud) Downstream(path, dirID string, kind OperationKind, cozyMetadata *vfs.FilesCozyMetadata) (*vfs.FileDoc, error)

func (*NextCloud) EmptyTrash

func (nc *NextCloud) EmptyTrash() error

func (*NextCloud) ListFiles

func (nc *NextCloud) ListFiles(path string) ([]jsonapi.Object, error)

func (*NextCloud) ListTrashed

func (nc *NextCloud) ListTrashed(path string) ([]jsonapi.Object, error)

func (*NextCloud) Mkdir

func (nc *NextCloud) Mkdir(path string) error

func (*NextCloud) Move

func (nc *NextCloud) Move(oldPath, newPath string) error

func (*NextCloud) Restore

func (nc *NextCloud) Restore(path string) error

func (*NextCloud) Upload

func (nc *NextCloud) Upload(path, mime string, contentLength int64, body io.Reader) error

func (*NextCloud) Upstream

func (nc *NextCloud) Upstream(path, from string, kind OperationKind) error

type OCSPayload

type OCSPayload struct {
	OCS struct {
		Data struct {
			UserID string `json:"userId"`
		} `json:"data"`
	} `json:"ocs"`
}

type OperationKind

type OperationKind int
const (
	MoveOperation OperationKind = iota
	CopyOperation
)

Jump to

Keyboard shortcuts

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