Documentation
¶
Overview ¶
Package eventsourceapi implements the public API of the eventsource.example microservice, including clients and data structures.
The event source microservice fires events that are caught by the event sink microservice.
Index ¶
- Constants
- Variables
- type Client
- type Hook
- type MulticastClient
- type MulticastTrigger
- func (_c *MulticastTrigger) ForHost(host string) *MulticastTrigger
- func (_c *MulticastTrigger) OnAllowRegister(ctx context.Context, email string) <-chan *OnAllowRegisterResponse
- func (_c *MulticastTrigger) OnRegistered(ctx context.Context, email string) <-chan *OnRegisteredResponse
- func (_c *MulticastTrigger) WithOptions(opts ...pub.Option) *MulticastTrigger
- type OnAllowRegisterIn
- type OnAllowRegisterOut
- type OnAllowRegisterResponse
- type OnRegisteredIn
- type OnRegisteredOut
- type OnRegisteredResponse
- type RegisterIn
- type RegisterOut
- type RegisterResponse
Constants ¶
const Hostname = "eventsource.example"
Hostname is the default hostname of the microservice: eventsource.example.
Variables ¶
var (
URLOfRegister = httpx.JoinHostAndPath(Hostname, `:443/register`)
)
Fully-qualified URLs of the microservice's endpoints.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface to calling the endpoints of the eventsource.example microservice. This simple version is for unicast calls.
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook assists in the subscription to the events of the eventsource.example microservice.
func NewHook ¶
func NewHook(listener service.Subscriber) *Hook
NewHook creates a new hook to the events of the eventsource.example microservice.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is an interface to calling the endpoints of the eventsource.example microservice. This advanced version is for multicast calls.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) *MulticastClient
NewMulticastClient creates a new multicast client to the eventsource.example microservice.
func (*MulticastClient) ForHost ¶
func (_c *MulticastClient) ForHost(host string) *MulticastClient
ForHost replaces the default hostname of this client.
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 applies options to requests made by this client.
type MulticastTrigger ¶
type MulticastTrigger struct {
// contains filtered or unexported fields
}
MulticastTrigger is an interface to trigger the events of the eventsource.example microservice.
func NewMulticastTrigger ¶
func NewMulticastTrigger(caller service.Publisher) *MulticastTrigger
NewMulticastTrigger creates a new multicast trigger of the eventsource.example microservice.
func (*MulticastTrigger) ForHost ¶
func (_c *MulticastTrigger) ForHost(host string) *MulticastTrigger
ForHost replaces the default hostname of this trigger.
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 applies options to requests made by this trigger.
type OnAllowRegisterIn ¶
type OnAllowRegisterIn struct {
Email string `json:"email"`
}
OnAllowRegisterIn are the input arguments of OnAllowRegister.
type OnAllowRegisterOut ¶
type OnAllowRegisterOut struct {
Allow bool `json:"allow"`
}
OnAllowRegisterOut are the return values 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 (_out *OnAllowRegisterResponse) Get() (allow bool, err error)
Get retrieves the return values.
type OnRegisteredIn ¶
type OnRegisteredIn struct {
Email string `json:"email"`
}
OnRegisteredIn are the input arguments of OnRegistered.
type OnRegisteredOut ¶
type OnRegisteredOut struct {
}
OnRegisteredOut are the return values 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 (_out *OnRegisteredResponse) Get() (err error)
Get retrieves the return values.
type RegisterIn ¶
type RegisterIn struct {
Email string `json:"email"`
}
RegisterIn are the input arguments of Register.
type RegisterOut ¶
type RegisterOut struct {
Allowed bool `json:"allowed"`
}
RegisterOut are the return values 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 (_out *RegisterResponse) Get() (allowed bool, err error)
Get retrieves the return values.