2019-02-07 13:13:01 +01:00
|
|
|
package usagestats
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
)
|
|
|
|
|
|
2021-09-21 20:50:37 +02:00
|
|
|
type Report struct {
|
2023-08-30 08:46:47 -07:00
|
|
|
Version string `json:"version"`
|
|
|
|
|
Metrics map[string]any `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 16:12:02 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-30 08:46:47 -07:00
|
|
|
type MetricsFunc func(context.Context) (map[string]any, error)
|
2020-12-16 12:44:33 +01:00
|
|
|
|
2021-09-23 12:55:00 +03:00
|
|
|
type SendReportCallbackFunc func()
|
|
|
|
|
|
2021-09-21 20:50:37 +02:00
|
|
|
type Service interface {
|
|
|
|
|
GetUsageReport(context.Context) (Report, error)
|
|
|
|
|
RegisterMetricsFunc(MetricsFunc)
|
2021-09-23 12:55:00 +03:00
|
|
|
RegisterSendReportCallback(SendReportCallbackFunc)
|
2023-08-03 11:01:44 +03:00
|
|
|
SetReadyToReport(context.Context)
|
2021-01-06 16:57:31 +01:00
|
|
|
}
|