A Go SDK and CLI tool for rFMS APIs.
- Full support for the rFMS 4.0.0 standard
- Backwards-compatibility with the rFMS 2.1.1 standard (JSON)
- Support for vendor-specific fields from Scania
$ go get github.com/way-platform/rfms-go@latestclient := 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
}
}The project is built using Mage, see magefile.go.
$ ./tools/mage buildFor all available build tasks, see:
$ ./tools/mage -lThe rfms CLI tool enables interaction with rFMS APIs from the command line.
go install github.com/way-platform/rfms-go/cmd/rfms@latest$ 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"
}This SDK is published under the MIT License.
Security researchers, see the Security Policy.
Be nice. For more info, see the Code of Conduct.
