# README
Smartcar Go SDK

Overview
The Smartcar API lets you read vehicle data (location, odometer, fuel, etc.) and send commands to vehicles (lock, unlock) using HTTP requests.
SDK Installation
go get github.com/smartcar/go-sdk-v2
SDK Example Usage
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.Vehicles.GetLocation(ctx, operations.GetLocationRequest{
VehicleID: "36ab27d0-fd9d-4455-823a-ce30af709ffc",
})
if err != nil {
log.Fatal(err)
}
if res.Location != nil {
// handle response
}
}
Available Resources and Operations
Cadillac
- GetChargeTime - Retrieve charging completion time for a Cadillac.
- GetVoltage - Retrieve charging voltmeter time for a Cadillac.
Chevrolet
- GetChargeTime - Retrieve charging completion time for a Chevrolet.
- GetVoltage - Retrieve charging voltmeter time for a Chevrolet.
Compatibility
- ListCompatibility - Compatibility
Evs
- 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.
Tesla
- GetAmmeter - Retrieve charging ammeter time for a Tesla.
- GetChargeTime - Retrieve charging completion time for a Tesla.
- GetCompass - Retrieve compass heading for a Tesla.
- GetExteriorTemperature - Retrieve exterior temperature for a Tesla.
- GetInteriorTemperature - Retrieve interior temperature for a Tesla.
- GetSpeedometer - Retrieve speed for a Tesla.
- GetVoltage - Retrieve charging voltmeter time for a Tesla.
- GetWattmeter - Retrieve charging wattmeter time for a Tesla.
- SetAmmeter - Set charging ammeter time for a Tesla.
User
- GetInfo - User Info
VehicleManagement
- DeleteManagementVehicleConnections - Delete vehicle connections by user_id or vehicle_id
- GetManagementVehicleConnections - Retrieve vehicle connections
Vehicles
- Batch - Batch
- LockStatus - Returns the lock status for a vehicle and the open status of its doors, windows, storage units, sunroof and charging port where available. The open status array(s) will be empty if a vehicle has partial support. The request will error if lock status can not be retrieved from the vehicle or the brand is not supported.
- Disconnect - Revoke Access
- Get - Vehicle Info
- GetEngineOil - Engine Oil Life
- GetFuelTank - Fuel Tank (US Only)
- GetLocation - Location
- GetOdometer - Odometer
- GetPermissions - Application Permissions
- GetTirePressure - Tire Pressure
- GetVin - Returns the vehicle’s manufacturer identifier.
- ListVehicles - All Vehicles
- LockUnlock - Lock/Unlock Vehicle
Webhooks
- Subscribe - Subscribe Webhook
- Unsubscribe - Unsubscribe Webhook
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is nil
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !