Documentation
¶
Overview ¶
Package telemetryapi provides functionality to interact with the telemetry GraphQL API.
Index ¶
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 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"`
CurrentLocationLatitude *float64 `json:"currentLocationLatitude"`
CurrentLocationLongitude *float64 `json:"currentLocationLongitude"`
CurrentLocationApproximateLatitude *float64 `json:"currentLocationApproximateLatitude"`
CurrentLocationApproximateLongitude *float64 `json:"currentLocationApproximateLongitude"`
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"`
CurrentLocationLatitude *SignalFloat `json:"currentLocationLatitude"`
CurrentLocationLongitude *SignalFloat `json:"currentLocationLongitude"`
CurrentLocationApproximateLatitude *SignalFloat `json:"currentLocationApproximateLatitude"`
CurrentLocationApproximateLongitude *SignalFloat `json:"currentLocationApproximateLongitude"`
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 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.