eventsourceapi

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteOfRegister        = `:443/register`          // MARKER: Register
	RouteOfOnAllowRegister = `:417/on-allow-register` // MARKER: OnAllowRegister
	RouteOfOnRegistered    = `:417/on-registered`     // MARKER: OnRegistered
)

Endpoint routes.

View Source
const Hostname = "eventsource.example"

Hostname is the default hostname of the microservice.

Variables

View Source
var (
	URLOfRegister        = httpx.JoinHostAndPath(Hostname, RouteOfRegister)        // MARKER: Register
	URLOfOnAllowRegister = httpx.JoinHostAndPath(Hostname, RouteOfOnAllowRegister) // MARKER: OnAllowRegister
	URLOfOnRegistered    = httpx.JoinHostAndPath(Hostname, RouteOfOnRegistered)    // MARKER: OnRegistered
)

Endpoint URLs.

Functions

This section is empty.

Types

type Client

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

Client is a lightweight proxy for making unicast calls to the microservice.

func NewClient

func NewClient(caller service.Publisher) Client

NewClient creates a new unicast client proxy to the microservice.

func (Client) ForHost

func (_c Client) ForHost(host string) Client

ForHost returns a copy of the client with a different hostname to be applied to requests.

func (Client) Register

func (_c Client) Register(ctx context.Context, email string) (allowed bool, err error)

Register attempts to register a new user.

func (Client) WithOptions added in v1.13.1

func (_c Client) WithOptions(opts ...pub.Option) Client

WithOptions returns a copy of the client with options to be applied to requests.

type Hook

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

Hook assists in the subscription to the events of the microservice.

func NewHook

func NewHook(listener service.Subscriber) Hook

NewHook creates a new hook to the events of the microservice.

func (Hook) ForHost

func (c Hook) ForHost(host string) Hook

ForHost returns a copy of the hook with a different hostname to be applied to the subscription.

func (Hook) OnAllowRegister

func (c Hook) OnAllowRegister(handler func(ctx context.Context, email string) (allow bool, err error)) (unsub func() (err error), err error)

OnAllowRegister is called before a user is allowed to register. Event sinks are given the opportunity to block the registration.

func (Hook) OnRegistered

func (c Hook) OnRegistered(handler func(ctx context.Context, email string) (err error)) (unsub func() (err error), err error)

OnRegistered is called when a user is successfully registered.

func (Hook) WithOptions added in v1.22.0

func (c Hook) WithOptions(opts ...sub.Option) Hook

WithOptions returns a copy of the hook with options to be applied to subscriptions.

type MulticastClient

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

MulticastClient is a lightweight proxy for making multicast calls to the microservice.

func NewMulticastClient

func NewMulticastClient(caller service.Publisher) MulticastClient

NewMulticastClient creates a new multicast client proxy to the microservice.

func (MulticastClient) ForHost

func (_c MulticastClient) ForHost(host string) MulticastClient

ForHost returns a copy of the client with a different hostname to be applied to requests.

func (MulticastClient) Register

func (_c MulticastClient) Register(ctx context.Context, email string) <-chan *RegisterResponse

Register attempts to register a new user.

func (MulticastClient) WithOptions added in v1.13.1

func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient

WithOptions returns a copy of the client with options to be applied to requests.

type MulticastTrigger

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

MulticastTrigger is a lightweight proxy for triggering the events of the microservice.

func NewMulticastTrigger

func NewMulticastTrigger(caller service.Publisher) MulticastTrigger

NewMulticastTrigger creates a new multicast trigger of events of the microservice.

func (MulticastTrigger) ForHost

func (_c MulticastTrigger) ForHost(host string) MulticastTrigger

ForHost returns a copy of the trigger with a different hostname to be applied to requests.

func (MulticastTrigger) OnAllowRegister

func (_c MulticastTrigger) OnAllowRegister(ctx context.Context, email string) <-chan *OnAllowRegisterResponse

OnAllowRegister is called before a user is allowed to register. Event sinks are given the opportunity to block the registration.

func (MulticastTrigger) OnRegistered

func (_c MulticastTrigger) OnRegistered(ctx context.Context, email string) <-chan *OnRegisteredResponse

OnRegistered is called when a user is successfully registered.

func (MulticastTrigger) WithOptions added in v1.13.1

func (_c MulticastTrigger) WithOptions(opts ...pub.Option) MulticastTrigger

WithOptions returns a copy of the trigger with options to be applied to requests.

type OnAllowRegisterIn

type OnAllowRegisterIn struct {
	Email string `json:"email,omitzero"`
}

OnAllowRegisterIn are the input arguments of OnAllowRegister.

type OnAllowRegisterOut

type OnAllowRegisterOut struct {
	Allow bool `json:"allow,omitzero"`
}

OnAllowRegisterOut are the output arguments of OnAllowRegister.

type OnAllowRegisterResponse

type OnAllowRegisterResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

OnAllowRegisterResponse is the response to OnAllowRegister.

func (*OnAllowRegisterResponse) Get

func (_res *OnAllowRegisterResponse) Get() (allow bool, err error)

Get retrieves the return values.

type OnRegisteredIn

type OnRegisteredIn struct {
	Email string `json:"email,omitzero"`
}

OnRegisteredIn are the input arguments of OnRegistered.

type OnRegisteredOut

type OnRegisteredOut struct {
}

OnRegisteredOut are the output arguments of OnRegistered.

type OnRegisteredResponse

type OnRegisteredResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

OnRegisteredResponse is the response to OnRegistered.

func (*OnRegisteredResponse) Get

func (_res *OnRegisteredResponse) Get() (err error)

Get retrieves the return values.

type RegisterIn

type RegisterIn struct {
	Email string `json:"email,omitzero"`
}

RegisterIn are the input arguments of Register.

type RegisterOut

type RegisterOut struct {
	Allowed bool `json:"allowed,omitzero"`
}

RegisterOut are the output arguments of Register.

type RegisterResponse

type RegisterResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

RegisterResponse is the response to Register.

func (*RegisterResponse) Get

func (_res *RegisterResponse) Get() (allowed bool, err error)

Get retrieves the return values.

Jump to

Keyboard shortcuts

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