2020-11-23 11:15:30 +01:00
|
|
|
package common
|
2018-09-21 12:31:52 +02:00
|
|
|
|
2020-11-23 11:15:30 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"strings"
|
|
|
|
)
|
2018-09-26 12:05:55 +02:00
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
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"`
|
2018-09-21 12:31:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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) {
|
2018-09-21 12:31:52 +02:00
|
|
|
res := &reachViewVersion{}
|
2018-09-26 12:05:55 +02:00
|
|
|
if err := c.ReqResp(ctx, eventGetReachViewVersion, nil, eventReachViewVersionResults, res); err != nil {
|
2020-11-23 11:15:30 +01:00
|
|
|
return "", false, err
|
2018-09-21 12:31:52 +02:00
|
|
|
}
|
2020-11-23 11:15:30 +01:00
|
|
|
|
|
|
|
return strings.TrimSpace(res.Version), res.Stable, nil
|
2018-09-21 12:31:52 +02:00
|
|
|
}
|