Documentation ¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeInternal(err error) *goa.ServiceError
- func MakeUnauthenticated(err error) *goa.ServiceError
- func NewRegisterEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewSearchEndpoint(s Service) goa.Endpoint
- type Auther
- type Client
- type Endpoints
- type PostOutput
- type PostOutputCollection
- type PostParams
- type RegisterPayload
- type SearchPayload
- type SearchResult
- type Service
Constants ¶
const ServiceName = "posts"
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 = [2]string{"register", "search"}
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 MakeInternal ¶
func MakeInternal(err error) *goa.ServiceError
MakeInternal builds a goa.ServiceError from an error.
func MakeUnauthenticated ¶
func MakeUnauthenticated(err error) *goa.ServiceError
MakeUnauthenticated builds a goa.ServiceError from an error.
func NewRegisterEndpoint ¶
func NewRegisterEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewRegisterEndpoint returns an endpoint function that calls the method "register" of service "posts".
func NewSearchEndpoint ¶
NewSearchEndpoint returns an endpoint function that calls the method "search" of service "posts".
Types ¶
type Auther ¶
type Auther interface { // APIKeyAuth implements the authorization logic for the APIKey security scheme. APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error) }
Auther defines the authorization functions to be implemented by the service.
type Client ¶
Client is the "posts" service client.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, p *SearchPayload) (res *SearchResult, err error)
Search calls the "search" endpoint of the "posts" service.
type Endpoints ¶
Endpoints wraps the "posts" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "posts" service with endpoints.
type PostOutput ¶
type PostOutputCollection ¶
type PostOutputCollection []*PostOutput
type PostParams ¶
type RegisterPayload ¶
type RegisterPayload struct { // API key used to perform authorization Key string Posts []*PostParams }
RegisterPayload is the payload type of the posts service register method.
type SearchPayload ¶
type SearchPayload struct { // search query Query string // page Page uint // results per page PageSize uint }
search params
type SearchResult ¶
type SearchResult struct { Posts PostOutputCollection Page uint TotalPage uint }
SearchResult is the result type of the posts service search method.
type Service ¶
type Service interface { // registers blog posts to be searched Register(context.Context, *RegisterPayload) (res int, err error) // search blog posts Search(context.Context, *SearchPayload) (res *SearchResult, err error) }
Service is the posts service interface.