Documentation
¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeConflict(err error) *goa.ServiceError
- func MakeForbidden(err error) *goa.ServiceError
- func MakeGatewayError(err error) *goa.ServiceError
- func MakeInvalid(err error) *goa.ServiceError
- func MakeInvariantViolation(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func MakeUnauthorized(err error) *goa.ServiceError
- func MakeUnexpected(err error) *goa.ServiceError
- func MakeUnsupportedMedia(err error) *goa.ServiceError
- func NewCreateCheckoutEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewCreateCustomerSessionEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewGetPeriodUsageEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewGetUsageTiersEndpoint(s Service) goa.Endpoint
- type Auther
- type Client
- func (c *Client) CreateCheckout(ctx context.Context, p *CreateCheckoutPayload) (res string, err error)
- func (c *Client) CreateCustomerSession(ctx context.Context, p *CreateCustomerSessionPayload) (res string, err error)
- func (c *Client) GetPeriodUsage(ctx context.Context, p *GetPeriodUsagePayload) (res *PeriodUsage, err error)
- func (c *Client) GetUsageTiers(ctx context.Context) (res *UsageTiers, err error)
- type CreateCheckoutPayload
- type CreateCustomerSessionPayload
- type Endpoints
- type GetPeriodUsagePayload
- type PeriodUsage
- type Service
- type TierLimits
- type UsageTiers
Constants ¶
const APIName = "gram"
APIName is the name of the API as defined in the design.
const APIVersion = "0.0.1"
APIVersion is the version of the API as defined in the design.
const ServiceName = "usage"
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 = [4]string{"getPeriodUsage", "getUsageTiers", "createCustomerSession", "createCheckout"}
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 MakeConflict ¶
func MakeConflict(err error) *goa.ServiceError
MakeConflict builds a goa.ServiceError from an error.
func MakeForbidden ¶
func MakeForbidden(err error) *goa.ServiceError
MakeForbidden builds a goa.ServiceError from an error.
func MakeGatewayError ¶
func MakeGatewayError(err error) *goa.ServiceError
MakeGatewayError builds a goa.ServiceError from an error.
func MakeInvalid ¶
func MakeInvalid(err error) *goa.ServiceError
MakeInvalid builds a goa.ServiceError from an error.
func MakeInvariantViolation ¶
func MakeInvariantViolation(err error) *goa.ServiceError
MakeInvariantViolation builds a goa.ServiceError from an error.
func MakeNotFound ¶
func MakeNotFound(err error) *goa.ServiceError
MakeNotFound builds a goa.ServiceError from an error.
func MakeUnauthorized ¶
func MakeUnauthorized(err error) *goa.ServiceError
MakeUnauthorized builds a goa.ServiceError from an error.
func MakeUnexpected ¶
func MakeUnexpected(err error) *goa.ServiceError
MakeUnexpected builds a goa.ServiceError from an error.
func MakeUnsupportedMedia ¶
func MakeUnsupportedMedia(err error) *goa.ServiceError
MakeUnsupportedMedia builds a goa.ServiceError from an error.
func NewCreateCheckoutEndpoint ¶
func NewCreateCheckoutEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCreateCheckoutEndpoint returns an endpoint function that calls the method "createCheckout" of service "usage".
func NewCreateCustomerSessionEndpoint ¶
func NewCreateCustomerSessionEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCreateCustomerSessionEndpoint returns an endpoint function that calls the method "createCustomerSession" of service "usage".
func NewGetPeriodUsageEndpoint ¶
func NewGetPeriodUsageEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewGetPeriodUsageEndpoint returns an endpoint function that calls the method "getPeriodUsage" of service "usage".
func NewGetUsageTiersEndpoint ¶
NewGetUsageTiersEndpoint returns an endpoint function that calls the method "getUsageTiers" of service "usage".
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 ¶
type Client struct {
GetPeriodUsageEndpoint goa.Endpoint
GetUsageTiersEndpoint goa.Endpoint
CreateCustomerSessionEndpoint goa.Endpoint
CreateCheckoutEndpoint goa.Endpoint
}
Client is the "usage" service client.
func NewClient ¶
func NewClient(getPeriodUsage, getUsageTiers, createCustomerSession, createCheckout goa.Endpoint) *Client
NewClient initializes a "usage" service client given the endpoints.
func (*Client) CreateCheckout ¶
func (c *Client) CreateCheckout(ctx context.Context, p *CreateCheckoutPayload) (res string, err error)
CreateCheckout calls the "createCheckout" endpoint of the "usage" service. CreateCheckout may return the following errors:
- "unauthorized" (type *goa.ServiceError): unauthorized access
- "forbidden" (type *goa.ServiceError): permission denied
- "bad_request" (type *goa.ServiceError): request is invalid
- "not_found" (type *goa.ServiceError): resource not found
- "conflict" (type *goa.ServiceError): resource already exists
- "unsupported_media" (type *goa.ServiceError): unsupported media type
- "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
- "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
- "unexpected" (type *goa.ServiceError): an unexpected error occurred
- "gateway_error" (type *goa.ServiceError): an unexpected error occurred
- error: internal error
func (*Client) CreateCustomerSession ¶
func (c *Client) CreateCustomerSession(ctx context.Context, p *CreateCustomerSessionPayload) (res string, err error)
CreateCustomerSession calls the "createCustomerSession" endpoint of the "usage" service. CreateCustomerSession may return the following errors:
- "unauthorized" (type *goa.ServiceError): unauthorized access
- "forbidden" (type *goa.ServiceError): permission denied
- "bad_request" (type *goa.ServiceError): request is invalid
- "not_found" (type *goa.ServiceError): resource not found
- "conflict" (type *goa.ServiceError): resource already exists
- "unsupported_media" (type *goa.ServiceError): unsupported media type
- "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
- "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
- "unexpected" (type *goa.ServiceError): an unexpected error occurred
- "gateway_error" (type *goa.ServiceError): an unexpected error occurred
- error: internal error
func (*Client) GetPeriodUsage ¶
func (c *Client) GetPeriodUsage(ctx context.Context, p *GetPeriodUsagePayload) (res *PeriodUsage, err error)
GetPeriodUsage calls the "getPeriodUsage" endpoint of the "usage" service. GetPeriodUsage may return the following errors:
- "unauthorized" (type *goa.ServiceError): unauthorized access
- "forbidden" (type *goa.ServiceError): permission denied
- "bad_request" (type *goa.ServiceError): request is invalid
- "not_found" (type *goa.ServiceError): resource not found
- "conflict" (type *goa.ServiceError): resource already exists
- "unsupported_media" (type *goa.ServiceError): unsupported media type
- "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
- "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
- "unexpected" (type *goa.ServiceError): an unexpected error occurred
- "gateway_error" (type *goa.ServiceError): an unexpected error occurred
- error: internal error
func (*Client) GetUsageTiers ¶
func (c *Client) GetUsageTiers(ctx context.Context) (res *UsageTiers, err error)
GetUsageTiers calls the "getUsageTiers" endpoint of the "usage" service. GetUsageTiers may return the following errors:
- "unauthorized" (type *goa.ServiceError): unauthorized access
- "forbidden" (type *goa.ServiceError): permission denied
- "bad_request" (type *goa.ServiceError): request is invalid
- "not_found" (type *goa.ServiceError): resource not found
- "conflict" (type *goa.ServiceError): resource already exists
- "unsupported_media" (type *goa.ServiceError): unsupported media type
- "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
- "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
- "unexpected" (type *goa.ServiceError): an unexpected error occurred
- "gateway_error" (type *goa.ServiceError): an unexpected error occurred
- error: internal error
type CreateCheckoutPayload ¶
CreateCheckoutPayload is the payload type of the usage service createCheckout method.
type CreateCustomerSessionPayload ¶
CreateCustomerSessionPayload is the payload type of the usage service createCustomerSession method.
type Endpoints ¶
type Endpoints struct {
GetPeriodUsage goa.Endpoint
GetUsageTiers goa.Endpoint
CreateCustomerSession goa.Endpoint
CreateCheckout goa.Endpoint
}
Endpoints wraps the "usage" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "usage" service with endpoints.
type GetPeriodUsagePayload ¶
GetPeriodUsagePayload is the payload type of the usage service getPeriodUsage method.
type PeriodUsage ¶
type PeriodUsage struct {
// The number of tool calls used
ToolCalls int
// The maximum number of tool calls allowed
MaxToolCalls int
// The number of servers used, according to the Polar meter
Servers int
// The maximum number of servers allowed
MaxServers int
// The number of servers enabled at the time of the request
ActualEnabledServerCount int
}
PeriodUsage is the result type of the usage service getPeriodUsage method.
type Service ¶
type Service interface {
// Get the usage for a project for a given period
GetPeriodUsage(context.Context, *GetPeriodUsagePayload) (res *PeriodUsage, err error)
// Get the usage tiers
GetUsageTiers(context.Context) (res *UsageTiers, err error)
// Create a customer session for the user
CreateCustomerSession(context.Context, *CreateCustomerSessionPayload) (res string, err error)
// Create a checkout link for upgrading to the business plan
CreateCheckout(context.Context, *CreateCheckoutPayload) (res string, err error)
}
Read usage for gram.
type TierLimits ¶
type TierLimits struct {
// The base price for the tier
BasePrice float64
// The number of tool calls included in the tier
IncludedToolCalls int
// The number of servers included in the tier
IncludedServers int
// The number of credits included in the tier for playground and other
// dashboard activities
IncludedCredits int
// The price per additional tool call
PricePerAdditionalToolCall float64
// The price per additional server
PricePerAdditionalServer float64
// The price per additional credit
PricePerAdditionalCredit float64
// Key feature bullets of the tier
FeatureBullets []string
// Included items bullets of the tier
IncludedBullets []string
// Add-on items bullets of the tier (optional)
AddOnBullets []string
}
type UsageTiers ¶
type UsageTiers struct {
// The limits for the free tier
Free *TierLimits
// The limits for the pro tier
Pro *TierLimits
// The limits for the enterprise tier
Enterprise *TierLimits
}
UsageTiers is the result type of the usage service getUsageTiers method.