Ondotori Web Storage API client
(T&D WebStorage Service API client)
go get -u github.com/k28/go-ondotori
package main
import (
"context"
"fmt"
"github.com/k28/go-ondotori"
)
func main() {
client, err := ondotori.New("API Token here", "rbxx1234", "password")
if err != nil {
fmt.Println(err.Error())
return
}
cp := ondotori.GetCurrentParam{
RemoteSerial: []string{},
BaseSerial: []string{},
}
res, err := client.GetCurrent(cp, context.TODO())
if err != nil {
fmt.Println(err.Error())
return
}
fmt.Println("response ", res.DeviceList)
} client, err := ondotori.New("API Token here", "rbxx1234", "password")
if err != nil {
fmt.Println(err.Error())
return
}
cp := ondotori.GetLatestDataParam{
RemoteSerial: "Device Serial here",
}
res, err := client.GetLatestData(cp, context.TODO())
if err != nil {
fmt.Println(err.Error())
return
}
// res will be DeviceData
fmt.Println("response ", res) client, err := ondotori.New("API Token here", "rbxx1234", "password")
if err != nil {
fmt.Println(err.Error())
return
}
cp := ondotori.GetDataParam{
RemoteSerial: "Device Serial here",
}
res, err := client.GetData(cp, context.TODO())
if err != nil {
fmt.Println(err.Error())
return
}
// res will be DeviceData
fmt.Println("response ", res) cp := ondotori.GetLatestDataRTR500Param{
RemoteSerial: "remote unit serial here",
BaseSerial: "base unit serial here",
}
res, err := client.GetLatestDataRTR500(cp, context.TODO())
if err != nil {
fmt.Println(err.Error())
return
}
// res will be DeviceDataRTR500, see device_data.go
fmt.Println("response ", res) cp := ondotori.GetDataRTR500Param{
RemoteSerial: "remote unit serial here",
BaseSerial: "base unit serial here",
From: &from,
To: &now,
Number: &limit,
}
res, err := client.GetDataRTR500(cp, context.TODO())
if err != nil {
fmt.Println(err.Error())
return
}
// res will be DeviceDataRTR500, see device_data.go
fmt.Println("response ", res)The package is available as open source under the terms of the MIT License.