gateways

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CatalogPageSize is the page size QueryDefinitionsByManufacturer returns.
	// Exported because callers page until a short page and must agree with it;
	// a private copy elsewhere silently truncates their iteration if it drifts.
	CatalogPageSize = 500
)
View Source
const DeviceDefinitionByIDQuery = `` /* 145-byte string literal not displayed */

Variables

View Source
var ErrBadRequest = errors.New("bad request")
View Source
var ErrManufacturerUnresolved = errors.New("manufacturer not resolved in identity")

ErrManufacturerUnresolved is returned by Create when identity-api cannot resolve the definition's manufacturer to a minted token id, whether because the make is not minted or because identity failed to answer. Nothing is written. A template created without a tokenId cannot be used by UpsertDecoding or addvin, and the on-chain create this replaced refused the same case.

View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrTemplateExists = errors.New("template already exists in catalog")

ErrTemplateExists is returned by Create when a template is already stored at the id: the worker answered 412 to its If-None-Match: * write, and nothing was written. A caller that only needs the template to exist -- the decode path -- treats it as success by another writer and reads the stored template back; it must not retry the write unconditionally.

View Source
var ErrTemplateNotFound = errors.New("template not found in catalog")

ErrTemplateNotFound is returned by GetTemplateByID/GetTemplateByIDFresh only for a genuine 404 from t/<id>.json -- the template import has not run for this id. Callers must check it with errors.Is, never by inspecting the error's message: any other status, a transport error, or a decode failure returns a distinct, non-sentinel error, so a catalog outage is never mistaken for "this vehicle does not exist." Conflating the two would let a caller respond to a 500 by creating a duplicate definition mid-outage.

Functions

This section is empty.

Types

type AutoIsoAPIService added in v1.0.32

type AutoIsoAPIService interface {
	GetVIN(vin string) (*coremodels.AutoIsoVINResponse, []byte, error)
}

func NewAutoIsoAPIService added in v1.0.32

func NewAutoIsoAPIService(autoIsoAPIUid, autoIsoAPIKey string) AutoIsoAPIService

type CarVxVINAPI added in v1.4.9

type CarVxVINAPI interface {
	GetVINInfo(chassisNumber string) (*coremodels.CarVxResponse, []byte, error)
}

func NewCarVxVINAPI added in v1.4.9

func NewCarVxVINAPI(logger *zerolog.Logger, settings *config.Settings) CarVxVINAPI

type DATGroupAPIService added in v1.1.0

type DATGroupAPIService interface {
	GetVINv2(vin string) (*coremodels.DATGroupInfoResponse, []byte, error)
}

func NewDATGroupAPIService added in v1.1.0

func NewDATGroupAPIService(settings *config.Settings, logger *zerolog.Logger) DATGroupAPIService

type DeviceDefinitionCatalogService added in v1.6.5

type DeviceDefinitionCatalogService interface {
	GetManufacturer(manufacturerSlug string) (*coremodels.Manufacturer, error)
	GetManufacturerNameByID(ctx context.Context, manufacturerID *big.Int) (string, error)
	// GetDeviceDefinitionByID gets a definition by slug ID, requiring it to belong to the given manufacturer.
	GetDeviceDefinitionByID(ctx context.Context, manufacturerID *big.Int, ID string) (*coremodels.DeviceDefinitionTablelandModel, error)
	// GetTemplateByID reads the vehicle template for a slug ID from t/<id>.json
	// and returns the manufacturer token id too. The token id is nil when the
	// template carries none: tokenId is optional in the contract, and a caller
	// must treat nil as unknown, never as manufacturer 0. It does not fall
	// back to the pre-migration definitions/<id>.json: a 404 here means the template
	// import has not run for this id, and that must fail loudly rather than
	// silently serving the flat pre-migration record.
	GetTemplateByID(ctx context.Context, ID string) (*coremodels.Template, *big.Int, error)
	// GetTemplateByIDFresh is GetTemplateByID with a request the edge cache
	// cannot answer. A caller that reads, mutates and writes back must use it:
	// documents are served with max-age=86400, so a cached read silently
	// discards any edit made in the last day when the result is PUT back.
	//
	// The worker and the catalog are one hostname, so this is not a different
	// host -- it is a different cache key, a unique query parameter the worker
	// ignores. See fetchTemplateDocFresh.
	//
	// The decode path uses it after Create returns ErrTemplateExists, to read
	// back the template another writer just stored: the edge may still be
	// serving the 404 the decode saw moments earlier.
	GetTemplateByIDFresh(ctx context.Context, ID string) (*coremodels.Template, *big.Int, error)
	// GetDefinition is GetDeviceDefinitionByID under its historical secondary name.
	GetDefinition(ctx context.Context, manufacturerID *big.Int, ID string) (*coremodels.DeviceDefinitionTablelandModel, error)
	// Create writes a template that does not exist yet and returns the
	// document the worker stored -- the PUT's own response, so no read-back
	// is needed. A caller must narrow that document to a trim exactly as it
	// would a template it had found, or a definition's first decode answers
	// differently from its second.
	Create(ctx context.Context, manufacturerName string, dd coremodels.DeviceDefinitionTablelandModel) (*coremodels.Template, error)
	Delete(ctx context.Context, manufacturerName, id string) (*string, error)
}

