- GetChargeTime - Retrieve charging completion time for a Cadillac.
- GetVoltage - Retrieve charging voltmeter time for a Cadillac.
Description
When the vehicle is charging, this endpoint returns the date and time the vehicle expects to complete this charging session. When the vehicle is not charging, this endpoint results in a vehicle state error.
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.Cadillac.GetChargeTime(ctx, operations.GetCadillacChargeTimeRequest{
VehicleID: "corrupti",
})
if err != nil {
log.Fatal(err)
}
if res.ChargeTime != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetCadillacChargeTimeRequest | ✔️ | The request object to use for the request. |
*operations.GetCadillacChargeTimeResponse, error
Description
When the vehicle is plugged in, this endpoint returns the voltage of the charger measured by the vehicle. When the vehicle is not plugged in, this endpoint results in a vehicle state error.
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.Cadillac.GetVoltage(ctx, operations.GetCadillacVoltageRequest{
VehicleID: "provident",
})
if err != nil {
log.Fatal(err)
}
if res.ChargeVoltage != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetCadillacVoltageRequest | ✔️ | The request object to use for the request. |