This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/emlid/common/reachview_version.go

27 lines
638 B
Go
Raw Normal View History

2020-11-23 11:15:30 +01:00
package common
2020-11-23 11:15:30 +01:00
import (
"context"
"strings"
)
const (
eventGetReachViewVersion = "get reachview version"
eventReachViewVersionResults = "current reachview version"
)
type reachViewVersion struct {
Version string `json:"version"`
2020-11-23 11:15:30 +01:00
Stable bool `json:"bool"`
}
// ReachViewVersion returns the ReachRS module ReachView version
2020-11-23 11:15:30 +01:00
func (c *Client) ReachViewVersion(ctx context.Context) (string, bool, error) {
res := &reachViewVersion{}
if err := c.ReqResp(ctx, eventGetReachViewVersion, nil, eventReachViewVersionResults, res); err != nil {
2020-11-23 11:15:30 +01:00
return "", false, err
}
2020-11-23 11:15:30 +01:00
return strings.TrimSpace(res.Version), res.Stable, nil
}