edition

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package edition decides which features the configured product edition (app.edition) serves. The commercial packages and routes are listed once, in config/editions.json; the community edition answers their /api/v2 routes exactly as it answers a route that is not declared, and its release leaves the packages out (packages/shared/build_package.py). The commercial API prefixes reserve parts of a package's v4 API for the commercial edition (forward-sdk.md section 12: the forward package's user self-service, plans and multipliers, v4.3): the community edition answers a request under one as a route that does not exist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	// contains filtered or unexported fields
}

Policy answers what one edition serves.

func For

func For(cfg *config.Config) *Policy

For returns the policy of the configured edition.

func New

func New(name string) *Policy

New returns the policy of an edition name (community when not valid).

func (*Policy) Commercial

func (p *Policy) Commercial() bool

Commercial reports whether this is the commercial edition.

func (*Policy) HiddenPackages

func (p *Policy) HiddenPackages() []string

HiddenPackages lists the packages the edition hides, sorted.

func (*Policy) HiddenRoutes

func (p *Policy) HiddenRoutes() []string

HiddenRoutes lists the /api/v2 routes ("METHOD path") the edition hides, sorted.

func (*Policy) Hides

func (p *Policy) Hides(packageID, routeID string) bool

Hides reports whether the edition hides a package route.

func (*Policy) HidesPackage

func (p *Policy) HidesPackage(packageID string) bool

HidesPackage reports whether the edition hides a whole package.

func (*Policy) HidesPath added in v4.2.0

func (p *Policy) HidesPath(requestPath string) bool

HidesPath reports whether the edition hides an /api/v4/ request path: one under a commercial API prefix, or the prefix itself without its slash.

func (*Policy) HidesRequest

func (p *Policy) HidesRequest(method, fullPath string) bool

HidesRequest reports whether the edition hides the /api/v2 route that a request matched: method and the gin route pattern (gin.Context.FullPath).

func (*Policy) Name

func (p *Policy) Name() string

Name is the edition name.

type Route

type Route struct {
	PackageID string
	RouteID   string
}

Route is one /api/v2 route of config/package-extraction.json.

type Table

type Table struct {
	Format             string   `json:"format"`
	Default            string   `json:"default"`
	CommercialPackages []string `json:"commercial_packages"`
	CommercialRoutes   []string `json:"commercial_routes"`
	// CommercialAPIPrefixes are /api/v4/ path prefixes, each ending in "/",
	// that only the commercial edition serves.
	CommercialAPIPrefixes []string `json:"commercial_api_prefixes"`
}

Table is config/editions.json.

func Commercial

func Commercial() Table

Commercial returns config/editions.json. It panics when the embedded table is invalid, which TestEmbeddedTablesAreValid catches.

Jump to

Keyboard shortcuts

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