server

package
v0.0.0-...-63cd2eb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeEchoerRequest

func DecodeEchoerRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeEchoerRequest returns a decoder for requests sent to the chatter echoer endpoint.

func DecodeHistoryRequest

func DecodeHistoryRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeHistoryRequest returns a decoder for requests sent to the chatter history endpoint.

func DecodeListenerRequest

func DecodeListenerRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeListenerRequest returns a decoder for requests sent to the chatter listener endpoint.

func DecodeLoginRequest

func DecodeLoginRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeLoginRequest returns a decoder for requests sent to the chatter login endpoint.

func DecodeSubscribeRequest

func DecodeSubscribeRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeSubscribeRequest returns a decoder for requests sent to the chatter subscribe endpoint.

func DecodeSummaryRequest

func DecodeSummaryRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeSummaryRequest returns a decoder for requests sent to the chatter summary endpoint.

func EchoerChatterPath

func EchoerChatterPath() string

EchoerChatterPath returns the URL path to the chatter service echoer HTTP endpoint.

func EncodeEchoerError

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

EncodeEchoerError returns an encoder for errors returned by the echoer chatter endpoint.

func EncodeHistoryError

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

EncodeHistoryError returns an encoder for errors returned by the history chatter endpoint.

func EncodeListenerError

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

EncodeListenerError returns an encoder for errors returned by the listener chatter endpoint.

func EncodeLoginError

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

EncodeLoginError returns an encoder for errors returned by the login chatter endpoint.

func EncodeLoginResponse

func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeLoginResponse returns an encoder for responses returned by the chatter login endpoint.

func EncodeSubscribeError

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

EncodeSubscribeError returns an encoder for errors returned by the subscribe chatter endpoint.

func EncodeSummaryError

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

EncodeSummaryError returns an encoder for errors returned by the summary chatter endpoint.

func HistoryChatterPath

func HistoryChatterPath() string

HistoryChatterPath returns the URL path to the chatter service history HTTP endpoint.

func ListenerChatterPath

func ListenerChatterPath() string

ListenerChatterPath returns the URL path to the chatter service listener HTTP endpoint.

func LoginChatterPath

func LoginChatterPath() string

LoginChatterPath returns the URL path to the chatter service login HTTP endpoint.

func Mount

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

Mount configures the mux to serve the chatter endpoints.

func MountEchoerHandler

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

MountEchoerHandler configures the mux to serve the "chatter" service "echoer" endpoint.

func MountHistoryHandler

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

MountHistoryHandler configures the mux to serve the "chatter" service "history" endpoint.

func MountListenerHandler

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

MountListenerHandler configures the mux to serve the "chatter" service "listener" endpoint.

func MountLoginHandler

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

MountLoginHandler configures the mux to serve the "chatter" service "login" endpoint.

func MountSubscribeHandler

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

MountSubscribeHandler configures the mux to serve the "chatter" service "subscribe" endpoint.

func MountSummaryHandler

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

MountSummaryHandler configures the mux to serve the "chatter" service "summary" endpoint.

func NewEchoerHandler

func NewEchoerHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewEchoerHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "echoer" endpoint.

func NewEchoerPayload

func NewEchoerPayload(token string) *chatter.EchoerPayload

NewEchoerPayload builds a chatter service echoer endpoint payload.

func NewHistoryHandler

func NewHistoryHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewHistoryHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "history" endpoint.

func NewHistoryPayload

func NewHistoryPayload(view *string, token string) *chatter.HistoryPayload

NewHistoryPayload builds a chatter service history endpoint payload.

func NewListenerHandler

func NewListenerHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewListenerHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "listener" endpoint.

func NewListenerPayload

func NewListenerPayload(token string) *chatter.ListenerPayload

NewListenerPayload builds a chatter service listener endpoint payload.

func NewLoginHandler

func NewLoginHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewLoginHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "login" endpoint.

func NewLoginPayload

func NewLoginPayload() *chatter.LoginPayload

NewLoginPayload builds a chatter service login endpoint payload.

func NewSubscribeHandler

func NewSubscribeHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewSubscribeHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "subscribe" endpoint.

func NewSubscribePayload

func NewSubscribePayload(token string) *chatter.SubscribePayload

NewSubscribePayload builds a chatter service subscribe endpoint payload.

func NewSummaryHandler

func NewSummaryHandler(
	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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer goahttp.ConnConfigureFunc,
) http.Handler

NewSummaryHandler creates a HTTP handler which loads the HTTP request and calls the "chatter" service "summary" endpoint.

func NewSummaryPayload

func NewSummaryPayload(token string) *chatter.SummaryPayload

NewSummaryPayload builds a chatter service summary endpoint payload.

func SubscribeChatterPath

func SubscribeChatterPath() string

SubscribeChatterPath returns the URL path to the chatter service subscribe HTTP endpoint.

func SummaryChatterPath

func SummaryChatterPath() string

SummaryChatterPath returns the URL path to the chatter service summary HTTP endpoint.

Types

type ChatSummaryResponse

type ChatSummaryResponse struct {
	// Message sent to the server
	Message string `form:"message" json:"message" xml:"message"`
	// Length of the message sent
	Length *int `form:"length,omitempty" json:"length,omitempty" xml:"length,omitempty"`
	// Time at which the message was sent
	SentAt string `form:"sent_at" json:"sent_at" xml:"sent_at"`
}

ChatSummaryResponse is used to define fields on response body types.

type ChatSummaryResponseCollection

type ChatSummaryResponseCollection []*ChatSummaryResponse

ChatSummaryResponseCollection is the type of the "chatter" service "summary" endpoint HTTP response body.

