Operations about electric vehicles
- GetBatteryCapacity - EV Battery Capacity
- GetBatteryLevel - EV Battery Level
- GetChargingLimit - EV Charging Limit
- GetChargingStatus - EV Charging Status
- SetChargingLimit - Set EV Charging Limit
- StartStopCharge - Start or stop charging an electric vehicle.
Description
Returns the total capacity of an electric vehicle's battery.
Permission
read_battery
Response body
Name | Type | Boolean |
---|---|---|
capacity | number | The total capacity of the vehicle's battery (in kilowatt-hours). |
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.GetBatteryCapacity(ctx, operations.GetBatteryCapacityRequest{
VehicleID: "unde",
})
if err != nil {
log.Fatal(err)
}
if res.BatteryCapacity != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetBatteryCapacityRequest | ✔️ | The request object to use for the request. |
*operations.GetBatteryCapacityResponse, error
Description
Retrieve EV battery level of a vehicle.
Permission
read_battery
Response body
Name | Type | Boolean |
---|---|---|
percentRemaining |
number | An EV battery’s state of charge (in percent). |
range |
number | The estimated remaining distance the vehicle can travel (in kilometers by default or in miles using the sc-unit-system. |
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.GetBatteryLevel(ctx, operations.GetBatteryLevelRequest{
VehicleID: "nulla",
})
if err != nil {
log.Fatal(err)
}
if res.BatteryLevel != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetBatteryLevelRequest | ✔️ | The request object to use for the request. |
*operations.GetBatteryLevelResponse, error
Description
Returns the current charge limit of an electric vehicle.
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.GetChargingLimit(ctx, operations.GetChargingLimitRequest{
VehicleID: "corrupti",
})
if err != nil {
log.Fatal(err)
}
if res.ChargeLimit != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetChargingLimitRequest | ✔️ | The request object to use for the request. |
*operations.GetChargingLimitResponse, error
Description
Returns the current charge status of an electric vehicle.
Permission
read_charge
Response body
Name | Type | Boolean |
---|---|---|
isPluggedIn |
boolean | Indicates whether a charging cable is currently plugged into the vehicle’s charge port. |
state |
string | Indicates whether the vehicle is currently charging. Options: CHARGING FULLY_CHARGED NOT_CHARGING |
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.GetChargingStatus(ctx, operations.GetChargingStatusRequest{
VehicleID: "illum",
})
if err != nil {
log.Fatal(err)
}
if res.ChargeStatus != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetChargingStatusRequest | ✔️ | The request object to use for the request. |
*operations.GetChargingStatusResponse, error
Description
Returns the current charge limit of an electric vehicle.
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.SetChargingLimit(ctx, operations.SetChargingLimitRequest{
ChargeLimit: &shared.ChargeLimit{
Limit: gosdkv2.Float32(1),
},
VehicleID: "vel",
})
if err != nil {
log.Fatal(err)
}
if res.SuccessResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SetChargingLimitRequest | ✔️ | The request object to use for the request. |
*operations.SetChargingLimitResponse, error
Description
Returns the current charge status of an electric vehicle.
Permission
read_charge
Response body
Name | Type | Boolean |
---|---|---|
isPluggedIn |
boolean | Indicates whether a charging cable is currently plugged into the vehicle’s charge port. |
state |
string | Indicates whether the vehicle is currently charging. Options: CHARGING FULLY_CHARGED NOT_CHARGING |
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Evs.StartStopCharge(ctx, operations.StartStopChargeRequest{
ChargeAction: &shared.ChargeAction{
Action: shared.ChargeActionActionStart.ToPointer(),
},
VehicleID: "error",
})
if err != nil {
log.Fatal(err)
}
if res.SuccessResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.StartStopChargeRequest | ✔️ | The request object to use for the request. |