//native
type Enode = {
token: string
}
export async function main(auth: Enode, vehicleId: string, smartChargingPlanId: string) {
const url = new URL(
`https://enode-api.production.enode.io/vehicles/${vehicleId}/smart-charging-plans/${smartChargingPlanId}`
)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 581 days ago