Documentation
¶
Index ¶
- Constants
- Variables
- func MakeInternalError(err error) *goa.ServiceError
- func MakeInvalidScopes(err error) *goa.ServiceError
- func MakeInvalidToken(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func NewGetEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewUpdateEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- type Auther
- type Client
- type Endpoints
- type GetPayload
- type GetResult
- type Service
- type UpdatePayload
Constants ¶
const APIName = "hub"
APIName is the name of the API as defined in the design.
const APIVersion = "1.0"
APIVersion is the version of the API as defined in the design.
const ServiceName = "rating"
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{"Get", "Update"}
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 MakeInternalError ¶
func MakeInternalError(err error) *goa.ServiceError
MakeInternalError builds a goa.ServiceError from an error.
func MakeInvalidScopes ¶
func MakeInvalidScopes(err error) *goa.ServiceError
MakeInvalidScopes builds a goa.ServiceError from an error.
func MakeInvalidToken ¶
func MakeInvalidToken(err error) *goa.ServiceError
MakeInvalidToken builds a goa.ServiceError from an error.
func MakeNotFound ¶
func MakeNotFound(err error) *goa.ServiceError
MakeNotFound builds a goa.ServiceError from an error.
func NewGetEndpoint ¶
func NewGetEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewGetEndpoint returns an endpoint function that calls the method "Get" of service "rating".
func NewUpdateEndpoint ¶
func NewUpdateEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewUpdateEndpoint returns an endpoint function that calls the method "Update" of service "rating".
Types ¶
type Auther ¶
type Auther interface {
// 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 Client ¶
Client is the "rating" service client.
func (*Client) Get ¶
Get calls the "Get" endpoint of the "rating" service. Get may return the following errors:
- "not-found" (type *goa.ServiceError): Resource Not Found Error
- "internal-error" (type *goa.ServiceError): Internal server error
- "invalid-token" (type *goa.ServiceError): Invalid User token
- "invalid-scopes" (type *goa.ServiceError): Invalid User scope
- error: internal error
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, p *UpdatePayload) (err error)
Update calls the "Update" endpoint of the "rating" service. Update may return the following errors:
- "not-found" (type *goa.ServiceError): Resource Not Found Error
- "internal-error" (type *goa.ServiceError): Internal server error
- "invalid-token" (type *goa.ServiceError): Invalid User token
- "invalid-scopes" (type *goa.ServiceError): Invalid User scope
- error: internal error
type Endpoints ¶
Endpoints wraps the "rating" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "rating" service with endpoints.
type GetPayload ¶
GetPayload is the payload type of the rating service Get method.
type GetResult ¶
type GetResult struct {
// User rating for resource
Rating int
}
GetResult is the result type of the rating service Get method.
type Service ¶
type Service interface {
// Find user's rating for a resource
Get(context.Context, *GetPayload) (res *GetResult, err error)
// Update user's rating for a resource
Update(context.Context, *UpdatePayload) (err error)
}
The rating service exposes endpoints to read and write user's rating for resources
type UpdatePayload ¶
type UpdatePayload struct {
// ID of a resource
ID uint
// User rating for resource
Rating uint
// JWT
Token string
}
UpdatePayload is the payload type of the rating service Update method.