portal

package
v1.0.0-beta.195 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotImplemented

func IsNotImplemented(err error) bool

IsNotImplemented returns a boolean indicating whether the error is a not implemented error.

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

type InvalidateTokenInput struct {
	Namespace string
	ID        *string
	Subject   *string
}

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 NotImplementedError

type NotImplementedError genericError

NotImplementedError represents an error when not implemented

func NewNotImplementedError

func NewNotImplementedError(err error) *NotImplementedError

NewNotImplementedError returns a new not implemented error

func (NotImplementedError) Error

func (e NotImplementedError) Error() string

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL