A Go SDK and CLI tool for the Mapon API.
- Read APIs for most core entities (Units, Routes, Objects, Drivers, Unit Groups, Alerts)
- Read APIs for unit data (CAN, ignition, humidity, etc)
$ go get github.com/way-platform/mapon-goctx := context.Background()
// Create a Mapon API client.
client, err := mapon.NewClient(
ctx,
mapon.WithAPIKey(os.Getenv("MAPON_API_KEY")),
)
if err != nil {
panic(err)
}
// List vehicles in the account.
response, err := client.ListUnits(ctx, &mapon.ListUnitsRequest{})
if err != nil {
panic(err)
}
for _, unit := range response.Units {
fmt.Println(unit.GetUnitId())
}
// For all available methods, see the API documentation.The project is built using Mage, see tools/magefile.go and the tools/mage helper script.
$ ./tools/mage buildFor all available build tasks, see:
$ ./tools/mage -lThe mapon CLI tool enables interaction with the APIs from the command line.
$ mapon
Mapon API CLI
USAGE
mapon [command] [--flags]
UNITS
units [--flags] List units
UNIT DATA
can-periods <unit-id> [--flags] List CAN data for a period
can-point <unit-id> [--flags] Get CAN data at a specific time
debug-info <unit-id ...> Get unit debug info
digital-inputs <unit-id ...> [--flags] List digital input events
digital-inputs-extended <unit-id ...> [--flags] List extended digital input events
driving-time <unit-id> Get driving time extended
fields <unit-id> Get unit custom fields
history-point <unit-id> [--flags] Get historical data at a specific time
humidity <unit-id ...> [--flags] List humidity data
ibuttons <unit-id ...> [--flags] List iButton events
ignitions <unit-id ...> [--flags] List ignition events
temperatures <unit-id ...> [--flags] List temperature data
UNIT GROUPS
unit-groups list [--flags] List unit groups
unit-groups units [--flags] List units in a group
DRIVERS
drivers [--flags] List drivers
ROUTES
routes [--flags] List routes
OBJECTS
objects List objects
ALERTS
alerts [--flags] List alertsgo install github.com/way-platform/mapon-go/cmd/mapon@latestPrebuilt binaries for Linux, Windows, and Mac are available from the Releases.
This SDK is published under the MIT License.
Security researchers, see the Security Policy.
Be nice. For more info, see the Code of Conduct.