func NewChatSummaryResponseCollection

func NewChatSummaryResponseCollection(res chatterviews.ChatSummaryCollectionView) ChatSummaryResponseCollection

NewChatSummaryResponseCollection builds the HTTP response body from the result of the "summary" endpoint of the "chatter" service.

type ConnConfigurer

type ConnConfigurer struct {
	EchoerFn    goahttp.ConnConfigureFunc
	ListenerFn  goahttp.ConnConfigureFunc
	SummaryFn   goahttp.ConnConfigureFunc
	SubscribeFn goahttp.ConnConfigureFunc
	HistoryFn   goahttp.ConnConfigureFunc
}

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

func NewConnConfigurer

func NewConnConfigurer(fn goahttp.ConnConfigureFunc) *ConnConfigurer

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

type EchoerServerStream

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

EchoerServerStream implements the chatter.EchoerServerStream interface.

func (*EchoerServerStream) Close

func (s *EchoerServerStream) Close() error

Close closes the "echoer" endpoint websocket connection.

func (*EchoerServerStream) Recv

func (s *EchoerServerStream) Recv() (string, error)

Recv reads instances of "string" from the "echoer" endpoint websocket connection.

func (*EchoerServerStream) Send

func (s *EchoerServerStream) Send(v string) error

Send streams instances of "string" to the "echoer" endpoint websocket connection.

type HistoryResponseBody

type HistoryResponseBody struct {
	// Message sent to the server
	Message string `form:"message" json:"message" xml:"message"`
	// Length of the message sent
	Length *int `form:"length,omitempty" json:"length,omitempty" xml:"length,omitempty"`
	// Time at which the message was sent
	SentAt string `form:"sent_at" json:"sent_at" xml:"sent_at"`
}

HistoryResponseBody is the type of the "chatter" service "history" endpoint HTTP response body.

func NewHistoryResponseBody

func NewHistoryResponseBody(res *chatterviews.ChatSummaryView) *HistoryResponseBody

NewHistoryResponseBody builds the HTTP response body from the result of the "history" endpoint of the "chatter" service.

type HistoryResponseBodyTiny

type HistoryResponseBodyTiny struct {
	// Message sent to the server
	Message string `form:"message" json:"message" xml:"message"`
}

HistoryResponseBodyTiny is the type of the "chatter" service "history" endpoint HTTP response body.

func NewHistoryResponseBodyTiny

func NewHistoryResponseBodyTiny(res *chatterviews.ChatSummaryView) *HistoryResponseBodyTiny

NewHistoryResponseBodyTiny builds the HTTP response body from the result of the "history" endpoint of the "chatter" service.

type HistoryServerStream

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

HistoryServerStream implements the chatter.HistoryServerStream interface.

func (*HistoryServerStream) Close

func (s *HistoryServerStream) Close() error

Close closes the "history" endpoint websocket connection.

func (*HistoryServerStream) Send

Send streams instances of "chatter.ChatSummary" to the "history" endpoint websocket connection.

func (*HistoryServerStream) SetView

func (s *HistoryServerStream) SetView(view string)

SetView sets the view to render the chatter.ChatSummary type before sending to the "history" endpoint websocket connection.

type ListenerServerStream

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

ListenerServerStream implements the chatter.ListenerServerStream interface.

func (*ListenerServerStream) Close

func (s *ListenerServerStream) Close() error

Close closes the "listener" endpoint websocket connection.

func (*ListenerServerStream) Recv

func (s *ListenerServerStream) Recv() (string, error)

Recv reads instances of "string" from the "listener" endpoint websocket connection.

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 Server

type Server struct {
	Mounts    []*MountPoint
	Login     http.Handler
	Echoer    http.Handler
	Listener  http.Handler
	Summary   http.Handler
	Subscribe http.Handler
	History   http.Handler
}

Server lists the chatter service endpoint HTTP handlers.

func New

func New(
	e *chatter.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(ctx context.Context, err error) goahttp.Statuser,
	upgrader goahttp.Upgrader,
	configurer *ConnConfigurer,
) *Server

New instantiates HTTP handlers for all the chatter 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) MethodNames

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the chatter endpoints.

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.

type SubscribeResponseBody

type SubscribeResponseBody struct {
	// Message sent to the server
	Message string `form:"message" json:"message" xml:"message"`
	Action  string `form:"action" json:"action" xml:"action"`
	// Time at which the message was added
	AddedAt string `form:"added_at" json:"added_at" xml:"added_at"`
}

SubscribeResponseBody is the type of the "chatter" service "subscribe" endpoint HTTP response body.

func NewSubscribeResponseBody

func NewSubscribeResponseBody(res *chatter.Event) *SubscribeResponseBody

NewSubscribeResponseBody builds the HTTP response body from the result of the "subscribe" endpoint of the "chatter" service.

type SubscribeServerStream

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

SubscribeServerStream implements the chatter.SubscribeServerStream interface.

func (*SubscribeServerStream) Close

func (s *SubscribeServerStream) Close() error

Close closes the "subscribe" endpoint websocket connection.

func (*SubscribeServerStream) Send

Send streams instances of "chatter.Event" to the "subscribe" endpoint websocket connection.

type SummaryServerStream

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

SummaryServerStream implements the chatter.SummaryServerStream interface.

func (*SummaryServerStream) Recv

func (s *SummaryServerStream) Recv() (string, error)

Recv reads instances of "string" from the "summary" endpoint websocket connection.

func (*SummaryServerStream) SendAndClose

SendAndClose streams instances of "chatter.ChatSummaryCollection" to the "summary" endpoint websocket connection and closes the connection.

Jump to

Keyboard shortcuts

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