api

package
v0.0.0-...-8027ee6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Apps = []string{
	"chat",
	"library",
}

Functions

func ChatPrivates

func ChatPrivates(poolName string) ([]chat.Private, error)

func ChatReceive

func ChatReceive(poolName string, after, before time.Time, limit int, private chat.Private) ([]chat.Message, error)

func ChatSend

func ChatSend(poolName string, contentType string, text string, bytes []byte, private chat.Private) (uint64, error)

func Dump

func Dump() map[string]any

func FactoryReset

func FactoryReset() error

FactoryReset deletes and recreates the DB. It is useful during development to recover from inconsistent data and structure.

func InviteReceive

func InviteReceive(poolName string, after int64, onlyMine bool) ([]invite.Invite, error)

func LibraryFind

func LibraryFind(poolName string, id uint64) (library.File, error)

func LibraryList

func LibraryList(poolName string, folder string) (library.List, error)

func LibraryReceive

func LibraryReceive(poolName string, id uint64, localPath string) error

func LibrarySave

func LibrarySave(poolName string, id uint64, dest string) error

func LibrarySend

func LibrarySend(poolName string, localPath string, name string, solveConflicts bool, tags ...string) (library.File, error)

func PoolCreate

func PoolCreate(c pool.Config, apps []string) error

func PoolGet

func PoolGet(name string) (*pool.Pool, error)

func PoolInvite

func PoolInvite(name string, ids []string, invitePool string) (string, error)

func PoolJoin

func PoolJoin(token string) (pool.Config, error)

PoolJoin adds a pool by using the provided invite token

func PoolLeave

func PoolLeave(name string) error

func PoolParseInvite

func PoolParseInvite(token string) (invite.Invite, error)

PoolParseInvite checks the validity of the provided invite token and returns the token object

func PoolSub

func PoolSub(name string, sub string, ids []string, apps []string) (string, error)

func PoolUsers

func PoolUsers(poolName string) ([]security.Identity, error)

func SetDbName

func SetDbName(dbName string)

SetDbName set the name of the DB file. Useful for test purpose

func SetDbPath

func SetDbPath(dbPath string)

SetDbPath set the full path where the DB will be created. Useful on Android/iOS platforms

func SetSelf

func SetSelf(identity security.Identity) error

func Start

func Start(dbPath string, availableBandwith pool.Bandwidth) error

Start initializes the library using the provided dbPath and availableBandwidth. It creates a new db when dbPath is not an existing file.

func Stop

func Stop() error

Stop closes the DB and it releases all connected pools

Types

type Notification

type Notification struct {
	Pool    string `json:"pool"`
	App     string `json:"app"`
	Message string `json:"message"`
	Count   int    `json:"count"`
}

func Notifications

func Notifications(ctime int64) []Notification

Jump to

Keyboard shortcuts

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