forked from c0re100/go-tdlib
/
callProblem.go
314 lines (253 loc) · 9.58 KB
/
callProblem.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
package tdlib
import (
"encoding/json"
"fmt"
)
// CallProblem Describes the exact type of a problem with a call
type CallProblem interface {
GetCallProblemEnum() CallProblemEnum
}
// CallProblemEnum Alias for abstract CallProblem 'Sub-Classes', used as constant-enum here
type CallProblemEnum string
// CallProblem enums
const (
CallProblemEchoType CallProblemEnum = "callProblemEcho"
CallProblemNoiseType CallProblemEnum = "callProblemNoise"
CallProblemInterruptionsType CallProblemEnum = "callProblemInterruptions"
CallProblemDistortedSpeechType CallProblemEnum = "callProblemDistortedSpeech"
CallProblemSilentLocalType CallProblemEnum = "callProblemSilentLocal"
CallProblemSilentRemoteType CallProblemEnum = "callProblemSilentRemote"
CallProblemDroppedType CallProblemEnum = "callProblemDropped"
CallProblemDistortedVideoType CallProblemEnum = "callProblemDistortedVideo"
CallProblemPixelatedVideoType CallProblemEnum = "callProblemPixelatedVideo"
)
func unmarshalCallProblem(rawMsg *json.RawMessage) (CallProblem, error) {
if rawMsg == nil {
return nil, nil
}
var objMap map[string]interface{}
err := json.Unmarshal(*rawMsg, &objMap)
if err != nil {
return nil, err
}
switch CallProblemEnum(objMap["@type"].(string)) {
case CallProblemEchoType:
var callProblemEcho CallProblemEcho
err := json.Unmarshal(*rawMsg, &callProblemEcho)
return &callProblemEcho, err
case CallProblemNoiseType:
var callProblemNoise CallProblemNoise
err := json.Unmarshal(*rawMsg, &callProblemNoise)
return &callProblemNoise, err
case CallProblemInterruptionsType:
var callProblemInterruptions CallProblemInterruptions
err := json.Unmarshal(*rawMsg, &callProblemInterruptions)
return &callProblemInterruptions, err
case CallProblemDistortedSpeechType:
var callProblemDistortedSpeech CallProblemDistortedSpeech
err := json.Unmarshal(*rawMsg, &callProblemDistortedSpeech)
return &callProblemDistortedSpeech, err
case CallProblemSilentLocalType:
var callProblemSilentLocal CallProblemSilentLocal
err := json.Unmarshal(*rawMsg, &callProblemSilentLocal)
return &callProblemSilentLocal, err
case CallProblemSilentRemoteType:
var callProblemSilentRemote CallProblemSilentRemote
err := json.Unmarshal(*rawMsg, &callProblemSilentRemote)
return &callProblemSilentRemote, err
case CallProblemDroppedType:
var callProblemDropped CallProblemDropped
err := json.Unmarshal(*rawMsg, &callProblemDropped)
return &callProblemDropped, err
case CallProblemDistortedVideoType:
var callProblemDistortedVideo CallProblemDistortedVideo
err := json.Unmarshal(*rawMsg, &callProblemDistortedVideo)
return &callProblemDistortedVideo, err
case CallProblemPixelatedVideoType:
var callProblemPixelatedVideo CallProblemPixelatedVideo
err := json.Unmarshal(*rawMsg, &callProblemPixelatedVideo)
return &callProblemPixelatedVideo, err
default:
return nil, fmt.Errorf("Error UnMarshaling, unknown type:" + objMap["@type"].(string))
}
}
// CallProblemEcho The user heard their own voice
type CallProblemEcho struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemEcho
func (callProblemEcho *CallProblemEcho) MessageType() string {
return "callProblemEcho"
}
// NewCallProblemEcho creates a new CallProblemEcho
//
func NewCallProblemEcho() *CallProblemEcho {
callProblemEchoTemp := CallProblemEcho{
tdCommon: tdCommon{Type: "callProblemEcho"},
}
return &callProblemEchoTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemEcho *CallProblemEcho) GetCallProblemEnum() CallProblemEnum {
return CallProblemEchoType
}
// CallProblemNoise The user heard background noise
type CallProblemNoise struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemNoise
func (callProblemNoise *CallProblemNoise) MessageType() string {
return "callProblemNoise"
}
// NewCallProblemNoise creates a new CallProblemNoise
//
func NewCallProblemNoise() *CallProblemNoise {
callProblemNoiseTemp := CallProblemNoise{
tdCommon: tdCommon{Type: "callProblemNoise"},
}
return &callProblemNoiseTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemNoise *CallProblemNoise) GetCallProblemEnum() CallProblemEnum {
return CallProblemNoiseType
}
// CallProblemInterruptions The other side kept disappearing
type CallProblemInterruptions struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemInterruptions
func (callProblemInterruptions *CallProblemInterruptions) MessageType() string {
return "callProblemInterruptions"
}
// NewCallProblemInterruptions creates a new CallProblemInterruptions
//
func NewCallProblemInterruptions() *CallProblemInterruptions {
callProblemInterruptionsTemp := CallProblemInterruptions{
tdCommon: tdCommon{Type: "callProblemInterruptions"},
}
return &callProblemInterruptionsTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemInterruptions *CallProblemInterruptions) GetCallProblemEnum() CallProblemEnum {
return CallProblemInterruptionsType
}
// CallProblemDistortedSpeech The speech was distorted
type CallProblemDistortedSpeech struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemDistortedSpeech
func (callProblemDistortedSpeech *CallProblemDistortedSpeech) MessageType() string {
return "callProblemDistortedSpeech"
}
// NewCallProblemDistortedSpeech creates a new CallProblemDistortedSpeech
//
func NewCallProblemDistortedSpeech() *CallProblemDistortedSpeech {
callProblemDistortedSpeechTemp := CallProblemDistortedSpeech{
tdCommon: tdCommon{Type: "callProblemDistortedSpeech"},
}
return &callProblemDistortedSpeechTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemDistortedSpeech *CallProblemDistortedSpeech) GetCallProblemEnum() CallProblemEnum {
return CallProblemDistortedSpeechType
}
// CallProblemSilentLocal The user couldn't hear the other side
type CallProblemSilentLocal struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemSilentLocal
func (callProblemSilentLocal *CallProblemSilentLocal) MessageType() string {
return "callProblemSilentLocal"
}
// NewCallProblemSilentLocal creates a new CallProblemSilentLocal
//
func NewCallProblemSilentLocal() *CallProblemSilentLocal {
callProblemSilentLocalTemp := CallProblemSilentLocal{
tdCommon: tdCommon{Type: "callProblemSilentLocal"},
}
return &callProblemSilentLocalTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemSilentLocal *CallProblemSilentLocal) GetCallProblemEnum() CallProblemEnum {
return CallProblemSilentLocalType
}
// CallProblemSilentRemote The other side couldn't hear the user
type CallProblemSilentRemote struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemSilentRemote
func (callProblemSilentRemote *CallProblemSilentRemote) MessageType() string {
return "callProblemSilentRemote"
}
// NewCallProblemSilentRemote creates a new CallProblemSilentRemote
//
func NewCallProblemSilentRemote() *CallProblemSilentRemote {
callProblemSilentRemoteTemp := CallProblemSilentRemote{
tdCommon: tdCommon{Type: "callProblemSilentRemote"},
}
return &callProblemSilentRemoteTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemSilentRemote *CallProblemSilentRemote) GetCallProblemEnum() CallProblemEnum {
return CallProblemSilentRemoteType
}
// CallProblemDropped The call ended unexpectedly
type CallProblemDropped struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemDropped
func (callProblemDropped *CallProblemDropped) MessageType() string {
return "callProblemDropped"
}
// NewCallProblemDropped creates a new CallProblemDropped
//
func NewCallProblemDropped() *CallProblemDropped {
callProblemDroppedTemp := CallProblemDropped{
tdCommon: tdCommon{Type: "callProblemDropped"},
}
return &callProblemDroppedTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemDropped *CallProblemDropped) GetCallProblemEnum() CallProblemEnum {
return CallProblemDroppedType
}
// CallProblemDistortedVideo The video was distorted
type CallProblemDistortedVideo struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemDistortedVideo
func (callProblemDistortedVideo *CallProblemDistortedVideo) MessageType() string {
return "callProblemDistortedVideo"
}
// NewCallProblemDistortedVideo creates a new CallProblemDistortedVideo
//
func NewCallProblemDistortedVideo() *CallProblemDistortedVideo {
callProblemDistortedVideoTemp := CallProblemDistortedVideo{
tdCommon: tdCommon{Type: "callProblemDistortedVideo"},
}
return &callProblemDistortedVideoTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemDistortedVideo *CallProblemDistortedVideo) GetCallProblemEnum() CallProblemEnum {
return CallProblemDistortedVideoType
}
// CallProblemPixelatedVideo The video was pixelated
type CallProblemPixelatedVideo struct {
tdCommon
}
// MessageType return the string telegram-type of CallProblemPixelatedVideo
func (callProblemPixelatedVideo *CallProblemPixelatedVideo) MessageType() string {
return "callProblemPixelatedVideo"
}
// NewCallProblemPixelatedVideo creates a new CallProblemPixelatedVideo
//
func NewCallProblemPixelatedVideo() *CallProblemPixelatedVideo {
callProblemPixelatedVideoTemp := CallProblemPixelatedVideo{
tdCommon: tdCommon{Type: "callProblemPixelatedVideo"},
}
return &callProblemPixelatedVideoTemp
}
// GetCallProblemEnum return the enum type of this object
func (callProblemPixelatedVideo *CallProblemPixelatedVideo) GetCallProblemEnum() CallProblemEnum {
return CallProblemPixelatedVideoType
}