Coder Social home page Coder Social logo

go-volvo's Introduction

Go-Volvo

A simple Go API client for Volvo's APIs

Very much work in progress. Hoping to create a small, simple API client for Go.

Getting Started

Get the Volvo Go API Client as a new module in your project:

go get github.com/jakeisonline/go-volvo

Import the package into your project:

import "github.com/jakeisonline/go-volvo/api"

Initialise a new API client:

client := api.NewClient("YourApiToken")
client.setAccessToken("YourAccessToken")

Now, make a call to an endpoint of your choice:

resp, err := client.Call("vehicles", "")
if err != nil {
  fmt.Print(err)
} else {
  body, err := io.ReadAll(resp.Body)
  if err != nil {
    fmt.Print(err)
  }
  defer resp.Body.Close()

  var response *api.VehiclesResponse
  api.UnmarshalAndCheck(body, &response)
  fmt.Println(response.Data)
}

Roadmap

  • Initiate auth code flow
  • Exchange auth code for access token
  • Auto refresh access token
  • Full API Support
    • Connected Vehicle API (in progress)
    • Energy API
    • Extended Vehicle API
    • Location API

Spec vs. Actual Responses

The official Volvo docs are great, and have been invaluable for this project. I have noted a few what appear to be errors in the documentation, however.

  • /connected-vehicle/v2/vehicles/{vin}/doors documents carLocked named object being returned, but actual object name is centralLock
  • /connected-vehicle/v2/vehicles/{vin}/statistics documents averageFuelConsumptionAutomatic and averageEnergyConsumptionAutomatic named objects, but these are seemingly never returned
  • /connected-vehicle/v2/vehicles/{vin}/vehicle documents interiorImageURL named object being returned, but actual object name is internalImageUrl
  • /connected-vehicle/v2/vehicles/{vin}/diagnostics documents serviceTrigger named object being returned, but this seemingly never returns. Additionally, washerFluidLevelWarning returns but is not documented
  • /connected-vehicle/v2/vehicles/{vin}/windows returns a sunroof objects, which is not documented

go-volvo's People

Contributors

jakeisonline avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.