-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
tl_rich_text_gen.go
2631 lines (2340 loc) · 58.3 KB
/
tl_rich_text_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/tdjson"
"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{}
_ = tdjson.Encoder{}
)
// TextEmpty represents TL type `textEmpty#dc3d824f`.
// Empty rich text element
//
// See https://core.telegram.org/constructor/textEmpty for reference.
type TextEmpty struct {
}
// TextEmptyTypeID is TL type id of TextEmpty.
const TextEmptyTypeID = 0xdc3d824f
// construct implements constructor of RichTextClass.
func (t TextEmpty) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextEmpty.
var (
_ bin.Encoder = &TextEmpty{}
_ bin.Decoder = &TextEmpty{}
_ bin.BareEncoder = &TextEmpty{}
_ bin.BareDecoder = &TextEmpty{}
_ RichTextClass = &TextEmpty{}
)
func (t *TextEmpty) Zero() bool {
if t == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (t *TextEmpty) String() string {
if t == nil {
return "TextEmpty(nil)"
}
type Alias TextEmpty
return fmt.Sprintf("TextEmpty%+v", Alias(*t))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextEmpty) TypeID() uint32 {
return TextEmptyTypeID
}
// TypeName returns name of type in TL schema.
func (*TextEmpty) TypeName() string {
return "textEmpty"
}
// TypeInfo returns info about TL type.
func (t *TextEmpty) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textEmpty",
ID: TextEmptyTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (t *TextEmpty) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textEmpty#dc3d824f as nil")
}
b.PutID(TextEmptyTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextEmpty) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textEmpty#dc3d824f as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextEmpty) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textEmpty#dc3d824f to nil")
}
if err := b.ConsumeID(TextEmptyTypeID); err != nil {
return fmt.Errorf("unable to decode textEmpty#dc3d824f: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextEmpty) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textEmpty#dc3d824f to nil")
}
return nil
}
// TextPlain represents TL type `textPlain#744694e0`.
// Plain text
//
// See https://core.telegram.org/constructor/textPlain for reference.
type TextPlain struct {
// Text
Text string
}
// TextPlainTypeID is TL type id of TextPlain.
const TextPlainTypeID = 0x744694e0
// construct implements constructor of RichTextClass.
func (t TextPlain) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextPlain.
var (
_ bin.Encoder = &TextPlain{}
_ bin.Decoder = &TextPlain{}
_ bin.BareEncoder = &TextPlain{}
_ bin.BareDecoder = &TextPlain{}
_ RichTextClass = &TextPlain{}
)
func (t *TextPlain) Zero() bool {
if t == nil {
return true
}
if !(t.Text == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextPlain) String() string {
if t == nil {
return "TextPlain(nil)"
}
type Alias TextPlain
return fmt.Sprintf("TextPlain%+v", Alias(*t))
}
// FillFrom fills TextPlain from given interface.
func (t *TextPlain) FillFrom(from interface {
GetText() (value string)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextPlain) TypeID() uint32 {
return TextPlainTypeID
}
// TypeName returns name of type in TL schema.
func (*TextPlain) TypeName() string {
return "textPlain"
}
// TypeInfo returns info about TL type.
func (t *TextPlain) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textPlain",
ID: TextPlainTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextPlain) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textPlain#744694e0 as nil")
}
b.PutID(TextPlainTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextPlain) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textPlain#744694e0 as nil")
}
b.PutString(t.Text)
return nil
}
// Decode implements bin.Decoder.
func (t *TextPlain) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textPlain#744694e0 to nil")
}
if err := b.ConsumeID(TextPlainTypeID); err != nil {
return fmt.Errorf("unable to decode textPlain#744694e0: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextPlain) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textPlain#744694e0 to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode textPlain#744694e0: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextPlain) GetText() (value string) {
if t == nil {
return
}
return t.Text
}
// TextBold represents TL type `textBold#6724abc4`.
// Bold text
//
// See https://core.telegram.org/constructor/textBold for reference.
type TextBold struct {
// Text
Text RichTextClass
}
// TextBoldTypeID is TL type id of TextBold.
const TextBoldTypeID = 0x6724abc4
// construct implements constructor of RichTextClass.
func (t TextBold) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextBold.
var (
_ bin.Encoder = &TextBold{}
_ bin.Decoder = &TextBold{}
_ bin.BareEncoder = &TextBold{}
_ bin.BareDecoder = &TextBold{}
_ RichTextClass = &TextBold{}
)
func (t *TextBold) Zero() bool {
if t == nil {
return true
}
if !(t.Text == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextBold) String() string {
if t == nil {
return "TextBold(nil)"
}
type Alias TextBold
return fmt.Sprintf("TextBold%+v", Alias(*t))
}
// FillFrom fills TextBold from given interface.
func (t *TextBold) FillFrom(from interface {
GetText() (value RichTextClass)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextBold) TypeID() uint32 {
return TextBoldTypeID
}
// TypeName returns name of type in TL schema.
func (*TextBold) TypeName() string {
return "textBold"
}
// TypeInfo returns info about TL type.
func (t *TextBold) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textBold",
ID: TextBoldTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextBold) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textBold#6724abc4 as nil")
}
b.PutID(TextBoldTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextBold) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textBold#6724abc4 as nil")
}
if t.Text == nil {
return fmt.Errorf("unable to encode textBold#6724abc4: field text is nil")
}
if err := t.Text.Encode(b); err != nil {
return fmt.Errorf("unable to encode textBold#6724abc4: field text: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextBold) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textBold#6724abc4 to nil")
}
if err := b.ConsumeID(TextBoldTypeID); err != nil {
return fmt.Errorf("unable to decode textBold#6724abc4: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextBold) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textBold#6724abc4 to nil")
}
{
value, err := DecodeRichText(b)
if err != nil {
return fmt.Errorf("unable to decode textBold#6724abc4: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextBold) GetText() (value RichTextClass) {
if t == nil {
return
}
return t.Text
}
// TextItalic represents TL type `textItalic#d912a59c`.
// Italic text
//
// See https://core.telegram.org/constructor/textItalic for reference.
type TextItalic struct {
// Text
Text RichTextClass
}
// TextItalicTypeID is TL type id of TextItalic.
const TextItalicTypeID = 0xd912a59c
// construct implements constructor of RichTextClass.
func (t TextItalic) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextItalic.
var (
_ bin.Encoder = &TextItalic{}
_ bin.Decoder = &TextItalic{}
_ bin.BareEncoder = &TextItalic{}
_ bin.BareDecoder = &TextItalic{}
_ RichTextClass = &TextItalic{}
)
func (t *TextItalic) Zero() bool {
if t == nil {
return true
}
if !(t.Text == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextItalic) String() string {
if t == nil {
return "TextItalic(nil)"
}
type Alias TextItalic
return fmt.Sprintf("TextItalic%+v", Alias(*t))
}
// FillFrom fills TextItalic from given interface.
func (t *TextItalic) FillFrom(from interface {
GetText() (value RichTextClass)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextItalic) TypeID() uint32 {
return TextItalicTypeID
}
// TypeName returns name of type in TL schema.
func (*TextItalic) TypeName() string {
return "textItalic"
}
// TypeInfo returns info about TL type.
func (t *TextItalic) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textItalic",
ID: TextItalicTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextItalic) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textItalic#d912a59c as nil")
}
b.PutID(TextItalicTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextItalic) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textItalic#d912a59c as nil")
}
if t.Text == nil {
return fmt.Errorf("unable to encode textItalic#d912a59c: field text is nil")
}
if err := t.Text.Encode(b); err != nil {
return fmt.Errorf("unable to encode textItalic#d912a59c: field text: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextItalic) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textItalic#d912a59c to nil")
}
if err := b.ConsumeID(TextItalicTypeID); err != nil {
return fmt.Errorf("unable to decode textItalic#d912a59c: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextItalic) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textItalic#d912a59c to nil")
}
{
value, err := DecodeRichText(b)
if err != nil {
return fmt.Errorf("unable to decode textItalic#d912a59c: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextItalic) GetText() (value RichTextClass) {
if t == nil {
return
}
return t.Text
}
// TextUnderline represents TL type `textUnderline#c12622c4`.
// Underlined text
//
// See https://core.telegram.org/constructor/textUnderline for reference.
type TextUnderline struct {
// Text
Text RichTextClass
}
// TextUnderlineTypeID is TL type id of TextUnderline.
const TextUnderlineTypeID = 0xc12622c4
// construct implements constructor of RichTextClass.
func (t TextUnderline) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextUnderline.
var (
_ bin.Encoder = &TextUnderline{}
_ bin.Decoder = &TextUnderline{}
_ bin.BareEncoder = &TextUnderline{}
_ bin.BareDecoder = &TextUnderline{}
_ RichTextClass = &TextUnderline{}
)
func (t *TextUnderline) Zero() bool {
if t == nil {
return true
}
if !(t.Text == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextUnderline) String() string {
if t == nil {
return "TextUnderline(nil)"
}
type Alias TextUnderline
return fmt.Sprintf("TextUnderline%+v", Alias(*t))
}
// FillFrom fills TextUnderline from given interface.
func (t *TextUnderline) FillFrom(from interface {
GetText() (value RichTextClass)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextUnderline) TypeID() uint32 {
return TextUnderlineTypeID
}
// TypeName returns name of type in TL schema.
func (*TextUnderline) TypeName() string {
return "textUnderline"
}
// TypeInfo returns info about TL type.
func (t *TextUnderline) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textUnderline",
ID: TextUnderlineTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextUnderline) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textUnderline#c12622c4 as nil")
}
b.PutID(TextUnderlineTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextUnderline) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textUnderline#c12622c4 as nil")
}
if t.Text == nil {
return fmt.Errorf("unable to encode textUnderline#c12622c4: field text is nil")
}
if err := t.Text.Encode(b); err != nil {
return fmt.Errorf("unable to encode textUnderline#c12622c4: field text: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextUnderline) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textUnderline#c12622c4 to nil")
}
if err := b.ConsumeID(TextUnderlineTypeID); err != nil {
return fmt.Errorf("unable to decode textUnderline#c12622c4: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextUnderline) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textUnderline#c12622c4 to nil")
}
{
value, err := DecodeRichText(b)
if err != nil {
return fmt.Errorf("unable to decode textUnderline#c12622c4: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextUnderline) GetText() (value RichTextClass) {
if t == nil {
return
}
return t.Text
}
// TextStrike represents TL type `textStrike#9bf8bb95`.
// Strikethrough text
//
// See https://core.telegram.org/constructor/textStrike for reference.
type TextStrike struct {
// Text
Text RichTextClass
}
// TextStrikeTypeID is TL type id of TextStrike.
const TextStrikeTypeID = 0x9bf8bb95
// construct implements constructor of RichTextClass.
func (t TextStrike) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextStrike.
var (
_ bin.Encoder = &TextStrike{}
_ bin.Decoder = &TextStrike{}
_ bin.BareEncoder = &TextStrike{}
_ bin.BareDecoder = &TextStrike{}
_ RichTextClass = &TextStrike{}
)
func (t *TextStrike) Zero() bool {
if t == nil {
return true
}
if !(t.Text == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextStrike) String() string {
if t == nil {
return "TextStrike(nil)"
}
type Alias TextStrike
return fmt.Sprintf("TextStrike%+v", Alias(*t))
}
// FillFrom fills TextStrike from given interface.
func (t *TextStrike) FillFrom(from interface {
GetText() (value RichTextClass)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextStrike) TypeID() uint32 {
return TextStrikeTypeID
}
// TypeName returns name of type in TL schema.
func (*TextStrike) TypeName() string {
return "textStrike"
}
// TypeInfo returns info about TL type.
func (t *TextStrike) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textStrike",
ID: TextStrikeTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextStrike) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textStrike#9bf8bb95 as nil")
}
b.PutID(TextStrikeTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextStrike) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textStrike#9bf8bb95 as nil")
}
if t.Text == nil {
return fmt.Errorf("unable to encode textStrike#9bf8bb95: field text is nil")
}
if err := t.Text.Encode(b); err != nil {
return fmt.Errorf("unable to encode textStrike#9bf8bb95: field text: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextStrike) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textStrike#9bf8bb95 to nil")
}
if err := b.ConsumeID(TextStrikeTypeID); err != nil {
return fmt.Errorf("unable to decode textStrike#9bf8bb95: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextStrike) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textStrike#9bf8bb95 to nil")
}
{
value, err := DecodeRichText(b)
if err != nil {
return fmt.Errorf("unable to decode textStrike#9bf8bb95: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextStrike) GetText() (value RichTextClass) {
if t == nil {
return
}
return t.Text
}
// TextFixed represents TL type `textFixed#6c3f19b9`.
// fixed-width rich text
//
// See https://core.telegram.org/constructor/textFixed for reference.
type TextFixed struct {
// Text
Text RichTextClass
}
// TextFixedTypeID is TL type id of TextFixed.
const TextFixedTypeID = 0x6c3f19b9
// construct implements constructor of RichTextClass.
func (t TextFixed) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextFixed.
var (
_ bin.Encoder = &TextFixed{}
_ bin.Decoder = &TextFixed{}
_ bin.BareEncoder = &TextFixed{}
_ bin.BareDecoder = &TextFixed{}
_ RichTextClass = &TextFixed{}
)
func (t *TextFixed) Zero() bool {
if t == nil {
return true
}
if !(t.Text == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TextFixed) String() string {
if t == nil {
return "TextFixed(nil)"
}
type Alias TextFixed
return fmt.Sprintf("TextFixed%+v", Alias(*t))
}
// FillFrom fills TextFixed from given interface.
func (t *TextFixed) FillFrom(from interface {
GetText() (value RichTextClass)
}) {
t.Text = from.GetText()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TextFixed) TypeID() uint32 {
return TextFixedTypeID
}
// TypeName returns name of type in TL schema.
func (*TextFixed) TypeName() string {
return "textFixed"
}
// TypeInfo returns info about TL type.
func (t *TextFixed) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "textFixed",
ID: TextFixedTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Text",
SchemaName: "text",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TextFixed) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textFixed#6c3f19b9 as nil")
}
b.PutID(TextFixedTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TextFixed) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode textFixed#6c3f19b9 as nil")
}
if t.Text == nil {
return fmt.Errorf("unable to encode textFixed#6c3f19b9: field text is nil")
}
if err := t.Text.Encode(b); err != nil {
return fmt.Errorf("unable to encode textFixed#6c3f19b9: field text: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (t *TextFixed) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textFixed#6c3f19b9 to nil")
}
if err := b.ConsumeID(TextFixedTypeID); err != nil {
return fmt.Errorf("unable to decode textFixed#6c3f19b9: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TextFixed) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode textFixed#6c3f19b9 to nil")
}
{
value, err := DecodeRichText(b)
if err != nil {
return fmt.Errorf("unable to decode textFixed#6c3f19b9: field text: %w", err)
}
t.Text = value
}
return nil
}
// GetText returns value of Text field.
func (t *TextFixed) GetText() (value RichTextClass) {
if t == nil {
return
}
return t.Text
}
// TextURL represents TL type `textUrl#3c2884c1`.
// Link
//
// See https://core.telegram.org/constructor/textUrl for reference.
type TextURL struct {
// Text of link
Text RichTextClass
// Webpage HTTP URL
URL string
// If a preview was already generated for the page, the page ID
WebpageID int64
}
// TextURLTypeID is TL type id of TextURL.
const TextURLTypeID = 0x3c2884c1
// construct implements constructor of RichTextClass.
func (t TextURL) construct() RichTextClass { return &t }
// Ensuring interfaces in compile-time for TextURL.
var (
_ bin.Encoder = &TextURL{}
_ bin.Decoder = &TextURL{}
_ bin.BareEncoder = &TextURL{}
_ bin.BareDecoder = &TextURL{}
_ RichTextClass = &TextURL{}
)
func (t *TextURL) Zero() bool {