gateways

package
v1.2.67 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TablelandRequests = "Tableland_All_Request"
	TablelandFindByID = "Tableland_FindByID_Request"
	TablelandCreated  = "Tableland_Created_Request"
	TablelandUpdated  = "Tableland_Updated_Request"
	TablelandExists   = "Tableland_Exists_Request"
	TablelandErrors   = "Tableland_Error_Request"
)

Variables

This section is empty.

Functions

func BuildDeviceTypeAttributesTbland added in v1.2.45

func BuildDeviceTypeAttributesTbland(attributes []*grpc.DeviceTypeAttributeRequest) string

BuildDeviceTypeAttributesTbland converts a list of DeviceTypeAttributeRequest to a JSON string for the given device type ID. It works the same as BuildDeviceTypeAttributes but the metadatakey is always "device_attributes" and does no attribute name validation

func GetDefaultImageURL added in v1.1.7

func GetDefaultImageURL(dd models.DeviceDefinition) string

func NewKeyedTransactorWithChainID added in v1.1.1

func NewKeyedTransactorWithChainID(context context.Context, send sender.Sender, chainID *big.Int) (*bind.TransactOpts, error)

Types

type AutoIsoAPIService added in v1.0.32

type AutoIsoAPIService interface {
	GetVIN(vin string) (*AutoIsoVINResponse, error)
}

func NewAutoIsoAPIService added in v1.0.32

func NewAutoIsoAPIService(settings *config.Settings) AutoIsoAPIService

type AutoIsoVINResponse added in v1.0.32

type AutoIsoVINResponse struct {
	Version          string `json:"version"`
	Vin              string `json:"vin"`
	APIStatus        string `json:"apiStatus"`
	ResponseDate     string `json:"responseDate"`
	FunctionName     string `json:"functionName"`
	FunctionResponse struct {
		Data struct {
			API struct {
				CoreVersion     string `json:"core_version"`
				EndpointVersion int    `json:"endpoint_version"`
				JSONVersion     string `json:"json_version"`
				APIType         string `json:"api_type"`
				APICache        string `json:"api_cache"`
				DataPrecision   int    `json:"data_precision"`
				DataMatching    string `json:"data_matching"`
				LexLang         string `json:"lex_lang"`
			} `json:"api"`
			Analyze struct {
				VinOrginal struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"vin_orginal"`
				VinCorrected struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"vin_corrected"`
				VinYear struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"vin_year"`
				VinSerial struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"vin_serial"`
				Checkdigit struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"checkdigit"`
			} `json:"analyze"`
			Decoder struct {
				Make struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"make"`
				Model struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"model"`
				ModelYear struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"model_year"`
				Body struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"body"`
				FuelType struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"fuel_type"`
				VehicleType struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"vehicle_type"`
				Doors struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"doors"`
				EngineDisplCm3 struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_displ_cm3"`
				EngineDisplL struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_displ_l"`
				EnginePowerHp struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_power_hp"`
				EnginePowerKw struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_power_kw"`
				EngineConf struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_conf"`
				EngineType struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_type"`
				EngineVersion struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_version"`
				EngineHead struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_head"`
				EngineValves struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_valves"`
				EngineCylinders struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_cylinders"`
				EngineDisplCid struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_displ_cid"`
				EngineTurbo struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"engine_turbo"`
				DriveType struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"drive_type"`
				GearboxType struct {
					Desc  string `json:"desc"`
					Value string `json:"value"`
				} `json:"gearbox_type"`
				EmissionStd struct {
					Desc   string `json:"desc"`
					Value  string `json:"value"`
					Co2Gkm string `json:"co2_gkm"`
				} `json:"emission_std"`
			} `json:"decoder"`
		} `json:"data"`
	} `json:"functionResponse"`
	LicenseInfo struct {
		LicenseNumber         string `json:"licenseNumber"`
		ValidTo               string `json:"validTo"`
		RemainingCredits      int    `json:"remainingCredits"`
		RemainingMonthlyLimit int    `json:"remainingMonthlyLimit"`
		RemainingDailyLimit   int    `json:"remainingDailyLimit"`
	} `json:"licenseInfo"`
}

