-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
executable file
·101 lines (84 loc) · 2.41 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
types.go
- Structure types and constants used across the application.
*/
package main
const url string = "https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql"
// Intent matching strings
const (
DESTONLY string = "Destination-Only"
BUSDEST string = "Bus-Destination"
)
// Configuration keys
const (
ROUTES string = "routes"
SIGNS string = "callSignToHeadsign"
PORT string = "port"
LOGFILE string = "logFile"
CLIENTCERT string = "clientCert"
SERVERCERT string = "serverCert"
SERVERKEY string = "serverKey"
STOPGTFSIDS string = "stopGtfsIds"
)
// A bus's arrival/departure details.
type routeArrDepDetails struct {
scheduledArrival float64
realtimeArrival float64
arrivalDelay float64
scheduledDeparture float64
realtimeDeparture float64
departureDelay float64
realtime bool
realtimeState string
headSign string
route string
}
// A bus's headsigns source/destination
type routeHeadSigns struct {
routeName string
headsigns []string
}
// Main structure that holds all stops and buses from the stop.
type routeData struct {
stopDetails stopStruct
arrDepDetails []routeArrDepDetails
}
// Structure that holds the bus stop details
type stopStruct struct {
gtfsId string
name string
code string
latitude float64
longitude float64
}
// Structure for Webhook Response to Dialogflow.
type simpleRespStruct struct {
TextToSpeech string `json:"textToSpeech"`
}
// Structure for Webhook Response to Dialogflow.
type itemStruct struct {
SimpleResponse simpleRespStruct `json:"simpleResponse"`
}
// Structure for Webhook Response to Dialogflow.
type suggestionStruct struct {
Title string `json:"title"`
}
// Structure for Webhook Response to Dialogflow.
type richResponseStruct struct {
Items []itemStruct `json:"items"`
Suggestions []suggestionStruct `json:"suggestions"`
}
// Structure for Webhook Response to Dialogflow.
type googleStruct struct {
ExpectUserResponse bool `json:"expectUserResponse"`
RichResponse richResponseStruct `json:"richResponse"`
}
// Structure for Webhook Response to Dialogflow.
type payloadStruct struct {
Google googleStruct `json:"google"`
}
// Structure for Webhook Response to Dialogflow.
type gaWebHookResponse struct {
FulfillmentText string `json:"fulfillmentText"`
Payload payloadStruct `json:"payload"`
}