Documentation ¶
Index ¶
- Constants
- Variables
- func NewEchoerEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewHistoryEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewListenerEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewLoginEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint
- func NewSubscribeEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewSummaryEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewViewedChatSummary(res *ChatSummary, view string) *chatterviews.ChatSummary
- func NewViewedChatSummaryCollection(res ChatSummaryCollection, view string) chatterviews.ChatSummaryCollection
- type Auther
- type ChatSummary
- type ChatSummaryCollection
- type Client
- func (c *Client) Echoer(ctx context.Context, p *EchoerPayload) (res EchoerClientStream, err error)
- func (c *Client) History(ctx context.Context, p *HistoryPayload) (res HistoryClientStream, err error)
- func (c *Client) Listener(ctx context.Context, p *ListenerPayload) (res ListenerClientStream, err error)
- func (c *Client) Login(ctx context.Context, p *LoginPayload) (res string, err error)
- func (c *Client) Subscribe(ctx context.Context, p *SubscribePayload) (res SubscribeClientStream, err error)
- func (c *Client) Summary(ctx context.Context, p *SummaryPayload) (res SummaryClientStream, err error)
- type EchoerClientStream
- type EchoerEndpointInput
- type EchoerPayload
- type EchoerServerStream
- type Endpoints
- type Event
- type HistoryClientStream
- type HistoryEndpointInput
- type HistoryPayload
- type HistoryServerStream
- type InvalidScopes
- type ListenerClientStream
- type ListenerEndpointInput
- type ListenerPayload
- type ListenerServerStream
- type LoginPayload
- type Service
- type SubscribeClientStream
- type SubscribeEndpointInput
- type SubscribePayload
- type SubscribeServerStream
- type SummaryClientStream
- type SummaryEndpointInput
- type SummaryPayload
- type SummaryServerStream
- type Unauthorized
Constants ¶
const ServiceName = "chatter"
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 ¶
var MethodNames = [6]string{"login", "echoer", "listener", "summary", "subscribe", "history"}
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 NewEchoerEndpoint ¶
func NewEchoerEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewEchoerEndpoint returns an endpoint function that calls the method "echoer" of service "chatter".
func NewHistoryEndpoint ¶
func NewHistoryEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewHistoryEndpoint returns an endpoint function that calls the method "history" of service "chatter".
func NewListenerEndpoint ¶
func NewListenerEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewListenerEndpoint returns an endpoint function that calls the method "listener" of service "chatter".
func NewLoginEndpoint ¶
func NewLoginEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint
NewLoginEndpoint returns an endpoint function that calls the method "login" of service "chatter".
func NewSubscribeEndpoint ¶
func NewSubscribeEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewSubscribeEndpoint returns an endpoint function that calls the method "subscribe" of service "chatter".
func NewSummaryEndpoint ¶
func NewSummaryEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewSummaryEndpoint returns an endpoint function that calls the method "summary" of service "chatter".
func NewViewedChatSummary ¶
func NewViewedChatSummary(res *ChatSummary, view string) *chatterviews.ChatSummary
NewViewedChatSummary initializes viewed result type ChatSummary from result type ChatSummary using the given view.
func NewViewedChatSummaryCollection ¶
func NewViewedChatSummaryCollection(res ChatSummaryCollection, view string) chatterviews.ChatSummaryCollection
NewViewedChatSummaryCollection initializes viewed result type ChatSummaryCollection from result type ChatSummaryCollection using the given view.
Types ¶
type Auther ¶
type Auther interface { // BasicAuth implements the authorization logic for the Basic security scheme. BasicAuth(ctx context.Context, user, pass string, schema *security.BasicScheme) (context.Context, error) // 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 ChatSummary ¶
type ChatSummary struct { // Message sent to the server Message string // Length of the message sent Length *int // Time at which the message was sent SentAt string }
ChatSummary is the result type of the chatter service history method.
func NewChatSummary ¶
func NewChatSummary(vres *chatterviews.ChatSummary) *ChatSummary
NewChatSummary initializes result type ChatSummary from viewed result type ChatSummary.
type ChatSummaryCollection ¶
type ChatSummaryCollection []*ChatSummary
ChatSummaryCollection is the result type of the chatter service summary method.
func NewChatSummaryCollection ¶
func NewChatSummaryCollection(vres chatterviews.ChatSummaryCollection) ChatSummaryCollection
NewChatSummaryCollection initializes result type ChatSummaryCollection from viewed result type ChatSummaryCollection.
type Client ¶
type Client struct { LoginEndpoint goa.Endpoint EchoerEndpoint goa.Endpoint ListenerEndpoint goa.Endpoint SummaryEndpoint goa.Endpoint SubscribeEndpoint goa.Endpoint HistoryEndpoint goa.Endpoint }
Client is the "chatter" service client.
func (*Client) Echoer ¶
func (c *Client) Echoer(ctx context.Context, p *EchoerPayload) (res EchoerClientStream, err error)
Echoer calls the "echoer" endpoint of the "chatter" service. Echoer may return the following errors:
- "unauthorized" (type Unauthorized)
- "invalid-scopes" (type InvalidScopes)
- error: internal error
func (*Client) History ¶
func (c *Client) History(ctx context.Context, p *HistoryPayload) (res HistoryClientStream, err error)
History calls the "history" endpoint of the "chatter" service. History may return the following errors:
- "unauthorized" (type Unauthorized)
- "invalid-scopes" (type InvalidScopes)
- error: internal error
func (*Client) Listener ¶
func (c *Client) Listener(ctx context.Context, p *ListenerPayload) (res ListenerClientStream, err error)
Listener calls the "listener" endpoint of the "chatter" service. Listener may return the following errors:
- "unauthorized" (type Unauthorized)
- "invalid-scopes" (type InvalidScopes)
- error: internal error
func (*Client) Login ¶
Login calls the "login" endpoint of the "chatter" service. Login may return the following errors:
- "unauthorized" (type Unauthorized)
- error: internal error
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, p *SubscribePayload) (res SubscribeClientStream, err error)
Subscribe calls the "subscribe" endpoint of the "chatter" service. Subscribe may return the following errors:
- "unauthorized" (type Unauthorized)
- "invalid-scopes" (type InvalidScopes)
- error: internal error
func (*Client) Summary ¶
func (c *Client) Summary(ctx context.Context, p *SummaryPayload) (res SummaryClientStream, err error)
Summary calls the "summary" endpoint of the "chatter" service. Summary may return the following errors:
- "unauthorized" (type Unauthorized)
- "invalid-scopes" (type InvalidScopes)
- error: internal error
type EchoerClientStream ¶
type EchoerClientStream interface { // Send streams instances of "string". Send(string) error // Recv reads instances of "string" from the stream. Recv() (string, error) // Close closes the stream. Close() error }
EchoerClientStream is the interface a "echoer" endpoint client stream must satisfy.
type EchoerEndpointInput ¶
type EchoerEndpointInput struct { // Payload is the method payload. Payload *EchoerPayload // Stream is the server stream used by the "echoer" method to send data. Stream EchoerServerStream }
EchoerEndpointInput holds both the payload and the server stream of the "echoer" method.
type EchoerPayload ¶
type EchoerPayload struct { // JWT used for authentication Token string }
EchoerPayload is the payload type of the chatter service echoer method.
type EchoerServerStream ¶
type EchoerServerStream interface { // Send streams instances of "string". Send(string) error // Recv reads instances of "string" from the stream. Recv() (string, error) // Close closes the stream. Close() error }
EchoerServerStream is the interface a "echoer" endpoint server stream must satisfy.
type Endpoints ¶
type Endpoints struct { Login goa.Endpoint Echoer goa.Endpoint Listener goa.Endpoint Summary goa.Endpoint Subscribe goa.Endpoint History goa.Endpoint }
Endpoints wraps the "chatter" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "chatter" service with endpoints.
type Event ¶
type Event struct { // Message sent to the server Message string Action string // Time at which the message was added AddedAt string }
Event is the result type of the chatter service subscribe method.
type HistoryClientStream ¶
type HistoryClientStream interface { // Recv reads instances of "ChatSummary" from the stream. Recv() (*ChatSummary, error) }
HistoryClientStream is the interface a "history" endpoint client stream must satisfy.
type HistoryEndpointInput ¶
type HistoryEndpointInput struct { // Payload is the method payload. Payload *HistoryPayload // Stream is the server stream used by the "history" method to send data. Stream HistoryServerStream }
HistoryEndpointInput holds both the payload and the server stream of the "history" method.
type HistoryPayload ¶
type HistoryPayload struct { // JWT used for authentication Token string // View to use to render the result View *string }
HistoryPayload is the payload type of the chatter service history method.
type HistoryServerStream ¶
type HistoryServerStream interface { // Send streams instances of "ChatSummary". Send(*ChatSummary) error // Close closes the stream. Close() error // SetView sets the view used to render the result before streaming. SetView(view string) }
HistoryServerStream is the interface a "history" endpoint server stream must satisfy.
type InvalidScopes ¶
type InvalidScopes string
func (InvalidScopes) Error ¶
func (e InvalidScopes) Error() string
Error returns an error description.
func (InvalidScopes) ErrorName ¶
func (e InvalidScopes) ErrorName() string
ErrorName returns "invalid-scopes".
type ListenerClientStream ¶
type ListenerClientStream interface { // Send streams instances of "string". Send(string) error // Close closes the stream. Close() error }
ListenerClientStream is the interface a "listener" endpoint client stream must satisfy.
type ListenerEndpointInput ¶
type ListenerEndpointInput struct { // Payload is the method payload. Payload *ListenerPayload // Stream is the server stream used by the "listener" method to send data. Stream ListenerServerStream }
ListenerEndpointInput holds both the payload and the server stream of the "listener" method.
type ListenerPayload ¶
type ListenerPayload struct { // JWT used for authentication Token string }
ListenerPayload is the payload type of the chatter service listener method.
type ListenerServerStream ¶
type ListenerServerStream interface { // Recv reads instances of "string" from the stream. Recv() (string, error) // Close closes the stream. Close() error }
ListenerServerStream is the interface a "listener" endpoint server stream must satisfy.
type LoginPayload ¶
Credentials used to authenticate to retrieve JWT token
type Service ¶
type Service interface { // Creates a valid JWT token for auth to chat. Login(context.Context, *LoginPayload) (res string, err error) // Echoes the message sent by the client. Echoer(context.Context, *EchoerPayload, EchoerServerStream) (err error) // Listens to the messages sent by the client. Listener(context.Context, *ListenerPayload, ListenerServerStream) (err error) // Summarizes the chat messages sent by the client. Summary(context.Context, *SummaryPayload, SummaryServerStream) (err error) // Subscribe to events sent when new chat messages are added. Subscribe(context.Context, *SubscribePayload, SubscribeServerStream) (err error) // Returns the chat messages sent to the server. // The "view" return value must have one of the following views // - "tiny" // - "default" History(context.Context, *HistoryPayload, HistoryServerStream) (err error) }
The chatter service implements a simple client and server chat.
type SubscribeClientStream ¶
type SubscribeClientStream interface { // Recv reads instances of "Event" from the stream. Recv() (*Event, error) }
SubscribeClientStream is the interface a "subscribe" endpoint client stream must satisfy.
type SubscribeEndpointInput ¶
type SubscribeEndpointInput struct { // Payload is the method payload. Payload *SubscribePayload // Stream is the server stream used by the "subscribe" method to send data. Stream SubscribeServerStream }
SubscribeEndpointInput holds both the payload and the server stream of the "subscribe" method.
type SubscribePayload ¶
type SubscribePayload struct { // JWT used for authentication Token string }
SubscribePayload is the payload type of the chatter service subscribe method.
type SubscribeServerStream ¶
type SubscribeServerStream interface { // Send streams instances of "Event". Send(*Event) error // Close closes the stream. Close() error }
SubscribeServerStream is the interface a "subscribe" endpoint server stream must satisfy.
type SummaryClientStream ¶
type SummaryClientStream interface { // Send streams instances of "string". Send(string) error // CloseAndRecv stops sending messages to the stream and reads instances of // "ChatSummaryCollection" from the stream. CloseAndRecv() (ChatSummaryCollection, error) }
SummaryClientStream is the interface a "summary" endpoint client stream must satisfy.
type SummaryEndpointInput ¶
type SummaryEndpointInput struct { // Payload is the method payload. Payload *SummaryPayload // Stream is the server stream used by the "summary" method to send data. Stream SummaryServerStream }
SummaryEndpointInput holds both the payload and the server stream of the "summary" method.
type SummaryPayload ¶
type SummaryPayload struct { // JWT used for authentication Token string }
SummaryPayload is the payload type of the chatter service summary method.
type SummaryServerStream ¶
type SummaryServerStream interface { // SendAndClose streams instances of "ChatSummaryCollection" and closes the // stream. SendAndClose(ChatSummaryCollection) error // Recv reads instances of "string" from the stream. Recv() (string, error) }
SummaryServerStream is the interface a "summary" endpoint server stream must satisfy.
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".