func (*AutoIsoVINResponse) GetStyle added in v1.0.32

func (v *AutoIsoVINResponse) GetStyle() string

GetStyle returns a standard style string built from the data we have

func (*AutoIsoVINResponse) GetSubModel added in v1.0.32

func (v *AutoIsoVINResponse) GetSubModel() string

GetSubModel returns the Body type, which we can use as the sub model.

type DATGroupAPIService added in v1.1.0

type DATGroupAPIService interface {
	GetVINv2(vin string, country string) (*DATGroupInfoResponse, error)
}

func NewDATGroupAPIService added in v1.1.0

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

type DATGroupEquipment added in v1.2.18

type DATGroupEquipment struct {
	DatEquipmentId          string `json:"datEquipmentId"`
	ManufacturerEquipmentId string `json:"manufacturerEquipmentId"`
	// if Vin Equipment, this comes from ShortName
	ManufacturerDescription string `json:"manufacturerDescription"`
	Description             string `json:"description"`
}

type DATGroupInfoResponse added in v1.2.18

type DATGroupInfoResponse struct {
	VIN              string `json:"vin"`
	DatECode         string `json:"datecode"`
	SalesDescription string `json:"salesDescription"`
	VehicleTypeName  string `json:"vehicleTypeName"`
	// make
	ManufacturerName string `json:"manufacturerName"`
	BaseModelName    string `json:"baseModelName"`
	SubModelName     string `json:"subModelName"`
	// this is the model name we want to use
	MainTypeGroupName string `json:"mainTypeGroupName"`
	VinAccuracy       int    `json:"vinAccuracy"`

	// when we're unable to get exact year
	YearLow  int `json:"yearLow"`
	YearHigh int `json:"yearHigh"`
	// we don't always get the exact year
	Year int `json:"year"`

	SeriesEquipment   []DATGroupEquipment `json:"seriesEquipment"`
	SpecialEquipment  []DATGroupEquipment `json:"specialEquipment"`
	DATECodeEquipment []DATGroupEquipment `json:"datECodeEquipment"`
	VINEquipment      []DATGroupEquipment `json:"vinEquipments"`
}

type DeviceDefinitionMetadata added in v1.2.43

type DeviceDefinitionMetadata struct {
	DeviceAttributes []DeviceTypeAttribute `json:"device_attributes"`
}

type DeviceDefinitionOnChainService added in v1.1.1

type DeviceDefinitionOnChainService interface {
	// GetDeviceDefinitionByID get DD from tableland by slug ID and specifying the manufacturer for the table to lookup in
	GetDeviceDefinitionByID(ctx context.Context, manufacturerID *big.Int, ID string) (*models.DeviceDefinition, error)
	// GetDefinitionByID get DD from tableland by slug ID, automatically figures out table by oem portion of slug
	GetDefinitionByID(ctx context.Context, ID string, reader *db.DB) (*DeviceDefinitionTablelandModel, error)
	GetDefinitionTableland(ctx context.Context, manufacturerID *big.Int, ID string) (*DeviceDefinitionTablelandModel, error)
	GetDeviceDefinitions(ctx context.Context, manufacturerID types.NullDecimal, ID string, model string, year int, pageIndex, pageSize int32) ([]*models.DeviceDefinition, error)
	Create(ctx context.Context, mk models.DeviceMake, dd models.DeviceDefinition) (*string, error)
	Update(ctx context.Context, manufacturerName string, input contracts.DeviceDefinitionUpdateInput) (*string, error)
}

func NewDeviceDefinitionOnChainService added in v1.1.1

func NewDeviceDefinitionOnChainService(settings *config.Settings, logger *zerolog.Logger, client *ethclient.Client, chainID *big.Int, sender sender.Sender) DeviceDefinitionOnChainService

type DeviceDefinitionTablelandModel added in v1.1.1

type DeviceDefinitionTablelandModel struct {
	ID         string                    `json:"id"`
	KSUID      string                    `json:"ksuid"`
	Model      string                    `json:"model"`
	Year       int                       `json:"year"`
	DeviceType string                    `json:"devicetype"`
	ImageURI   string                    `json:"imageuri"`
	Metadata   *DeviceDefinitionMetadata `json:"metadata"`
}

