Skip to content

smartcar/go-sdk-v2

Repository files navigation

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"
	"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 := smartcar.New(
        smartcar.WithSecurity(shared.Security{
            BearerAuth: "",
        }),
    )
    vehicleID := "36ab27d0-fd9d-4455-823a-ce30af709ffc"

    ctx := context.Background()
    res, err := s.Vehicles.GetLocation(ctx, vehicleID)
    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.

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