Skip to content

Vehicle

The Vehicle API provides access to vehicle profile and status.

Try it online

getCurrentVehicleProfilegetCurrentVehicleStatusLoad both

Use the buttons above to load data

Vehicle API demo

Load the current vehicle profile and real-time status; values are shown as key–value pairs (mock data)

Import

ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'

API reference

getCurrentVehicleProfile

Get profile information for the currently bound vehicle.

ts
const profile = await woo.getCurrentVehicleProfile()

Return value VehicleProfile:

FieldTypeDescription
vinstringVehicle identification number (VIN)
brandstringBrand
modelstringModel
yearnumberModel year
colorstringColor
licensePlatestringLicense plate number
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)

getCurrentVehicleStatus

Get real-time status for the current vehicle.

ts
const status = await woo.getCurrentVehicleStatus()

Return value VehicleStatus:

FieldTypeDescription
mileagenumberTotal mileage (km)
fuelLevelnumberFuel level (percent)
batteryLevelnumberBattery state of charge (percent)
isLockedbooleanWhether the vehicle is locked
location{ lat: number, lng: number }Vehicle position
ts
const status = await woo.getCurrentVehicleStatus()

if (status.fuelLevel < 20) {
  woo.showToast({ title: '油量不足,请及时加油', icon: 'none' })
}

Quick reference

MethodDescriptionSignature
getVehicleInfoGet basic vehicle information() → Promise<VehicleInfo>
getVehicleStatusGet real-time vehicle status() → Promise<VehicleStatus>
onVehicleStatusChangeListen for vehicle status changes(callback) → void

MiniDev Studio — Mini-app Development Toolkit