func (*DeviceDefinitionTablelandModel) UnmarshalJSON added in v1.2.43

func (d *DeviceDefinitionTablelandModel) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the unmarshaling of DeviceDefinitionTablelandModel to handle cases where metadata is an empty string.

type DeviceTypeAttribute added in v1.1.1

type DeviceTypeAttribute struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func GetDeviceAttributesTyped added in v1.1.1

func GetDeviceAttributesTyped(metadata null.JSON, key string) []DeviceTypeAttribute

type DrivlyAPIService added in v0.6.8

type DrivlyAPIService interface {
	GetVINInfo(vin string) (*DrivlyVINResponse, error)
}

func NewDrivlyAPIService added in v0.6.8

func NewDrivlyAPIService(settings *config.Settings) DrivlyAPIService

type DrivlyVINResponse added in v0.8.5

type DrivlyVINResponse struct {
	Vin                      string   `json:"vin"`
	WindowSticker            string   `json:"windowSticker"`
	Year                     string   `json:"year"`
	Make                     string   `json:"make"`
	Model                    string   `json:"model"`
	SubModel                 string   `json:"subModel"`
	Trim                     string   `json:"trim"`
	Generation               int      `json:"generation"`
	SubGeneration            int      `json:"subGeneration"`
	ManufacturerCode         string   `json:"manufacturerCode"`
	Body                     string   `json:"body"`
	Style                    string   `json:"style"`
	Type                     string   `json:"type"`
	Drive                    string   `json:"drive"`
	Transmission             string   `json:"transmission"`
	TransmissionDetails      string   `json:"transmissionDetails"`
	Engine                   string   `json:"engine"`
	EngineDetails            string   `json:"engineDetails"`
	Doors                    int      `json:"doors"`
	PaintColor               string   `json:"paintColor"`
	PaintName                string   `json:"paintName"`
	PaintCode                string   `json:"paintCode"`
	Interior                 string   `json:"interior"`
	Options                  []string `json:"options"`
	OptionCodes              string   `json:"optionCodes"`
	MsrpBase                 float64  `json:"msrpBase"`
	MsrpDiscount             float64  `json:"msrpDiscount"`
	MsrpOptions              float64  `json:"msrpOptions"`
	MsrpDelivery             float64  `json:"msrpDelivery"`
	Msrp                     float64  `json:"msrp"`
	WarrantyBasicMonths      int      `json:"warrantyBasicMonths"`
	WarrantyCorrosionMonths  int      `json:"warrantyCorrosionMonths"`
	WarrantyEmissionsMonths  int      `json:"warrantyEmissionsMonths"`
	WarrantyFullMonths       int      `json:"warrantyFullMonths"`
	WarrantyFullMiles        int      `json:"warrantyFullMiles"`
	WarrantyDrivetrainMonths int      `json:"warrantyDrivetrainMonths"`
	WarrantyPowertrainMonths int      `json:"warrantyPowertrainMonths"`
	WarrantyPowertrainMiles  int      `json:"warrantyPowertrainMiles"`
	WarrantyRoadsideMonths   int      `json:"warrantyRoadsideMonths"`
	WarrantyRoadsideMiles    int      `json:"warrantyRoadsideMiles"`
	Wheelbase                string   `json:"wheelbase"`
	Fuel                     string   `json:"fuel"`
	FuelTankCapacityGal      float64  `json:"fuelTankCapacityGal"`
	Mpg                      int      `json:"mpg"`
	MpgCity                  int      `json:"mpgCity"`
	MpgHighway               int      `json:"mpgHighway"`
	LastOdometer             int      `json:"lastOdometer"`
	LastOdometerDate         string   `json:"lastOdometerDate"`
	EstimatedOdometer        int      `json:"estimatedOdometer"`
	Salvage                  bool     `json:"salvage"`
	PreviousOwners           int      `json:"previousOwners"`
	TotalLoss                bool     `json:"totalLoss"`
	Branded                  bool     `json:"branded"`
	LastTitleState           string   `json:"lastTitleState"`
	TitleIssueDate           string   `json:"titleIssueDate"`
	TitleNumber              string   `json:"titleNumber"`
	Confidence               float64  `json:"confidence"`
	VehicleHistory           []string `json:"vehicleHistory"`
	InstalledEquipment       []string `json:"installedEquipment"`
	Dimensions               []string `json:"dimensions"`
}

