client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invoke added in v1.0.3

func Invoke[TRequest any, TResult any](req TRequest) (TResult, error)

invoke a register handler

func Register added in v1.0.3

func Register[TRequest any, TResult any](fcall RequestHandler[TRequest, TResult]) error

register handlers for invocation in the mediator

Types

type AMIClient added in v1.0.2

type AMIClient struct {

	// List of natsubjects the system will process
	Node *amitools.Node

	// MBPrefix is the string which should be prepended to all Nats subjects, sending and receiving.
	// It defaults to "ami.".
	MBPrefix string

	//TopicSeparator is the string which we use btw topics to all Nats Subjects, sending and receiving.
	TopicSeparator string

	// MBPrefix is the string which should be add to the end to all Nats subjects, sending and receiving.
	// It defaults to ".*".
	MBPostfix string
	// contains filtered or unexported fields
}

func NewAmiClient added in v1.0.2

func NewAmiClient(ctx context.Context, opts ...OptionFunc) *AMIClient

func (*AMIClient) Close added in v1.0.2

func (ami *AMIClient) Close()

func (*AMIClient) CoreSettings added in v1.0.2

func (ami *AMIClient) CoreSettings(ctx context.Context, actionID string, node *amitools.Node) (*responses.ResponseData, error)

func (*AMIClient) GetNats added in v1.0.2

func (ami *AMIClient) GetNats() *nats.Conn

func (*AMIClient) GetNode added in v1.0.3

func (ami *AMIClient) GetNode() *amitools.Node

func (*AMIClient) GetNodeByIP added in v1.0.3

func (ami *AMIClient) GetNodeByIP(ip string) *amitools.Node

func (*AMIClient) GetNodes added in v1.0.3

func (ami *AMIClient) GetNodes() map[string]*amitools.Node

func (*AMIClient) Listen added in v1.0.2

func (ami *AMIClient) Listen(ctx context.Context) error

----------------------------------------

func (*AMIClient) SetAmiRequestHandler added in v1.0.3

func (s *AMIClient) SetAmiRequestHandler(fcall AMIRequestHandler)

func (*AMIClient) Subjects added in v1.0.2

func (ami *AMIClient) Subjects(topic string, id string) string

func (*AMIClient) Subscribe added in v1.0.3

func (ami *AMIClient) Subscribe(evt *amitools.Event, node *amitools.Node, cb nats.MsgHandler) (*nats.Subscription, error)

func (*AMIClient) UnSubscribe added in v1.0.3

func (ami *AMIClient) UnSubscribe(sub *nats.Subscription) error

type AMIRequestHandler added in v1.0.3

type AMIRequestHandler func(req *amitools.Request) (*amitools.Request, error)

type OptionFunc added in v1.0.2

type OptionFunc func(*AMIClient)

OptionFunc is a function which configures options on a Client

func WithName added in v1.0.2

func WithName(name string) OptionFunc

func WithNatsUri added in v1.0.2

func WithNatsUri(uri string) OptionFunc

func WithPrefix added in v1.0.2

func WithPrefix(prefix string) OptionFunc

func WithType added in v1.0.3

func WithType(t amitools.NodeType) OptionFunc

type Options

type Options struct {
	//Chatty
	Verbose *bool

	MBus *nats.Conn
}

Options describes the options for connecting to a native Asterisk AMI- server.

type RequestHandler added in v1.0.3

type RequestHandler[TRequest any, TResult any] func(req TRequest) (TResult, error)

Jump to

Keyboard shortcuts

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