Skip to content

Latest commit

 

History

History
executable file
·
173 lines (118 loc) · 7.16 KB

README.md

File metadata and controls

executable file
·
173 lines (118 loc) · 7.16 KB

Smartcar Go SDK Build Status Release GoDoc

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

  • GetChargeTime - Retrieve charging completion time for a Cadillac.
  • GetVoltage - Retrieve charging voltmeter time for a Cadillac.
  • GetChargeTime - Retrieve charging completion time for a Chevrolet.
  • GetVoltage - Retrieve charging voltmeter time for a Chevrolet.
  • 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

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 !

SDK Created by Speakeasy