server

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSeenRequest

func DecodeSeenRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeSeenRequest returns a decoder for requests sent to the notifications seen endpoint.

func EncodeListenError

func EncodeListenError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeListenError returns an encoder for errors returned by the listen notifications endpoint.

func EncodeSeenError

func EncodeSeenError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeSeenError returns an encoder for errors returned by the seen notifications endpoint.

func EncodeSeenResponse

func EncodeSeenResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeSeenResponse returns an encoder for responses returned by the notifications seen endpoint.

func ListenNotificationsPath

func ListenNotificationsPath() string

ListenNotificationsPath returns the URL path to the notifications service listen HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the notifications endpoints.

func MountCORSHandler

func MountCORSHandler(mux goahttp.Muxer, h http.Handler)

MountCORSHandler configures the mux to serve the CORS endpoints for the service notifications.

func MountListenHandler

func MountListenHandler(mux goahttp.Muxer, h http.Handler)

MountListenHandler configures the mux to serve the "notifications" service "listen" endpoint.

func MountSeenHandler

func MountSeenHandler(mux goahttp.Muxer, h http.Handler)

MountSeenHandler configures the mux to serve the "notifications" service "seen" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

NewCORSHandler creates a HTTP handler which returns a simple 200 response.

func NewListenHandler

func NewListenHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewListenHandler creates a HTTP handler which loads the HTTP request and calls the "notifications" service "listen" endpoint.

func NewSeenHandler

func NewSeenHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewSeenHandler creates a HTTP handler which loads the HTTP request and calls the "notifications" service "seen" endpoint.

func NewSeenPayload

func NewSeenPayload(body *SeenRequestBody, auth string) *notifications.SeenPayload

NewSeenPayload builds a notifications service seen endpoint payload.

func SeenNotificationsPath

func SeenNotificationsPath() string

SeenNotificationsPath returns the URL path to the notifications service seen HTTP endpoint.

func ValidateSeenRequestBody

func ValidateSeenRequestBody(body *SeenRequestBody) (err error)

ValidateSeenRequestBody runs the validations defined on SeenRequestBody

Types

type ConnConfigurer

type ConnConfigurer struct {
	ListenFn goahttp.ConnConfigureFunc
}

ConnConfigurer holds the websocket connection configurer functions for the streaming endpoints in "notifications" service.

func NewConnConfigurer

func NewConnConfigurer(fn goahttp.ConnConfigureFunc) *ConnConfigurer

NewConnConfigurer initializes the websocket connection configurer function with fn for all the streaming endpoints in "notifications" service.

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type ListenBadRequestResponseBody

type ListenBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ListenBadRequestResponseBody is the type of the "notifications" service "listen" endpoint HTTP response body for the "bad-request" error.

func NewListenBadRequestResponseBody

func NewListenBadRequestResponseBody(res *goa.ServiceError) *ListenBadRequestResponseBody

NewListenBadRequestResponseBody builds the HTTP response body from the result of the "listen" endpoint of the "notifications" service.

type ListenForbiddenResponseBody

type ListenForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ListenForbiddenResponseBody is the type of the "notifications" service "listen" endpoint HTTP response body for the "forbidden" error.

func NewListenForbiddenResponseBody

func NewListenForbiddenResponseBody(res *goa.ServiceError) *ListenForbiddenResponseBody

NewListenForbiddenResponseBody builds the HTTP response body from the result of the "listen" endpoint of the "notifications" service.

type ListenNotFoundResponseBody

type ListenNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

ListenNotFoundResponseBody is the type of the "notifications" service "listen" endpoint HTTP response body for the "not-found" error.

func NewListenNotFoundResponseBody

func NewListenNotFoundResponseBody(res *goa.ServiceError) *ListenNotFoundResponseBody

NewListenNotFoundResponseBody builds the HTTP response body from the result of the "listen" endpoint of the "notifications" service.

type ListenServerStream

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

ListenServerStream implements the notifications.ListenServerStream interface.

func (*ListenServerStream) Close

func (s *ListenServerStream) Close() error

Close closes the "listen" endpoint websocket connection.

func (*ListenServerStream) Recv

func (s *ListenServerStream) Recv() (map[string]interface{}, error)

Recv reads instances of "map[string]interface{}" from the "listen" endpoint websocket connection.

func (*ListenServerStream) Send

func (s *ListenServerStream) Send(v map[string]interface{}) error

Send streams instances of "map[string]interface{}" to the "listen" endpoint websocket connection.

type ListenUnauthorizedResponseBody

type ListenUnauthorizedResponseBody string

ListenUnauthorizedResponseBody is the type of the "notifications" service "listen" endpoint HTTP response body for the "unauthorized" error.

func NewListenUnauthorizedResponseBody

func NewListenUnauthorizedResponseBody(res notifications.Unauthorized) ListenUnauthorizedResponseBody

NewListenUnauthorizedResponseBody builds the HTTP response body from the result of the "listen" endpoint of the "notifications" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type SeenBadRequestResponseBody

type SeenBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

SeenBadRequestResponseBody is the type of the "notifications" service "seen" endpoint HTTP response body for the "bad-request" error.

func NewSeenBadRequestResponseBody

func NewSeenBadRequestResponseBody(res *goa.ServiceError) *SeenBadRequestResponseBody

NewSeenBadRequestResponseBody builds the HTTP response body from the result of the "seen" endpoint of the "notifications" service.

type SeenForbiddenResponseBody

type SeenForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

SeenForbiddenResponseBody is the type of the "notifications" service "seen" endpoint HTTP response body for the "forbidden" error.

func NewSeenForbiddenResponseBody

func NewSeenForbiddenResponseBody(res *goa.ServiceError) *SeenForbiddenResponseBody

NewSeenForbiddenResponseBody builds the HTTP response body from the result of the "seen" endpoint of the "notifications" service.

type SeenNotFoundResponseBody

type SeenNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

SeenNotFoundResponseBody is the type of the "notifications" service "seen" endpoint HTTP response body for the "not-found" error.

func NewSeenNotFoundResponseBody

func NewSeenNotFoundResponseBody(res *goa.ServiceError) *SeenNotFoundResponseBody

NewSeenNotFoundResponseBody builds the HTTP response body from the result of the "seen" endpoint of the "notifications" service.

type SeenRequestBody

type SeenRequestBody struct {
	Ids []int64 `form:"ids,omitempty" json:"ids,omitempty" xml:"ids,omitempty"`
}

SeenRequestBody is the type of the "notifications" service "seen" endpoint HTTP request body.

type SeenUnauthorizedResponseBody

type SeenUnauthorizedResponseBody string

SeenUnauthorizedResponseBody is the type of the "notifications" service "seen" endpoint HTTP response body for the "unauthorized" error.

func NewSeenUnauthorizedResponseBody

func NewSeenUnauthorizedResponseBody(res notifications.Unauthorized) SeenUnauthorizedResponseBody

NewSeenUnauthorizedResponseBody builds the HTTP response body from the result of the "seen" endpoint of the "notifications" service.

type Server

type Server struct {
	Mounts []*MountPoint
	Listen http.Handler
	Seen   http.Handler
	CORS   http.Handler
}

Server lists the notifications service endpoint HTTP handlers.

func New

func New(
	e *notifications.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer *ConnConfigurer,
) *Server

New instantiates HTTP handlers for all the notifications service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

Jump to

Keyboard shortcuts

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