forked from c0re100/go-tdlib
/
update.go
4536 lines (3797 loc) · 168 KB
/
update.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package tdlib
import (
"encoding/json"
"fmt"
)
// Update Contains notifications about data changes
type Update interface {
GetUpdateEnum() UpdateEnum
}
// UpdateEnum Alias for abstract Update 'Sub-Classes', used as constant-enum here
type UpdateEnum string
// Update enums
const (
UpdateAuthorizationStateType UpdateEnum = "updateAuthorizationState"
UpdateNewMessageType UpdateEnum = "updateNewMessage"
UpdateMessageSendAcknowledgedType UpdateEnum = "updateMessageSendAcknowledged"
UpdateMessageSendSucceededType UpdateEnum = "updateMessageSendSucceeded"
UpdateMessageSendFailedType UpdateEnum = "updateMessageSendFailed"
UpdateMessageContentType UpdateEnum = "updateMessageContent"
UpdateMessageEditedType UpdateEnum = "updateMessageEdited"
UpdateMessageIsPinnedType UpdateEnum = "updateMessageIsPinned"
UpdateMessageInteractionInfoType UpdateEnum = "updateMessageInteractionInfo"
UpdateMessageContentOpenedType UpdateEnum = "updateMessageContentOpened"
UpdateMessageMentionReadType UpdateEnum = "updateMessageMentionRead"
UpdateMessageLiveLocationViewedType UpdateEnum = "updateMessageLiveLocationViewed"
UpdateNewChatType UpdateEnum = "updateNewChat"
UpdateChatTitleType UpdateEnum = "updateChatTitle"
UpdateChatPhotoType UpdateEnum = "updateChatPhoto"
UpdateChatPermissionsType UpdateEnum = "updateChatPermissions"
UpdateChatLastMessageType UpdateEnum = "updateChatLastMessage"
UpdateChatPositionType UpdateEnum = "updateChatPosition"
UpdateChatReadInboxType UpdateEnum = "updateChatReadInbox"
UpdateChatReadOutboxType UpdateEnum = "updateChatReadOutbox"
UpdateChatActionBarType UpdateEnum = "updateChatActionBar"
UpdateChatDraftMessageType UpdateEnum = "updateChatDraftMessage"
UpdateChatMessageSenderType UpdateEnum = "updateChatMessageSender"
UpdateChatMessageTtlType UpdateEnum = "updateChatMessageTtl"
UpdateChatNotificationSettingsType UpdateEnum = "updateChatNotificationSettings"
UpdateChatPendingJoinRequestsType UpdateEnum = "updateChatPendingJoinRequests"
UpdateChatReplyMarkupType UpdateEnum = "updateChatReplyMarkup"
UpdateChatThemeType UpdateEnum = "updateChatTheme"
UpdateChatUnreadMentionCountType UpdateEnum = "updateChatUnreadMentionCount"
UpdateChatVideoChatType UpdateEnum = "updateChatVideoChat"
UpdateChatDefaultDisableNotificationType UpdateEnum = "updateChatDefaultDisableNotification"
UpdateChatHasProtectedContentType UpdateEnum = "updateChatHasProtectedContent"
UpdateChatHasScheduledMessagesType UpdateEnum = "updateChatHasScheduledMessages"
UpdateChatIsBlockedType UpdateEnum = "updateChatIsBlocked"
UpdateChatIsMarkedAsUnreadType UpdateEnum = "updateChatIsMarkedAsUnread"
UpdateChatFiltersType UpdateEnum = "updateChatFilters"
UpdateChatOnlineMemberCountType UpdateEnum = "updateChatOnlineMemberCount"
UpdateScopeNotificationSettingsType UpdateEnum = "updateScopeNotificationSettings"
UpdateNotificationType UpdateEnum = "updateNotification"
UpdateNotificationGroupType UpdateEnum = "updateNotificationGroup"
UpdateActiveNotificationsType UpdateEnum = "updateActiveNotifications"
UpdateHavePendingNotificationsType UpdateEnum = "updateHavePendingNotifications"
UpdateDeleteMessagesType UpdateEnum = "updateDeleteMessages"
UpdateChatActionType UpdateEnum = "updateChatAction"
UpdateUserStatusType UpdateEnum = "updateUserStatus"
UpdateUserType UpdateEnum = "updateUser"
UpdateBasicGroupType UpdateEnum = "updateBasicGroup"
UpdateSupergroupType UpdateEnum = "updateSupergroup"
UpdateSecretChatType UpdateEnum = "updateSecretChat"
UpdateUserFullInfoType UpdateEnum = "updateUserFullInfo"
UpdateBasicGroupFullInfoType UpdateEnum = "updateBasicGroupFullInfo"
UpdateSupergroupFullInfoType UpdateEnum = "updateSupergroupFullInfo"
UpdateServiceNotificationType UpdateEnum = "updateServiceNotification"
UpdateFileType UpdateEnum = "updateFile"
UpdateFileGenerationStartType UpdateEnum = "updateFileGenerationStart"
UpdateFileGenerationStopType UpdateEnum = "updateFileGenerationStop"
UpdateCallType UpdateEnum = "updateCall"
UpdateGroupCallType UpdateEnum = "updateGroupCall"
UpdateGroupCallParticipantType UpdateEnum = "updateGroupCallParticipant"
UpdateNewCallSignalingDataType UpdateEnum = "updateNewCallSignalingData"
UpdateUserPrivacySettingRulesType UpdateEnum = "updateUserPrivacySettingRules"
UpdateUnreadMessageCountType UpdateEnum = "updateUnreadMessageCount"
UpdateUnreadChatCountType UpdateEnum = "updateUnreadChatCount"
UpdateOptionType UpdateEnum = "updateOption"
UpdateStickerSetType UpdateEnum = "updateStickerSet"
UpdateInstalledStickerSetsType UpdateEnum = "updateInstalledStickerSets"
UpdateTrendingStickerSetsType UpdateEnum = "updateTrendingStickerSets"
UpdateRecentStickersType UpdateEnum = "updateRecentStickers"
UpdateFavoriteStickersType UpdateEnum = "updateFavoriteStickers"
UpdateSavedAnimationsType UpdateEnum = "updateSavedAnimations"
UpdateSelectedBackgroundType UpdateEnum = "updateSelectedBackground"
UpdateChatThemesType UpdateEnum = "updateChatThemes"
UpdateLanguagePackStringsType UpdateEnum = "updateLanguagePackStrings"
UpdateConnectionStateType UpdateEnum = "updateConnectionState"
UpdateTermsOfServiceType UpdateEnum = "updateTermsOfService"
UpdateUsersNearbyType UpdateEnum = "updateUsersNearby"
UpdateDiceEmojisType UpdateEnum = "updateDiceEmojis"
UpdateAnimatedEmojiMessageClickedType UpdateEnum = "updateAnimatedEmojiMessageClicked"
UpdateAnimationSearchParametersType UpdateEnum = "updateAnimationSearchParameters"
UpdateSuggestedActionsType UpdateEnum = "updateSuggestedActions"
UpdateNewInlineQueryType UpdateEnum = "updateNewInlineQuery"
UpdateNewChosenInlineResultType UpdateEnum = "updateNewChosenInlineResult"
UpdateNewCallbackQueryType UpdateEnum = "updateNewCallbackQuery"
UpdateNewInlineCallbackQueryType UpdateEnum = "updateNewInlineCallbackQuery"
UpdateNewShippingQueryType UpdateEnum = "updateNewShippingQuery"
UpdateNewPreCheckoutQueryType UpdateEnum = "updateNewPreCheckoutQuery"
UpdateNewCustomEventType UpdateEnum = "updateNewCustomEvent"
UpdateNewCustomQueryType UpdateEnum = "updateNewCustomQuery"
UpdatePollType UpdateEnum = "updatePoll"
UpdatePollAnswerType UpdateEnum = "updatePollAnswer"
UpdateChatMemberType UpdateEnum = "updateChatMember"
UpdateNewChatJoinRequestType UpdateEnum = "updateNewChatJoinRequest"
)
func unmarshalUpdate(rawMsg *json.RawMessage) (Update, error) {
if rawMsg == nil {
return nil, nil
}
var objMap map[string]interface{}
err := json.Unmarshal(*rawMsg, &objMap)
if err != nil {
return nil, err
}
switch UpdateEnum(objMap["@type"].(string)) {
case UpdateAuthorizationStateType:
var updateAuthorizationState UpdateAuthorizationState
err := json.Unmarshal(*rawMsg, &updateAuthorizationState)
return &updateAuthorizationState, err
case UpdateNewMessageType:
var updateNewMessage UpdateNewMessage
err := json.Unmarshal(*rawMsg, &updateNewMessage)
return &updateNewMessage, err
case UpdateMessageSendAcknowledgedType:
var updateMessageSendAcknowledged UpdateMessageSendAcknowledged
err := json.Unmarshal(*rawMsg, &updateMessageSendAcknowledged)
return &updateMessageSendAcknowledged, err
case UpdateMessageSendSucceededType:
var updateMessageSendSucceeded UpdateMessageSendSucceeded
err := json.Unmarshal(*rawMsg, &updateMessageSendSucceeded)
return &updateMessageSendSucceeded, err
case UpdateMessageSendFailedType:
var updateMessageSendFailed UpdateMessageSendFailed
err := json.Unmarshal(*rawMsg, &updateMessageSendFailed)
return &updateMessageSendFailed, err
case UpdateMessageContentType:
var updateMessageContent UpdateMessageContent
err := json.Unmarshal(*rawMsg, &updateMessageContent)
return &updateMessageContent, err
case UpdateMessageEditedType:
var updateMessageEdited UpdateMessageEdited
err := json.Unmarshal(*rawMsg, &updateMessageEdited)
return &updateMessageEdited, err
case UpdateMessageIsPinnedType:
var updateMessageIsPinned UpdateMessageIsPinned
err := json.Unmarshal(*rawMsg, &updateMessageIsPinned)
return &updateMessageIsPinned, err
case UpdateMessageInteractionInfoType:
var updateMessageInteractionInfo UpdateMessageInteractionInfo
err := json.Unmarshal(*rawMsg, &updateMessageInteractionInfo)
return &updateMessageInteractionInfo, err
case UpdateMessageContentOpenedType:
var updateMessageContentOpened UpdateMessageContentOpened
err := json.Unmarshal(*rawMsg, &updateMessageContentOpened)
return &updateMessageContentOpened, err
case UpdateMessageMentionReadType:
var updateMessageMentionRead UpdateMessageMentionRead
err := json.Unmarshal(*rawMsg, &updateMessageMentionRead)
return &updateMessageMentionRead, err
case UpdateMessageLiveLocationViewedType:
var updateMessageLiveLocationViewed UpdateMessageLiveLocationViewed
err := json.Unmarshal(*rawMsg, &updateMessageLiveLocationViewed)
return &updateMessageLiveLocationViewed, err
case UpdateNewChatType:
var updateNewChat UpdateNewChat
err := json.Unmarshal(*rawMsg, &updateNewChat)
return &updateNewChat, err
case UpdateChatTitleType:
var updateChatTitle UpdateChatTitle
err := json.Unmarshal(*rawMsg, &updateChatTitle)
return &updateChatTitle, err
case UpdateChatPhotoType:
var updateChatPhoto UpdateChatPhoto
err := json.Unmarshal(*rawMsg, &updateChatPhoto)
return &updateChatPhoto, err
case UpdateChatPermissionsType:
var updateChatPermissions UpdateChatPermissions
err := json.Unmarshal(*rawMsg, &updateChatPermissions)
return &updateChatPermissions, err
case UpdateChatLastMessageType:
var updateChatLastMessage UpdateChatLastMessage
err := json.Unmarshal(*rawMsg, &updateChatLastMessage)
return &updateChatLastMessage, err
case UpdateChatPositionType:
var updateChatPosition UpdateChatPosition
err := json.Unmarshal(*rawMsg, &updateChatPosition)
return &updateChatPosition, err
case UpdateChatReadInboxType:
var updateChatReadInbox UpdateChatReadInbox
err := json.Unmarshal(*rawMsg, &updateChatReadInbox)
return &updateChatReadInbox, err
case UpdateChatReadOutboxType:
var updateChatReadOutbox UpdateChatReadOutbox
err := json.Unmarshal(*rawMsg, &updateChatReadOutbox)
return &updateChatReadOutbox, err
case UpdateChatActionBarType:
var updateChatActionBar UpdateChatActionBar
err := json.Unmarshal(*rawMsg, &updateChatActionBar)
return &updateChatActionBar, err
case UpdateChatDraftMessageType:
var updateChatDraftMessage UpdateChatDraftMessage
err := json.Unmarshal(*rawMsg, &updateChatDraftMessage)
return &updateChatDraftMessage, err
case UpdateChatMessageSenderType:
var updateChatMessageSender UpdateChatMessageSender
err := json.Unmarshal(*rawMsg, &updateChatMessageSender)
return &updateChatMessageSender, err
case UpdateChatMessageTtlType:
var updateChatMessageTtl UpdateChatMessageTtl
err := json.Unmarshal(*rawMsg, &updateChatMessageTtl)
return &updateChatMessageTtl, err
case UpdateChatNotificationSettingsType:
var updateChatNotificationSettings UpdateChatNotificationSettings
err := json.Unmarshal(*rawMsg, &updateChatNotificationSettings)
return &updateChatNotificationSettings, err
case UpdateChatPendingJoinRequestsType:
var updateChatPendingJoinRequests UpdateChatPendingJoinRequests
err := json.Unmarshal(*rawMsg, &updateChatPendingJoinRequests)
return &updateChatPendingJoinRequests, err
case UpdateChatReplyMarkupType:
var updateChatReplyMarkup UpdateChatReplyMarkup
err := json.Unmarshal(*rawMsg, &updateChatReplyMarkup)
return &updateChatReplyMarkup, err
case UpdateChatThemeType:
var updateChatTheme UpdateChatTheme
err := json.Unmarshal(*rawMsg, &updateChatTheme)
return &updateChatTheme, err
case UpdateChatUnreadMentionCountType:
var updateChatUnreadMentionCount UpdateChatUnreadMentionCount
err := json.Unmarshal(*rawMsg, &updateChatUnreadMentionCount)
return &updateChatUnreadMentionCount, err
case UpdateChatVideoChatType:
var updateChatVideoChat UpdateChatVideoChat
err := json.Unmarshal(*rawMsg, &updateChatVideoChat)
return &updateChatVideoChat, err
case UpdateChatDefaultDisableNotificationType:
var updateChatDefaultDisableNotification UpdateChatDefaultDisableNotification
err := json.Unmarshal(*rawMsg, &updateChatDefaultDisableNotification)
return &updateChatDefaultDisableNotification, err
case UpdateChatHasProtectedContentType:
var updateChatHasProtectedContent UpdateChatHasProtectedContent
err := json.Unmarshal(*rawMsg, &updateChatHasProtectedContent)
return &updateChatHasProtectedContent, err
case UpdateChatHasScheduledMessagesType:
var updateChatHasScheduledMessages UpdateChatHasScheduledMessages
err := json.Unmarshal(*rawMsg, &updateChatHasScheduledMessages)
return &updateChatHasScheduledMessages, err
case UpdateChatIsBlockedType:
var updateChatIsBlocked UpdateChatIsBlocked
err := json.Unmarshal(*rawMsg, &updateChatIsBlocked)
return &updateChatIsBlocked, err
case UpdateChatIsMarkedAsUnreadType:
var updateChatIsMarkedAsUnread UpdateChatIsMarkedAsUnread
err := json.Unmarshal(*rawMsg, &updateChatIsMarkedAsUnread)
return &updateChatIsMarkedAsUnread, err
case UpdateChatFiltersType:
var updateChatFilters UpdateChatFilters
err := json.Unmarshal(*rawMsg, &updateChatFilters)
return &updateChatFilters, err
case UpdateChatOnlineMemberCountType:
var updateChatOnlineMemberCount UpdateChatOnlineMemberCount
err := json.Unmarshal(*rawMsg, &updateChatOnlineMemberCount)
return &updateChatOnlineMemberCount, err
case UpdateScopeNotificationSettingsType:
var updateScopeNotificationSettings UpdateScopeNotificationSettings
err := json.Unmarshal(*rawMsg, &updateScopeNotificationSettings)
return &updateScopeNotificationSettings, err
case UpdateNotificationType:
var updateNotification UpdateNotification
err := json.Unmarshal(*rawMsg, &updateNotification)
return &updateNotification, err
case UpdateNotificationGroupType:
var updateNotificationGroup UpdateNotificationGroup
err := json.Unmarshal(*rawMsg, &updateNotificationGroup)
return &updateNotificationGroup, err
case UpdateActiveNotificationsType:
var updateActiveNotifications UpdateActiveNotifications
err := json.Unmarshal(*rawMsg, &updateActiveNotifications)
return &updateActiveNotifications, err
case UpdateHavePendingNotificationsType:
var updateHavePendingNotifications UpdateHavePendingNotifications
err := json.Unmarshal(*rawMsg, &updateHavePendingNotifications)
return &updateHavePendingNotifications, err
case UpdateDeleteMessagesType:
var updateDeleteMessages UpdateDeleteMessages
err := json.Unmarshal(*rawMsg, &updateDeleteMessages)
return &updateDeleteMessages, err
case UpdateChatActionType:
var updateChatAction UpdateChatAction
err := json.Unmarshal(*rawMsg, &updateChatAction)
return &updateChatAction, err
case UpdateUserStatusType:
var updateUserStatus UpdateUserStatus
err := json.Unmarshal(*rawMsg, &updateUserStatus)
return &updateUserStatus, err
case UpdateUserType:
var updateUser UpdateUser
err := json.Unmarshal(*rawMsg, &updateUser)
return &updateUser, err
case UpdateBasicGroupType:
var updateBasicGroup UpdateBasicGroup
err := json.Unmarshal(*rawMsg, &updateBasicGroup)
return &updateBasicGroup, err
case UpdateSupergroupType:
var updateSupergroup UpdateSupergroup
err := json.Unmarshal(*rawMsg, &updateSupergroup)
return &updateSupergroup, err
case UpdateSecretChatType:
var updateSecretChat UpdateSecretChat
err := json.Unmarshal(*rawMsg, &updateSecretChat)
return &updateSecretChat, err
case UpdateUserFullInfoType:
var updateUserFullInfo UpdateUserFullInfo
err := json.Unmarshal(*rawMsg, &updateUserFullInfo)
return &updateUserFullInfo, err
case UpdateBasicGroupFullInfoType:
var updateBasicGroupFullInfo UpdateBasicGroupFullInfo
err := json.Unmarshal(*rawMsg, &updateBasicGroupFullInfo)
return &updateBasicGroupFullInfo, err
case UpdateSupergroupFullInfoType:
var updateSupergroupFullInfo UpdateSupergroupFullInfo
err := json.Unmarshal(*rawMsg, &updateSupergroupFullInfo)
return &updateSupergroupFullInfo, err
case UpdateServiceNotificationType:
var updateServiceNotification UpdateServiceNotification
err := json.Unmarshal(*rawMsg, &updateServiceNotification)
return &updateServiceNotification, err
case UpdateFileType:
var updateFile UpdateFile
err := json.Unmarshal(*rawMsg, &updateFile)
return &updateFile, err
case UpdateFileGenerationStartType:
var updateFileGenerationStart UpdateFileGenerationStart
err := json.Unmarshal(*rawMsg, &updateFileGenerationStart)
return &updateFileGenerationStart, err
case UpdateFileGenerationStopType:
var updateFileGenerationStop UpdateFileGenerationStop
err := json.Unmarshal(*rawMsg, &updateFileGenerationStop)
return &updateFileGenerationStop, err
case UpdateCallType:
var updateCall UpdateCall
err := json.Unmarshal(*rawMsg, &updateCall)
return &updateCall, err
case UpdateGroupCallType:
var updateGroupCall UpdateGroupCall
err := json.Unmarshal(*rawMsg, &updateGroupCall)
return &updateGroupCall, err
case UpdateGroupCallParticipantType:
var updateGroupCallParticipant UpdateGroupCallParticipant
err := json.Unmarshal(*rawMsg, &updateGroupCallParticipant)
return &updateGroupCallParticipant, err
case UpdateNewCallSignalingDataType:
var updateNewCallSignalingData UpdateNewCallSignalingData
err := json.Unmarshal(*rawMsg, &updateNewCallSignalingData)
return &updateNewCallSignalingData, err
case UpdateUserPrivacySettingRulesType:
var updateUserPrivacySettingRules UpdateUserPrivacySettingRules
err := json.Unmarshal(*rawMsg, &updateUserPrivacySettingRules)
return &updateUserPrivacySettingRules, err
case UpdateUnreadMessageCountType:
var updateUnreadMessageCount UpdateUnreadMessageCount
err := json.Unmarshal(*rawMsg, &updateUnreadMessageCount)
return &updateUnreadMessageCount, err
case UpdateUnreadChatCountType:
var updateUnreadChatCount UpdateUnreadChatCount
err := json.Unmarshal(*rawMsg, &updateUnreadChatCount)
return &updateUnreadChatCount, err
case UpdateOptionType:
var updateOption UpdateOption
err := json.Unmarshal(*rawMsg, &updateOption)
return &updateOption, err
case UpdateStickerSetType:
var updateStickerSet UpdateStickerSet
err := json.Unmarshal(*rawMsg, &updateStickerSet)
return &updateStickerSet, err
case UpdateInstalledStickerSetsType:
var updateInstalledStickerSets UpdateInstalledStickerSets
err := json.Unmarshal(*rawMsg, &updateInstalledStickerSets)
return &updateInstalledStickerSets, err
case UpdateTrendingStickerSetsType:
var updateTrendingStickerSets UpdateTrendingStickerSets
err := json.Unmarshal(*rawMsg, &updateTrendingStickerSets)
return &updateTrendingStickerSets, err
case UpdateRecentStickersType:
var updateRecentStickers UpdateRecentStickers
err := json.Unmarshal(*rawMsg, &updateRecentStickers)
return &updateRecentStickers, err
case UpdateFavoriteStickersType:
var updateFavoriteStickers UpdateFavoriteStickers
err := json.Unmarshal(*rawMsg, &updateFavoriteStickers)
return &updateFavoriteStickers, err
case UpdateSavedAnimationsType:
var updateSavedAnimations UpdateSavedAnimations
err := json.Unmarshal(*rawMsg, &updateSavedAnimations)
return &updateSavedAnimations, err
case UpdateSelectedBackgroundType:
var updateSelectedBackground UpdateSelectedBackground
err := json.Unmarshal(*rawMsg, &updateSelectedBackground)
return &updateSelectedBackground, err
case UpdateChatThemesType:
var updateChatThemes UpdateChatThemes
err := json.Unmarshal(*rawMsg, &updateChatThemes)
return &updateChatThemes, err
case UpdateLanguagePackStringsType:
var updateLanguagePackStrings UpdateLanguagePackStrings
err := json.Unmarshal(*rawMsg, &updateLanguagePackStrings)
return &updateLanguagePackStrings, err
case UpdateConnectionStateType:
var updateConnectionState UpdateConnectionState
err := json.Unmarshal(*rawMsg, &updateConnectionState)
return &updateConnectionState, err
case UpdateTermsOfServiceType:
var updateTermsOfService UpdateTermsOfService
err := json.Unmarshal(*rawMsg, &updateTermsOfService)
return &updateTermsOfService, err
case UpdateUsersNearbyType:
var updateUsersNearby UpdateUsersNearby
err := json.Unmarshal(*rawMsg, &updateUsersNearby)
return &updateUsersNearby, err
case UpdateDiceEmojisType:
var updateDiceEmojis UpdateDiceEmojis
err := json.Unmarshal(*rawMsg, &updateDiceEmojis)
return &updateDiceEmojis, err
case UpdateAnimatedEmojiMessageClickedType:
var updateAnimatedEmojiMessageClicked UpdateAnimatedEmojiMessageClicked
err := json.Unmarshal(*rawMsg, &updateAnimatedEmojiMessageClicked)
return &updateAnimatedEmojiMessageClicked, err
case UpdateAnimationSearchParametersType:
var updateAnimationSearchParameters UpdateAnimationSearchParameters
err := json.Unmarshal(*rawMsg, &updateAnimationSearchParameters)
return &updateAnimationSearchParameters, err
case UpdateSuggestedActionsType:
var updateSuggestedActions UpdateSuggestedActions
err := json.Unmarshal(*rawMsg, &updateSuggestedActions)
return &updateSuggestedActions, err
case UpdateNewInlineQueryType:
var updateNewInlineQuery UpdateNewInlineQuery
err := json.Unmarshal(*rawMsg, &updateNewInlineQuery)
return &updateNewInlineQuery, err
case UpdateNewChosenInlineResultType:
var updateNewChosenInlineResult UpdateNewChosenInlineResult
err := json.Unmarshal(*rawMsg, &updateNewChosenInlineResult)
return &updateNewChosenInlineResult, err
case UpdateNewCallbackQueryType:
var updateNewCallbackQuery UpdateNewCallbackQuery
err := json.Unmarshal(*rawMsg, &updateNewCallbackQuery)
return &updateNewCallbackQuery, err
case UpdateNewInlineCallbackQueryType:
var updateNewInlineCallbackQuery UpdateNewInlineCallbackQuery
err := json.Unmarshal(*rawMsg, &updateNewInlineCallbackQuery)
return &updateNewInlineCallbackQuery, err
case UpdateNewShippingQueryType:
var updateNewShippingQuery UpdateNewShippingQuery
err := json.Unmarshal(*rawMsg, &updateNewShippingQuery)
return &updateNewShippingQuery, err
case UpdateNewPreCheckoutQueryType:
var updateNewPreCheckoutQuery UpdateNewPreCheckoutQuery
err := json.Unmarshal(*rawMsg, &updateNewPreCheckoutQuery)
return &updateNewPreCheckoutQuery, err
case UpdateNewCustomEventType:
var updateNewCustomEvent UpdateNewCustomEvent
err := json.Unmarshal(*rawMsg, &updateNewCustomEvent)
return &updateNewCustomEvent, err
case UpdateNewCustomQueryType:
var updateNewCustomQuery UpdateNewCustomQuery
err := json.Unmarshal(*rawMsg, &updateNewCustomQuery)
return &updateNewCustomQuery, err
case UpdatePollType:
var updatePoll UpdatePoll
err := json.Unmarshal(*rawMsg, &updatePoll)
return &updatePoll, err
case UpdatePollAnswerType:
var updatePollAnswer UpdatePollAnswer
err := json.Unmarshal(*rawMsg, &updatePollAnswer)
return &updatePollAnswer, err
case UpdateChatMemberType:
var updateChatMember UpdateChatMember
err := json.Unmarshal(*rawMsg, &updateChatMember)
return &updateChatMember, err
case UpdateNewChatJoinRequestType:
var updateNewChatJoinRequest UpdateNewChatJoinRequest
err := json.Unmarshal(*rawMsg, &updateNewChatJoinRequest)
return &updateNewChatJoinRequest, err
default:
return nil, fmt.Errorf("Error UnMarshaling, unknown type:" + objMap["@type"].(string))
}
}
// UpdateAuthorizationState The user authorization state has changed
type UpdateAuthorizationState struct {
tdCommon
AuthorizationState AuthorizationState `json:"authorization_state"` // New authorization state
}
// MessageType return the string telegram-type of UpdateAuthorizationState
func (updateAuthorizationState *UpdateAuthorizationState) MessageType() string {
return "updateAuthorizationState"
}
// NewUpdateAuthorizationState creates a new UpdateAuthorizationState
//
// @param authorizationState New authorization state
func NewUpdateAuthorizationState(authorizationState AuthorizationState) *UpdateAuthorizationState {
updateAuthorizationStateTemp := UpdateAuthorizationState{
tdCommon: tdCommon{Type: "updateAuthorizationState"},
AuthorizationState: authorizationState,
}
return &updateAuthorizationStateTemp
}
// UnmarshalJSON unmarshal to json
func (updateAuthorizationState *UpdateAuthorizationState) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
tempObj := struct {
tdCommon
}{}
err = json.Unmarshal(b, &tempObj)
if err != nil {
return err
}
updateAuthorizationState.tdCommon = tempObj.tdCommon
fieldAuthorizationState, _ := unmarshalAuthorizationState(objMap["authorization_state"])
updateAuthorizationState.AuthorizationState = fieldAuthorizationState
return nil
}
// GetUpdateEnum return the enum type of this object
func (updateAuthorizationState *UpdateAuthorizationState) GetUpdateEnum() UpdateEnum {
return UpdateAuthorizationStateType
}
// UpdateNewMessage A new message was received; can also be an outgoing message
type UpdateNewMessage struct {
tdCommon
Message *Message `json:"message"` // The new message
}
// MessageType return the string telegram-type of UpdateNewMessage
func (updateNewMessage *UpdateNewMessage) MessageType() string {
return "updateNewMessage"
}
// NewUpdateNewMessage creates a new UpdateNewMessage
//
// @param message The new message
func NewUpdateNewMessage(message *Message) *UpdateNewMessage {
updateNewMessageTemp := UpdateNewMessage{
tdCommon: tdCommon{Type: "updateNewMessage"},
Message: message,
}
return &updateNewMessageTemp
}
// GetUpdateEnum return the enum type of this object
func (updateNewMessage *UpdateNewMessage) GetUpdateEnum() UpdateEnum {
return UpdateNewMessageType
}
// UpdateMessageSendAcknowledged A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message
type UpdateMessageSendAcknowledged struct {
tdCommon
ChatId int64 `json:"chat_id"` // The chat identifier of the sent message
MessageId int64 `json:"message_id"` // A temporary message identifier
}
// MessageType return the string telegram-type of UpdateMessageSendAcknowledged
func (updateMessageSendAcknowledged *UpdateMessageSendAcknowledged) MessageType() string {
return "updateMessageSendAcknowledged"
}
// NewUpdateMessageSendAcknowledged creates a new UpdateMessageSendAcknowledged
//
// @param chatId The chat identifier of the sent message
// @param messageId A temporary message identifier
func NewUpdateMessageSendAcknowledged(chatId int64, messageId int64) *UpdateMessageSendAcknowledged {
updateMessageSendAcknowledgedTemp := UpdateMessageSendAcknowledged{
tdCommon: tdCommon{Type: "updateMessageSendAcknowledged"},
ChatId: chatId,
MessageId: messageId,
}
return &updateMessageSendAcknowledgedTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageSendAcknowledged *UpdateMessageSendAcknowledged) GetUpdateEnum() UpdateEnum {
return UpdateMessageSendAcknowledgedType
}
// UpdateMessageSendSucceeded A message has been successfully sent
type UpdateMessageSendSucceeded struct {
tdCommon
Message *Message `json:"message"` // The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change
OldMessageId int64 `json:"old_message_id"` // The previous temporary message identifier
}
// MessageType return the string telegram-type of UpdateMessageSendSucceeded
func (updateMessageSendSucceeded *UpdateMessageSendSucceeded) MessageType() string {
return "updateMessageSendSucceeded"
}
// NewUpdateMessageSendSucceeded creates a new UpdateMessageSendSucceeded
//
// @param message The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change
// @param oldMessageId The previous temporary message identifier
func NewUpdateMessageSendSucceeded(message *Message, oldMessageId int64) *UpdateMessageSendSucceeded {
updateMessageSendSucceededTemp := UpdateMessageSendSucceeded{
tdCommon: tdCommon{Type: "updateMessageSendSucceeded"},
Message: message,
OldMessageId: oldMessageId,
}
return &updateMessageSendSucceededTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageSendSucceeded *UpdateMessageSendSucceeded) GetUpdateEnum() UpdateEnum {
return UpdateMessageSendSucceededType
}
// UpdateMessageSendFailed A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update
type UpdateMessageSendFailed struct {
tdCommon
Message *Message `json:"message"` // The failed to send message
OldMessageId int64 `json:"old_message_id"` // The previous temporary message identifier
ErrorCode int32 `json:"error_code"` // An error code
ErrorMessage string `json:"error_message"` // Error message
}
// MessageType return the string telegram-type of UpdateMessageSendFailed
func (updateMessageSendFailed *UpdateMessageSendFailed) MessageType() string {
return "updateMessageSendFailed"
}
// NewUpdateMessageSendFailed creates a new UpdateMessageSendFailed
//
// @param message The failed to send message
// @param oldMessageId The previous temporary message identifier
// @param errorCode An error code
// @param errorMessage Error message
func NewUpdateMessageSendFailed(message *Message, oldMessageId int64, errorCode int32, errorMessage string) *UpdateMessageSendFailed {
updateMessageSendFailedTemp := UpdateMessageSendFailed{
tdCommon: tdCommon{Type: "updateMessageSendFailed"},
Message: message,
OldMessageId: oldMessageId,
ErrorCode: errorCode,
ErrorMessage: errorMessage,
}
return &updateMessageSendFailedTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageSendFailed *UpdateMessageSendFailed) GetUpdateEnum() UpdateEnum {
return UpdateMessageSendFailedType
}
// UpdateMessageContent The message content has changed
type UpdateMessageContent struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
NewContent MessageContent `json:"new_content"` // New message content
}
// MessageType return the string telegram-type of UpdateMessageContent
func (updateMessageContent *UpdateMessageContent) MessageType() string {
return "updateMessageContent"
}
// NewUpdateMessageContent creates a new UpdateMessageContent
//
// @param chatId Chat identifier
// @param messageId Message identifier
// @param newContent New message content
func NewUpdateMessageContent(chatId int64, messageId int64, newContent MessageContent) *UpdateMessageContent {
updateMessageContentTemp := UpdateMessageContent{
tdCommon: tdCommon{Type: "updateMessageContent"},
ChatId: chatId,
MessageId: messageId,
NewContent: newContent,
}
return &updateMessageContentTemp
}
// UnmarshalJSON unmarshal to json
func (updateMessageContent *UpdateMessageContent) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
tempObj := struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
}{}
err = json.Unmarshal(b, &tempObj)
if err != nil {
return err
}
updateMessageContent.tdCommon = tempObj.tdCommon
updateMessageContent.ChatId = tempObj.ChatId
updateMessageContent.MessageId = tempObj.MessageId
fieldNewContent, _ := unmarshalMessageContent(objMap["new_content"])
updateMessageContent.NewContent = fieldNewContent
return nil
}
// GetUpdateEnum return the enum type of this object
func (updateMessageContent *UpdateMessageContent) GetUpdateEnum() UpdateEnum {
return UpdateMessageContentType
}
// UpdateMessageEdited A message was edited. Changes in the message content will come in a separate updateMessageContent
type UpdateMessageEdited struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
EditDate int32 `json:"edit_date"` // Point in time (Unix timestamp) when the message was edited
ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message reply markup; may be null
}
// MessageType return the string telegram-type of UpdateMessageEdited
func (updateMessageEdited *UpdateMessageEdited) MessageType() string {
return "updateMessageEdited"
}
// NewUpdateMessageEdited creates a new UpdateMessageEdited
//
// @param chatId Chat identifier
// @param messageId Message identifier
// @param editDate Point in time (Unix timestamp) when the message was edited
// @param replyMarkup New message reply markup; may be null
func NewUpdateMessageEdited(chatId int64, messageId int64, editDate int32, replyMarkup ReplyMarkup) *UpdateMessageEdited {
updateMessageEditedTemp := UpdateMessageEdited{
tdCommon: tdCommon{Type: "updateMessageEdited"},
ChatId: chatId,
MessageId: messageId,
EditDate: editDate,
ReplyMarkup: replyMarkup,
}
return &updateMessageEditedTemp
}
// UnmarshalJSON unmarshal to json
func (updateMessageEdited *UpdateMessageEdited) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
tempObj := struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
EditDate int32 `json:"edit_date"` // Point in time (Unix timestamp) when the message was edited
}{}
err = json.Unmarshal(b, &tempObj)
if err != nil {
return err
}
updateMessageEdited.tdCommon = tempObj.tdCommon
updateMessageEdited.ChatId = tempObj.ChatId
updateMessageEdited.MessageId = tempObj.MessageId
updateMessageEdited.EditDate = tempObj.EditDate
fieldReplyMarkup, _ := unmarshalReplyMarkup(objMap["reply_markup"])
updateMessageEdited.ReplyMarkup = fieldReplyMarkup
return nil
}
// GetUpdateEnum return the enum type of this object
func (updateMessageEdited *UpdateMessageEdited) GetUpdateEnum() UpdateEnum {
return UpdateMessageEditedType
}
// UpdateMessageIsPinned The message pinned state was changed
type UpdateMessageIsPinned struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // The message identifier
IsPinned bool `json:"is_pinned"` // True, if the message is pinned
}
// MessageType return the string telegram-type of UpdateMessageIsPinned
func (updateMessageIsPinned *UpdateMessageIsPinned) MessageType() string {
return "updateMessageIsPinned"
}
// NewUpdateMessageIsPinned creates a new UpdateMessageIsPinned
//
// @param chatId Chat identifier
// @param messageId The message identifier
// @param isPinned True, if the message is pinned
func NewUpdateMessageIsPinned(chatId int64, messageId int64, isPinned bool) *UpdateMessageIsPinned {
updateMessageIsPinnedTemp := UpdateMessageIsPinned{
tdCommon: tdCommon{Type: "updateMessageIsPinned"},
ChatId: chatId,
MessageId: messageId,
IsPinned: isPinned,
}
return &updateMessageIsPinnedTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageIsPinned *UpdateMessageIsPinned) GetUpdateEnum() UpdateEnum {
return UpdateMessageIsPinnedType
}
// UpdateMessageInteractionInfo The information about interactions with a message has changed
type UpdateMessageInteractionInfo struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
InteractionInfo *MessageInteractionInfo `json:"interaction_info"` // New information about interactions with the message; may be null
}
// MessageType return the string telegram-type of UpdateMessageInteractionInfo
func (updateMessageInteractionInfo *UpdateMessageInteractionInfo) MessageType() string {
return "updateMessageInteractionInfo"
}
// NewUpdateMessageInteractionInfo creates a new UpdateMessageInteractionInfo
//
// @param chatId Chat identifier
// @param messageId Message identifier
// @param interactionInfo New information about interactions with the message; may be null
func NewUpdateMessageInteractionInfo(chatId int64, messageId int64, interactionInfo *MessageInteractionInfo) *UpdateMessageInteractionInfo {
updateMessageInteractionInfoTemp := UpdateMessageInteractionInfo{
tdCommon: tdCommon{Type: "updateMessageInteractionInfo"},
ChatId: chatId,
MessageId: messageId,
InteractionInfo: interactionInfo,
}
return &updateMessageInteractionInfoTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageInteractionInfo *UpdateMessageInteractionInfo) GetUpdateEnum() UpdateEnum {
return UpdateMessageInteractionInfoType
}
// UpdateMessageContentOpened The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the TTL timer for self-destructing messages
type UpdateMessageContentOpened struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
}
// MessageType return the string telegram-type of UpdateMessageContentOpened
func (updateMessageContentOpened *UpdateMessageContentOpened) MessageType() string {
return "updateMessageContentOpened"
}
// NewUpdateMessageContentOpened creates a new UpdateMessageContentOpened
//
// @param chatId Chat identifier
// @param messageId Message identifier
func NewUpdateMessageContentOpened(chatId int64, messageId int64) *UpdateMessageContentOpened {
updateMessageContentOpenedTemp := UpdateMessageContentOpened{
tdCommon: tdCommon{Type: "updateMessageContentOpened"},
ChatId: chatId,
MessageId: messageId,
}
return &updateMessageContentOpenedTemp
}
// GetUpdateEnum return the enum type of this object
func (updateMessageContentOpened *UpdateMessageContentOpened) GetUpdateEnum() UpdateEnum {
return UpdateMessageContentOpenedType
}
// UpdateMessageMentionRead A message with an unread mention was read
type UpdateMessageMentionRead struct {
tdCommon
ChatId int64 `json:"chat_id"` // Chat identifier
MessageId int64 `json:"message_id"` // Message identifier
UnreadMentionCount int32 `json:"unread_mention_count"` // The new number of unread mention messages left in the chat