common

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PowerTrainType = "powertrain_type"

	// VehicleMetadataKey is the default json key where we store vehicle metadata in device_definitions.metadata
	VehicleMetadataKey     = "vehicle_info"
	AftermarketMetadataKey = "aftermarket-device"
)
View Source
const (
	SmartCarVendor = "SmartCar"
	AutoPiVendor   = "AutoPi"
)
View Source
const (
	DefaultDeviceType     = "vehicle"
	DefautlAutoPiTemplate = "130" // dimo device client template
)

Variables

This section is empty.

Functions

func BuildDeviceDefinitionName added in v0.4.3

func BuildDeviceDefinitionName(year int16, mk string, model string) string

func BuildDeviceTypeAttributes added in v0.2.0

func BuildDeviceTypeAttributes(attributes []*coremodels.UpdateDeviceTypeAttribute, dt *repoModel.DeviceType) (null.JSON, error)

func BuildExternalIDs added in v1.0.38

func BuildExternalIDs(externalIDsJSON null.JSON) []*coremodels.ExternalID

func CheckTransactionStatus added in v1.2.95

func CheckTransactionStatus(txHash, apiKey string, useAmoy bool) (bool, error)

func Contains added in v0.1.4

func Contains(s []string, str string) bool

Contains returns true if string exist in slice

func ConvertDeviceTypeAttrsToDefinitionMetadata added in v1.2.95

func ConvertDeviceTypeAttrsToDefinitionMetadata(attributes []*coremodels.UpdateDeviceTypeAttribute) *coremodels.DeviceDefinitionMetadata

func ConvertMetadataToDeviceAttributes added in v1.2.95

func ConvertMetadataToDeviceAttributes(metadata *coremodels.DeviceDefinitionMetadata) []coremodels.DeviceTypeAttributeEditor

func DeviceDefinitionSlug added in v1.1.9

func DeviceDefinitionSlug(makeSlug, modelSlug string, year int16) string

func ExternalIDsToGRPC added in v1.0.38

func ExternalIDsToGRPC(externalIDs []*coremodels.ExternalID) []*grpc.ExternalID

func GetDefaultImageURL added in v0.7.4

func GetDefaultImageURL(images []*repoModel.Image) string

GetDefaultImageURL if the images relation is not empty, looks for the best image to use based on some logic

func GetDeviceAttributesTyped added in v0.8.8

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

func JSONOrDefault added in v0.1.2

func JSONOrDefault(j null.JSON) json.RawMessage

Types

type ErrorResponse

type ErrorResponse struct {
	Field string
	Tag   string
	Value string
}

type RegionEnum added in v0.1.6

type RegionEnum string
const (
	AmericasRegion RegionEnum = "Americas"
	EuropeRegion   RegionEnum = "Europe"
)

func (RegionEnum) String added in v0.1.6

func (r RegionEnum) String() string

type TxStatusResponse added in v1.2.95

type TxStatusResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Result  struct {
		Status string `json:"status"`
	} `json:"result"`
}

Jump to

Keyboard shortcuts

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