2019-02-07 06:13:01 -06:00
|
|
|
package usagestats
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
2021-09-21 13:50:37 -05:00
|
|
|
type Report struct {
|
|
|
|
Version string `json:"version"`
|
|
|
|
Metrics map[string]interface{} `json:"metrics"`
|
|
|
|
Os string `json:"os"`
|
|
|
|
Arch string `json:"arch"`
|
|
|
|
Edition string `json:"edition"`
|
|
|
|
HasValidLicense bool `json:"hasValidLicense"`
|
|
|
|
Packaging string `json:"packaging"`
|
|
|
|
UsageStatsId string `json:"usageStatsId"`
|
2020-12-16 09:12:02 -06:00
|
|
|
}
|
|
|
|
|
2021-11-03 08:10:39 -05:00
|
|
|
type MetricsFunc func(context.Context) (map[string]interface{}, error)
|
2020-12-16 05:44:33 -06:00
|
|
|
|
2021-09-23 04:55:00 -05:00
|
|
|
type SendReportCallbackFunc func()
|
|
|
|
|
2021-09-21 13:50:37 -05:00
|
|
|
type Service interface {
|
|
|
|
GetUsageReport(context.Context) (Report, error)
|
|
|
|
RegisterMetricsFunc(MetricsFunc)
|
2021-09-23 04:55:00 -05:00
|
|
|
RegisterSendReportCallback(SendReportCallbackFunc)
|
2021-01-06 09:57:31 -06:00
|
|
|
}
|