+16
-6
gen/main.go
+16
-6
gen/main.go
···
4
4
"reflect"
5
5
6
6
"github.com/bluesky-social/indigo/mst"
7
-
"github.com/vylet-app/go/generated/atproto"
8
7
"github.com/vylet-app/go/generated/vylet"
9
8
cbg "github.com/whyrusleeping/cbor-gen"
10
9
)
···
21
20
22
21
if err := genCfg.WriteMapEncodersToFile("generated/vylet/cbor_gen.go", "vylet",
23
22
vylet.ActorProfile{},
23
+
vylet.FeedComment{},
24
+
vylet.FeedLike{},
25
+
vylet.FeedPost{},
26
+
vylet.GraphFollow{},
27
+
vylet.RichtextFacet{},
28
+
vylet.RichtextFacet_ByteSlice{},
29
+
vylet.RichtextFacet_Link{},
30
+
vylet.RichtextFacet_Mention{},
31
+
vylet.MediaImages{},
32
+
vylet.MediaImages_Image{},
33
+
vylet.MediaDefs_AspectRatio{},
24
34
); err != nil {
25
35
panic(err)
26
36
}
27
37
28
-
if err := genCfg.WriteMapEncodersToFile("generated/atproto/cbor_gen.go", "atproto",
29
-
atproto.RepoStrongRef{},
30
-
); err != nil {
31
-
panic(err)
32
-
}
38
+
// if err := genCfg.WriteMapEncodersToFile("generated/atproto/cbor_gen.go", "atproto",
39
+
// atproto.RepoStrongRef{},
40
+
// ); err != nil {
41
+
// panic(err)
42
+
// }
33
43
}
+2120
generated/vylet/cbor_gen.go
+2120
generated/vylet/cbor_gen.go
···
8
8
"math"
9
9
"sort"
10
10
11
+
atproto "github.com/bluesky-social/indigo/api/atproto"
11
12
util "github.com/bluesky-social/indigo/lex/util"
12
13
cid "github.com/ipfs/go-cid"
13
14
cbg "github.com/whyrusleeping/cbor-gen"
···
387
388
388
389
return nil
389
390
}
391
+
func (t *FeedComment) MarshalCBOR(w io.Writer) error {
392
+
if t == nil {
393
+
_, err := w.Write(cbg.CborNull)
394
+
return err
395
+
}
396
+
397
+
cw := cbg.NewCborWriter(w)
398
+
fieldCount := 6
399
+
400
+
if t.Facets == nil {
401
+
fieldCount--
402
+
}
403
+
404
+
if t.Parent == nil {
405
+
fieldCount--
406
+
}
407
+
408
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
409
+
return err
410
+
}
411
+
412
+
// t.Root (atproto.RepoStrongRef) (struct)
413
+
if len("root") > 1000000 {
414
+
return xerrors.Errorf("Value in field \"root\" was too long")
415
+
}
416
+
417
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("root"))); err != nil {
418
+
return err
419
+
}
420
+
if _, err := cw.WriteString(string("root")); err != nil {
421
+
return err
422
+
}
423
+
424
+
if err := t.Root.MarshalCBOR(cw); err != nil {
425
+
return err
426
+
}
427
+
428
+
// t.Text (string) (string)
429
+
if len("text") > 1000000 {
430
+
return xerrors.Errorf("Value in field \"text\" was too long")
431
+
}
432
+
433
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("text"))); err != nil {
434
+
return err
435
+
}
436
+
if _, err := cw.WriteString(string("text")); err != nil {
437
+
return err
438
+
}
439
+
440
+
if len(t.Text) > 1000000 {
441
+
return xerrors.Errorf("Value in field t.Text was too long")
442
+
}
443
+
444
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Text))); err != nil {
445
+
return err
446
+
}
447
+
if _, err := cw.WriteString(string(t.Text)); err != nil {
448
+
return err
449
+
}
450
+
451
+
// t.LexiconTypeID (string) (string)
452
+
if len("$type") > 1000000 {
453
+
return xerrors.Errorf("Value in field \"$type\" was too long")
454
+
}
455
+
456
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
457
+
return err
458
+
}
459
+
if _, err := cw.WriteString(string("$type")); err != nil {
460
+
return err
461
+
}
462
+
463
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.feed.comment"))); err != nil {
464
+
return err
465
+
}
466
+
if _, err := cw.WriteString(string("app.vylet.feed.comment")); err != nil {
467
+
return err
468
+
}
469
+
470
+
// t.Facets ([]*vylet.RichtextFacet) (slice)
471
+
if t.Facets != nil {
472
+
473
+
if len("facets") > 1000000 {
474
+
return xerrors.Errorf("Value in field \"facets\" was too long")
475
+
}
476
+
477
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("facets"))); err != nil {
478
+
return err
479
+
}
480
+
if _, err := cw.WriteString(string("facets")); err != nil {
481
+
return err
482
+
}
483
+
484
+
if len(t.Facets) > 8192 {
485
+
return xerrors.Errorf("Slice value in field t.Facets was too long")
486
+
}
487
+
488
+
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Facets))); err != nil {
489
+
return err
490
+
}
491
+
for _, v := range t.Facets {
492
+
if err := v.MarshalCBOR(cw); err != nil {
493
+
return err
494
+
}
495
+
496
+
}
497
+
}
498
+
499
+
// t.Parent (atproto.RepoStrongRef) (struct)
500
+
if t.Parent != nil {
501
+
502
+
if len("parent") > 1000000 {
503
+
return xerrors.Errorf("Value in field \"parent\" was too long")
504
+
}
505
+
506
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("parent"))); err != nil {
507
+
return err
508
+
}
509
+
if _, err := cw.WriteString(string("parent")); err != nil {
510
+
return err
511
+
}
512
+
513
+
if err := t.Parent.MarshalCBOR(cw); err != nil {
514
+
return err
515
+
}
516
+
}
517
+
518
+
// t.CreatedAt (string) (string)
519
+
if len("createdAt") > 1000000 {
520
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
521
+
}
522
+
523
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
524
+
return err
525
+
}
526
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
527
+
return err
528
+
}
529
+
530
+
if len(t.CreatedAt) > 1000000 {
531
+
return xerrors.Errorf("Value in field t.CreatedAt was too long")
532
+
}
533
+
534
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
535
+
return err
536
+
}
537
+
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
538
+
return err
539
+
}
540
+
return nil
541
+
}
542
+
543
+
func (t *FeedComment) UnmarshalCBOR(r io.Reader) (err error) {
544
+
*t = FeedComment{}
545
+
546
+
cr := cbg.NewCborReader(r)
547
+
548
+
maj, extra, err := cr.ReadHeader()
549
+
if err != nil {
550
+
return err
551
+
}
552
+
defer func() {
553
+
if err == io.EOF {
554
+
err = io.ErrUnexpectedEOF
555
+
}
556
+
}()
557
+
558
+
if maj != cbg.MajMap {
559
+
return fmt.Errorf("cbor input should be of type map")
560
+
}
561
+
562
+
if extra > cbg.MaxLength {
563
+
return fmt.Errorf("FeedComment: map struct too large (%d)", extra)
564
+
}
565
+
566
+
n := extra
567
+
568
+
nameBuf := make([]byte, 9)
569
+
for i := uint64(0); i < n; i++ {
570
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
571
+
if err != nil {
572
+
return err
573
+
}
574
+
575
+
if !ok {
576
+
// Field doesn't exist on this type, so ignore it
577
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
578
+
return err
579
+
}
580
+
continue
581
+
}
582
+
583
+
switch string(nameBuf[:nameLen]) {
584
+
// t.Root (atproto.RepoStrongRef) (struct)
585
+
case "root":
586
+
587
+
{
588
+
589
+
b, err := cr.ReadByte()
590
+
if err != nil {
591
+
return err
592
+
}
593
+
if b != cbg.CborNull[0] {
594
+
if err := cr.UnreadByte(); err != nil {
595
+
return err
596
+
}
597
+
t.Root = new(atproto.RepoStrongRef)
598
+
if err := t.Root.UnmarshalCBOR(cr); err != nil {
599
+
return xerrors.Errorf("unmarshaling t.Root pointer: %w", err)
600
+
}
601
+
}
602
+
603
+
}
604
+
// t.Text (string) (string)
605
+
case "text":
606
+
607
+
{
608
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
609
+
if err != nil {
610
+
return err
611
+
}
612
+
613
+
t.Text = string(sval)
614
+
}
615
+
// t.LexiconTypeID (string) (string)
616
+
case "$type":
617
+
618
+
{
619
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
620
+
if err != nil {
621
+
return err
622
+
}
623
+
624
+
t.LexiconTypeID = string(sval)
625
+
}
626
+
// t.Facets ([]*vylet.RichtextFacet) (slice)
627
+
case "facets":
628
+
629
+
maj, extra, err = cr.ReadHeader()
630
+
if err != nil {
631
+
return err
632
+
}
633
+
634
+
if extra > 8192 {
635
+
return fmt.Errorf("t.Facets: array too large (%d)", extra)
636
+
}
637
+
638
+
if maj != cbg.MajArray {
639
+
return fmt.Errorf("expected cbor array")
640
+
}
641
+
642
+
if extra > 0 {
643
+
t.Facets = make([]*RichtextFacet, extra)
644
+
}
645
+
646
+
for i := 0; i < int(extra); i++ {
647
+
{
648
+
var maj byte
649
+
var extra uint64
650
+
var err error
651
+
_ = maj
652
+
_ = extra
653
+
_ = err
654
+
655
+
{
656
+
657
+
b, err := cr.ReadByte()
658
+
if err != nil {
659
+
return err
660
+
}
661
+
if b != cbg.CborNull[0] {
662
+
if err := cr.UnreadByte(); err != nil {
663
+
return err
664
+
}
665
+
t.Facets[i] = new(RichtextFacet)
666
+
if err := t.Facets[i].UnmarshalCBOR(cr); err != nil {
667
+
return xerrors.Errorf("unmarshaling t.Facets[i] pointer: %w", err)
668
+
}
669
+
}
670
+
671
+
}
672
+
673
+
}
674
+
}
675
+
// t.Parent (atproto.RepoStrongRef) (struct)
676
+
case "parent":
677
+
678
+
{
679
+
680
+
b, err := cr.ReadByte()
681
+
if err != nil {
682
+
return err
683
+
}
684
+
if b != cbg.CborNull[0] {
685
+
if err := cr.UnreadByte(); err != nil {
686
+
return err
687
+
}
688
+
t.Parent = new(atproto.RepoStrongRef)
689
+
if err := t.Parent.UnmarshalCBOR(cr); err != nil {
690
+
return xerrors.Errorf("unmarshaling t.Parent pointer: %w", err)
691
+
}
692
+
}
693
+
694
+
}
695
+
// t.CreatedAt (string) (string)
696
+
case "createdAt":
697
+
698
+
{
699
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
700
+
if err != nil {
701
+
return err
702
+
}
703
+
704
+
t.CreatedAt = string(sval)
705
+
}
706
+
707
+
default:
708
+
// Field doesn't exist on this type, so ignore it
709
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
710
+
return err
711
+
}
712
+
}
713
+
}
714
+
715
+
return nil
716
+
}
717
+
func (t *FeedLike) MarshalCBOR(w io.Writer) error {
718
+
if t == nil {
719
+
_, err := w.Write(cbg.CborNull)
720
+
return err
721
+
}
722
+
723
+
cw := cbg.NewCborWriter(w)
724
+
725
+
if _, err := cw.Write([]byte{163}); err != nil {
726
+
return err
727
+
}
728
+
729
+
// t.LexiconTypeID (string) (string)
730
+
if len("$type") > 1000000 {
731
+
return xerrors.Errorf("Value in field \"$type\" was too long")
732
+
}
733
+
734
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
735
+
return err
736
+
}
737
+
if _, err := cw.WriteString(string("$type")); err != nil {
738
+
return err
739
+
}
740
+
741
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.feed.like"))); err != nil {
742
+
return err
743
+
}
744
+
if _, err := cw.WriteString(string("app.vylet.feed.like")); err != nil {
745
+
return err
746
+
}
747
+
748
+
// t.Subject (atproto.RepoStrongRef) (struct)
749
+
if len("subject") > 1000000 {
750
+
return xerrors.Errorf("Value in field \"subject\" was too long")
751
+
}
752
+
753
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
754
+
return err
755
+
}
756
+
if _, err := cw.WriteString(string("subject")); err != nil {
757
+
return err
758
+
}
759
+
760
+
if err := t.Subject.MarshalCBOR(cw); err != nil {
761
+
return err
762
+
}
763
+
764
+
// t.CreatedAt (string) (string)
765
+
if len("createdAt") > 1000000 {
766
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
767
+
}
768
+
769
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
770
+
return err
771
+
}
772
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
773
+
return err
774
+
}
775
+
776
+
if len(t.CreatedAt) > 1000000 {
777
+
return xerrors.Errorf("Value in field t.CreatedAt was too long")
778
+
}
779
+
780
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
781
+
return err
782
+
}
783
+
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
784
+
return err
785
+
}
786
+
return nil
787
+
}
788
+
789
+
func (t *FeedLike) UnmarshalCBOR(r io.Reader) (err error) {
790
+
*t = FeedLike{}
791
+
792
+
cr := cbg.NewCborReader(r)
793
+
794
+
maj, extra, err := cr.ReadHeader()
795
+
if err != nil {
796
+
return err
797
+
}
798
+
defer func() {
799
+
if err == io.EOF {
800
+
err = io.ErrUnexpectedEOF
801
+
}
802
+
}()
803
+
804
+
if maj != cbg.MajMap {
805
+
return fmt.Errorf("cbor input should be of type map")
806
+
}
807
+
808
+
if extra > cbg.MaxLength {
809
+
return fmt.Errorf("FeedLike: map struct too large (%d)", extra)
810
+
}
811
+
812
+
n := extra
813
+
814
+
nameBuf := make([]byte, 9)
815
+
for i := uint64(0); i < n; i++ {
816
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
817
+
if err != nil {
818
+
return err
819
+
}
820
+
821
+
if !ok {
822
+
// Field doesn't exist on this type, so ignore it
823
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
824
+
return err
825
+
}
826
+
continue
827
+
}
828
+
829
+
switch string(nameBuf[:nameLen]) {
830
+
// t.LexiconTypeID (string) (string)
831
+
case "$type":
832
+
833
+
{
834
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
835
+
if err != nil {
836
+
return err
837
+
}
838
+
839
+
t.LexiconTypeID = string(sval)
840
+
}
841
+
// t.Subject (atproto.RepoStrongRef) (struct)
842
+
case "subject":
843
+
844
+
{
845
+
846
+
b, err := cr.ReadByte()
847
+
if err != nil {
848
+
return err
849
+
}
850
+
if b != cbg.CborNull[0] {
851
+
if err := cr.UnreadByte(); err != nil {
852
+
return err
853
+
}
854
+
t.Subject = new(atproto.RepoStrongRef)
855
+
if err := t.Subject.UnmarshalCBOR(cr); err != nil {
856
+
return xerrors.Errorf("unmarshaling t.Subject pointer: %w", err)
857
+
}
858
+
}
859
+
860
+
}
861
+
// t.CreatedAt (string) (string)
862
+
case "createdAt":
863
+
864
+
{
865
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
866
+
if err != nil {
867
+
return err
868
+
}
869
+
870
+
t.CreatedAt = string(sval)
871
+
}
872
+
873
+
default:
874
+
// Field doesn't exist on this type, so ignore it
875
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
876
+
return err
877
+
}
878
+
}
879
+
}
880
+
881
+
return nil
882
+
}
883
+
func (t *FeedPost) MarshalCBOR(w io.Writer) error {
884
+
if t == nil {
885
+
_, err := w.Write(cbg.CborNull)
886
+
return err
887
+
}
888
+
889
+
cw := cbg.NewCborWriter(w)
890
+
fieldCount := 6
891
+
892
+
if t.Caption == nil {
893
+
fieldCount--
894
+
}
895
+
896
+
if t.Facets == nil {
897
+
fieldCount--
898
+
}
899
+
900
+
if t.Labels == nil {
901
+
fieldCount--
902
+
}
903
+
904
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
905
+
return err
906
+
}
907
+
908
+
// t.LexiconTypeID (string) (string)
909
+
if len("$type") > 1000000 {
910
+
return xerrors.Errorf("Value in field \"$type\" was too long")
911
+
}
912
+
913
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
914
+
return err
915
+
}
916
+
if _, err := cw.WriteString(string("$type")); err != nil {
917
+
return err
918
+
}
919
+
920
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.feed.post"))); err != nil {
921
+
return err
922
+
}
923
+
if _, err := cw.WriteString(string("app.vylet.feed.post")); err != nil {
924
+
return err
925
+
}
926
+
927
+
// t.Media (vylet.FeedPost_Media) (struct)
928
+
if len("media") > 1000000 {
929
+
return xerrors.Errorf("Value in field \"media\" was too long")
930
+
}
931
+
932
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("media"))); err != nil {
933
+
return err
934
+
}
935
+
if _, err := cw.WriteString(string("media")); err != nil {
936
+
return err
937
+
}
938
+
939
+
if err := t.Media.MarshalCBOR(cw); err != nil {
940
+
return err
941
+
}
942
+
943
+
// t.Facets ([]*vylet.RichtextFacet) (slice)
944
+
if t.Facets != nil {
945
+
946
+
if len("facets") > 1000000 {
947
+
return xerrors.Errorf("Value in field \"facets\" was too long")
948
+
}
949
+
950
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("facets"))); err != nil {
951
+
return err
952
+
}
953
+
if _, err := cw.WriteString(string("facets")); err != nil {
954
+
return err
955
+
}
956
+
957
+
if len(t.Facets) > 8192 {
958
+
return xerrors.Errorf("Slice value in field t.Facets was too long")
959
+
}
960
+
961
+
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Facets))); err != nil {
962
+
return err
963
+
}
964
+
for _, v := range t.Facets {
965
+
if err := v.MarshalCBOR(cw); err != nil {
966
+
return err
967
+
}
968
+
969
+
}
970
+
}
971
+
972
+
// t.Labels (vylet.FeedPost_Labels) (struct)
973
+
if t.Labels != nil {
974
+
975
+
if len("labels") > 1000000 {
976
+
return xerrors.Errorf("Value in field \"labels\" was too long")
977
+
}
978
+
979
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("labels"))); err != nil {
980
+
return err
981
+
}
982
+
if _, err := cw.WriteString(string("labels")); err != nil {
983
+
return err
984
+
}
985
+
986
+
if err := t.Labels.MarshalCBOR(cw); err != nil {
987
+
return err
988
+
}
989
+
}
990
+
991
+
// t.Caption (string) (string)
992
+
if t.Caption != nil {
993
+
994
+
if len("caption") > 1000000 {
995
+
return xerrors.Errorf("Value in field \"caption\" was too long")
996
+
}
997
+
998
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("caption"))); err != nil {
999
+
return err
1000
+
}
1001
+
if _, err := cw.WriteString(string("caption")); err != nil {
1002
+
return err
1003
+
}
1004
+
1005
+
if t.Caption == nil {
1006
+
if _, err := cw.Write(cbg.CborNull); err != nil {
1007
+
return err
1008
+
}
1009
+
} else {
1010
+
if len(*t.Caption) > 1000000 {
1011
+
return xerrors.Errorf("Value in field t.Caption was too long")
1012
+
}
1013
+
1014
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Caption))); err != nil {
1015
+
return err
1016
+
}
1017
+
if _, err := cw.WriteString(string(*t.Caption)); err != nil {
1018
+
return err
1019
+
}
1020
+
}
1021
+
}
1022
+
1023
+
// t.CreatedAt (string) (string)
1024
+
if len("createdAt") > 1000000 {
1025
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
1026
+
}
1027
+
1028
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
1029
+
return err
1030
+
}
1031
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
1032
+
return err
1033
+
}
1034
+
1035
+
if len(t.CreatedAt) > 1000000 {
1036
+
return xerrors.Errorf("Value in field t.CreatedAt was too long")
1037
+
}
1038
+
1039
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
1040
+
return err
1041
+
}
1042
+
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
1043
+
return err
1044
+
}
1045
+
return nil
1046
+
}
1047
+
1048
+
func (t *FeedPost) UnmarshalCBOR(r io.Reader) (err error) {
1049
+
*t = FeedPost{}
1050
+
1051
+
cr := cbg.NewCborReader(r)
1052
+
1053
+
maj, extra, err := cr.ReadHeader()
1054
+
if err != nil {
1055
+
return err
1056
+
}
1057
+
defer func() {
1058
+
if err == io.EOF {
1059
+
err = io.ErrUnexpectedEOF
1060
+
}
1061
+
}()
1062
+
1063
+
if maj != cbg.MajMap {
1064
+
return fmt.Errorf("cbor input should be of type map")
1065
+
}
1066
+
1067
+
if extra > cbg.MaxLength {
1068
+
return fmt.Errorf("FeedPost: map struct too large (%d)", extra)
1069
+
}
1070
+
1071
+
n := extra
1072
+
1073
+
nameBuf := make([]byte, 9)
1074
+
for i := uint64(0); i < n; i++ {
1075
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1076
+
if err != nil {
1077
+
return err
1078
+
}
1079
+
1080
+
if !ok {
1081
+
// Field doesn't exist on this type, so ignore it
1082
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1083
+
return err
1084
+
}
1085
+
continue
1086
+
}
1087
+
1088
+
switch string(nameBuf[:nameLen]) {
1089
+
// t.LexiconTypeID (string) (string)
1090
+
case "$type":
1091
+
1092
+
{
1093
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1094
+
if err != nil {
1095
+
return err
1096
+
}
1097
+
1098
+
t.LexiconTypeID = string(sval)
1099
+
}
1100
+
// t.Media (vylet.FeedPost_Media) (struct)
1101
+
case "media":
1102
+
1103
+
{
1104
+
1105
+
b, err := cr.ReadByte()
1106
+
if err != nil {
1107
+
return err
1108
+
}
1109
+
if b != cbg.CborNull[0] {
1110
+
if err := cr.UnreadByte(); err != nil {
1111
+
return err
1112
+
}
1113
+
t.Media = new(FeedPost_Media)
1114
+
if err := t.Media.UnmarshalCBOR(cr); err != nil {
1115
+
return xerrors.Errorf("unmarshaling t.Media pointer: %w", err)
1116
+
}
1117
+
}
1118
+
1119
+
}
1120
+
// t.Facets ([]*vylet.RichtextFacet) (slice)
1121
+
case "facets":
1122
+
1123
+
maj, extra, err = cr.ReadHeader()
1124
+
if err != nil {
1125
+
return err
1126
+
}
1127
+
1128
+
if extra > 8192 {
1129
+
return fmt.Errorf("t.Facets: array too large (%d)", extra)
1130
+
}
1131
+
1132
+
if maj != cbg.MajArray {
1133
+
return fmt.Errorf("expected cbor array")
1134
+
}
1135
+
1136
+
if extra > 0 {
1137
+
t.Facets = make([]*RichtextFacet, extra)
1138
+
}
1139
+
1140
+
for i := 0; i < int(extra); i++ {
1141
+
{
1142
+
var maj byte
1143
+
var extra uint64
1144
+
var err error
1145
+
_ = maj
1146
+
_ = extra
1147
+
_ = err
1148
+
1149
+
{
1150
+
1151
+
b, err := cr.ReadByte()
1152
+
if err != nil {
1153
+
return err
1154
+
}
1155
+
if b != cbg.CborNull[0] {
1156
+
if err := cr.UnreadByte(); err != nil {
1157
+
return err
1158
+
}
1159
+
t.Facets[i] = new(RichtextFacet)
1160
+
if err := t.Facets[i].UnmarshalCBOR(cr); err != nil {
1161
+
return xerrors.Errorf("unmarshaling t.Facets[i] pointer: %w", err)
1162
+
}
1163
+
}
1164
+
1165
+
}
1166
+
1167
+
}
1168
+
}
1169
+
// t.Labels (vylet.FeedPost_Labels) (struct)
1170
+
case "labels":
1171
+
1172
+
{
1173
+
1174
+
b, err := cr.ReadByte()
1175
+
if err != nil {
1176
+
return err
1177
+
}
1178
+
if b != cbg.CborNull[0] {
1179
+
if err := cr.UnreadByte(); err != nil {
1180
+
return err
1181
+
}
1182
+
t.Labels = new(FeedPost_Labels)
1183
+
if err := t.Labels.UnmarshalCBOR(cr); err != nil {
1184
+
return xerrors.Errorf("unmarshaling t.Labels pointer: %w", err)
1185
+
}
1186
+
}
1187
+
1188
+
}
1189
+
// t.Caption (string) (string)
1190
+
case "caption":
1191
+
1192
+
{
1193
+
b, err := cr.ReadByte()
1194
+
if err != nil {
1195
+
return err
1196
+
}
1197
+
if b != cbg.CborNull[0] {
1198
+
if err := cr.UnreadByte(); err != nil {
1199
+
return err
1200
+
}
1201
+
1202
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1203
+
if err != nil {
1204
+
return err
1205
+
}
1206
+
1207
+
t.Caption = (*string)(&sval)
1208
+
}
1209
+
}
1210
+
// t.CreatedAt (string) (string)
1211
+
case "createdAt":
1212
+
1213
+
{
1214
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1215
+
if err != nil {
1216
+
return err
1217
+
}
1218
+
1219
+
t.CreatedAt = string(sval)
1220
+
}
1221
+
1222
+
default:
1223
+
// Field doesn't exist on this type, so ignore it
1224
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1225
+
return err
1226
+
}
1227
+
}
1228
+
}
1229
+
1230
+
return nil
1231
+
}
1232
+
func (t *GraphFollow) MarshalCBOR(w io.Writer) error {
1233
+
if t == nil {
1234
+
_, err := w.Write(cbg.CborNull)
1235
+
return err
1236
+
}
1237
+
1238
+
cw := cbg.NewCborWriter(w)
1239
+
1240
+
if _, err := cw.Write([]byte{163}); err != nil {
1241
+
return err
1242
+
}
1243
+
1244
+
// t.LexiconTypeID (string) (string)
1245
+
if len("$type") > 1000000 {
1246
+
return xerrors.Errorf("Value in field \"$type\" was too long")
1247
+
}
1248
+
1249
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1250
+
return err
1251
+
}
1252
+
if _, err := cw.WriteString(string("$type")); err != nil {
1253
+
return err
1254
+
}
1255
+
1256
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.graph.follow"))); err != nil {
1257
+
return err
1258
+
}
1259
+
if _, err := cw.WriteString(string("app.vylet.graph.follow")); err != nil {
1260
+
return err
1261
+
}
1262
+
1263
+
// t.Subject (string) (string)
1264
+
if len("subject") > 1000000 {
1265
+
return xerrors.Errorf("Value in field \"subject\" was too long")
1266
+
}
1267
+
1268
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
1269
+
return err
1270
+
}
1271
+
if _, err := cw.WriteString(string("subject")); err != nil {
1272
+
return err
1273
+
}
1274
+
1275
+
if len(t.Subject) > 1000000 {
1276
+
return xerrors.Errorf("Value in field t.Subject was too long")
1277
+
}
1278
+
1279
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
1280
+
return err
1281
+
}
1282
+
if _, err := cw.WriteString(string(t.Subject)); err != nil {
1283
+
return err
1284
+
}
1285
+
1286
+
// t.CreatedAt (string) (string)
1287
+
if len("createdAt") > 1000000 {
1288
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
1289
+
}
1290
+
1291
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
1292
+
return err
1293
+
}
1294
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
1295
+
return err
1296
+
}
1297
+
1298
+
if len(t.CreatedAt) > 1000000 {
1299
+
return xerrors.Errorf("Value in field t.CreatedAt was too long")
1300
+
}
1301
+
1302
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
1303
+
return err
1304
+
}
1305
+
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
1306
+
return err
1307
+
}
1308
+
return nil
1309
+
}
1310
+
1311
+
func (t *GraphFollow) UnmarshalCBOR(r io.Reader) (err error) {
1312
+
*t = GraphFollow{}
1313
+
1314
+
cr := cbg.NewCborReader(r)
1315
+
1316
+
maj, extra, err := cr.ReadHeader()
1317
+
if err != nil {
1318
+
return err
1319
+
}
1320
+
defer func() {
1321
+
if err == io.EOF {
1322
+
err = io.ErrUnexpectedEOF
1323
+
}
1324
+
}()
1325
+
1326
+
if maj != cbg.MajMap {
1327
+
return fmt.Errorf("cbor input should be of type map")
1328
+
}
1329
+
1330
+
if extra > cbg.MaxLength {
1331
+
return fmt.Errorf("GraphFollow: map struct too large (%d)", extra)
1332
+
}
1333
+
1334
+
n := extra
1335
+
1336
+
nameBuf := make([]byte, 9)
1337
+
for i := uint64(0); i < n; i++ {
1338
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1339
+
if err != nil {
1340
+
return err
1341
+
}
1342
+
1343
+
if !ok {
1344
+
// Field doesn't exist on this type, so ignore it
1345
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1346
+
return err
1347
+
}
1348
+
continue
1349
+
}
1350
+
1351
+
switch string(nameBuf[:nameLen]) {
1352
+
// t.LexiconTypeID (string) (string)
1353
+
case "$type":
1354
+
1355
+
{
1356
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1357
+
if err != nil {
1358
+
return err
1359
+
}
1360
+
1361
+
t.LexiconTypeID = string(sval)
1362
+
}
1363
+
// t.Subject (string) (string)
1364
+
case "subject":
1365
+
1366
+
{
1367
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1368
+
if err != nil {
1369
+
return err
1370
+
}
1371
+
1372
+
t.Subject = string(sval)
1373
+
}
1374
+
// t.CreatedAt (string) (string)
1375
+
case "createdAt":
1376
+
1377
+
{
1378
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1379
+
if err != nil {
1380
+
return err
1381
+
}
1382
+
1383
+
t.CreatedAt = string(sval)
1384
+
}
1385
+
1386
+
default:
1387
+
// Field doesn't exist on this type, so ignore it
1388
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1389
+
return err
1390
+
}
1391
+
}
1392
+
}
1393
+
1394
+
return nil
1395
+
}
1396
+
func (t *RichtextFacet) MarshalCBOR(w io.Writer) error {
1397
+
if t == nil {
1398
+
_, err := w.Write(cbg.CborNull)
1399
+
return err
1400
+
}
1401
+
1402
+
cw := cbg.NewCborWriter(w)
1403
+
1404
+
if _, err := cw.Write([]byte{162}); err != nil {
1405
+
return err
1406
+
}
1407
+
1408
+
// t.Index (vylet.RichtextFacet_ByteSlice) (struct)
1409
+
if len("index") > 1000000 {
1410
+
return xerrors.Errorf("Value in field \"index\" was too long")
1411
+
}
1412
+
1413
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("index"))); err != nil {
1414
+
return err
1415
+
}
1416
+
if _, err := cw.WriteString(string("index")); err != nil {
1417
+
return err
1418
+
}
1419
+
1420
+
if err := t.Index.MarshalCBOR(cw); err != nil {
1421
+
return err
1422
+
}
1423
+
1424
+
// t.Features ([]*vylet.RichtextFacet_Features_Elem) (slice)
1425
+
if len("features") > 1000000 {
1426
+
return xerrors.Errorf("Value in field \"features\" was too long")
1427
+
}
1428
+
1429
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("features"))); err != nil {
1430
+
return err
1431
+
}
1432
+
if _, err := cw.WriteString(string("features")); err != nil {
1433
+
return err
1434
+
}
1435
+
1436
+
if len(t.Features) > 8192 {
1437
+
return xerrors.Errorf("Slice value in field t.Features was too long")
1438
+
}
1439
+
1440
+
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Features))); err != nil {
1441
+
return err
1442
+
}
1443
+
for _, v := range t.Features {
1444
+
if err := v.MarshalCBOR(cw); err != nil {
1445
+
return err
1446
+
}
1447
+
1448
+
}
1449
+
return nil
1450
+
}
1451
+
1452
+
func (t *RichtextFacet) UnmarshalCBOR(r io.Reader) (err error) {
1453
+
*t = RichtextFacet{}
1454
+
1455
+
cr := cbg.NewCborReader(r)
1456
+
1457
+
maj, extra, err := cr.ReadHeader()
1458
+
if err != nil {
1459
+
return err
1460
+
}
1461
+
defer func() {
1462
+
if err == io.EOF {
1463
+
err = io.ErrUnexpectedEOF
1464
+
}
1465
+
}()
1466
+
1467
+
if maj != cbg.MajMap {
1468
+
return fmt.Errorf("cbor input should be of type map")
1469
+
}
1470
+
1471
+
if extra > cbg.MaxLength {
1472
+
return fmt.Errorf("RichtextFacet: map struct too large (%d)", extra)
1473
+
}
1474
+
1475
+
n := extra
1476
+
1477
+
nameBuf := make([]byte, 8)
1478
+
for i := uint64(0); i < n; i++ {
1479
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1480
+
if err != nil {
1481
+
return err
1482
+
}
1483
+
1484
+
if !ok {
1485
+
// Field doesn't exist on this type, so ignore it
1486
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1487
+
return err
1488
+
}
1489
+
continue
1490
+
}
1491
+
1492
+
switch string(nameBuf[:nameLen]) {
1493
+
// t.Index (vylet.RichtextFacet_ByteSlice) (struct)
1494
+
case "index":
1495
+
1496
+
{
1497
+
1498
+
b, err := cr.ReadByte()
1499
+
if err != nil {
1500
+
return err
1501
+
}
1502
+
if b != cbg.CborNull[0] {
1503
+
if err := cr.UnreadByte(); err != nil {
1504
+
return err
1505
+
}
1506
+
t.Index = new(RichtextFacet_ByteSlice)
1507
+
if err := t.Index.UnmarshalCBOR(cr); err != nil {
1508
+
return xerrors.Errorf("unmarshaling t.Index pointer: %w", err)
1509
+
}
1510
+
}
1511
+
1512
+
}
1513
+
// t.Features ([]*vylet.RichtextFacet_Features_Elem) (slice)
1514
+
case "features":
1515
+
1516
+
maj, extra, err = cr.ReadHeader()
1517
+
if err != nil {
1518
+
return err
1519
+
}
1520
+
1521
+
if extra > 8192 {
1522
+
return fmt.Errorf("t.Features: array too large (%d)", extra)
1523
+
}
1524
+
1525
+
if maj != cbg.MajArray {
1526
+
return fmt.Errorf("expected cbor array")
1527
+
}
1528
+
1529
+
if extra > 0 {
1530
+
t.Features = make([]*RichtextFacet_Features_Elem, extra)
1531
+
}
1532
+
1533
+
for i := 0; i < int(extra); i++ {
1534
+
{
1535
+
var maj byte
1536
+
var extra uint64
1537
+
var err error
1538
+
_ = maj
1539
+
_ = extra
1540
+
_ = err
1541
+
1542
+
{
1543
+
1544
+
b, err := cr.ReadByte()
1545
+
if err != nil {
1546
+
return err
1547
+
}
1548
+
if b != cbg.CborNull[0] {
1549
+
if err := cr.UnreadByte(); err != nil {
1550
+
return err
1551
+
}
1552
+
t.Features[i] = new(RichtextFacet_Features_Elem)
1553
+
if err := t.Features[i].UnmarshalCBOR(cr); err != nil {
1554
+
return xerrors.Errorf("unmarshaling t.Features[i] pointer: %w", err)
1555
+
}
1556
+
}
1557
+
1558
+
}
1559
+
1560
+
}
1561
+
}
1562
+
1563
+
default:
1564
+
// Field doesn't exist on this type, so ignore it
1565
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1566
+
return err
1567
+
}
1568
+
}
1569
+
}
1570
+
1571
+
return nil
1572
+
}
1573
+
func (t *RichtextFacet_ByteSlice) MarshalCBOR(w io.Writer) error {
1574
+
if t == nil {
1575
+
_, err := w.Write(cbg.CborNull)
1576
+
return err
1577
+
}
1578
+
1579
+
cw := cbg.NewCborWriter(w)
1580
+
1581
+
if _, err := cw.Write([]byte{162}); err != nil {
1582
+
return err
1583
+
}
1584
+
1585
+
// t.ByteEnd (int64) (int64)
1586
+
if len("byteEnd") > 1000000 {
1587
+
return xerrors.Errorf("Value in field \"byteEnd\" was too long")
1588
+
}
1589
+
1590
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("byteEnd"))); err != nil {
1591
+
return err
1592
+
}
1593
+
if _, err := cw.WriteString(string("byteEnd")); err != nil {
1594
+
return err
1595
+
}
1596
+
1597
+
if t.ByteEnd >= 0 {
1598
+
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ByteEnd)); err != nil {
1599
+
return err
1600
+
}
1601
+
} else {
1602
+
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.ByteEnd-1)); err != nil {
1603
+
return err
1604
+
}
1605
+
}
1606
+
1607
+
// t.ByteStart (int64) (int64)
1608
+
if len("byteStart") > 1000000 {
1609
+
return xerrors.Errorf("Value in field \"byteStart\" was too long")
1610
+
}
1611
+
1612
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("byteStart"))); err != nil {
1613
+
return err
1614
+
}
1615
+
if _, err := cw.WriteString(string("byteStart")); err != nil {
1616
+
return err
1617
+
}
1618
+
1619
+
if t.ByteStart >= 0 {
1620
+
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ByteStart)); err != nil {
1621
+
return err
1622
+
}
1623
+
} else {
1624
+
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.ByteStart-1)); err != nil {
1625
+
return err
1626
+
}
1627
+
}
1628
+
1629
+
return nil
1630
+
}
1631
+
1632
+
func (t *RichtextFacet_ByteSlice) UnmarshalCBOR(r io.Reader) (err error) {
1633
+
*t = RichtextFacet_ByteSlice{}
1634
+
1635
+
cr := cbg.NewCborReader(r)
1636
+
1637
+
maj, extra, err := cr.ReadHeader()
1638
+
if err != nil {
1639
+
return err
1640
+
}
1641
+
defer func() {
1642
+
if err == io.EOF {
1643
+
err = io.ErrUnexpectedEOF
1644
+
}
1645
+
}()
1646
+
1647
+
if maj != cbg.MajMap {
1648
+
return fmt.Errorf("cbor input should be of type map")
1649
+
}
1650
+
1651
+
if extra > cbg.MaxLength {
1652
+
return fmt.Errorf("RichtextFacet_ByteSlice: map struct too large (%d)", extra)
1653
+
}
1654
+
1655
+
n := extra
1656
+
1657
+
nameBuf := make([]byte, 9)
1658
+
for i := uint64(0); i < n; i++ {
1659
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1660
+
if err != nil {
1661
+
return err
1662
+
}
1663
+
1664
+
if !ok {
1665
+
// Field doesn't exist on this type, so ignore it
1666
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1667
+
return err
1668
+
}
1669
+
continue
1670
+
}
1671
+
1672
+
switch string(nameBuf[:nameLen]) {
1673
+
// t.ByteEnd (int64) (int64)
1674
+
case "byteEnd":
1675
+
{
1676
+
maj, extra, err := cr.ReadHeader()
1677
+
if err != nil {
1678
+
return err
1679
+
}
1680
+
var extraI int64
1681
+
switch maj {
1682
+
case cbg.MajUnsignedInt:
1683
+
extraI = int64(extra)
1684
+
if extraI < 0 {
1685
+
return fmt.Errorf("int64 positive overflow")
1686
+
}
1687
+
case cbg.MajNegativeInt:
1688
+
extraI = int64(extra)
1689
+
if extraI < 0 {
1690
+
return fmt.Errorf("int64 negative overflow")
1691
+
}
1692
+
extraI = -1 - extraI
1693
+
default:
1694
+
return fmt.Errorf("wrong type for int64 field: %d", maj)
1695
+
}
1696
+
1697
+
t.ByteEnd = int64(extraI)
1698
+
}
1699
+
// t.ByteStart (int64) (int64)
1700
+
case "byteStart":
1701
+
{
1702
+
maj, extra, err := cr.ReadHeader()
1703
+
if err != nil {
1704
+
return err
1705
+
}
1706
+
var extraI int64
1707
+
switch maj {
1708
+
case cbg.MajUnsignedInt:
1709
+
extraI = int64(extra)
1710
+
if extraI < 0 {
1711
+
return fmt.Errorf("int64 positive overflow")
1712
+
}
1713
+
case cbg.MajNegativeInt:
1714
+
extraI = int64(extra)
1715
+
if extraI < 0 {
1716
+
return fmt.Errorf("int64 negative overflow")
1717
+
}
1718
+
extraI = -1 - extraI
1719
+
default:
1720
+
return fmt.Errorf("wrong type for int64 field: %d", maj)
1721
+
}
1722
+
1723
+
t.ByteStart = int64(extraI)
1724
+
}
1725
+
1726
+
default:
1727
+
// Field doesn't exist on this type, so ignore it
1728
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1729
+
return err
1730
+
}
1731
+
}
1732
+
}
1733
+
1734
+
return nil
1735
+
}
1736
+
func (t *RichtextFacet_Link) MarshalCBOR(w io.Writer) error {
1737
+
if t == nil {
1738
+
_, err := w.Write(cbg.CborNull)
1739
+
return err
1740
+
}
1741
+
1742
+
cw := cbg.NewCborWriter(w)
1743
+
1744
+
if _, err := cw.Write([]byte{162}); err != nil {
1745
+
return err
1746
+
}
1747
+
1748
+
// t.Uri (string) (string)
1749
+
if len("uri") > 1000000 {
1750
+
return xerrors.Errorf("Value in field \"uri\" was too long")
1751
+
}
1752
+
1753
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("uri"))); err != nil {
1754
+
return err
1755
+
}
1756
+
if _, err := cw.WriteString(string("uri")); err != nil {
1757
+
return err
1758
+
}
1759
+
1760
+
if len(t.Uri) > 1000000 {
1761
+
return xerrors.Errorf("Value in field t.Uri was too long")
1762
+
}
1763
+
1764
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil {
1765
+
return err
1766
+
}
1767
+
if _, err := cw.WriteString(string(t.Uri)); err != nil {
1768
+
return err
1769
+
}
1770
+
1771
+
// t.LexiconTypeID (string) (string)
1772
+
if len("$type") > 1000000 {
1773
+
return xerrors.Errorf("Value in field \"$type\" was too long")
1774
+
}
1775
+
1776
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1777
+
return err
1778
+
}
1779
+
if _, err := cw.WriteString(string("$type")); err != nil {
1780
+
return err
1781
+
}
1782
+
1783
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.richtext.facet#link"))); err != nil {
1784
+
return err
1785
+
}
1786
+
if _, err := cw.WriteString(string("app.vylet.richtext.facet#link")); err != nil {
1787
+
return err
1788
+
}
1789
+
return nil
1790
+
}
1791
+
1792
+
func (t *RichtextFacet_Link) UnmarshalCBOR(r io.Reader) (err error) {
1793
+
*t = RichtextFacet_Link{}
1794
+
1795
+
cr := cbg.NewCborReader(r)
1796
+
1797
+
maj, extra, err := cr.ReadHeader()
1798
+
if err != nil {
1799
+
return err
1800
+
}
1801
+
defer func() {
1802
+
if err == io.EOF {
1803
+
err = io.ErrUnexpectedEOF
1804
+
}
1805
+
}()
1806
+
1807
+
if maj != cbg.MajMap {
1808
+
return fmt.Errorf("cbor input should be of type map")
1809
+
}
1810
+
1811
+
if extra > cbg.MaxLength {
1812
+
return fmt.Errorf("RichtextFacet_Link: map struct too large (%d)", extra)
1813
+
}
1814
+
1815
+
n := extra
1816
+
1817
+
nameBuf := make([]byte, 5)
1818
+
for i := uint64(0); i < n; i++ {
1819
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1820
+
if err != nil {
1821
+
return err
1822
+
}
1823
+
1824
+
if !ok {
1825
+
// Field doesn't exist on this type, so ignore it
1826
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1827
+
return err
1828
+
}
1829
+
continue
1830
+
}
1831
+
1832
+
switch string(nameBuf[:nameLen]) {
1833
+
// t.Uri (string) (string)
1834
+
case "uri":
1835
+
1836
+
{
1837
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1838
+
if err != nil {
1839
+
return err
1840
+
}
1841
+
1842
+
t.Uri = string(sval)
1843
+
}
1844
+
// t.LexiconTypeID (string) (string)
1845
+
case "$type":
1846
+
1847
+
{
1848
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1849
+
if err != nil {
1850
+
return err
1851
+
}
1852
+
1853
+
t.LexiconTypeID = string(sval)
1854
+
}
1855
+
1856
+
default:
1857
+
// Field doesn't exist on this type, so ignore it
1858
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1859
+
return err
1860
+
}
1861
+
}
1862
+
}
1863
+
1864
+
return nil
1865
+
}
1866
+
func (t *RichtextFacet_Mention) MarshalCBOR(w io.Writer) error {
1867
+
if t == nil {
1868
+
_, err := w.Write(cbg.CborNull)
1869
+
return err
1870
+
}
1871
+
1872
+
cw := cbg.NewCborWriter(w)
1873
+
1874
+
if _, err := cw.Write([]byte{162}); err != nil {
1875
+
return err
1876
+
}
1877
+
1878
+
// t.Did (string) (string)
1879
+
if len("did") > 1000000 {
1880
+
return xerrors.Errorf("Value in field \"did\" was too long")
1881
+
}
1882
+
1883
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
1884
+
return err
1885
+
}
1886
+
if _, err := cw.WriteString(string("did")); err != nil {
1887
+
return err
1888
+
}
1889
+
1890
+
if len(t.Did) > 1000000 {
1891
+
return xerrors.Errorf("Value in field t.Did was too long")
1892
+
}
1893
+
1894
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
1895
+
return err
1896
+
}
1897
+
if _, err := cw.WriteString(string(t.Did)); err != nil {
1898
+
return err
1899
+
}
1900
+
1901
+
// t.LexiconTypeID (string) (string)
1902
+
if len("$type") > 1000000 {
1903
+
return xerrors.Errorf("Value in field \"$type\" was too long")
1904
+
}
1905
+
1906
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1907
+
return err
1908
+
}
1909
+
if _, err := cw.WriteString(string("$type")); err != nil {
1910
+
return err
1911
+
}
1912
+
1913
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.richtext.facet#mention"))); err != nil {
1914
+
return err
1915
+
}
1916
+
if _, err := cw.WriteString(string("app.vylet.richtext.facet#mention")); err != nil {
1917
+
return err
1918
+
}
1919
+
return nil
1920
+
}
1921
+
1922
+
func (t *RichtextFacet_Mention) UnmarshalCBOR(r io.Reader) (err error) {
1923
+
*t = RichtextFacet_Mention{}
1924
+
1925
+
cr := cbg.NewCborReader(r)
1926
+
1927
+
maj, extra, err := cr.ReadHeader()
1928
+
if err != nil {
1929
+
return err
1930
+
}
1931
+
defer func() {
1932
+
if err == io.EOF {
1933
+
err = io.ErrUnexpectedEOF
1934
+
}
1935
+
}()
1936
+
1937
+
if maj != cbg.MajMap {
1938
+
return fmt.Errorf("cbor input should be of type map")
1939
+
}
1940
+
1941
+
if extra > cbg.MaxLength {
1942
+
return fmt.Errorf("RichtextFacet_Mention: map struct too large (%d)", extra)
1943
+
}
1944
+
1945
+
n := extra
1946
+
1947
+
nameBuf := make([]byte, 5)
1948
+
for i := uint64(0); i < n; i++ {
1949
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1950
+
if err != nil {
1951
+
return err
1952
+
}
1953
+
1954
+
if !ok {
1955
+
// Field doesn't exist on this type, so ignore it
1956
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1957
+
return err
1958
+
}
1959
+
continue
1960
+
}
1961
+
1962
+
switch string(nameBuf[:nameLen]) {
1963
+
// t.Did (string) (string)
1964
+
case "did":
1965
+
1966
+
{
1967
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1968
+
if err != nil {
1969
+
return err
1970
+
}
1971
+
1972
+
t.Did = string(sval)
1973
+
}
1974
+
// t.LexiconTypeID (string) (string)
1975
+
case "$type":
1976
+
1977
+
{
1978
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1979
+
if err != nil {
1980
+
return err
1981
+
}
1982
+
1983
+
t.LexiconTypeID = string(sval)
1984
+
}
1985
+
1986
+
default:
1987
+
// Field doesn't exist on this type, so ignore it
1988
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1989
+
return err
1990
+
}
1991
+
}
1992
+
}
1993
+
1994
+
return nil
1995
+
}
1996
+
func (t *MediaImages) MarshalCBOR(w io.Writer) error {
1997
+
if t == nil {
1998
+
_, err := w.Write(cbg.CborNull)
1999
+
return err
2000
+
}
2001
+
2002
+
cw := cbg.NewCborWriter(w)
2003
+
2004
+
if _, err := cw.Write([]byte{162}); err != nil {
2005
+
return err
2006
+
}
2007
+
2008
+
// t.LexiconTypeID (string) (string)
2009
+
if len("$type") > 1000000 {
2010
+
return xerrors.Errorf("Value in field \"$type\" was too long")
2011
+
}
2012
+
2013
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2014
+
return err
2015
+
}
2016
+
if _, err := cw.WriteString(string("$type")); err != nil {
2017
+
return err
2018
+
}
2019
+
2020
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.vylet.media.images"))); err != nil {
2021
+
return err
2022
+
}
2023
+
if _, err := cw.WriteString(string("app.vylet.media.images")); err != nil {
2024
+
return err
2025
+
}
2026
+
2027
+
// t.Images ([]*vylet.MediaImages_Image) (slice)
2028
+
if len("images") > 1000000 {
2029
+
return xerrors.Errorf("Value in field \"images\" was too long")
2030
+
}
2031
+
2032
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("images"))); err != nil {
2033
+
return err
2034
+
}
2035
+
if _, err := cw.WriteString(string("images")); err != nil {
2036
+
return err
2037
+
}
2038
+
2039
+
if len(t.Images) > 8192 {
2040
+
return xerrors.Errorf("Slice value in field t.Images was too long")
2041
+
}
2042
+
2043
+
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Images))); err != nil {
2044
+
return err
2045
+
}
2046
+
for _, v := range t.Images {
2047
+
if err := v.MarshalCBOR(cw); err != nil {
2048
+
return err
2049
+
}
2050
+
2051
+
}
2052
+
return nil
2053
+
}
2054
+
2055
+
func (t *MediaImages) UnmarshalCBOR(r io.Reader) (err error) {
2056
+
*t = MediaImages{}
2057
+
2058
+
cr := cbg.NewCborReader(r)
2059
+
2060
+
maj, extra, err := cr.ReadHeader()
2061
+
if err != nil {
2062
+
return err
2063
+
}
2064
+
defer func() {
2065
+
if err == io.EOF {
2066
+
err = io.ErrUnexpectedEOF
2067
+
}
2068
+
}()
2069
+
2070
+
if maj != cbg.MajMap {
2071
+
return fmt.Errorf("cbor input should be of type map")
2072
+
}
2073
+
2074
+
if extra > cbg.MaxLength {
2075
+
return fmt.Errorf("MediaImages: map struct too large (%d)", extra)
2076
+
}
2077
+
2078
+
n := extra
2079
+
2080
+
nameBuf := make([]byte, 6)
2081
+
for i := uint64(0); i < n; i++ {
2082
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2083
+
if err != nil {
2084
+
return err
2085
+
}
2086
+
2087
+
if !ok {
2088
+
// Field doesn't exist on this type, so ignore it
2089
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2090
+
return err
2091
+
}
2092
+
continue
2093
+
}
2094
+
2095
+
switch string(nameBuf[:nameLen]) {
2096
+
// t.LexiconTypeID (string) (string)
2097
+
case "$type":
2098
+
2099
+
{
2100
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
2101
+
if err != nil {
2102
+
return err
2103
+
}
2104
+
2105
+
t.LexiconTypeID = string(sval)
2106
+
}
2107
+
// t.Images ([]*vylet.MediaImages_Image) (slice)
2108
+
case "images":
2109
+
2110
+
maj, extra, err = cr.ReadHeader()
2111
+
if err != nil {
2112
+
return err
2113
+
}
2114
+
2115
+
if extra > 8192 {
2116
+
return fmt.Errorf("t.Images: array too large (%d)", extra)
2117
+
}
2118
+
2119
+
if maj != cbg.MajArray {
2120
+
return fmt.Errorf("expected cbor array")
2121
+
}
2122
+
2123
+
if extra > 0 {
2124
+
t.Images = make([]*MediaImages_Image, extra)
2125
+
}
2126
+
2127
+
for i := 0; i < int(extra); i++ {
2128
+
{
2129
+
var maj byte
2130
+
var extra uint64
2131
+
var err error
2132
+
_ = maj
2133
+
_ = extra
2134
+
_ = err
2135
+
2136
+
{
2137
+
2138
+
b, err := cr.ReadByte()
2139
+
if err != nil {
2140
+
return err
2141
+
}
2142
+
if b != cbg.CborNull[0] {
2143
+
if err := cr.UnreadByte(); err != nil {
2144
+
return err
2145
+
}
2146
+
t.Images[i] = new(MediaImages_Image)
2147
+
if err := t.Images[i].UnmarshalCBOR(cr); err != nil {
2148
+
return xerrors.Errorf("unmarshaling t.Images[i] pointer: %w", err)
2149
+
}
2150
+
}
2151
+
2152
+
}
2153
+
2154
+
}
2155
+
}
2156
+
2157
+
default:
2158
+
// Field doesn't exist on this type, so ignore it
2159
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2160
+
return err
2161
+
}
2162
+
}
2163
+
}
2164
+
2165
+
return nil
2166
+
}
2167
+
func (t *MediaImages_Image) MarshalCBOR(w io.Writer) error {
2168
+
if t == nil {
2169
+
_, err := w.Write(cbg.CborNull)
2170
+
return err
2171
+
}
2172
+
2173
+
cw := cbg.NewCborWriter(w)
2174
+
fieldCount := 3
2175
+
2176
+
if t.AspectRatio == nil {
2177
+
fieldCount--
2178
+
}
2179
+
2180
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2181
+
return err
2182
+
}
2183
+
2184
+
// t.Alt (string) (string)
2185
+
if len("alt") > 1000000 {
2186
+
return xerrors.Errorf("Value in field \"alt\" was too long")
2187
+
}
2188
+
2189
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("alt"))); err != nil {
2190
+
return err
2191
+
}
2192
+
if _, err := cw.WriteString(string("alt")); err != nil {
2193
+
return err
2194
+
}
2195
+
2196
+
if len(t.Alt) > 1000000 {
2197
+
return xerrors.Errorf("Value in field t.Alt was too long")
2198
+
}
2199
+
2200
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Alt))); err != nil {
2201
+
return err
2202
+
}
2203
+
if _, err := cw.WriteString(string(t.Alt)); err != nil {
2204
+
return err
2205
+
}
2206
+
2207
+
// t.Image (util.LexBlob) (struct)
2208
+
if len("image") > 1000000 {
2209
+
return xerrors.Errorf("Value in field \"image\" was too long")
2210
+
}
2211
+
2212
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("image"))); err != nil {
2213
+
return err
2214
+
}
2215
+
if _, err := cw.WriteString(string("image")); err != nil {
2216
+
return err
2217
+
}
2218
+
2219
+
if err := t.Image.MarshalCBOR(cw); err != nil {
2220
+
return err
2221
+
}
2222
+
2223
+
// t.AspectRatio (vylet.MediaDefs_AspectRatio) (struct)
2224
+
if t.AspectRatio != nil {
2225
+
2226
+
if len("aspectRatio") > 1000000 {
2227
+
return xerrors.Errorf("Value in field \"aspectRatio\" was too long")
2228
+
}
2229
+
2230
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("aspectRatio"))); err != nil {
2231
+
return err
2232
+
}
2233
+
if _, err := cw.WriteString(string("aspectRatio")); err != nil {
2234
+
return err
2235
+
}
2236
+
2237
+
if err := t.AspectRatio.MarshalCBOR(cw); err != nil {
2238
+
return err
2239
+
}
2240
+
}
2241
+
return nil
2242
+
}
2243
+
2244
+
func (t *MediaImages_Image) UnmarshalCBOR(r io.Reader) (err error) {
2245
+
*t = MediaImages_Image{}
2246
+
2247
+
cr := cbg.NewCborReader(r)
2248
+
2249
+
maj, extra, err := cr.ReadHeader()
2250
+
if err != nil {
2251
+
return err
2252
+
}
2253
+
defer func() {
2254
+
if err == io.EOF {
2255
+
err = io.ErrUnexpectedEOF
2256
+
}
2257
+
}()
2258
+
2259
+
if maj != cbg.MajMap {
2260
+
return fmt.Errorf("cbor input should be of type map")
2261
+
}
2262
+
2263
+
if extra > cbg.MaxLength {
2264
+
return fmt.Errorf("MediaImages_Image: map struct too large (%d)", extra)
2265
+
}
2266
+
2267
+
n := extra
2268
+
2269
+
nameBuf := make([]byte, 11)
2270
+
for i := uint64(0); i < n; i++ {
2271
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2272
+
if err != nil {
2273
+
return err
2274
+
}
2275
+
2276
+
if !ok {
2277
+
// Field doesn't exist on this type, so ignore it
2278
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2279
+
return err
2280
+
}
2281
+
continue
2282
+
}
2283
+
2284
+
switch string(nameBuf[:nameLen]) {
2285
+
// t.Alt (string) (string)
2286
+
case "alt":
2287
+
2288
+
{
2289
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
2290
+
if err != nil {
2291
+
return err
2292
+
}
2293
+
2294
+
t.Alt = string(sval)
2295
+
}
2296
+
// t.Image (util.LexBlob) (struct)
2297
+
case "image":
2298
+
2299
+
{
2300
+
2301
+
b, err := cr.ReadByte()
2302
+
if err != nil {
2303
+
return err
2304
+
}
2305
+
if b != cbg.CborNull[0] {
2306
+
if err := cr.UnreadByte(); err != nil {
2307
+
return err
2308
+
}
2309
+
t.Image = new(util.LexBlob)
2310
+
if err := t.Image.UnmarshalCBOR(cr); err != nil {
2311
+
return xerrors.Errorf("unmarshaling t.Image pointer: %w", err)
2312
+
}
2313
+
}
2314
+
2315
+
}
2316
+
// t.AspectRatio (vylet.MediaDefs_AspectRatio) (struct)
2317
+
case "aspectRatio":
2318
+
2319
+
{
2320
+
2321
+
b, err := cr.ReadByte()
2322
+
if err != nil {
2323
+
return err
2324
+
}
2325
+
if b != cbg.CborNull[0] {
2326
+
if err := cr.UnreadByte(); err != nil {
2327
+
return err
2328
+
}
2329
+
t.AspectRatio = new(MediaDefs_AspectRatio)
2330
+
if err := t.AspectRatio.UnmarshalCBOR(cr); err != nil {
2331
+
return xerrors.Errorf("unmarshaling t.AspectRatio pointer: %w", err)
2332
+
}
2333
+
}
2334
+
2335
+
}
2336
+
2337
+
default:
2338
+
// Field doesn't exist on this type, so ignore it
2339
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2340
+
return err
2341
+
}
2342
+
}
2343
+
}
2344
+
2345
+
return nil
2346
+
}
2347
+
func (t *MediaDefs_AspectRatio) MarshalCBOR(w io.Writer) error {
2348
+
if t == nil {
2349
+
_, err := w.Write(cbg.CborNull)
2350
+
return err
2351
+
}
2352
+
2353
+
cw := cbg.NewCborWriter(w)
2354
+
2355
+
if _, err := cw.Write([]byte{162}); err != nil {
2356
+
return err
2357
+
}
2358
+
2359
+
// t.Width (int64) (int64)
2360
+
if len("width") > 1000000 {
2361
+
return xerrors.Errorf("Value in field \"width\" was too long")
2362
+
}
2363
+
2364
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("width"))); err != nil {
2365
+
return err
2366
+
}
2367
+
if _, err := cw.WriteString(string("width")); err != nil {
2368
+
return err
2369
+
}
2370
+
2371
+
if t.Width >= 0 {
2372
+
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Width)); err != nil {
2373
+
return err
2374
+
}
2375
+
} else {
2376
+
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Width-1)); err != nil {
2377
+
return err
2378
+
}
2379
+
}
2380
+
2381
+
// t.Height (int64) (int64)
2382
+
if len("height") > 1000000 {
2383
+
return xerrors.Errorf("Value in field \"height\" was too long")
2384
+
}
2385
+
2386
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("height"))); err != nil {
2387
+
return err
2388
+
}
2389
+
if _, err := cw.WriteString(string("height")); err != nil {
2390
+
return err
2391
+
}
2392
+
2393
+
if t.Height >= 0 {
2394
+
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Height)); err != nil {
2395
+
return err
2396
+
}
2397
+
} else {
2398
+
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Height-1)); err != nil {
2399
+
return err
2400
+
}
2401
+
}
2402
+
2403
+
return nil
2404
+
}
2405
+
2406
+
func (t *MediaDefs_AspectRatio) UnmarshalCBOR(r io.Reader) (err error) {
2407
+
*t = MediaDefs_AspectRatio{}
2408
+
2409
+
cr := cbg.NewCborReader(r)
2410
+
2411
+
maj, extra, err := cr.ReadHeader()
2412
+
if err != nil {
2413
+
return err
2414
+
}
2415
+
defer func() {
2416
+
if err == io.EOF {
2417
+
err = io.ErrUnexpectedEOF
2418
+
}
2419
+
}()
2420
+
2421
+
if maj != cbg.MajMap {
2422
+
return fmt.Errorf("cbor input should be of type map")
2423
+
}
2424
+
2425
+
if extra > cbg.MaxLength {
2426
+
return fmt.Errorf("MediaDefs_AspectRatio: map struct too large (%d)", extra)
2427
+
}
2428
+
2429
+
n := extra
2430
+
2431
+
nameBuf := make([]byte, 6)
2432
+
for i := uint64(0); i < n; i++ {
2433
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2434
+
if err != nil {
2435
+
return err
2436
+
}
2437
+
2438
+
if !ok {
2439
+
// Field doesn't exist on this type, so ignore it
2440
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2441
+
return err
2442
+
}
2443
+
continue
2444
+
}
2445
+
2446
+
switch string(nameBuf[:nameLen]) {
2447
+
// t.Width (int64) (int64)
2448
+
case "width":
2449
+
{
2450
+
maj, extra, err := cr.ReadHeader()
2451
+
if err != nil {
2452
+
return err
2453
+
}
2454
+
var extraI int64
2455
+
switch maj {
2456
+
case cbg.MajUnsignedInt:
2457
+
extraI = int64(extra)
2458
+
if extraI < 0 {
2459
+
return fmt.Errorf("int64 positive overflow")
2460
+
}
2461
+
case cbg.MajNegativeInt:
2462
+
extraI = int64(extra)
2463
+
if extraI < 0 {
2464
+
return fmt.Errorf("int64 negative overflow")
2465
+
}
2466
+
extraI = -1 - extraI
2467
+
default:
2468
+
return fmt.Errorf("wrong type for int64 field: %d", maj)
2469
+
}
2470
+
2471
+
t.Width = int64(extraI)
2472
+
}
2473
+
// t.Height (int64) (int64)
2474
+
case "height":
2475
+
{
2476
+
maj, extra, err := cr.ReadHeader()
2477
+
if err != nil {
2478
+
return err
2479
+
}
2480
+
var extraI int64
2481
+
switch maj {
2482
+
case cbg.MajUnsignedInt:
2483
+
extraI = int64(extra)
2484
+
if extraI < 0 {
2485
+
return fmt.Errorf("int64 positive overflow")
2486
+
}
2487
+
case cbg.MajNegativeInt:
2488
+
extraI = int64(extra)
2489
+
if extraI < 0 {
2490
+
return fmt.Errorf("int64 negative overflow")
2491
+
}
2492
+
extraI = -1 - extraI
2493
+
default:
2494
+
return fmt.Errorf("wrong type for int64 field: %d", maj)
2495
+
}
2496
+
2497
+
t.Height = int64(extraI)
2498
+
}
2499
+
2500
+
default:
2501
+
// Field doesn't exist on this type, so ignore it
2502
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2503
+
return err
2504
+
}
2505
+
}
2506
+
}
2507
+
2508
+
return nil
2509
+
}
+28
generated/vylet/feedcomment.go
+28
generated/vylet/feedcomment.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.feed.comment
4
+
5
+
package vylet
6
+
7
+
import (
8
+
comatproto "github.com/bluesky-social/indigo/api/atproto"
9
+
lexutil "github.com/bluesky-social/indigo/lex/util"
10
+
)
11
+
12
+
func init() {
13
+
lexutil.RegisterType("app.vylet.feed.comment", &FeedComment{})
14
+
}
15
+
16
+
type FeedComment struct {
17
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.feed.comment"`
18
+
// createdAt: Client-declared timestamp when this post was originally created.
19
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
20
+
// facets: Annotations of the comment (mentions, URLs)
21
+
Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"`
22
+
// parent: The Vylet comment that this comment is a reply to.
23
+
Parent *comatproto.RepoStrongRef `json:"parent,omitempty" cborgen:"parent,omitempty"`
24
+
// root: The Vylet post that this comment is a part of.
25
+
Root *comatproto.RepoStrongRef `json:"root" cborgen:"root"`
26
+
// text: The text that corresponds to the post's media.
27
+
Text string `json:"text" cborgen:"text"`
28
+
}
+79
generated/vylet/feeddefs.go
+79
generated/vylet/feeddefs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.feed.defs
4
+
5
+
package vylet
6
+
7
+
import (
8
+
"encoding/json"
9
+
"fmt"
10
+
11
+
comatproto "github.com/bluesky-social/indigo/api/atproto"
12
+
lexutil "github.com/bluesky-social/indigo/lex/util"
13
+
)
14
+
15
+
// FeedDefs_CommentView is a "commentView" in the app.vylet.feed.defs schema.
16
+
type FeedDefs_CommentView struct {
17
+
Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"`
18
+
Cid string `json:"cid" cborgen:"cid"`
19
+
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
20
+
Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"`
21
+
IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
22
+
Labels []*comatproto.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"`
23
+
Parent *comatproto.RepoStrongRef `json:"parent,omitempty" cborgen:"parent,omitempty"`
24
+
ReplyCount *int64 `json:"replyCount,omitempty" cborgen:"replyCount,omitempty"`
25
+
Root *comatproto.RepoStrongRef `json:"root,omitempty" cborgen:"root,omitempty"`
26
+
Text *string `json:"text,omitempty" cborgen:"text,omitempty"`
27
+
Uri string `json:"uri" cborgen:"uri"`
28
+
Viewer *FeedDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"`
29
+
}
30
+
31
+
// FeedDefs_PostView is a "postView" in the app.vylet.feed.defs schema.
32
+
type FeedDefs_PostView struct {
33
+
Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"`
34
+
Caption *string `json:"caption,omitempty" cborgen:"caption,omitempty"`
35
+
Cid string `json:"cid" cborgen:"cid"`
36
+
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
37
+
Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"`
38
+
IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
39
+
Labels []*comatproto.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"`
40
+
LikeCount *int64 `json:"likeCount,omitempty" cborgen:"likeCount,omitempty"`
41
+
Media *FeedDefs_PostView_Media `json:"media" cborgen:"media"`
42
+
ReplyCount *int64 `json:"replyCount,omitempty" cborgen:"replyCount,omitempty"`
43
+
Uri string `json:"uri" cborgen:"uri"`
44
+
Viewer *FeedDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"`
45
+
}
46
+
47
+
type FeedDefs_PostView_Media struct {
48
+
MediaImages_View *MediaImages_View
49
+
}
50
+
51
+
func (t *FeedDefs_PostView_Media) MarshalJSON() ([]byte, error) {
52
+
if t.MediaImages_View != nil {
53
+
t.MediaImages_View.LexiconTypeID = "app.vylet.media.images#view"
54
+
return json.Marshal(t.MediaImages_View)
55
+
}
56
+
return nil, fmt.Errorf("can not marshal empty union as JSON")
57
+
}
58
+
59
+
func (t *FeedDefs_PostView_Media) UnmarshalJSON(b []byte) error {
60
+
typ, err := lexutil.TypeExtract(b)
61
+
if err != nil {
62
+
return err
63
+
}
64
+
65
+
switch typ {
66
+
case "app.vylet.media.images#view":
67
+
t.MediaImages_View = new(MediaImages_View)
68
+
return json.Unmarshal(b, t.MediaImages_View)
69
+
default:
70
+
return nil
71
+
}
72
+
}
73
+
74
+
// FeedDefs_ViewerState is a "viewerState" in the app.vylet.feed.defs schema.
75
+
//
76
+
// Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.
77
+
type FeedDefs_ViewerState struct {
78
+
Like *string `json:"like,omitempty" cborgen:"like,omitempty"`
79
+
}
+20
generated/vylet/feedlike.go
+20
generated/vylet/feedlike.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.feed.like
4
+
5
+
package vylet
6
+
7
+
import (
8
+
comatproto "github.com/bluesky-social/indigo/api/atproto"
9
+
lexutil "github.com/bluesky-social/indigo/lex/util"
10
+
)
11
+
12
+
func init() {
13
+
lexutil.RegisterType("app.vylet.feed.like", &FeedLike{})
14
+
}
15
+
16
+
type FeedLike struct {
17
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.feed.like"`
18
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
19
+
Subject *comatproto.RepoStrongRef `json:"subject" cborgen:"subject"`
20
+
}
+142
generated/vylet/feedpost.go
+142
generated/vylet/feedpost.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.feed.post
4
+
5
+
package vylet
6
+
7
+
import (
8
+
"bytes"
9
+
"encoding/json"
10
+
"fmt"
11
+
"io"
12
+
13
+
comatproto "github.com/bluesky-social/indigo/api/atproto"
14
+
lexutil "github.com/bluesky-social/indigo/lex/util"
15
+
cbg "github.com/whyrusleeping/cbor-gen"
16
+
)
17
+
18
+
func init() {
19
+
lexutil.RegisterType("app.vylet.feed.post", &FeedPost{})
20
+
}
21
+
22
+
type FeedPost struct {
23
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.feed.post"`
24
+
// caption: The text that corresponds to the post's media.
25
+
Caption *string `json:"caption,omitempty" cborgen:"caption,omitempty"`
26
+
// createdAt: Client-declared timestamp when this post was originally created.
27
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
28
+
// facets: Annotations of the caption (mentions, URLs)
29
+
Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"`
30
+
// labels: Self-label values for this post. Effectively content warnings.
31
+
Labels *FeedPost_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"`
32
+
Media *FeedPost_Media `json:"media" cborgen:"media"`
33
+
}
34
+
35
+
// Self-label values for this post. Effectively content warnings.
36
+
type FeedPost_Labels struct {
37
+
LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels
38
+
}
39
+
40
+
func (t *FeedPost_Labels) MarshalJSON() ([]byte, error) {
41
+
if t.LabelDefs_SelfLabels != nil {
42
+
t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels"
43
+
return json.Marshal(t.LabelDefs_SelfLabels)
44
+
}
45
+
return nil, fmt.Errorf("can not marshal empty union as JSON")
46
+
}
47
+
48
+
func (t *FeedPost_Labels) UnmarshalJSON(b []byte) error {
49
+
typ, err := lexutil.TypeExtract(b)
50
+
if err != nil {
51
+
return err
52
+
}
53
+
54
+
switch typ {
55
+
case "com.atproto.label.defs#selfLabels":
56
+
t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels)
57
+
return json.Unmarshal(b, t.LabelDefs_SelfLabels)
58
+
default:
59
+
return nil
60
+
}
61
+
}
62
+
63
+
func (t *FeedPost_Labels) MarshalCBOR(w io.Writer) error {
64
+
65
+
if t == nil {
66
+
_, err := w.Write(cbg.CborNull)
67
+
return err
68
+
}
69
+
if t.LabelDefs_SelfLabels != nil {
70
+
return t.LabelDefs_SelfLabels.MarshalCBOR(w)
71
+
}
72
+
return fmt.Errorf("can not marshal empty union as CBOR")
73
+
}
74
+
75
+
func (t *FeedPost_Labels) UnmarshalCBOR(r io.Reader) error {
76
+
typ, b, err := lexutil.CborTypeExtractReader(r)
77
+
if err != nil {
78
+
return err
79
+
}
80
+
81
+
switch typ {
82
+
case "com.atproto.label.defs#selfLabels":
83
+
t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels)
84
+
return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b))
85
+
default:
86
+
return nil
87
+
}
88
+
}
89
+
90
+
type FeedPost_Media struct {
91
+
MediaImages *MediaImages
92
+
}
93
+
94
+
func (t *FeedPost_Media) MarshalJSON() ([]byte, error) {
95
+
if t.MediaImages != nil {
96
+
t.MediaImages.LexiconTypeID = "app.vylet.media.images"
97
+
return json.Marshal(t.MediaImages)
98
+
}
99
+
return nil, fmt.Errorf("can not marshal empty union as JSON")
100
+
}
101
+
102
+
func (t *FeedPost_Media) UnmarshalJSON(b []byte) error {
103
+
typ, err := lexutil.TypeExtract(b)
104
+
if err != nil {
105
+
return err
106
+
}
107
+
108
+
switch typ {
109
+
case "app.vylet.media.images":
110
+
t.MediaImages = new(MediaImages)
111
+
return json.Unmarshal(b, t.MediaImages)
112
+
default:
113
+
return nil
114
+
}
115
+
}
116
+
117
+
func (t *FeedPost_Media) MarshalCBOR(w io.Writer) error {
118
+
119
+
if t == nil {
120
+
_, err := w.Write(cbg.CborNull)
121
+
return err
122
+
}
123
+
if t.MediaImages != nil {
124
+
return t.MediaImages.MarshalCBOR(w)
125
+
}
126
+
return fmt.Errorf("can not marshal empty union as CBOR")
127
+
}
128
+
129
+
func (t *FeedPost_Media) UnmarshalCBOR(r io.Reader) error {
130
+
typ, b, err := lexutil.CborTypeExtractReader(r)
131
+
if err != nil {
132
+
return err
133
+
}
134
+
135
+
switch typ {
136
+
case "app.vylet.media.images":
137
+
t.MediaImages = new(MediaImages)
138
+
return t.MediaImages.UnmarshalCBOR(bytes.NewReader(b))
139
+
default:
140
+
return nil
141
+
}
142
+
}
+17
generated/vylet/graphfollow.go
+17
generated/vylet/graphfollow.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.graph.follow
4
+
5
+
package vylet
6
+
7
+
import lexutil "github.com/bluesky-social/indigo/lex/util"
8
+
9
+
func init() {
10
+
lexutil.RegisterType("app.vylet.graph.follow", &GraphFollow{})
11
+
}
12
+
13
+
type GraphFollow struct {
14
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.graph.follow"`
15
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
16
+
Subject string `json:"subject" cborgen:"subject"`
17
+
}
+13
generated/vylet/mediadefs.go
+13
generated/vylet/mediadefs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.media.defs
4
+
5
+
package vylet
6
+
7
+
// MediaDefs_AspectRatio is a "aspectRatio" in the app.vylet.media.defs schema.
8
+
//
9
+
// width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.
10
+
type MediaDefs_AspectRatio struct {
11
+
Height int64 `json:"height" cborgen:"height"`
12
+
Width int64 `json:"width" cborgen:"width"`
13
+
}
+44
generated/vylet/mediaimages.go
+44
generated/vylet/mediaimages.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.media.images
4
+
5
+
package vylet
6
+
7
+
import (
8
+
lexutil "github.com/bluesky-social/indigo/lex/util"
9
+
)
10
+
11
+
func init() {
12
+
lexutil.RegisterType("app.vylet.media.images#main", &MediaImages{})
13
+
}
14
+
15
+
// MediaImages is a "main" in the app.vylet.media.images schema.
16
+
type MediaImages struct {
17
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.media.images"`
18
+
Images []*MediaImages_Image `json:"images" cborgen:"images"`
19
+
}
20
+
21
+
// MediaImages_Image is a "image" in the app.vylet.media.images schema.
22
+
type MediaImages_Image struct {
23
+
// alt: Alt text description of the image, for accessibility.
24
+
Alt string `json:"alt" cborgen:"alt"`
25
+
AspectRatio *MediaDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"`
26
+
Image *lexutil.LexBlob `json:"image" cborgen:"image"`
27
+
}
28
+
29
+
// MediaImages_View is a "view" in the app.vylet.media.images schema.
30
+
type MediaImages_View struct {
31
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.media.images#view"`
32
+
Images []*MediaImages_ViewImage `json:"images" cborgen:"images"`
33
+
}
34
+
35
+
// MediaImages_ViewImage is a "viewImage" in the app.vylet.media.images schema.
36
+
type MediaImages_ViewImage struct {
37
+
// alt: Alt text description of the image, for accessibility.
38
+
Alt *string `json:"alt,omitempty" cborgen:"alt,omitempty"`
39
+
AspectRatio *MediaDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"`
40
+
// fullsize: Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View.
41
+
Fullsize string `json:"fullsize" cborgen:"fullsize"`
42
+
// thumbnail: Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.
43
+
Thumbnail string `json:"thumbnail" cborgen:"thumbnail"`
44
+
}
+115
generated/vylet/richtextfacet.go
+115
generated/vylet/richtextfacet.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
// Lexicon schema: app.vylet.richtext.facet
4
+
5
+
package vylet
6
+
7
+
import (
8
+
"bytes"
9
+
"encoding/json"
10
+
"fmt"
11
+
"io"
12
+
13
+
lexutil "github.com/bluesky-social/indigo/lex/util"
14
+
cbg "github.com/whyrusleeping/cbor-gen"
15
+
)
16
+
17
+
// RichtextFacet is a "main" in the app.vylet.richtext.facet schema.
18
+
//
19
+
// Annotation of a sub-string within rich text.
20
+
type RichtextFacet struct {
21
+
Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"`
22
+
Index *RichtextFacet_ByteSlice `json:"index" cborgen:"index"`
23
+
}
24
+
25
+
// RichtextFacet_ByteSlice is a "byteSlice" in the app.vylet.richtext.facet schema.
26
+
//
27
+
// Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.
28
+
type RichtextFacet_ByteSlice struct {
29
+
ByteEnd int64 `json:"byteEnd" cborgen:"byteEnd"`
30
+
ByteStart int64 `json:"byteStart" cborgen:"byteStart"`
31
+
}
32
+
33
+
type RichtextFacet_Features_Elem struct {
34
+
RichtextFacet_Mention *RichtextFacet_Mention
35
+
RichtextFacet_Link *RichtextFacet_Link
36
+
}
37
+
38
+
func (t *RichtextFacet_Features_Elem) MarshalJSON() ([]byte, error) {
39
+
if t.RichtextFacet_Mention != nil {
40
+
t.RichtextFacet_Mention.LexiconTypeID = "app.vylet.richtext.facet#mention"
41
+
return json.Marshal(t.RichtextFacet_Mention)
42
+
}
43
+
if t.RichtextFacet_Link != nil {
44
+
t.RichtextFacet_Link.LexiconTypeID = "app.vylet.richtext.facet#link"
45
+
return json.Marshal(t.RichtextFacet_Link)
46
+
}
47
+
return nil, fmt.Errorf("can not marshal empty union as JSON")
48
+
}
49
+
50
+
func (t *RichtextFacet_Features_Elem) UnmarshalJSON(b []byte) error {
51
+
typ, err := lexutil.TypeExtract(b)
52
+
if err != nil {
53
+
return err
54
+
}
55
+
56
+
switch typ {
57
+
case "app.vylet.richtext.facet#mention":
58
+
t.RichtextFacet_Mention = new(RichtextFacet_Mention)
59
+
return json.Unmarshal(b, t.RichtextFacet_Mention)
60
+
case "app.vylet.richtext.facet#link":
61
+
t.RichtextFacet_Link = new(RichtextFacet_Link)
62
+
return json.Unmarshal(b, t.RichtextFacet_Link)
63
+
default:
64
+
return nil
65
+
}
66
+
}
67
+
68
+
func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error {
69
+
70
+
if t == nil {
71
+
_, err := w.Write(cbg.CborNull)
72
+
return err
73
+
}
74
+
if t.RichtextFacet_Mention != nil {
75
+
return t.RichtextFacet_Mention.MarshalCBOR(w)
76
+
}
77
+
if t.RichtextFacet_Link != nil {
78
+
return t.RichtextFacet_Link.MarshalCBOR(w)
79
+
}
80
+
return fmt.Errorf("can not marshal empty union as CBOR")
81
+
}
82
+
83
+
func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) error {
84
+
typ, b, err := lexutil.CborTypeExtractReader(r)
85
+
if err != nil {
86
+
return err
87
+
}
88
+
89
+
switch typ {
90
+
case "app.vylet.richtext.facet#mention":
91
+
t.RichtextFacet_Mention = new(RichtextFacet_Mention)
92
+
return t.RichtextFacet_Mention.UnmarshalCBOR(bytes.NewReader(b))
93
+
case "app.vylet.richtext.facet#link":
94
+
t.RichtextFacet_Link = new(RichtextFacet_Link)
95
+
return t.RichtextFacet_Link.UnmarshalCBOR(bytes.NewReader(b))
96
+
default:
97
+
return nil
98
+
}
99
+
}
100
+
101
+
// RichtextFacet_Link is a "link" in the app.vylet.richtext.facet schema.
102
+
//
103
+
// Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.
104
+
type RichtextFacet_Link struct {
105
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.richtext.facet#link"`
106
+
Uri string `json:"uri" cborgen:"uri"`
107
+
}
108
+
109
+
// RichtextFacet_Mention is a "mention" in the app.vylet.richtext.facet schema.
110
+
//
111
+
// Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.
112
+
type RichtextFacet_Mention struct {
113
+
LexiconTypeID string `json:"$type" cborgen:"$type,const=app.vylet.richtext.facet#mention"`
114
+
Did string `json:"did" cborgen:"did"`
115
+
}