-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
tl_privacy_key_gen.go
1064 lines (919 loc) · 28 KB
/
tl_privacy_key_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{}
)
// PrivacyKeyStatusTimestamp represents TL type `privacyKeyStatusTimestamp#bc2eab30`.
// Whether we can see the last online timestamp
//
// See https://core.telegram.org/constructor/privacyKeyStatusTimestamp for reference.
type PrivacyKeyStatusTimestamp struct {
}
// PrivacyKeyStatusTimestampTypeID is TL type id of PrivacyKeyStatusTimestamp.
const PrivacyKeyStatusTimestampTypeID = 0xbc2eab30
func (p *PrivacyKeyStatusTimestamp) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyStatusTimestamp) String() string {
if p == nil {
return "PrivacyKeyStatusTimestamp(nil)"
}
type Alias PrivacyKeyStatusTimestamp
return fmt.Sprintf("PrivacyKeyStatusTimestamp%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyStatusTimestamp) TypeID() uint32 {
return PrivacyKeyStatusTimestampTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyStatusTimestamp) TypeName() string {
return "privacyKeyStatusTimestamp"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyStatusTimestamp) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyStatusTimestamp",
ID: PrivacyKeyStatusTimestampTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyStatusTimestamp) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyStatusTimestamp#bc2eab30 as nil")
}
b.PutID(PrivacyKeyStatusTimestampTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyStatusTimestamp) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyStatusTimestamp#bc2eab30 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyStatusTimestamp) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyStatusTimestamp#bc2eab30 to nil")
}
if err := b.ConsumeID(PrivacyKeyStatusTimestampTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyStatusTimestamp#bc2eab30: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyStatusTimestamp) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyStatusTimestamp#bc2eab30 to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyStatusTimestamp) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyStatusTimestamp.
var (
_ bin.Encoder = &PrivacyKeyStatusTimestamp{}
_ bin.Decoder = &PrivacyKeyStatusTimestamp{}
_ bin.BareEncoder = &PrivacyKeyStatusTimestamp{}
_ bin.BareDecoder = &PrivacyKeyStatusTimestamp{}
_ PrivacyKeyClass = &PrivacyKeyStatusTimestamp{}
)
// PrivacyKeyChatInvite represents TL type `privacyKeyChatInvite#500e6dfa`.
// Whether the user can be invited to chats
//
// See https://core.telegram.org/constructor/privacyKeyChatInvite for reference.
type PrivacyKeyChatInvite struct {
}
// PrivacyKeyChatInviteTypeID is TL type id of PrivacyKeyChatInvite.
const PrivacyKeyChatInviteTypeID = 0x500e6dfa
func (p *PrivacyKeyChatInvite) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyChatInvite) String() string {
if p == nil {
return "PrivacyKeyChatInvite(nil)"
}
type Alias PrivacyKeyChatInvite
return fmt.Sprintf("PrivacyKeyChatInvite%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyChatInvite) TypeID() uint32 {
return PrivacyKeyChatInviteTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyChatInvite) TypeName() string {
return "privacyKeyChatInvite"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyChatInvite) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyChatInvite",
ID: PrivacyKeyChatInviteTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyChatInvite) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyChatInvite#500e6dfa as nil")
}
b.PutID(PrivacyKeyChatInviteTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyChatInvite) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyChatInvite#500e6dfa as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyChatInvite) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyChatInvite#500e6dfa to nil")
}
if err := b.ConsumeID(PrivacyKeyChatInviteTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyChatInvite#500e6dfa: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyChatInvite) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyChatInvite#500e6dfa to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyChatInvite) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyChatInvite.
var (
_ bin.Encoder = &PrivacyKeyChatInvite{}
_ bin.Decoder = &PrivacyKeyChatInvite{}
_ bin.BareEncoder = &PrivacyKeyChatInvite{}
_ bin.BareDecoder = &PrivacyKeyChatInvite{}
_ PrivacyKeyClass = &PrivacyKeyChatInvite{}
)
// PrivacyKeyPhoneCall represents TL type `privacyKeyPhoneCall#3d662b7b`.
// Whether the user accepts phone calls
//
// See https://core.telegram.org/constructor/privacyKeyPhoneCall for reference.
type PrivacyKeyPhoneCall struct {
}
// PrivacyKeyPhoneCallTypeID is TL type id of PrivacyKeyPhoneCall.
const PrivacyKeyPhoneCallTypeID = 0x3d662b7b
func (p *PrivacyKeyPhoneCall) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyPhoneCall) String() string {
if p == nil {
return "PrivacyKeyPhoneCall(nil)"
}
type Alias PrivacyKeyPhoneCall
return fmt.Sprintf("PrivacyKeyPhoneCall%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyPhoneCall) TypeID() uint32 {
return PrivacyKeyPhoneCallTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyPhoneCall) TypeName() string {
return "privacyKeyPhoneCall"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyPhoneCall) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyPhoneCall",
ID: PrivacyKeyPhoneCallTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyPhoneCall) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneCall#3d662b7b as nil")
}
b.PutID(PrivacyKeyPhoneCallTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyPhoneCall) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneCall#3d662b7b as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyPhoneCall) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneCall#3d662b7b to nil")
}
if err := b.ConsumeID(PrivacyKeyPhoneCallTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyPhoneCall#3d662b7b: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyPhoneCall) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneCall#3d662b7b to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyPhoneCall) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyPhoneCall.
var (
_ bin.Encoder = &PrivacyKeyPhoneCall{}
_ bin.Decoder = &PrivacyKeyPhoneCall{}
_ bin.BareEncoder = &PrivacyKeyPhoneCall{}
_ bin.BareDecoder = &PrivacyKeyPhoneCall{}
_ PrivacyKeyClass = &PrivacyKeyPhoneCall{}
)
// PrivacyKeyPhoneP2P represents TL type `privacyKeyPhoneP2P#39491cc8`.
// Whether P2P connections in phone calls are allowed
//
// See https://core.telegram.org/constructor/privacyKeyPhoneP2P for reference.
type PrivacyKeyPhoneP2P struct {
}
// PrivacyKeyPhoneP2PTypeID is TL type id of PrivacyKeyPhoneP2P.
const PrivacyKeyPhoneP2PTypeID = 0x39491cc8
func (p *PrivacyKeyPhoneP2P) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyPhoneP2P) String() string {
if p == nil {
return "PrivacyKeyPhoneP2P(nil)"
}
type Alias PrivacyKeyPhoneP2P
return fmt.Sprintf("PrivacyKeyPhoneP2P%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyPhoneP2P) TypeID() uint32 {
return PrivacyKeyPhoneP2PTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyPhoneP2P) TypeName() string {
return "privacyKeyPhoneP2P"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyPhoneP2P) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyPhoneP2P",
ID: PrivacyKeyPhoneP2PTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyPhoneP2P) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneP2P#39491cc8 as nil")
}
b.PutID(PrivacyKeyPhoneP2PTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyPhoneP2P) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneP2P#39491cc8 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyPhoneP2P) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneP2P#39491cc8 to nil")
}
if err := b.ConsumeID(PrivacyKeyPhoneP2PTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyPhoneP2P#39491cc8: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyPhoneP2P) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneP2P#39491cc8 to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyPhoneP2P) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyPhoneP2P.
var (
_ bin.Encoder = &PrivacyKeyPhoneP2P{}
_ bin.Decoder = &PrivacyKeyPhoneP2P{}
_ bin.BareEncoder = &PrivacyKeyPhoneP2P{}
_ bin.BareDecoder = &PrivacyKeyPhoneP2P{}
_ PrivacyKeyClass = &PrivacyKeyPhoneP2P{}
)
// PrivacyKeyForwards represents TL type `privacyKeyForwards#69ec56a3`.
// Whether messages forwarded from the user will be anonymously forwarded¹
//
// Links:
// 1) https://telegram.org/blog/unsend-privacy-emoji#anonymous-forwarding
//
// See https://core.telegram.org/constructor/privacyKeyForwards for reference.
type PrivacyKeyForwards struct {
}
// PrivacyKeyForwardsTypeID is TL type id of PrivacyKeyForwards.
const PrivacyKeyForwardsTypeID = 0x69ec56a3
func (p *PrivacyKeyForwards) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyForwards) String() string {
if p == nil {
return "PrivacyKeyForwards(nil)"
}
type Alias PrivacyKeyForwards
return fmt.Sprintf("PrivacyKeyForwards%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyForwards) TypeID() uint32 {
return PrivacyKeyForwardsTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyForwards) TypeName() string {
return "privacyKeyForwards"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyForwards) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyForwards",
ID: PrivacyKeyForwardsTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyForwards) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyForwards#69ec56a3 as nil")
}
b.PutID(PrivacyKeyForwardsTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyForwards) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyForwards#69ec56a3 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyForwards) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyForwards#69ec56a3 to nil")
}
if err := b.ConsumeID(PrivacyKeyForwardsTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyForwards#69ec56a3: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyForwards) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyForwards#69ec56a3 to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyForwards) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyForwards.
var (
_ bin.Encoder = &PrivacyKeyForwards{}
_ bin.Decoder = &PrivacyKeyForwards{}
_ bin.BareEncoder = &PrivacyKeyForwards{}
_ bin.BareDecoder = &PrivacyKeyForwards{}
_ PrivacyKeyClass = &PrivacyKeyForwards{}
)
// PrivacyKeyProfilePhoto represents TL type `privacyKeyProfilePhoto#96151fed`.
// Whether the profile picture of the user is visible
//
// See https://core.telegram.org/constructor/privacyKeyProfilePhoto for reference.
type PrivacyKeyProfilePhoto struct {
}
// PrivacyKeyProfilePhotoTypeID is TL type id of PrivacyKeyProfilePhoto.
const PrivacyKeyProfilePhotoTypeID = 0x96151fed
func (p *PrivacyKeyProfilePhoto) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyProfilePhoto) String() string {
if p == nil {
return "PrivacyKeyProfilePhoto(nil)"
}
type Alias PrivacyKeyProfilePhoto
return fmt.Sprintf("PrivacyKeyProfilePhoto%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyProfilePhoto) TypeID() uint32 {
return PrivacyKeyProfilePhotoTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyProfilePhoto) TypeName() string {
return "privacyKeyProfilePhoto"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyProfilePhoto) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyProfilePhoto",
ID: PrivacyKeyProfilePhotoTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyProfilePhoto) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyProfilePhoto#96151fed as nil")
}
b.PutID(PrivacyKeyProfilePhotoTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyProfilePhoto) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyProfilePhoto#96151fed as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyProfilePhoto) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyProfilePhoto#96151fed to nil")
}
if err := b.ConsumeID(PrivacyKeyProfilePhotoTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyProfilePhoto#96151fed: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyProfilePhoto) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyProfilePhoto#96151fed to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyProfilePhoto) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyProfilePhoto.
var (
_ bin.Encoder = &PrivacyKeyProfilePhoto{}
_ bin.Decoder = &PrivacyKeyProfilePhoto{}
_ bin.BareEncoder = &PrivacyKeyProfilePhoto{}
_ bin.BareDecoder = &PrivacyKeyProfilePhoto{}
_ PrivacyKeyClass = &PrivacyKeyProfilePhoto{}
)
// PrivacyKeyPhoneNumber represents TL type `privacyKeyPhoneNumber#d19ae46d`.
// Whether the user allows us to see his phone number
//
// See https://core.telegram.org/constructor/privacyKeyPhoneNumber for reference.
type PrivacyKeyPhoneNumber struct {
}
// PrivacyKeyPhoneNumberTypeID is TL type id of PrivacyKeyPhoneNumber.
const PrivacyKeyPhoneNumberTypeID = 0xd19ae46d
func (p *PrivacyKeyPhoneNumber) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyPhoneNumber) String() string {
if p == nil {
return "PrivacyKeyPhoneNumber(nil)"
}
type Alias PrivacyKeyPhoneNumber
return fmt.Sprintf("PrivacyKeyPhoneNumber%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyPhoneNumber) TypeID() uint32 {
return PrivacyKeyPhoneNumberTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyPhoneNumber) TypeName() string {
return "privacyKeyPhoneNumber"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyPhoneNumber) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyPhoneNumber",
ID: PrivacyKeyPhoneNumberTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyPhoneNumber) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneNumber#d19ae46d as nil")
}
b.PutID(PrivacyKeyPhoneNumberTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyPhoneNumber) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyPhoneNumber#d19ae46d as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyPhoneNumber) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneNumber#d19ae46d to nil")
}
if err := b.ConsumeID(PrivacyKeyPhoneNumberTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyPhoneNumber#d19ae46d: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyPhoneNumber) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyPhoneNumber#d19ae46d to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyPhoneNumber) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyPhoneNumber.
var (
_ bin.Encoder = &PrivacyKeyPhoneNumber{}
_ bin.Decoder = &PrivacyKeyPhoneNumber{}
_ bin.BareEncoder = &PrivacyKeyPhoneNumber{}
_ bin.BareDecoder = &PrivacyKeyPhoneNumber{}
_ PrivacyKeyClass = &PrivacyKeyPhoneNumber{}
)
// PrivacyKeyAddedByPhone represents TL type `privacyKeyAddedByPhone#42ffd42b`.
// Whether people can add you to their contact list by your phone number
//
// See https://core.telegram.org/constructor/privacyKeyAddedByPhone for reference.
type PrivacyKeyAddedByPhone struct {
}
// PrivacyKeyAddedByPhoneTypeID is TL type id of PrivacyKeyAddedByPhone.
const PrivacyKeyAddedByPhoneTypeID = 0x42ffd42b
func (p *PrivacyKeyAddedByPhone) Zero() bool {
if p == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (p *PrivacyKeyAddedByPhone) String() string {
if p == nil {
return "PrivacyKeyAddedByPhone(nil)"
}
type Alias PrivacyKeyAddedByPhone
return fmt.Sprintf("PrivacyKeyAddedByPhone%+v", Alias(*p))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PrivacyKeyAddedByPhone) TypeID() uint32 {
return PrivacyKeyAddedByPhoneTypeID
}
// TypeName returns name of type in TL schema.
func (*PrivacyKeyAddedByPhone) TypeName() string {
return "privacyKeyAddedByPhone"
}
// TypeInfo returns info about TL type.
func (p *PrivacyKeyAddedByPhone) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "privacyKeyAddedByPhone",
ID: PrivacyKeyAddedByPhoneTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (p *PrivacyKeyAddedByPhone) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyAddedByPhone#42ffd42b as nil")
}
b.PutID(PrivacyKeyAddedByPhoneTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PrivacyKeyAddedByPhone) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode privacyKeyAddedByPhone#42ffd42b as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (p *PrivacyKeyAddedByPhone) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyAddedByPhone#42ffd42b to nil")
}
if err := b.ConsumeID(PrivacyKeyAddedByPhoneTypeID); err != nil {
return fmt.Errorf("unable to decode privacyKeyAddedByPhone#42ffd42b: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PrivacyKeyAddedByPhone) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode privacyKeyAddedByPhone#42ffd42b to nil")
}
return nil
}
// construct implements constructor of PrivacyKeyClass.
func (p PrivacyKeyAddedByPhone) construct() PrivacyKeyClass { return &p }
// Ensuring interfaces in compile-time for PrivacyKeyAddedByPhone.
var (
_ bin.Encoder = &PrivacyKeyAddedByPhone{}
_ bin.Decoder = &PrivacyKeyAddedByPhone{}
_ bin.BareEncoder = &PrivacyKeyAddedByPhone{}
_ bin.BareDecoder = &PrivacyKeyAddedByPhone{}
_ PrivacyKeyClass = &PrivacyKeyAddedByPhone{}
)
// PrivacyKeyClass represents PrivacyKey generic type.
//
// See https://core.telegram.org/type/PrivacyKey for reference.
//
// Example:
// g, err := tg.DecodePrivacyKey(buf)
// if err != nil {
// panic(err)
// }
// switch v := g.(type) {
// case *tg.PrivacyKeyStatusTimestamp: // privacyKeyStatusTimestamp#bc2eab30
// case *tg.PrivacyKeyChatInvite: // privacyKeyChatInvite#500e6dfa
// case *tg.PrivacyKeyPhoneCall: // privacyKeyPhoneCall#3d662b7b
// case *tg.PrivacyKeyPhoneP2P: // privacyKeyPhoneP2P#39491cc8
// case *tg.PrivacyKeyForwards: // privacyKeyForwards#69ec56a3
// case *tg.PrivacyKeyProfilePhoto: // privacyKeyProfilePhoto#96151fed
// case *tg.PrivacyKeyPhoneNumber: // privacyKeyPhoneNumber#d19ae46d
// case *tg.PrivacyKeyAddedByPhone: // privacyKeyAddedByPhone#42ffd42b
// default: panic(v)
// }
type PrivacyKeyClass interface {
bin.Encoder
bin.Decoder
bin.BareEncoder
bin.BareDecoder
construct() PrivacyKeyClass
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
TypeID() uint32
// TypeName returns name of type in TL schema.
TypeName() string
// String implements fmt.Stringer.
String() string
// Zero returns true if current object has a zero value.
Zero() bool
}
// DecodePrivacyKey implements binary de-serialization for PrivacyKeyClass.
func DecodePrivacyKey(buf *bin.Buffer) (PrivacyKeyClass, error) {
id, err := buf.PeekID()
if err != nil {
return nil, err
}
switch id {
case PrivacyKeyStatusTimestampTypeID:
// Decoding privacyKeyStatusTimestamp#bc2eab30.
v := PrivacyKeyStatusTimestamp{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyChatInviteTypeID:
// Decoding privacyKeyChatInvite#500e6dfa.
v := PrivacyKeyChatInvite{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyPhoneCallTypeID:
// Decoding privacyKeyPhoneCall#3d662b7b.
v := PrivacyKeyPhoneCall{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyPhoneP2PTypeID:
// Decoding privacyKeyPhoneP2P#39491cc8.
v := PrivacyKeyPhoneP2P{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyForwardsTypeID:
// Decoding privacyKeyForwards#69ec56a3.
v := PrivacyKeyForwards{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyProfilePhotoTypeID:
// Decoding privacyKeyProfilePhoto#96151fed.
v := PrivacyKeyProfilePhoto{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyPhoneNumberTypeID:
// Decoding privacyKeyPhoneNumber#d19ae46d.
v := PrivacyKeyPhoneNumber{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
case PrivacyKeyAddedByPhoneTypeID:
// Decoding privacyKeyAddedByPhone#42ffd42b.
v := PrivacyKeyAddedByPhone{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err)
}
return &v, nil
default:
return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", bin.NewUnexpectedID(id))
}
}
// PrivacyKey boxes the PrivacyKeyClass providing a helper.
type PrivacyKeyBox struct {
PrivacyKey PrivacyKeyClass
}
// Decode implements bin.Decoder for PrivacyKeyBox.
func (b *PrivacyKeyBox) Decode(buf *bin.Buffer) error {
if b == nil {
return fmt.Errorf("unable to decode PrivacyKeyBox to nil")
}
v, err := DecodePrivacyKey(buf)
if err != nil {
return fmt.Errorf("unable to decode boxed value: %w", err)
}
b.PrivacyKey = v
return nil
}
// Encode implements bin.Encode for PrivacyKeyBox.
func (b *PrivacyKeyBox) Encode(buf *bin.Buffer) error {
if b == nil || b.PrivacyKey == nil {
return fmt.Errorf("unable to encode PrivacyKeyClass as nil")
}
return b.PrivacyKey.Encode(buf)
}
// PrivacyKeyClassArray is adapter for slice of PrivacyKeyClass.
type PrivacyKeyClassArray []PrivacyKeyClass
// Sort sorts slice of PrivacyKeyClass.
func (s PrivacyKeyClassArray) Sort(less func(a, b PrivacyKeyClass) bool) PrivacyKeyClassArray {
sort.Slice(s, func(i, j int) bool {
return less(s[i], s[j])
})
return s
}
// SortStable sorts slice of PrivacyKeyClass.
func (s PrivacyKeyClassArray) SortStable(less func(a, b PrivacyKeyClass) bool) PrivacyKeyClassArray {
sort.SliceStable(s, func(i, j int) bool {
return less(s[i], s[j])
})
return s