bots

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotIpfsHandler

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

BotIpfsHandler implements shared.IpfsHandler. Extends it by hanging on the the botID

func (BotIpfsHandler) Add

func (mip BotIpfsHandler) Add(data []byte, encrypt bool) (hash string, key string, err error)

Add allows a bot to add data to IPFS. currently it does not pin the data, only adds.

func (BotIpfsHandler) Get

func (mip BotIpfsHandler) Get(pth string, key string) ([]byte, error)

Get allows a bot to get IPFS data by the cid/path. Allows optional key for decryption on the fly

type BotKVStore

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

BotKVStore implements shared.BotStore. Extends it with BotID and BotVersion

func (BotKVStore) Delete

func (kv BotKVStore) Delete(key string) (ok bool, err error)

Delete allows a bot to delete a value in the kv store

func (BotKVStore) Get

func (kv BotKVStore) Get(key string) (data []byte, version int32, err error)

Get allows a bot to get a value by string. It responds with the version of the bot that wrote the data.

func (BotKVStore) Set

func (kv BotKVStore) Set(key string, data []byte) (ok bool, err error)

Set allows a bot to add a key-val to the store

type Service

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

Service holds a map to all running bots on this node

func NewService

func NewService(node *core.Textile) *Service

NewService returns a new bot service

func (*Service) Create

func (s *Service) Create(botID string, botVersion int, name string, params map[string]string, pth string)

Create configures the Bot rpc instance

func (*Service) Delete

func (s *Service) Delete(botID string, q []byte) (shared.Response, error)

Delete runs the bot.Delete method

func (*Service) Exists

func (s *Service) Exists(id string) bool

Exists is a helper to check if a bot exists

func (*Service) Get

func (s *Service) Get(botID string, q []byte) (shared.Response, error)

Get runs the bot.Get method

func (*Service) Post

func (s *Service) Post(botID string, q []byte, body []byte) (shared.Response, error)

Post runs the bot.Post method

func (*Service) Put

func (s *Service) Put(botID string, q []byte, body []byte) (shared.Response, error)

Put runs the bot.Put method

func (*Service) RunAll

func (s *Service) RunAll(repoPath string, bots []string)

RunAll runs a list of bots from Textile config

Jump to

Keyboard shortcuts

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