notifications

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "notifications"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [2]string{"listen", "seen"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func NewListenEndpoint

func NewListenEndpoint(s Service) goa.Endpoint

NewListenEndpoint returns an endpoint function that calls the method "listen" of service "notifications".

func NewSeenEndpoint

func NewSeenEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewSeenEndpoint returns an endpoint function that calls the method "seen" of service "notifications".

Types

type Auther

type Auther interface {
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	ListenEndpoint goa.Endpoint
	SeenEndpoint   goa.Endpoint
}

Client is the "notifications" service client.

func NewClient

func NewClient(listen, seen goa.Endpoint) *Client

NewClient initializes a "notifications" service client given the endpoints.

func (*Client) Listen

func (c *Client) Listen(ctx context.Context) (res ListenClientStream, err error)

Listen calls the "listen" endpoint of the "notifications" service.

func (*Client) Seen

func (c *Client) Seen(ctx context.Context, p *SeenPayload) (err error)

Seen calls the "seen" endpoint of the "notifications" service.

type Endpoints

type Endpoints struct {
	Listen goa.Endpoint
	Seen   goa.Endpoint
}

Endpoints wraps the "notifications" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "notifications" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "notifications" service endpoints.

type ListenClientStream

type ListenClientStream interface {
	// Send streams instances of "map[string]interface{}".
	Send(map[string]interface{}) error
	// Recv reads instances of "map[string]interface{}" from the stream.
	Recv() (map[string]interface{}, error)
	// Close closes the stream.
	Close() error
}

ListenClientStream is the interface a "listen" endpoint client stream must satisfy.

type ListenEndpointInput

type ListenEndpointInput struct {
	// Stream is the server stream used by the "listen" method to send data.
	Stream ListenServerStream
}

ListenEndpointInput holds both the payload and the server stream of the "listen" method.

type ListenServerStream

type ListenServerStream interface {
	// Send streams instances of "map[string]interface{}".
	Send(map[string]interface{}) error
	// Recv reads instances of "map[string]interface{}" from the stream.
	Recv() (map[string]interface{}, error)
	// Close closes the stream.
	Close() error
}

ListenServerStream is the interface a "listen" endpoint server stream must satisfy.

type SeenPayload

type SeenPayload struct {
	Auth string
	Ids  []int64
}

SeenPayload is the payload type of the notifications service seen method.

type Service

type Service interface {
	// Listen implements listen.
	Listen(context.Context, ListenServerStream) (err error)
	// Seen implements seen.
	Seen(context.Context, *SeenPayload) (err error)
}

Service is the notifications service interface.

type Unauthorized

type Unauthorized string

credentials are invalid

func (Unauthorized) Error

func (e Unauthorized) Error() string

Error returns an error description.

func (Unauthorized) ErrorName

func (e Unauthorized) ErrorName() string

ErrorName returns "unauthorized".

Jump to

Keyboard shortcuts

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