github.com/goadesign/goa/examples/chatter/gen/chatter
chattersvc
import "github.com/goadesign/goa/examples/chatter/gen/chatter"
Overview
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 NewSummaryEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewViewedChatSummary(res *ChatSummary, view string) *chattersvcviews.ChatSummary
- func NewViewedChatSummaryCollection(res ChatSummaryCollection, view string) chattersvcviews.ChatSummaryCollection
- type ChatSummary
- type ChatSummaryCollection
- type Client
- func NewClient(login, echoer, listener, summary, history goa.Endpoint) *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) Summary(ctx context.Context, p *SummaryPayload) (res SummaryClientStream, err error)
- type EchoerClientStream
- type EchoerEndpointInput
- type EchoerPayload
- type EchoerServerStream
- type Endpoints
- type HistoryClientStream
- type HistoryEndpointInput
- type HistoryPayload
- type HistoryServerStream
- type InvalidScopes
- type ListenerClientStream
- type ListenerEndpointInput
- type ListenerPayload
- type ListenerServerStream
- type LoginPayload
- type Service
- type SummaryClientStream
- type SummaryEndpointInput
- type SummaryPayload
- type SummaryServerStream
- type Unauthorized
Package files
client.go endpoints.go service.go
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 = [5]string{"login", "echoer", "listener", "summary", "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.
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 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) *chattersvcviews.ChatSummary
NewViewedChatSummary initializes viewed result type ChatSummary from result type ChatSummary using the given view.
func NewViewedChatSummaryCollection
func NewViewedChatSummaryCollection(res ChatSummaryCollection, view string) chattersvcviews.ChatSummaryCollection
NewViewedChatSummaryCollection initializes viewed result type ChatSummaryCollection from result type ChatSummaryCollection using the given view.
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 *chattersvcviews.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 chattersvcviews.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
HistoryEndpoint goa.Endpoint
}
Client is the “chatter” service client.
func NewClient
func NewClient(login, echoer, listener, summary, history goa.Endpoint) *Client
NewClient initializes a “chatter” service client given the endpoints.
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
func (c *Client) Login(ctx context.Context, p *LoginPayload) (res string, err error)
Login calls the “login” endpoint of the “chatter” service. Login may return the following errors:
- "unauthorized" (type Unauthorized)
- 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 is the input type of “echoer” endpoint that holds the method payload and the server stream.
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
History goa.Endpoint
}
Endpoints wraps the “chatter” service endpoints.
func NewEndpoints
func NewEndpoints(s Service, authBasicFn security.AuthBasicFunc, authJWTFn security.AuthJWTFunc) *Endpoints
NewEndpoints wraps the methods of the “chatter” service with endpoints.
func (*Endpoints) Use
func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)
Use applies the given middleware to all the “chatter” service endpoints.
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 is the input type of “history” endpoint that holds the method payload and the server stream.
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 is the input type of “listener” endpoint that holds the method payload and the server stream.
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
type LoginPayload struct {
User string
Password string
}
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)
// 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 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 is the input type of “summary” endpoint that holds the method payload and the server stream.
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”.
Generated by godoc2md