Documentation ¶
Index ¶
- Variables
- func SetLicenseCache(licenseKey, instanceName string, license LicenseKey)
- type ActiveLicenseKeyResponse
- type FeatureType
- type LicenseKey
- type LicenseKeyMeta
- type LicenseService
- func (s *LicenseService) GetSubscription(ctx context.Context) (*apiv2pb.Subscription, error)
- func (s *LicenseService) IsFeatureEnabled(feature FeatureType) bool
- func (s *LicenseService) LoadSubscription(ctx context.Context) (*apiv2pb.Subscription, error)
- func (s *LicenseService) UpdateSubscription(ctx context.Context, licenseKey string) (*apiv2pb.Subscription, error)
- type ValidateLicenseKeyResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var FeatureMatrix = map[FeatureType][2]bool{ FeatureTypeUnlimitedAccounts: {false, true}, FeatureTypeUnlimitedCollections: {false, true}, FeatureTypeCustomeStyle: {false, true}, }
FeatureMatrix is a matrix of features in [Free, Pro].
Functions ¶
func SetLicenseCache ¶
func SetLicenseCache(licenseKey, instanceName string, license LicenseKey)
Types ¶
type ActiveLicenseKeyResponse ¶
type ActiveLicenseKeyResponse struct { Activated bool `json:"activated"` Error *string `json:"error"` LicenseKey *LicenseKey `json:"license_key"` Meta *LicenseKeyMeta `json:"meta"` }
type FeatureType ¶
type FeatureType string
const ( // FeatureTypeUnlimitedAccounts allows the user to create unlimited accounts. FeatureTypeUnlimitedAccounts FeatureType = "unlimited_accounts" // FeatureTypeUnlimitedAccounts allows the user to create unlimited collections. FeatureTypeUnlimitedCollections FeatureType = "unlimited_collections" // FeatureTypeCustomStyle allows the user to customize the style. FeatureTypeCustomeStyle FeatureType = "custom_style" )
type LicenseKey ¶
type LicenseKey struct { ID int32 `json:"id"` Status string `json:"status"` Key string `json:"key"` CreatedAt string `json:"created_at"` ExpiresAt *string `json:"updated_at"` }
func GetLicenseCache ¶
func GetLicenseCache(licenseKey, instanceName string) *LicenseKey
type LicenseKeyMeta ¶
type LicenseKeyMeta struct { StoreID int32 `json:"store_id"` OrderID int32 `json:"order_id"` OrderItemID int32 `json:"order_item_id"` ProductID int32 `json:"product_id"` ProductName string `json:"product_name"` VariantID int32 `json:"variant_id"` VariantName string `json:"variant_name"` CustomerID int32 `json:"customer_id"` CustomerName string `json:"customer_name"` CustomerEmail string `json:"customer_email"` }
type LicenseService ¶
type LicenseService struct { Profile *profile.Profile Store *store.Store // contains filtered or unexported fields }
func NewLicenseService ¶
func NewLicenseService(profile *profile.Profile, store *store.Store) *LicenseService
NewLicenseService creates a new LicenseService.
func (*LicenseService) GetSubscription ¶
func (s *LicenseService) GetSubscription(ctx context.Context) (*apiv2pb.Subscription, error)
func (*LicenseService) IsFeatureEnabled ¶
func (s *LicenseService) IsFeatureEnabled(feature FeatureType) bool
func (*LicenseService) LoadSubscription ¶
func (s *LicenseService) LoadSubscription(ctx context.Context) (*apiv2pb.Subscription, error)
func (*LicenseService) UpdateSubscription ¶
func (s *LicenseService) UpdateSubscription(ctx context.Context, licenseKey string) (*apiv2pb.Subscription, error)
type ValidateLicenseKeyResponse ¶
type ValidateLicenseKeyResponse struct { Valid bool `json:"valid"` Error *string `json:"error"` LicenseKey *LicenseKey `json:"license_key"` Meta *LicenseKeyMeta `json:"meta"` }
Click to show internal directories.
Click to hide internal directories.