Documentation
¶
Index ¶
Constants ¶
const (
SmartCarVendor = "SmartCar"
)
Variables ¶
This section is empty.
Functions ¶
func ParseSmartCarYears ¶
ParseSmartCarYears parses out the years format in the smartcar document and returns an array of years
Types ¶
type CreateDocsResp ¶
type DeviceDefinitionSearchDoc ¶
type DeviceDefinitionSearchDoc struct {
ID string `json:"id"`
// SearchDisplay M+M+Y
SearchDisplay string `json:"search_display"`
Make string `json:"make"`
Model string `json:"model"`
Year int `json:"year"`
// SubModels: M+M+Y+Submodel name
SubModels []string `json:"sub_models"`
ImageURL string `json:"image_url"`
}
DeviceDefinitionSearchDoc used for elastic search document indexing. entirely for searching, source of truth is DB. elastic only supports lowercase letters, number and underscores, ie. snake_case
type ElasticSearchService ¶
type ElasticSearchService interface {
LoadDeviceDefinitions() error
GetEngines() (*GetEnginesResp, error)
CreateEngine(name string, metaSource *string) (*EngineDetail, error)
AddSourceEngineToMetaEngine(sourceName, metaName string) (*EngineDetail, error)
RemoveSourceEngine(sourceName, metaName string) (*EngineDetail, error)
DeleteEngine(name string) error
CreateDocuments(docs []DeviceDefinitionSearchDoc, engineName string) ([]CreateDocsResp, error)
CreateDocumentsBatched(docs []DeviceDefinitionSearchDoc, engineName string) error
UpdateSearchSettingsForDeviceDefs(engineName string) error
GetMetaEngineName() string
}
func NewElasticSearchService ¶
type EngineDetail ¶
type EngineDetail struct {
Name string `json:"name"`
Language *string `json:"language,omitempty"`
Type *string `json:"type,omitempty"`
DocumentCount *int `json:"document_count,omitempty"`
SourceEngines []string `json:"source_engines,omitempty"`
}
EngineDetail can be used as a response when listing engines, or to create an engine. The minimum parameters are Name. Type and Source can be used when dealing with Meta Engines: https://www.elastic.co/guide/en/app-search/current/meta-engines.html
type GetEnginesResp ¶
type GetEnginesResp struct {
Meta struct {
Page struct {
Current int `json:"current"`
TotalPages int `json:"total_pages"`
TotalResults int `json:"total_results"`
Size int `json:"size"`
} `json:"page"`
} `json:"meta"`
Results []EngineDetail `json:"results"`
}
type IntegrationCapabilities ¶
type IntegrationCapabilities struct {
Location bool `json:"location"`
Odometer bool `json:"odometer"`
LockUnlock bool `json:"lock_unlock"`
EVBattery bool `json:"ev_battery"`
EVChargingStatus bool `json:"ev_charging_status"`
EVStartStopCharge bool `json:"ev_start_stop_charge"`
FuelTank bool `json:"fuel_tank"`
TirePressure bool `json:"tire_pressure"`
EngineOilLife bool `json:"engine_oil_life"`
VehicleAttributes bool `json:"vehicle_attributes"`
VIN bool `json:"vin"`
}
IntegrationCapabilities gets stored on the association table btw a device_definition and the integrations, device_integrations
type SmartCarCompatibilityData ¶
type SmartCarCompatibilityData struct {
ComponentChunkName string `json:"componentChunkName"`
Path string `json:"path"`
Result struct {
Data struct {
AllMakesTable struct {
Edges []struct {
Node struct {
CompatibilityData map[string][]struct {
Name string `json:"name"`
Headers []struct {
Text string `json:"text"`
Tooltip *string `json:"tooltip"`
} `json:"headers"`
Rows [][]struct {
Color *string `json:"color"`
Subtext *string `json:"subtext"`
Text *string `json:"text"`
Type *string `json:"type"`
VehicleType *string `json:"vehicleType"`
} `json:"rows"`
} `json:"compatibilityData"`
} `json:"node"`
} `json:"edges"`
} `json:"allMakesTable"`
} `json:"data"`
} `json:"result"`
}
type SmartCarService ¶
type SmartCarService interface {
GetOrCreateSmartCarIntegration(ctx context.Context) (string, error)
GetSmartCarVehicleData() (*SmartCarCompatibilityData, error)
}
func NewSmartCarService ¶
func NewSmartCarService(dbs func() *db.ReaderWriter, logger zerolog.Logger) SmartCarService