Documentation
¶
Overview ¶
Package telemetryapi provides functionality to interact with the telemetry GraphQL API.
Index ¶
- Constants
- func GenerateHistoricalQuery(signals []string) string
- func GenerateLatestSignalsQuery(signals []string) string
- type Location
- type Service
- type Signal
- type SignalAggregations
- type SignalCollection
- type SignalFloat
- type SignalLocation
- type SignalString
- type TelemetryHistoricalOptions
- type TelemetryLatestOptions
Constants ¶
const ( // DefaultTimeout is the default timeout for telemetry queries. DefaultTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GenerateHistoricalQuery ¶
GenerateHistoricalQuery generates a GraphQL query for historical signals based on requested signal names.
func GenerateLatestSignalsQuery ¶
GenerateLatestSignalsQuery generates a GraphQL query for latest signals based on requested signal names.
Types ¶
type Location ¶ added in v0.1.17
type Location struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
HDOP float64 `json:"hdop"`
}
Location is a WGS 84 coordinate as returned by the telemetry GraphQL API.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service interacts with the telemetry GraphQL API.
func NewService ¶
NewService creates a new instance of Service with optional TLS certificate pool.
func (*Service) GetHistoricalDataWithAuth ¶
func (s *Service) GetHistoricalDataWithAuth(ctx context.Context, options TelemetryHistoricalOptions, jwtToken string) ([]Signal, error)
GetHistoricalDataWithAuth fetches historical telemetry data for a vehicle with JWT authentication.
func (*Service) GetLatestSignalsWithAuth ¶
func (s *Service) GetLatestSignalsWithAuth(ctx context.Context, options TelemetryLatestOptions) ([]Signal, error)
GetLatestSignalsWithAuth fetches the latest telemetry signals for a vehicle with JWT authentication.
type Signal ¶
type Signal struct {
Name string `json:"name"`
Value any `json:"value"`
Timestamp time.Time `json:"timestamp"`
}
Signal represents a telemetry signal (for backward compatibility).
type SignalAggregations ¶
type SignalAggregations struct {
Timestamp time.Time `json:"timestamp"`
CurrentLocationCoordinates *Location `json:"currentLocationCoordinates"`
CurrentLocationApproximateCoordinates *Location `json:"currentLocationApproximateCoordinates"`
PowertrainTransmissionTravelledDistance *float64 `json:"powertrainTransmissionTravelledDistance"`
Speed *float64 `json:"speed"`
ObdDTCList *string `json:"obdDTCList"`
ObdStatusDTCCount *float64 `json:"obdStatusDTCCount"`
ChassisAxleRow1WheelLeftTirePressure *float64 `json:"chassisAxleRow1WheelLeftTirePressure"`
ChassisAxleRow1WheelRightTirePressure *float64 `json:"chassisAxleRow1WheelRightTirePressure"`
ChassisAxleRow2WheelLeftTirePressure *float64 `json:"chassisAxleRow2WheelLeftTirePressure"`
ChassisAxleRow2WheelRightTirePressure *float64 `json:"chassisAxleRow2WheelRightTirePressure"`
}
SignalAggregations represents historical signal aggregations.
type SignalCollection ¶
type SignalCollection struct {
LastSeen time.Time `json:"lastSeen"`
CurrentLocationCoordinates *SignalLocation `json:"currentLocationCoordinates"`
CurrentLocationApproximateCoordinates *SignalLocation `json:"currentLocationApproximateCoordinates"`
PowertrainTransmissionTravelledDistance *SignalFloat `json:"powertrainTransmissionTravelledDistance"`
Speed *SignalFloat `json:"speed"`
ObdDTCList *SignalString `json:"obdDTCList"`
ObdStatusDTCCount *SignalFloat `json:"obdStatusDTCCount"`
ChassisAxleRow1WheelLeftTirePressure *SignalFloat `json:"chassisAxleRow1WheelLeftTirePressure"`
ChassisAxleRow1WheelRightTirePressure *SignalFloat `json:"chassisAxleRow1WheelRightTirePressure"`
ChassisAxleRow2WheelLeftTirePressure *SignalFloat `json:"chassisAxleRow2WheelLeftTirePressure"`
ChassisAxleRow2WheelRightTirePressure *SignalFloat `json:"chassisAxleRow2WheelRightTirePressure"`
}
SignalCollection represents the latest signals collection from telemetry API.
type SignalFloat ¶
SignalFloat represents a float signal with timestamp.
type SignalLocation ¶ added in v0.1.17
SignalLocation represents a location signal with timestamp.
type SignalString ¶
SignalString represents a string signal with timestamp.
type TelemetryHistoricalOptions ¶
type TelemetryHistoricalOptions struct {
TokenID *big.Int `json:"tokenId"`
StartDate time.Time `json:"startDate,omitempty"`
EndDate time.Time `json:"endDate,omitempty"`
Interval string `json:"interval,omitempty"`
Signals []string `json:"signals,omitempty"`
}
TelemetryHistoricalOptions represents options for querying telemetry data.