DeviceDefinitionCatalogService reads device definitions from the R2-backed catalog (CDN) and writes them through the definitions-worker. It replaces the Tableland on-chain service.

func NewDeviceDefinitionCatalogService added in v1.6.5

func NewDeviceDefinitionCatalogService(settings *config.Settings, logger *zerolog.Logger) DeviceDefinitionCatalogService

type DrivlyAPIService added in v0.6.8

type DrivlyAPIService interface {
	GetVINInfo(vin string) (*coremodels.DrivlyVINResponse, []byte, error)
}

func NewDrivlyAPIService added in v0.6.8

func NewDrivlyAPIService(settings *config.Settings) DrivlyAPIService

type ElevaAPI added in v1.5.6

type ElevaAPI interface {
	GetVINInfo(vin string) (*coremodels.ElevaVINResponse, error)
}

func NewElevaAPI added in v1.5.6

func NewElevaAPI(settings *config.Settings) ElevaAPI

type ElevaConfig added in v1.5.6

type ElevaConfig struct {
	Username string
	Password string
}

type FuelAPIService added in v0.9.8

type FuelAPIService interface {
	FetchDeviceImages(mk, mdl string, yr int, prodID int, prodFormat int) (FuelDeviceImages, error)
}

func NewFuelAPIService added in v0.9.8

func NewFuelAPIService(settings *config.Settings, logger *zerolog.Logger) FuelAPIService

type FuelDeviceImages added in v0.9.8

type FuelDeviceImages struct {
	FuelAPIID string      `boil:"fuelID"`
	Width     int         `boil:"width"`
	Height    int         `boil:"height"`
	Angle     string      `boil:"angle"`
	Images    []FuelImage `boil:"images"`

	// use to track if we used a different year image and could not find this one
	NotExactImage bool
	// contains filtered or unexported fields
}

type FuelImage added in v0.9.8

type FuelImage struct {
	SourceURL string `boil:"sourceURL"`
	Color     string `boil:"color"`
}

type GraphQLRequest added in v1.2.75

type GraphQLRequest struct {
	Query string `json:"query"`
}

type IdentityAPI added in v1.2.75

type IdentityAPI interface {
	GetManufacturer(slug string) (*coremodels.Manufacturer, error)
	GetManufacturers() ([]coremodels.Manufacturer, error)
	GetDeviceDefinitionByID(id string) (*coremodels.DeviceDefinition, error)
}

func NewIdentityAPIService added in v1.2.75

func NewIdentityAPIService(logger *zerolog.Logger, settings *config.Settings) IdentityAPI

NewIdentityAPIService creates a new instance of IdentityAPI, initializing it with the provided logger, settings, and HTTP client. httpClient is used for testing really

type Japan17VINAPI added in v1.2.96

type Japan17VINAPI interface {
	GetVINInfo(vin string) (*coremodels.Japan17MMY, []byte, error)
}

func NewJapan17VINAPI added in v1.2.96

func NewJapan17VINAPI(logger *zerolog.Logger, settings *config.Settings) Japan17VINAPI

type VincarioAPIService added in v0.7.9

type VincarioAPIService interface {
	DecodeVIN(vin string) (*coremodels.VincarioInfoResponse, []byte, error)
}

func NewVincarioAPIService added in v0.7.9

func NewVincarioAPIService(settings *config.Settings, log *zerolog.Logger) VincarioAPIService

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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