-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
tl_input_peer_gen.go
1742 lines (1516 loc) · 41.4 KB
/
tl_input_peer_gen.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
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
)
// InputPeerEmpty represents TL type `inputPeerEmpty#7f3b18ea`.
// An empty constructor, no user or chat is defined.
//
// See https://core.telegram.org/constructor/inputPeerEmpty for reference.
type InputPeerEmpty struct {
}
// InputPeerEmptyTypeID is TL type id of InputPeerEmpty.
const InputPeerEmptyTypeID = 0x7f3b18ea
func (i *InputPeerEmpty) Zero() bool {
if i == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerEmpty) String() string {
if i == nil {
return "InputPeerEmpty(nil)"
}
type Alias InputPeerEmpty
return fmt.Sprintf("InputPeerEmpty%+v", Alias(*i))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerEmpty) TypeID() uint32 {
return InputPeerEmptyTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerEmpty) TypeName() string {
return "inputPeerEmpty"
}
// TypeInfo returns info about TL type.
func (i *InputPeerEmpty) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerEmpty",
ID: InputPeerEmptyTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerEmpty) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerEmpty#7f3b18ea as nil")
}
b.PutID(InputPeerEmptyTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerEmpty) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerEmpty#7f3b18ea as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (i *InputPeerEmpty) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerEmpty#7f3b18ea to nil")
}
if err := b.ConsumeID(InputPeerEmptyTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerEmpty#7f3b18ea: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerEmpty) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerEmpty#7f3b18ea to nil")
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerEmpty) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerEmpty.
var (
_ bin.Encoder = &InputPeerEmpty{}
_ bin.Decoder = &InputPeerEmpty{}
_ bin.BareEncoder = &InputPeerEmpty{}
_ bin.BareDecoder = &InputPeerEmpty{}
_ InputPeerClass = &InputPeerEmpty{}
)
// InputPeerSelf represents TL type `inputPeerSelf#7da07ec9`.
// Defines the current user.
//
// See https://core.telegram.org/constructor/inputPeerSelf for reference.
type InputPeerSelf struct {
}
// InputPeerSelfTypeID is TL type id of InputPeerSelf.
const InputPeerSelfTypeID = 0x7da07ec9
func (i *InputPeerSelf) Zero() bool {
if i == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerSelf) String() string {
if i == nil {
return "InputPeerSelf(nil)"
}
type Alias InputPeerSelf
return fmt.Sprintf("InputPeerSelf%+v", Alias(*i))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerSelf) TypeID() uint32 {
return InputPeerSelfTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerSelf) TypeName() string {
return "inputPeerSelf"
}
// TypeInfo returns info about TL type.
func (i *InputPeerSelf) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerSelf",
ID: InputPeerSelfTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerSelf) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerSelf#7da07ec9 as nil")
}
b.PutID(InputPeerSelfTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerSelf) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerSelf#7da07ec9 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (i *InputPeerSelf) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerSelf#7da07ec9 to nil")
}
if err := b.ConsumeID(InputPeerSelfTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerSelf#7da07ec9: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerSelf) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerSelf#7da07ec9 to nil")
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerSelf) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerSelf.
var (
_ bin.Encoder = &InputPeerSelf{}
_ bin.Decoder = &InputPeerSelf{}
_ bin.BareEncoder = &InputPeerSelf{}
_ bin.BareDecoder = &InputPeerSelf{}
_ InputPeerClass = &InputPeerSelf{}
)
// InputPeerChat represents TL type `inputPeerChat#179be863`.
// Defines a chat for further interaction.
//
// See https://core.telegram.org/constructor/inputPeerChat for reference.
type InputPeerChat struct {
// Chat idientifier
ChatID int
}
// InputPeerChatTypeID is TL type id of InputPeerChat.
const InputPeerChatTypeID = 0x179be863
func (i *InputPeerChat) Zero() bool {
if i == nil {
return true
}
if !(i.ChatID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerChat) String() string {
if i == nil {
return "InputPeerChat(nil)"
}
type Alias InputPeerChat
return fmt.Sprintf("InputPeerChat%+v", Alias(*i))
}
// FillFrom fills InputPeerChat from given interface.
func (i *InputPeerChat) FillFrom(from interface {
GetChatID() (value int)
}) {
i.ChatID = from.GetChatID()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerChat) TypeID() uint32 {
return InputPeerChatTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerChat) TypeName() string {
return "inputPeerChat"
}
// TypeInfo returns info about TL type.
func (i *InputPeerChat) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerChat",
ID: InputPeerChatTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ChatID",
SchemaName: "chat_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerChat) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChat#179be863 as nil")
}
b.PutID(InputPeerChatTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerChat) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChat#179be863 as nil")
}
b.PutInt(i.ChatID)
return nil
}
// GetChatID returns value of ChatID field.
func (i *InputPeerChat) GetChatID() (value int) {
return i.ChatID
}
// Decode implements bin.Decoder.
func (i *InputPeerChat) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerChat#179be863 to nil")
}
if err := b.ConsumeID(InputPeerChatTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerChat#179be863: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerChat) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerChat#179be863 to nil")
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputPeerChat#179be863: field chat_id: %w", err)
}
i.ChatID = value
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerChat) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerChat.
var (
_ bin.Encoder = &InputPeerChat{}
_ bin.Decoder = &InputPeerChat{}
_ bin.BareEncoder = &InputPeerChat{}
_ bin.BareDecoder = &InputPeerChat{}
_ InputPeerClass = &InputPeerChat{}
)
// InputPeerUser represents TL type `inputPeerUser#7b8e7de6`.
// Defines a user for further interaction.
//
// See https://core.telegram.org/constructor/inputPeerUser for reference.
type InputPeerUser struct {
// User identifier
UserID int
// access_hash value from the user¹ constructor
//
// Links:
// 1) https://core.telegram.org/constructor/user
AccessHash int64
}
// InputPeerUserTypeID is TL type id of InputPeerUser.
const InputPeerUserTypeID = 0x7b8e7de6
func (i *InputPeerUser) Zero() bool {
if i == nil {
return true
}
if !(i.UserID == 0) {
return false
}
if !(i.AccessHash == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerUser) String() string {
if i == nil {
return "InputPeerUser(nil)"
}
type Alias InputPeerUser
return fmt.Sprintf("InputPeerUser%+v", Alias(*i))
}
// FillFrom fills InputPeerUser from given interface.
func (i *InputPeerUser) FillFrom(from interface {
GetUserID() (value int)
GetAccessHash() (value int64)
}) {
i.UserID = from.GetUserID()
i.AccessHash = from.GetAccessHash()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerUser) TypeID() uint32 {
return InputPeerUserTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerUser) TypeName() string {
return "inputPeerUser"
}
// TypeInfo returns info about TL type.
func (i *InputPeerUser) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerUser",
ID: InputPeerUserTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "UserID",
SchemaName: "user_id",
},
{
Name: "AccessHash",
SchemaName: "access_hash",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerUser) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerUser#7b8e7de6 as nil")
}
b.PutID(InputPeerUserTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerUser) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerUser#7b8e7de6 as nil")
}
b.PutInt(i.UserID)
b.PutLong(i.AccessHash)
return nil
}
// GetUserID returns value of UserID field.
func (i *InputPeerUser) GetUserID() (value int) {
return i.UserID
}
// GetAccessHash returns value of AccessHash field.
func (i *InputPeerUser) GetAccessHash() (value int64) {
return i.AccessHash
}
// Decode implements bin.Decoder.
func (i *InputPeerUser) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerUser#7b8e7de6 to nil")
}
if err := b.ConsumeID(InputPeerUserTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerUser#7b8e7de6: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerUser) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerUser#7b8e7de6 to nil")
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputPeerUser#7b8e7de6: field user_id: %w", err)
}
i.UserID = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode inputPeerUser#7b8e7de6: field access_hash: %w", err)
}
i.AccessHash = value
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerUser) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerUser.
var (
_ bin.Encoder = &InputPeerUser{}
_ bin.Decoder = &InputPeerUser{}
_ bin.BareEncoder = &InputPeerUser{}
_ bin.BareDecoder = &InputPeerUser{}
_ InputPeerClass = &InputPeerUser{}
)
// InputPeerChannel represents TL type `inputPeerChannel#20adaef8`.
// Defines a channel for further interaction.
//
// See https://core.telegram.org/constructor/inputPeerChannel for reference.
type InputPeerChannel struct {
// Channel identifier
ChannelID int
// access_hash value from the channel¹ constructor
//
// Links:
// 1) https://core.telegram.org/constructor/channel
AccessHash int64
}
// InputPeerChannelTypeID is TL type id of InputPeerChannel.
const InputPeerChannelTypeID = 0x20adaef8
func (i *InputPeerChannel) Zero() bool {
if i == nil {
return true
}
if !(i.ChannelID == 0) {
return false
}
if !(i.AccessHash == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerChannel) String() string {
if i == nil {
return "InputPeerChannel(nil)"
}
type Alias InputPeerChannel
return fmt.Sprintf("InputPeerChannel%+v", Alias(*i))
}
// FillFrom fills InputPeerChannel from given interface.
func (i *InputPeerChannel) FillFrom(from interface {
GetChannelID() (value int)
GetAccessHash() (value int64)
}) {
i.ChannelID = from.GetChannelID()
i.AccessHash = from.GetAccessHash()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerChannel) TypeID() uint32 {
return InputPeerChannelTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerChannel) TypeName() string {
return "inputPeerChannel"
}
// TypeInfo returns info about TL type.
func (i *InputPeerChannel) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerChannel",
ID: InputPeerChannelTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ChannelID",
SchemaName: "channel_id",
},
{
Name: "AccessHash",
SchemaName: "access_hash",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerChannel) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChannel#20adaef8 as nil")
}
b.PutID(InputPeerChannelTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerChannel) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChannel#20adaef8 as nil")
}
b.PutInt(i.ChannelID)
b.PutLong(i.AccessHash)
return nil
}
// GetChannelID returns value of ChannelID field.
func (i *InputPeerChannel) GetChannelID() (value int) {
return i.ChannelID
}
// GetAccessHash returns value of AccessHash field.
func (i *InputPeerChannel) GetAccessHash() (value int64) {
return i.AccessHash
}
// Decode implements bin.Decoder.
func (i *InputPeerChannel) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerChannel#20adaef8 to nil")
}
if err := b.ConsumeID(InputPeerChannelTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerChannel#20adaef8: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerChannel) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerChannel#20adaef8 to nil")
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputPeerChannel#20adaef8: field channel_id: %w", err)
}
i.ChannelID = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode inputPeerChannel#20adaef8: field access_hash: %w", err)
}
i.AccessHash = value
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerChannel) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerChannel.
var (
_ bin.Encoder = &InputPeerChannel{}
_ bin.Decoder = &InputPeerChannel{}
_ bin.BareEncoder = &InputPeerChannel{}
_ bin.BareDecoder = &InputPeerChannel{}
_ InputPeerClass = &InputPeerChannel{}
)
// InputPeerUserFromMessage represents TL type `inputPeerUserFromMessage#17bae2e6`.
// Defines a min¹ user that was seen in a certain message of a certain chat.
//
// Links:
// 1) https://core.telegram.org/api/min
//
// See https://core.telegram.org/constructor/inputPeerUserFromMessage for reference.
type InputPeerUserFromMessage struct {
// The chat where the user was seen
Peer InputPeerClass
// The message ID
MsgID int
// The identifier of the user that was seen
UserID int
}
// InputPeerUserFromMessageTypeID is TL type id of InputPeerUserFromMessage.
const InputPeerUserFromMessageTypeID = 0x17bae2e6
func (i *InputPeerUserFromMessage) Zero() bool {
if i == nil {
return true
}
if !(i.Peer == nil) {
return false
}
if !(i.MsgID == 0) {
return false
}
if !(i.UserID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerUserFromMessage) String() string {
if i == nil {
return "InputPeerUserFromMessage(nil)"
}
type Alias InputPeerUserFromMessage
return fmt.Sprintf("InputPeerUserFromMessage%+v", Alias(*i))
}
// FillFrom fills InputPeerUserFromMessage from given interface.
func (i *InputPeerUserFromMessage) FillFrom(from interface {
GetPeer() (value InputPeerClass)
GetMsgID() (value int)
GetUserID() (value int)
}) {
i.Peer = from.GetPeer()
i.MsgID = from.GetMsgID()
i.UserID = from.GetUserID()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerUserFromMessage) TypeID() uint32 {
return InputPeerUserFromMessageTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerUserFromMessage) TypeName() string {
return "inputPeerUserFromMessage"
}
// TypeInfo returns info about TL type.
func (i *InputPeerUserFromMessage) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerUserFromMessage",
ID: InputPeerUserFromMessageTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Peer",
SchemaName: "peer",
},
{
Name: "MsgID",
SchemaName: "msg_id",
},
{
Name: "UserID",
SchemaName: "user_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerUserFromMessage) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerUserFromMessage#17bae2e6 as nil")
}
b.PutID(InputPeerUserFromMessageTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerUserFromMessage) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerUserFromMessage#17bae2e6 as nil")
}
if i.Peer == nil {
return fmt.Errorf("unable to encode inputPeerUserFromMessage#17bae2e6: field peer is nil")
}
if err := i.Peer.Encode(b); err != nil {
return fmt.Errorf("unable to encode inputPeerUserFromMessage#17bae2e6: field peer: %w", err)
}
b.PutInt(i.MsgID)
b.PutInt(i.UserID)
return nil
}
// GetPeer returns value of Peer field.
func (i *InputPeerUserFromMessage) GetPeer() (value InputPeerClass) {
return i.Peer
}
// GetMsgID returns value of MsgID field.
func (i *InputPeerUserFromMessage) GetMsgID() (value int) {
return i.MsgID
}
// GetUserID returns value of UserID field.
func (i *InputPeerUserFromMessage) GetUserID() (value int) {
return i.UserID
}
// Decode implements bin.Decoder.
func (i *InputPeerUserFromMessage) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerUserFromMessage#17bae2e6 to nil")
}
if err := b.ConsumeID(InputPeerUserFromMessageTypeID); err != nil {
return fmt.Errorf("unable to decode inputPeerUserFromMessage#17bae2e6: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputPeerUserFromMessage) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputPeerUserFromMessage#17bae2e6 to nil")
}
{
value, err := DecodeInputPeer(b)
if err != nil {
return fmt.Errorf("unable to decode inputPeerUserFromMessage#17bae2e6: field peer: %w", err)
}
i.Peer = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputPeerUserFromMessage#17bae2e6: field msg_id: %w", err)
}
i.MsgID = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputPeerUserFromMessage#17bae2e6: field user_id: %w", err)
}
i.UserID = value
}
return nil
}
// construct implements constructor of InputPeerClass.
func (i InputPeerUserFromMessage) construct() InputPeerClass { return &i }
// Ensuring interfaces in compile-time for InputPeerUserFromMessage.
var (
_ bin.Encoder = &InputPeerUserFromMessage{}
_ bin.Decoder = &InputPeerUserFromMessage{}
_ bin.BareEncoder = &InputPeerUserFromMessage{}
_ bin.BareDecoder = &InputPeerUserFromMessage{}
_ InputPeerClass = &InputPeerUserFromMessage{}
)
// InputPeerChannelFromMessage represents TL type `inputPeerChannelFromMessage#9c95f7bb`.
// Defines a min¹ channel that was seen in a certain message of a certain chat.
//
// Links:
// 1) https://core.telegram.org/api/min
//
// See https://core.telegram.org/constructor/inputPeerChannelFromMessage for reference.
type InputPeerChannelFromMessage struct {
// The chat where the channel's message was seen
Peer InputPeerClass
// The message ID
MsgID int
// The identifier of the channel that was seen
ChannelID int
}
// InputPeerChannelFromMessageTypeID is TL type id of InputPeerChannelFromMessage.
const InputPeerChannelFromMessageTypeID = 0x9c95f7bb
func (i *InputPeerChannelFromMessage) Zero() bool {
if i == nil {
return true
}
if !(i.Peer == nil) {
return false
}
if !(i.MsgID == 0) {
return false
}
if !(i.ChannelID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputPeerChannelFromMessage) String() string {
if i == nil {
return "InputPeerChannelFromMessage(nil)"
}
type Alias InputPeerChannelFromMessage
return fmt.Sprintf("InputPeerChannelFromMessage%+v", Alias(*i))
}
// FillFrom fills InputPeerChannelFromMessage from given interface.
func (i *InputPeerChannelFromMessage) FillFrom(from interface {
GetPeer() (value InputPeerClass)
GetMsgID() (value int)
GetChannelID() (value int)
}) {
i.Peer = from.GetPeer()
i.MsgID = from.GetMsgID()
i.ChannelID = from.GetChannelID()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerChannelFromMessage) TypeID() uint32 {
return InputPeerChannelFromMessageTypeID
}
// TypeName returns name of type in TL schema.
func (*InputPeerChannelFromMessage) TypeName() string {
return "inputPeerChannelFromMessage"
}
// TypeInfo returns info about TL type.
func (i *InputPeerChannelFromMessage) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputPeerChannelFromMessage",
ID: InputPeerChannelFromMessageTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Peer",
SchemaName: "peer",
},
{
Name: "MsgID",
SchemaName: "msg_id",
},
{
Name: "ChannelID",
SchemaName: "channel_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputPeerChannelFromMessage) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChannelFromMessage#9c95f7bb as nil")
}
b.PutID(InputPeerChannelFromMessageTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputPeerChannelFromMessage) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputPeerChannelFromMessage#9c95f7bb as nil")
}
if i.Peer == nil {
return fmt.Errorf("unable to encode inputPeerChannelFromMessage#9c95f7bb: field peer is nil")
}
if err := i.Peer.Encode(b); err != nil {
return fmt.Errorf("unable to encode inputPeerChannelFromMessage#9c95f7bb: field peer: %w", err)
}
b.PutInt(i.MsgID)
b.PutInt(i.ChannelID)
return nil
}
// GetPeer returns value of Peer field.
func (i *InputPeerChannelFromMessage) GetPeer() (value InputPeerClass) {
return i.Peer
}
// GetMsgID returns value of MsgID field.
func (i *InputPeerChannelFromMessage) GetMsgID() (value int) {