-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpressway.go
More file actions
32 lines (25 loc) · 979 Bytes
/
Copy pathexpressway.go
File metadata and controls
32 lines (25 loc) · 979 Bytes
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
package ltadatamall
import "errors"
type AllExpresswayEstimatedTravelTimes struct {
Metadata string `json:"odata.metadata"`
EstimatedTravelTimes []ExpresswayEstimatedTravelTimes `json:"value"`
}
type ExpresswayEstimatedTravelTimes struct {
Name string `json:"Name"`
Direction int `json:"Direction"`
FarEndPoint string `json:"FarEndPoint"`
StartPoint string `json:"StartPoint"`
EndPoint string `json:"EndPoint"`
EstTime int `json:"EstTime"`
}
func GetAllExpresswayEstimatedTravelTimes(apiClient *APIClient) (AllExpresswayEstimatedTravelTimes, error) {
var result AllExpresswayEstimatedTravelTimes
endpoint := "EstTravelTimes"
if err := apiClient.getJSON(endpoint, &result); err != nil {
return AllExpresswayEstimatedTravelTimes{}, err
}
if len(result.EstimatedTravelTimes) == 0 {
return AllExpresswayEstimatedTravelTimes{}, errors.New("no estimated travel times found")
}
return result, nil
}