package teslainventory_sdk import "time" // modelEnum. type modelEnum string //nolint:exported // keeping the enum simple and readable. const ( MODEL_3 modelEnum = "m3" MODEL_Y modelEnum = "my" MODEL_S modelEnum = "ms" MODEL_X modelEnum = "mx" ) // conditionEnum. type conditionEnum string //nolint:exported // keeping the enum simple and readable. const ( CONDITION_NEW conditionEnum = "new" CONDITION_USED conditionEnum = "used" ) // arrangeByEnum allow to order availabilities by a specific element. type arrangeByEnum string //nolint:exported // keeping the enum simple and readable. const ( ARRANGE_BY_PRICE arrangeByEnum = "Price" ARRANGE_BY_ODOMETER arrangeByEnum = "Odometer" ARRANGE_BY_YEAR arrangeByEnum = "Year" ARRANGE_BY_DISTANCE arrangeByEnum = "Distance" ) // orderByEnum. type orderByEnum string //nolint:exported // keeping the enum simple and readable. const ( ORDER_BY_ASC orderByEnum = "asc" ORDER_BY_DESC orderByEnum = "desc" ) /** / OPTIONS ENUM **/ // autopilotEnum. type autopilotEnum string //nolint:exported // keeping the enum simple and readable. const ( AUTOPILOT_AP autopilotEnum = "AUTOPILOT" AUTOPILOT_ENHANCED autopilotEnum = "ENHANCED_AUTOPILOT" AUTOPILOT_FSD autopilotEnum = "AUTOPILOT_FULL_SELF_DRIVING" AUTOPILOT_ORIGINAL autopilotEnum = "AUTOPILOT_ORIGINAL" ) // cabinConfigEnum. type cabinConfigEnum string //nolint:exported // keeping the enum simple and readable. const ( CABIN_CONFIG_FIVE cabinConfigEnum = "FIVE" CABIN_CONFIG_SIX cabinConfigEnum = "SIX" CABIN_CONFIG_SEVEN cabinConfigEnum = "SEVEN" ) // interiorEnum. type interiorEnum string //nolint:exported // keeping the enum simple and readable. const ( INTERIOR_CREAM interiorEnum = "CREAM" INTERIOR_WHITE interiorEnum = "WHITE" INTERIOR_BLACK interiorEnum = "BLACK" ) // paintEnum. type paintEnum string //nolint:exported // keeping the enum simple and readable. const ( PAINT_RED paintEnum = "RED" PAINT_WHITE paintEnum = "WHITE" PAINT_BLACK paintEnum = "BLACK" PAINT_GREY paintEnum = "GREY" PAINT_BLUE paintEnum = "BLUE" PAINT_SILVER paintEnum = "SILVER" ) // steeringWheelEnum. type steeringWheelEnum string //nolint:exported // keeping the enum simple and readable. const ( STEERING_WHEEL_YOKE steeringWheelEnum = "STEERING_YOKE" STEERING_WHEEL_ROUND steeringWheelEnum = "STEERING_ROUND" ) // trimEnum. type trimEnum string //nolint:exported // keeping the enum simple and readable. const ( TRIM_MS_AWD trimEnum = "MSAWD" TRIM_MS_PLAID trimEnum = "MSPLAID" TRIM_M3_RWD trimEnum = "M3RWD" TRIM_LR_AWD trimEnum = "LRAWD" TRIM_PERF_AWD trimEnum = "PAWD" TRIM_MX_PLAID trimEnum = "MXPLAID" TRIM_MX_PERF trimEnum = "MXPERF" TRIM_MX_AWD trimEnum = "MXAWD" TRIM_MX_90D trimEnum = "90D" TRIM_MY_RWD trimEnum = "MYRWD" ) // wheelsEnum. type wheelsEnum string //nolint:exported // keeping the enum simple and readable. const ( WHEELS_18 wheelsEnum = "EIGHTEEN" WHEELS_19 wheelsEnum = "NINETEEN" WHEELS_20 wheelsEnum = "TWENTY" WHEELS_21 wheelsEnum = "TWENTY_ONE" WHEELS_22 wheelsEnum = "TWENTY_TWO" ) // AvailabilityParams is the params accepted by the API. type AvailabilityParams struct { Query AvailabilityQueryParams `json:"query"` Offset *int `json:"offset,omitempty"` Count *int `json:"count,omitempty"` OutsideOffset *int `json:"outsideOffset,omitempty"` OutsideSearch *bool `json:"outsideSearch,omitempty"` } // AvailabilityQueryParams are the params to filter results. type AvailabilityQueryParams struct { Arrangeby *arrangeByEnum `json:"arrangeby,omitempty"` Condition *conditionEnum `json:"condition,omitempty"` Language *string `json:"language,omitempty"` Lat *float64 `json:"lat,omitempty"` Lng *float64 `json:"lng,omitempty"` Market *string `json:"market,omitempty"` Model *modelEnum `json:"model,omitempty"` Options *OptionsParams `json:"options,omitempty"` Order *orderByEnum `json:"order,omitempty"` Range *int `json:"range,omitempty"` Region *string `json:"region,omitempty"` SuperRegion *string `json:"super_region,omitempty"` Zip *string `json:"zip,omitempty"` } // OptionsParams contain the car option. type OptionsParams struct { AdditionalOptions []string `json:"ADL_OPTS,omitempty"` Autopilot []autopilotEnum `json:"AUTOPILOT,omitempty"` CabinConfig []cabinConfigEnum `json:"CABIN_CONFIG,omitempty"` Interior []interiorEnum `json:"INTERIOR,omitempty"` Paint []paintEnum `json:"PAINT,omitempty"` SteeringWheel []steeringWheelEnum `json:"STEERING_WHEEL,omitempty"` Trim []trimEnum `json:"TRIM,omitempty"` Wheels []wheelsEnum `json:"WHEELS,omitempty"` Year []string `json:"Year,omitempty"` } /** / Response. **/ // Availability represent a available car with its characteristics. type Availability struct { InTransit bool `json:"InTransit,omitempty"` AdlOpts any `json:"ADL_OPTS,omitempty"` Autopilot []string `json:"AUTOPILOT,omitempty"` AcquisitionSubType any `json:"AcquisitionSubType,omitempty"` AcquisitionType any `json:"AcquisitionType,omitempty"` ActualGAInDate string `json:"ActualGAInDate,omitempty"` Battery any `json:"BATTERY,omitempty"` CabinConfig []string `json:"CABIN_CONFIG,omitempty"` CPORefurbishmentStatus any `json:"CPORefurbishmentStatus,omitempty"` City string `json:"City,omitempty"` CompositorViews struct { FrontView string `json:"frontView,omitempty"` SideView string `json:"sideView,omitempty"` InteriorView string `json:"interiorView,omitempty"` } `json:"CompositorViews,omitempty"` CountryCode string `json:"CountryCode,omitempty"` CountryCodes []string `json:"CountryCodes,omitempty"` CountryHasVehicleAtLocation bool `json:"CountryHasVehicleAtLocation,omitempty"` CountryOfOrigin string `json:"CountryOfOrigin,omitempty"` CurrencyCode string `json:"CurrencyCode,omitempty"` CurrencyCodes string `json:"CurrencyCodes,omitempty"` Decor any `json:"DECOR,omitempty"` Drive []string `json:"DRIVE,omitempty"` DamageDisclosureStatus any `json:"DamageDisclosureStatus,omitempty"` DestinationHandlingFee int `json:"DestinationHandlingFee,omitempty"` Discount int `json:"Discount,omitempty"` DisplayWarranty bool `json:"DisplayWarranty,omitempty"` EtaToCurrent string `json:"EtaToCurrent,omitempty"` FactoryCode string `json:"FactoryCode,omitempty"` FactoryDepartureDate string `json:"FactoryDepartureDate,omitempty"` FixedAssets bool `json:"FixedAssets,omitempty"` FlexibleOptionsData []struct { Code string `json:"code,omitempty"` Description string `json:"description,omitempty"` Group string `json:"group,omitempty"` LongName string `json:"long_name,omitempty"` Name string `json:"name,omitempty"` Price int `json:"price,omitempty"` } `json:"FlexibleOptionsData,omitempty"` ForecastedFactoryGatedDate any `json:"ForecastedFactoryGatedDate,omitempty"` Headliner any `json:"HEADLINER,omitempty"` HasDamagePhotos bool `json:"HasDamagePhotos,omitempty"` HasOptionCodeData bool `json:"HasOptionCodeData,omitempty"` Hash string `json:"Hash,omitempty"` Interior []string `json:"INTERIOR,omitempty"` IncentivesDetails struct { Current struct { Fuel struct { Data []struct { Algorithm bool `json:"algorithm,omitempty"` Amount any `json:"amount,omitempty"` Description string `json:"description,omitempty"` IncentiveType string `json:"incentiveType,omitempty"` Market string `json:"market,omitempty"` Period string `json:"period,omitempty"` Variables struct { Distance any `json:"distance,omitempty"` FuelEfficiencyImperial any `json:"fuel_efficiency_imperial,omitempty"` FuelEfficiencyMetric float64 `json:"fuel_efficiency_metric,omitempty"` FuelPrice float64 `json:"fuel_price,omitempty"` KwhConsumption float64 `json:"kwh_consumption,omitempty"` KwhPrice float64 `json:"kwh_price,omitempty"` Months int `json:"months,omitempty"` TollSavings int `json:"toll_savings,omitempty"` } `json:"variables,omitempty"` Variant string `json:"variant,omitempty"` } `json:"data,omitempty"` Total int `json:"total,omitempty"` } `json:"fuel,omitempty"` } `json:"current,omitempty"` Total struct { Fuel any `json:"fuel,omitempty"` IncludedInPurchasePrice int `json:"includedInPurchasePrice,omitempty"` Monthly int `json:"monthly,omitempty"` Once int `json:"once,omitempty"` } `json:"total,omitempty"` } `json:"IncentivesDetails,omitempty"` InspectionDocumentGUID any `json:"InspectionDocumentGuid,omitempty"` InventoryPrice int `json:"InventoryPrice,omitempty"` IsAtLocation bool `json:"IsAtLocation,omitempty"` IsChargingConnectorIncluded bool `json:"IsChargingConnectorIncluded,omitempty"` IsDemo bool `json:"IsDemo,omitempty"` IsFactoryGated bool `json:"IsFactoryGated,omitempty"` IsInTransit bool `json:"IsInTransit,omitempty"` IsLegacy bool `json:"IsLegacy,omitempty"` IsPreProdWithDisclaimer bool `json:"IsPreProdWithDisclaimer,omitempty"` IsTegra bool `json:"IsTegra,omitempty"` Language string `json:"Language,omitempty"` Languages []string `json:"Languages,omitempty"` LexiconDefaultOptions []struct { Code string `json:"code,omitempty"` Description string `json:"description,omitempty"` Group string `json:"group,omitempty"` LongName string `json:"long_name,omitempty"` Name string `json:"name,omitempty"` } `json:"LexiconDefaultOptions,omitempty"` ListingType string `json:"ListingType,omitempty"` ListingTypes string `json:"ListingTypes,omitempty"` MarketingInUseDate any `json:"MarketingInUseDate,omitempty"` Model string `json:"Model,omitempty"` Odometer int `json:"Odometer,omitempty"` OdometerType string `json:"OdometerType,omitempty"` OnConfiguratorPricePercentage int `json:"OnConfiguratorPricePercentage,omitempty"` OptionCodeData []struct { AccelerationUnitLong string `json:"acceleration_unit_long,omitempty"` AccelerationUnitShort string `json:"acceleration_unit_short,omitempty"` AccelerationValue string `json:"acceleration_value,omitempty"` Code string `json:"code,omitempty"` Group string `json:"group,omitempty"` Price int `json:"price,omitempty"` UnitLong string `json:"unit_long,omitempty"` UnitShort string `json:"unit_short,omitempty"` Value string `json:"value,omitempty"` TopSpeedLabel string `json:"top_speed_label,omitempty"` RangeLabelSource string `json:"range_label_source,omitempty"` RangeSource string `json:"range_source,omitempty"` RangeSourceInventoryNew string `json:"range_source_inventory_new,omitempty"` Description string `json:"description,omitempty"` LongName string `json:"long_name,omitempty"` Name string `json:"name,omitempty"` } `json:"OptionCodeData,omitempty"` OptionCodeList string `json:"OptionCodeList,omitempty"` OptionCodeListDisplayOnly any `json:"OptionCodeListDisplayOnly,omitempty"` OptionCodePricing []struct { Code string `json:"code,omitempty"` Group string `json:"group,omitempty"` Price int `json:"price,omitempty"` } `json:"OptionCodePricing,omitempty"` OrderFee struct { Type string `json:"type,omitempty"` Value int `json:"value,omitempty"` } `json:"OrderFee,omitempty"` OriginalDeliveryDate any `json:"OriginalDeliveryDate,omitempty"` OriginalInCustomerGarageDate any `json:"OriginalInCustomerGarageDate,omitempty"` Paint []string `json:"PAINT,omitempty"` PlannedGADailyDate string `json:"PlannedGADailyDate,omitempty"` Price int64 `json:"Price,omitempty"` PurchasePrice int `json:"PurchasePrice,omitempty"` Roof any `json:"ROOF,omitempty"` RegistrationCount int `json:"RegistrationCount,omitempty"` SteeringWheel any `json:"STEERING_WHEEL,omitempty"` SalesMetro string `json:"SalesMetro,omitempty"` StateProvince string `json:"StateProvince,omitempty"` StateProvinceLongName string `json:"StateProvinceLongName,omitempty"` Trim []string `json:"TRIM,omitempty"` TaxScheme any `json:"TaxScheme,omitempty"` ThirdPartyHistoryURL any `json:"ThirdPartyHistoryUrl,omitempty"` TitleStatus string `json:"TitleStatus,omitempty"` TitleSubtype []string `json:"TitleSubtype,omitempty"` TotalPrice int `json:"TotalPrice,omitempty"` TradeInType any `json:"TradeInType,omitempty"` TransportFees struct { ExemptVRL []any `json:"exemptVRL,omitempty"` Fees []any `json:"fees,omitempty"` MetroFees []any `json:"metro_fees,omitempty"` UnfundedLocationFees []any `json:"unfunded_location_fees,omitempty"` } `json:"TransportFees,omitempty"` TrimCode string `json:"TrimCode,omitempty"` TrimName string `json:"TrimName,omitempty"` Trt int `json:"Trt,omitempty"` TrtName string `json:"TrtName,omitempty"` Vin string `json:"VIN,omitempty"` VehicleHistory any `json:"VehicleHistory,omitempty"` VehicleRegion string `json:"VehicleRegion,omitempty"` VrlName string `json:"VrlName,omitempty"` Wheels []string `json:"WHEELS,omitempty"` WarrantyBatteryExpDate time.Time `json:"WarrantyBatteryExpDate,omitempty"` WarrantyBatteryIsExpired bool `json:"WarrantyBatteryIsExpired,omitempty"` WarrantyBatteryMile int `json:"WarrantyBatteryMile,omitempty"` WarrantyBatteryYear int `json:"WarrantyBatteryYear,omitempty"` WarrantyData struct { UsedVehicleLimitedWarrantyMile int `json:"UsedVehicleLimitedWarrantyMile,omitempty"` UsedVehicleLimitedWarrantyYear int `json:"UsedVehicleLimitedWarrantyYear,omitempty"` WarrantyBatteryExpDate time.Time `json:"WarrantyBatteryExpDate,omitempty"` WarrantyBatteryIsExpired bool `json:"WarrantyBatteryIsExpired,omitempty"` WarrantyBatteryMile int `json:"WarrantyBatteryMile,omitempty"` WarrantyBatteryYear int `json:"WarrantyBatteryYear,omitempty"` WarrantyDriveUnitExpDate time.Time `json:"WarrantyDriveUnitExpDate,omitempty"` WarrantyDriveUnitMile int `json:"WarrantyDriveUnitMile,omitempty"` WarrantyDriveUnitYear int `json:"WarrantyDriveUnitYear,omitempty"` WarrantyMile int `json:"WarrantyMile,omitempty"` WarrantyVehicleExpDate time.Time `json:"WarrantyVehicleExpDate,omitempty"` WarrantyVehicleIsExpired bool `json:"WarrantyVehicleIsExpired,omitempty"` WarrantyYear int `json:"WarrantyYear,omitempty"` } `json:"WarrantyData,omitempty"` WarrantyDriveUnitExpDate time.Time `json:"WarrantyDriveUnitExpDate,omitempty"` WarrantyDriveUnitMile int `json:"WarrantyDriveUnitMile,omitempty"` WarrantyDriveUnitYear int `json:"WarrantyDriveUnitYear,omitempty"` WarrantyMile int `json:"WarrantyMile,omitempty"` WarrantyVehicleExpDate time.Time `json:"WarrantyVehicleExpDate,omitempty"` WarrantyVehicleIsExpired bool `json:"WarrantyVehicleIsExpired,omitempty"` WarrantyYear int `json:"WarrantyYear,omitempty"` Year int `json:"Year,omitempty"` AlternateCurrency []any `json:"AlternateCurrency,omitempty"` UsedVehicleLimitedWarrantyMile int `json:"UsedVehicleLimitedWarrantyMile,omitempty"` UsedVehicleLimitedWarrantyYear int `json:"UsedVehicleLimitedWarrantyYear,omitempty"` OdometerTypeShort string `json:"OdometerTypeShort,omitempty"` DeliveryDateDisplay bool `json:"DeliveryDateDisplay,omitempty"` TransportationFee int `json:"TransportationFee,omitempty"` VrlList []struct { Vrl int `json:"vrl,omitempty"` Lat int `json:"lat,omitempty"` Lon int `json:"lon,omitempty"` VrlLocks []any `json:"vrlLocks,omitempty"` } `json:"vrlList,omitempty"` OptionCodeSpecs struct { CSpecs struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` Options []struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` LongName string `json:"long_name,omitempty"` Description string `json:"description,omitempty"` } `json:"options,omitempty"` } `json:"C_SPECS,omitempty"` CDesign struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` Options []any `json:"options,omitempty"` } `json:"C_DESIGN,omitempty"` CCallouts struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` Options []struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` LongName string `json:"long_name,omitempty"` Description string `json:"description,omitempty"` Group string `json:"group,omitempty"` List []string `json:"list,omitempty"` Period string `json:"period,omitempty"` } `json:"options,omitempty"` } `json:"C_CALLOUTS,omitempty"` COpts struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` Options []struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` LongName string `json:"long_name,omitempty"` Description string `json:"description,omitempty"` } `json:"options,omitempty"` } `json:"C_OPTS,omitempty"` } `json:"OptionCodeSpecs,omitempty"` CompositorViewsCustom struct { IsProductWithCustomViews bool `json:"isProductWithCustomViews,omitempty"` ExternalZoom struct { Order int `json:"order,omitempty"` Search int `json:"search,omitempty"` } `json:"externalZoom,omitempty"` ExternalCrop struct { Order string `json:"order,omitempty"` Search string `json:"search,omitempty"` } `json:"externalCrop,omitempty"` } `json:"CompositorViewsCustom,omitempty"` IsRangeStandard bool `json:"IsRangeStandard,omitempty"` MetroName string `json:"MetroName,omitempty"` GeoPoints [][]any `json:"geoPoints,omitempty"` HasMarketingOptions bool `json:"HasMarketingOptions,omitempty"` InTransitMetroName string `json:"InTransitMetroName,omitempty"` InTransitSalesMetro string `json:"InTransitSalesMetro,omitempty"` FirstRegistrationDate any `json:"FirstRegistrationDate,omitempty"` } /** * Tesla inventory API have to kind of response by on the result. * Either you have a exact response (most of the case) * Either you have a multiple availability based on the level of match with your filters * * I have decided to use the 2nd format in the inventory SDK as it can handle both cases **/ // AvailabilitiesExactResponse contain the a list of car availability. type AvailabilitiesExactResponse struct { Results []Availability `json:"results"` TotalMatchesFound string `json:"total_matches_found"` } // AvailabilitiesResponse contain the a list of car availability. type AvailabilitiesResponse struct { Results struct { Approximate []Availability `json:"approximate"` ApproximateOutside []Availability `json:"approximateOutside"` Exact []Availability `json:"exact"` } `json:"results"` TotalMatchesFound int `json:"total_matches_found"` }