koofrclient

package module
v0.0.0-...-cbd7fc9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 6 Imported by: 10

README

go-koofrclient

Go Koofr client.

GoDoc

Install

go get github.com/koofr/go-koofrclient

Testing

go get -t
KOOFR_APIBASE="https://app.koofr.net" KOOFR_EMAIL="email@example.com" KOOFR_PASSWORD="yourpassword" go test

Documentation

Index

Constants

View Source
const (
	MountDeviceType = "device"
	MountExportType = "export"
	MountImportType = "import"
)
View Source
const (
	StorageHubProvider  = "storagehub"
	StorageBlobProvider = "storageblob"
)

Variables

View Source
var ErrCannotOverwrite = fmt.Errorf("Can not overwrite (filter constraint fails)")
View Source
var ErrCannotRemove = fmt.Errorf("Can not remove (filter constraint fails)")

Functions

This section is empty.

Types

type CopyOptions

type CopyOptions struct {
	SetModified *int64
}

type DeleteOptions

type DeleteOptions struct {
	RemoveIfModified *int64
	RemoveIfSize     *int64
	RemoveIfHash     *string
	RemoveIfEmpty    bool
}

type Device

type Device struct {
	Id         string `json:"id"`
	ApiKey     string `json:"apiKey"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	SpaceTotal int64  `json:"spaceTotal"`
	SpaceUsed  int64  `json:"spaceUsed"`
	SpaceFree  int64  `json:"spaceFree"`
	Version    int    `json:"version"`
	Provider   struct {
		Name string      `json:"name"`
		Data interface{} `json:"data"`
	} `json:"provider"`
	ReadOnly    bool   `json:"readonly"`
	RootMountId string `json:"rootMountId"`
}

type DeviceCreate

type DeviceCreate struct {
	Name         string         `json:"name"`
	ProviderName DeviceProvider `json:"providerName"`
}

type DeviceProvider

type DeviceProvider string

type DeviceUpdate

type DeviceUpdate struct {
	Name string `json:"name"`
}

type FileCopy

type FileCopy struct {
	ToMountId string `json:"toMountId"`
	TPath     string `json:"toPath"`
	Modified  *int64 `json:"modified,omitempty"`
}

type FileInfo

type FileInfo struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Modified    int64  `json:"modified"`
	Size        int64  `json:"size"`
	ContentType string `json:"contentType"`
	Path        string `json:"path"`
	Hash        string `json:"hash"`
}

type FileMove

type FileMove struct {
	ToMountId string `json:"toMountId"`
	TPath     string `json:"toPath"`
}

type FileSpan

type FileSpan struct {
	Start int64
	End   int64
}

type FileTree

type FileTree struct {
	FileInfo
	Children []*FileTree `json:"children"`
}

func (*FileTree) Flatten

func (tree *FileTree) Flatten() []FileInfo

type FileUpload

type FileUpload struct {
	Name string `json:"name"`
}

type FolderCreate

type FolderCreate struct {
	Name string `json:"name"`
}

type KoofrClient

type KoofrClient struct {
	*httpclient.HTTPClient
	// contains filtered or unexported fields
}

func NewKoofrClient

func NewKoofrClient(baseUrl string, disableSecurity bool) *KoofrClient

func NewKoofrClientWithHTTPClient

func NewKoofrClientWithHTTPClient(baseUrl string, httpClient *httpclient.HTTPClient) *KoofrClient

func (*KoofrClient) Authenticate

func (c *KoofrClient) Authenticate(email string, password string) (err error)

func (*KoofrClient) Devices

func (c *KoofrClient) Devices() (devices []Device, err error)

func (*KoofrClient) DevicesCreate

func (c *KoofrClient) DevicesCreate(name string, provider DeviceProvider) (device Device, err error)

func (*KoofrClient) DevicesDelete

func (c *KoofrClient) DevicesDelete(deviceId string) (err error)

func (*KoofrClient) DevicesDetails

func (c *KoofrClient) DevicesDetails(deviceId string) (device Device, err error)

func (*KoofrClient) DevicesUpdate

func (c *KoofrClient) DevicesUpdate(deviceId string, deviceUpdate DeviceUpdate) (err error)

func (*KoofrClient) FilesCopy

func (c *KoofrClient) FilesCopy(mountId string, path string, toMountId string, toPath string, options CopyOptions) (err error)

func (*KoofrClient) FilesDelete

func (c *KoofrClient) FilesDelete(mountId string, path string) (err error)

func (*KoofrClient) FilesDeleteWithOptions

func (c *KoofrClient) FilesDeleteWithOptions(mountId string, path string, deleteOptions *DeleteOptions) (err error)

func (*KoofrClient) FilesGet

func (c *KoofrClient) FilesGet(mountId string, path string) (reader io.ReadCloser, err error)

func (*KoofrClient) FilesGetRange

func (c *KoofrClient) FilesGetRange(mountId string, path string, span *FileSpan) (reader io.ReadCloser, err error)

func (*KoofrClient) FilesInfo

func (c *KoofrClient) FilesInfo(mountId string, path string) (info FileInfo, err error)

func (*KoofrClient) FilesList

func (c *KoofrClient) FilesList(mountId string, basePath string) (files []FileInfo, err error)

func (*KoofrClient) FilesMove

func (c *KoofrClient) FilesMove(mountId string, path string, toMountId string, toPath string) (err error)

func (*KoofrClient) FilesNewFolder

func (c *KoofrClient) FilesNewFolder(mountId string, path string, name string) (err error)

func (*KoofrClient) FilesPut

func (c *KoofrClient) FilesPut(mountId string, path string, name string, reader io.Reader) (newName string, err error)

func (*KoofrClient) FilesPutWithOptions

func (c *KoofrClient) FilesPutWithOptions(mountId string, path string, name string, reader io.Reader, putOptions *PutOptions) (fileInfo *FileInfo, err error)

func (*KoofrClient) FilesTree

func (c *KoofrClient) FilesTree(mountId string, path string) (tree FileTree, err error)

func (*KoofrClient) GetToken

func (c *KoofrClient) GetToken() string

func (*KoofrClient) GetUserID

func (c *KoofrClient) GetUserID() string

func (*KoofrClient) Mounts

func (c *KoofrClient) Mounts() (mounts []Mount, err error)

func (*KoofrClient) MountsDetails

func (c *KoofrClient) MountsDetails(mountId string) (mount Mount, err error)

func (*KoofrClient) SetToken

func (c *KoofrClient) SetToken(token string)

func (*KoofrClient) SetUserAgent

func (c *KoofrClient) SetUserAgent(ua string)

func (*KoofrClient) SetUserID

func (c *KoofrClient) SetUserID(userID string)

func (*KoofrClient) Shared

func (c *KoofrClient) Shared() (shared []Shared, err error)

func (*KoofrClient) UserInfo

func (c *KoofrClient) UserInfo() (user User, err error)
type Link struct {
	Id               string `json:id`
	Name             string `json:name`
	Path             string `json:path`
	Counter          int64  `json:counter`
	Url              string `json:url`
	ShortUrl         string `json:shortUrl`
	Hash             string `json:hash`
	Host             string `json:host`
	HasPassword      bool   `json:hasPassword`
	Password         string `json:password`
	ValidFrom        int64  `json:validFrom`
	ValidTo          int64  `json:validTo`
	PasswordRequired bool   `json:passwordRequired`
}

type Mount

type Mount struct {
	Id          string           `json:"id"`
	Name        string           `json:"name"`
	Type        MountType        `json:"type"`
	Origin      string           `json:"origin"`
	SpaceTotal  int64            `json:"spaceTotal"`
	SpaceUsed   int64            `json:"spaceUsed"`
	Online      bool             `json:"online"`
	Owner       MountUser        `json:"owner"`
	Users       []MountUser      `json:"users"`
	Groups      []MountGroup     `json:"groups"`
	Version     int              `json:"version"`
	Permissions MountPermissions `json:"permissions"`
	IsPrimary   bool             `json:"isPrimary"`
	IsShared    bool             `json:"isShared"`
}

type MountGroup

type MountGroup struct {
	Id          string           `json:"id"`
	Name        string           `json:"name"`
	Permissions MountPermissions `json:"permissions"`
}

type MountPermissions

type MountPermissions struct {
	Read           bool `json:"READ"`
	Write          bool `json:"write"`
	Owner          bool `json:"OWNER"`
	Mount          bool `json:"MOUNT"`
	CreateReceiver bool `json:"CREATE_RECEIVER"`
	CreateLink     bool `json:"CREATE_LINK"`
	Comment        bool `json:"COMMENT"`
}

type MountType

type MountType string

type MountUser

type MountUser struct {
	Id          string           `json:"id"`
	Name        string           `json:"name"`
	Email       string           `json:"email"`
	Permissions MountPermissions `json:"permissions"`
}

type PutOptions

type PutOptions struct {
	OverwriteIfModified        *int64
	OverwriteIfSize            *int64
	OverwriteIfHash            *string
	OverwriteIgnoreNonExisting bool
	NoRename                   bool
	ForceOverwrite             bool
	SetModified                *int64
}

type Receiver

type Receiver struct {
	Id          string `json:id`
	Name        string `json:name`
	Path        string `json:path`
	Counter     int64  `json:counter`
	Url         string `json:url`
	ShortUrl    string `json:shortUrl`
	Hash        string `json:hash`
	Host        string `json:host`
	HasPassword bool   `json:hasPassword`
	Password    string `json:password`
	ValidFrom   int64  `json:validFrom`
	ValidTo     int64  `json:validTo`
	Alert       bool   `json:alert`
}

type Shared

type Shared struct {
	Name        string    `json:name`
	Type        MountType `json:type`
	Modified    int64     `json:modified`
	Size        int64     `json:size`
	ContentType string    `json:contentType`
	Hash        string    `json:hash`
	Mount       Mount     `json:mount`
	Link        Link      `json:link`
	Receiver    Receiver  `json:receiver`
}

type Token

type Token struct {
	Token string
}

type TokenRequest

type TokenRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type User

type User struct {
	Id        string `json:"id"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
}

Jump to

Keyboard shortcuts

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