func (*DrivlyVINResponse) GetExternalID added in v0.8.5

func (vir *DrivlyVINResponse) GetExternalID() string

GetExternalID builds something we can use as an external ID that is drivly specific, at the MMY level (not for style)

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 VincarioAPIService added in v0.7.9

type VincarioAPIService interface {
	DecodeVIN(vin string) (*VincarioInfoResponse, error)
}

func NewVincarioAPIService added in v0.7.9

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

type VincarioInfoResponse added in v0.7.9

type VincarioInfoResponse struct {
	VIN                      string   `key:"VIN"`
	VehicleID                int      `key:"Vehicle ID"`
	Make                     string   `key:"Make"`
	Model                    string   `key:"Model"`
	ModelYear                int      `key:"Model Year"`
	ProductType              string   `key:"Product Type"`
	Body                     string   `key:"Body"`
	Series                   string   `key:"Series"`
	Drive                    string   `key:"Drive"`
	EngineDisplacement       int      `key:"Engine Displacement (ccm)"`
	FuelType                 string   `key:"Fuel Type - Primary"`
	EngineCode               string   `key:"Engine Code"`
	Transmission             string   `key:"Transmission"`
	NumberOfGears            int      `key:"Number of Gears"`
	EmissionStandard         string   `key:"Emission Standard"`
	PlantCountry             string   `key:"Plant Country"`
	ProductionStopped        int      `key:"Production Stopped"`
	EngineManufacturer       string   `key:"Engine Manufacturer"`
	EngineType               string   `key:"Engine Type"`
	AverageCO2Emission       float64  `key:"Average CO2 Emission (g/km)"`
	NumberOfWheels           int      `key:"Number Wheels"`
	NumberOfAxles            int      `key:"Number of Axles"`
	NumberOfDoors            int      `key:"Number of Doors"`
	FrontBrakes              string   `key:"Front Brakes"`
	RearBrakes               string   `key:"Rear Brakes"`
	BrakeSystem              string   `key:"Brake System"`
	SteeringType             string   `key:"Steering Type"`
	WheelSize                string   `key:"Wheel Size"`
	WheelSizeArray           []string `key:"Wheel Size Array"`
	Wheelbase                int      `key:"Wheelbase (mm)"`
	WheelbaseArray           []int    `key:"Wheelbase Array (mm)"`
	Height                   int      `key:"Height (mm)"`
	Length                   int      `key:"Length (mm)"`
	Width                    int      `key:"Width (mm)"`
	RearOverhang             int      `key:"Rear Overhang (mm)"`
	FrontOverhang            int      `key:"Front Overhang (mm)"`
	TrackFront               int      `key:"Track Front (mm)"`
	TrackRear                int      `key:"Track Rear (mm)"`
	MaxSpeed                 int      `key:"Max Speed (km/h)"`
	WeightEmpty              int      `key:"Weight Empty (kg)"`
	MaxWeight                int      `key:"Max Weight (kg)"`
	MaxRoofLoad              int      `key:"Max roof load (kg)"`
	TrailerLoadWithoutBrakes int      `key:"Permitted trailer load without brakes (kg)"`
	CheckDigit               string   `key:"Check Digit"`
	SequentialNumber         string   `key:"Sequential Number"`
}

func (*VincarioInfoResponse) GetMetadata added in v1.0.0

func (v *VincarioInfoResponse) GetMetadata() (null.JSON, error)

GetMetadata returns a map of metadata for the vehicle, in standard format.

func (*VincarioInfoResponse) GetStyle added in v0.7.9

func (v *VincarioInfoResponse) GetStyle() string

GetStyle returns a standard style string built from the data we have

func (*VincarioInfoResponse) GetSubModel added in v0.7.9

func (v *VincarioInfoResponse) GetSubModel() string

GetSubModel returns the Body type from Vincario, which we can use as the sub model.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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