Skip to content

way-platform/rfms-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rFMS Go

PkgGoDev GoReportCard CI

A Go SDK and CLI tool for rFMS APIs.

SDK

Features

Supported OEMs

Installing

$ go get github.com/way-platform/rfms-go@latest

Using

client := rfms.NewClient(
    rfms.WithScania(os.Getenv("SCANIA_CLIENT_ID"), os.Getenv("SCANIA_CLIENT_SECRET")),
)
lastVIN, moreDataAvailable := "", true
for moreDataAvailable {
    response, err := client.Vehicles(context.Background(), &rfms.VehiclesRequest{
        LastVIN: lastVIN,
    })
    if err != nil {
        panic(err)
    }
    for _, vehicle := range response.Vehicles {
        fmt.Println(vehicle.VIN)
    }
    moreDataAvailable = response.MoreDataAvailable
    if moreDataAvailable {
        lastVIN = response.Vehicles[len(response.Vehicles)-1].VIN
    }
}

Developing

Build project

The project is built using Mage, see magefile.go.

$ ./tools/mage build

For all available build tasks, see:

$ ./tools/mage -l

CLI tool

The rfms CLI tool enables interaction with rFMS APIs from the command line.

Installing

go install github.com/way-platform/rfms-go/cmd/rfms@latest

Using

$ rfms auth login scania --client-id $CLIENT_ID --client-secret $CLIENT_SECRET

Logged in to SCANIA.
$ rfms vehicles
{
  "authorizedPaths": [
    "/vehiclepositions",
    "/vehiclestatuses"
  ],
  "brand": "SCANIA",
  "customerVehicleName": "testingapp3",
  "type": "TRUCK",
  "vin": "YS2RKSTO01TT00068"
}
{
  "authorizedPaths": [
    "/vehiclepositions",
    "/vehiclestatuses"
  ],
  "brand": "SCANIA",
  "customerVehicleName": "Pins. Truck",
  "type": "TRUCK",
  "vin": "YS2R4X2000TT00396"
}

License

This SDK is published under the MIT License.

Security

Security researchers, see the Security Policy.

Code of Conduct

Be nice. For more info, see the Code of Conduct.