communicate

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Create = agentsv1.Method_CREATE
)
View Source
const (
	Sync = agentsv1.Method_SYNC
)

Variables

This section is empty.

Functions

func StateAsString

func StateAsString(s *agentsv1.Answer) string

func ToMethod

func ToMethod(req any) agentsv1.Method

Types

type Client

type Client interface {
	Ready() bool
	Process(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
}

type ClientContext

type ClientContext struct {
	Method agentsv1.Method
	Client Client
	// contains filtered or unexported fields
}

func NewClientContext

func NewClientContext(ctx context.Context, method agentsv1.Method) (*ClientContext, error)

func (*ClientContext) Confirm

func (c *ClientContext) Confirm(s int) *agentsv1.ConfirmAnswer

func (*ClientContext) Display

func (c *ClientContext) Display(msg *agentsv1.Message, data map[string]string) *agentsv1.Question

func (*ClientContext) Get

func (c *ClientContext) Get() string

func (*ClientContext) Input

func (c *ClientContext) Input(i int) *agentsv1.InputAnswer

func (*ClientContext) NewChoice

func (c *ClientContext) NewChoice(msg *agentsv1.Message, options ...*agentsv1.Message) *agentsv1.Question

func (*ClientContext) NewConfirm

func (c *ClientContext) NewConfirm(msg *agentsv1.Message, defaultConfirm bool) *agentsv1.Question

func (*ClientContext) NewSelection

func (c *ClientContext) NewSelection(msg *agentsv1.Message, options ...*agentsv1.Message) *agentsv1.Question

func (*ClientContext) NewSequence

func (c *ClientContext) NewSequence(qs ...*agentsv1.Question) (*Sequence, error)

NewSequence creates a SequenceClient

func (*ClientContext) NewStringInput

func (c *ClientContext) NewStringInput(msg *agentsv1.Message, defaultValue string) *agentsv1.Question

func (*ClientContext) NextRound

func (c *ClientContext) NextRound() int32

func (*ClientContext) Process

func (*ClientContext) Ready

func (c *ClientContext) Ready() bool

func (*ClientContext) SafeConfirm

func (c *ClientContext) SafeConfirm(s int) (*agentsv1.ConfirmAnswer, error)

func (*ClientContext) Selection

func (c *ClientContext) Selection(i int) *agentsv1.SelectionAnswer

type ClientManager

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

func NewClientManager

func NewClientManager() *ClientManager

func (*ClientManager) Add

func (m *ClientManager) Add(method agentsv1.Method, client *ClientContext) error

func (*ClientManager) Process

func (*ClientManager) WithLogger

func (m *ClientManager) WithLogger(logger shared.BaseLogger)

type NoOpClientContext

type NoOpClientContext struct{}

func NewNoOpClientContext

func NewNoOpClientContext() *NoOpClientContext

func (*NoOpClientContext) Process

func (*NoOpClientContext) Ready

func (c *NoOpClientContext) Ready() bool

type QuestionHandler

type QuestionHandler interface {
	Process(req *agentsv1.InformationRequest) (*agentsv1.Answer, error)
}

type Sequence

type Sequence struct {
	Method agentsv1.Method
	// contains filtered or unexported fields
}

func NewSequence

func NewSequence(method agentsv1.Method, qs ...*agentsv1.Question) *Sequence

func (*Sequence) Find

func (s *Sequence) Find(name string) int

func (*Sequence) Process

func (*Sequence) Ready

func (s *Sequence) Ready() bool

type ServerContext

type ServerContext struct {
	Handler QuestionHandler
	Method  agentsv1.Method
	// contains filtered or unexported fields
}

func NewServerContext

func NewServerContext(method agentsv1.Method, logger shared.BaseLogger) *ServerContext

func (*ServerContext) Communicate

func (c *ServerContext) Communicate(answer *agentsv1.Answer) (*agentsv1.Engage, error)

func (*ServerContext) Done

func (c *ServerContext) Done() bool

func (*ServerContext) Process

func (c *ServerContext) Process(request *agentsv1.InformationRequest) (*agentsv1.Answer, error)

type ServerManager

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

func NewServerManager

func NewServerManager(logger shared.BaseLogger) *ServerManager

func (*ServerManager) Register

func (m *ServerManager) Register(channels ...*agentsv1.Channel) error

func (*ServerManager) RequiresCommunication

func (m *ServerManager) RequiresCommunication(req any) (*ServerContext, bool)

Jump to

Keyboard shortcuts

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