Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTokenInput ¶
type CreateTokenInput struct {
Namespace string
Subject string
AllowedMeterSlugs *[]string
ExpiresAt *time.Time
}
CreateTokenInput is the input for the CreateToken method.
func (CreateTokenInput) Validate ¶
func (i CreateTokenInput) Validate() error
type InvalidateTokenInput ¶
InvalidateTokenInput is the input for the InvalidateToken method.
func (InvalidateTokenInput) Validate ¶
func (i InvalidateTokenInput) Validate() error
type ListTokensInput ¶
type ListTokensInput struct {
Namespace string
pagination.Page
}
ListTokensInput is the input for the ListTokens method.
func (ListTokensInput) Validate ¶
func (i ListTokensInput) Validate() error
type PortalToken ¶
type PortalToken struct {
Id *string
AllowedMeterSlugs *[]string
ExpiresAt *time.Time
Subject string
// Only set when creating a token.
Token *string
}
PortalToken is the struct for the portal token.
type PortalTokenClaims ¶
type PortalTokenClaims struct {
// Namespace is the namespace where the token is created.
Namespace string
// Id is the unique identifier of the token.
Id string
// AllowedMeterSlugs is a list of meter slugs that the token allows access to.
// All meter slugs are allowed if the list is empty.
AllowedMeterSlugs []string
// Subject is the subject of the token.
Subject string
// ExpiresAt is the expiration time of the token if any.
ExpiresAt *time.Time
}
PortalTokenClaims is the claims struct for the portal token.
func (*PortalTokenClaims) GetAllowedMeterSlugs ¶
func (c *PortalTokenClaims) GetAllowedMeterSlugs() ([]string, error)
GetAllowedMeterSlugs returns the list of allowed meter slugs.
type PortalTokenService ¶
type PortalTokenService interface {
CreateToken(ctx context.Context, input CreateTokenInput) (*PortalToken, error)
Validate(ctx context.Context, tokenString string) (*PortalTokenClaims, error)
ListTokens(ctx context.Context, input ListTokensInput) (pagination.PagedResponse[*PortalToken], error)
InvalidateToken(ctx context.Context, input InvalidateTokenInput) error
}
PortalTokenService is the service for the portal token management.
type Service ¶
type Service interface {
PortalTokenService
}
Service is the interface for the portal service.
Click to show internal directories.
Click to hide internal directories.