Skip to content

way-platform/rfms-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 mise, see mise.toml.

$ mise install && mise run build

For all available build tasks, see:

$ mise tasks

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.

About

Go SDK for rFMS APIs

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors