-
Notifications
You must be signed in to change notification settings - Fork 10
/
http.go
155 lines (129 loc) · 2.91 KB
/
http.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package data
type Session struct {
New bool
SessionId string
Attributes map[string]string
}
type System struct {
User User
Application Application
Device Device
}
type User struct {
UserId string
AccessToken string
UserInfo UserInfo
}
type UserInfo struct {
}
type Application struct {
ApplicationId string
}
type Device struct {
DeviceId string
SupportedInterfaces map[string]interface{}
}
type Context struct {
System System
AudioPlayer AudioPlayerContext
VideoPlayer VideoPlayerContext
}
type AudioPlayerContext struct {
Token string
OffsetInMilliseconds int32 `json:"offsetInMilliSeconds,omitempty"`
PlayActivity string
}
type VideoPlayerContext struct {
Token string
OffsetInMilliseconds int32 `json:"offsetInMilliseconds,omitempty"`
PlayActivity string
}
type baseRequest struct {
Type string
RequestId string
Timestamp string
}
// 公共请求体
type RequestPart struct {
Version string
Session Session
Context Context
Request baseRequest
}
// 事件请求
type EventRequest struct {
Request struct {
baseRequest
Token string
Url string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
}
}
type AudioPlayerEventRequest struct {
Request struct {
baseRequest
Token string
OffsetInMilliseconds int32 `json:"offsetInMilliSeconds,omitempty"` //Audio Player Event
}
}
type VideoPlayerEventRequest struct {
Request struct {
baseRequest
Token string
OffsetInMilliseconds int32 `json:"offsetInMilliseconds,omitempty"` //Audio Player Event
}
}
// 打开请求
type LaunchRequest struct {
Request baseRequest
}
// 退出请求
type SessionEndedRequestBody struct {
baseRequest
Reason string
}
type SessionEndedRequest struct {
Request SessionEndedRequestBody
}
// intent request
type Query struct {
Type string
Original string
}
type Slot struct {
Name string `json:"name"`
Value string `json:"value"`
ConfirmationStatus string `json:"confirmationStatus"`
}
type Intent struct {
Name string `json:"name"`
Slots map[string]Slot `json:"slots"`
ConfirmationStatus string `json:"confirmationStatus"`
}
type IntentRequestBody struct {
baseRequest
Query Query
DialogState string
Intents []Intent
}
type IntentRequest struct {
Request IntentRequestBody
}
//--------response------
type SessionResponse struct {
Attributes map[string]string `json:"attributes"`
}
type ContextResponse struct {
Intent Intent `json:"intent"`
}
type DialogDirective struct {
Type string `json:"type"`
SlotToElicit string `json:"slotToElicit,omitempty"`
SlotToConfirm string `json:"slotToConfirm,omitempty"`
UpdatedIntent Intent `json:"updatedIntent"`
}
type Speech struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Ssml string `json:"ssml,omitempty"`
}