/
types.go
75 lines (66 loc) · 1.27 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package mercedes
import (
"fmt"
"html"
"time"
)
var Regions = map[string]string{
"apac": "Asia-Pacific",
"ece": "ECE",
"noram": "North-America",
}
type ErrorInfo struct {
ErrorCode int
ErrorMessage string
ErrorDetails string
}
func (e ErrorInfo) Error() error {
if e.ErrorCode == 0 {
return nil
}
return fmt.Errorf("%s: %s", e.ErrorMessage, html.UnescapeString(e.ErrorDetails))
}
type PinRequest struct {
EmailOrPhoneNumber string `json:"emailOrPhoneNumber"`
CountryCode string `json:"countryCode"`
Nonce string `json:"nonce"`
}
type PinResponse struct {
IsEmail bool `json:"isEmail"`
UserName string `json:"username"`
}
type VehiclesResponse struct {
AssignedVehicles []Vehicle
}
type Vehicle struct {
Fin string
Vin string
}
type StatusResponse struct {
VehicleInfo struct {
Odometer struct {
Value int
Unit string
}
Timestamp time.Time
}
EvInfo struct {
Battery struct {
ChargingStatus int
DistanceToEmpty struct {
Value int
Unit string
}
StateOfCharge float64 // 75
EndOfChargeTime int // Minutes after midnight
TotalRange int // 17
}
Timestamp time.Time
}
LocationResponse struct {
TimeStamp time.Time
Longitude float64
Latitude float64
}
Timestamp time.Time
}