this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lex: update rich text facet

+92 -73
+72 -53
api/bsky/cbor_gen.go
··· 2484 2484 return err 2485 2485 } 2486 2486 2487 - // t.Index (bsky.RichtextFacet_TextSlice) (struct) 2487 + // t.Index (bsky.RichtextFacet_ByteSlice) (struct) 2488 2488 if len("index") > cbg.MaxLength { 2489 2489 return xerrors.Errorf("Value in field \"index\" was too long") 2490 2490 } ··· 2500 2500 return err 2501 2501 } 2502 2502 2503 - // t.Value (bsky.RichtextFacet_Value) (struct) 2504 - if len("value") > cbg.MaxLength { 2505 - return xerrors.Errorf("Value in field \"value\" was too long") 2503 + // t.Features ([]*bsky.RichtextFacet_Features_Elem) (slice) 2504 + if len("features") > cbg.MaxLength { 2505 + return xerrors.Errorf("Value in field \"features\" was too long") 2506 2506 } 2507 2507 2508 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { 2508 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("features"))); err != nil { 2509 2509 return err 2510 2510 } 2511 - if _, err := io.WriteString(w, string("value")); err != nil { 2511 + if _, err := io.WriteString(w, string("features")); err != nil { 2512 2512 return err 2513 2513 } 2514 2514 2515 - if err := t.Value.MarshalCBOR(cw); err != nil { 2515 + if len(t.Features) > cbg.MaxLength { 2516 + return xerrors.Errorf("Slice value in field t.Features was too long") 2517 + } 2518 + 2519 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Features))); err != nil { 2516 2520 return err 2521 + } 2522 + for _, v := range t.Features { 2523 + if err := v.MarshalCBOR(cw); err != nil { 2524 + return err 2525 + } 2517 2526 } 2518 2527 2519 2528 // t.LexiconTypeID (string) (string) ··· 2579 2588 } 2580 2589 2581 2590 switch name { 2582 - // t.Index (bsky.RichtextFacet_TextSlice) (struct) 2591 + // t.Index (bsky.RichtextFacet_ByteSlice) (struct) 2583 2592 case "index": 2584 2593 2585 2594 { ··· 2592 2601 if err := cr.UnreadByte(); err != nil { 2593 2602 return err 2594 2603 } 2595 - t.Index = new(RichtextFacet_TextSlice) 2604 + t.Index = new(RichtextFacet_ByteSlice) 2596 2605 if err := t.Index.UnmarshalCBOR(cr); err != nil { 2597 2606 return xerrors.Errorf("unmarshaling t.Index pointer: %w", err) 2598 2607 } 2599 2608 } 2600 2609 2601 2610 } 2602 - // t.Value (bsky.RichtextFacet_Value) (struct) 2603 - case "value": 2611 + // t.Features ([]*bsky.RichtextFacet_Features_Elem) (slice) 2612 + case "features": 2613 + 2614 + maj, extra, err = cr.ReadHeader() 2615 + if err != nil { 2616 + return err 2617 + } 2618 + 2619 + if extra > cbg.MaxLength { 2620 + return fmt.Errorf("t.Features: array too large (%d)", extra) 2621 + } 2622 + 2623 + if maj != cbg.MajArray { 2624 + return fmt.Errorf("expected cbor array") 2625 + } 2626 + 2627 + if extra > 0 { 2628 + t.Features = make([]*RichtextFacet_Features_Elem, extra) 2629 + } 2604 2630 2605 - { 2631 + for i := 0; i < int(extra); i++ { 2606 2632 2607 - b, err := cr.ReadByte() 2608 - if err != nil { 2633 + var v RichtextFacet_Features_Elem 2634 + if err := v.UnmarshalCBOR(cr); err != nil { 2609 2635 return err 2610 - } 2611 - if b != cbg.CborNull[0] { 2612 - if err := cr.UnreadByte(); err != nil { 2613 - return err 2614 - } 2615 - t.Value = new(RichtextFacet_Value) 2616 - if err := t.Value.UnmarshalCBOR(cr); err != nil { 2617 - return xerrors.Errorf("unmarshaling t.Value pointer: %w", err) 2618 - } 2619 2636 } 2620 2637 2638 + t.Features[i] = &v 2621 2639 } 2640 + 2622 2641 // t.LexiconTypeID (string) (string) 2623 2642 case "LexiconTypeID": 2624 2643 ··· 2639 2658 2640 2659 return nil 2641 2660 } 2642 - func (t *RichtextFacet_TextSlice) MarshalCBOR(w io.Writer) error { 2661 + func (t *RichtextFacet_ByteSlice) MarshalCBOR(w io.Writer) error { 2643 2662 if t == nil { 2644 2663 _, err := w.Write(cbg.CborNull) 2645 2664 return err ··· 2651 2670 return err 2652 2671 } 2653 2672 2654 - // t.End (int64) (int64) 2655 - if len("end") > cbg.MaxLength { 2656 - return xerrors.Errorf("Value in field \"end\" was too long") 2673 + // t.ByteEnd (int64) (int64) 2674 + if len("byteEnd") > cbg.MaxLength { 2675 + return xerrors.Errorf("Value in field \"byteEnd\" was too long") 2657 2676 } 2658 2677 2659 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("end"))); err != nil { 2678 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("byteEnd"))); err != nil { 2660 2679 return err 2661 2680 } 2662 - if _, err := io.WriteString(w, string("end")); err != nil { 2681 + if _, err := io.WriteString(w, string("byteEnd")); err != nil { 2663 2682 return err 2664 2683 } 2665 2684 2666 - if t.End >= 0 { 2667 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.End)); err != nil { 2685 + if t.ByteEnd >= 0 { 2686 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ByteEnd)); err != nil { 2668 2687 return err 2669 2688 } 2670 2689 } else { 2671 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.End-1)); err != nil { 2690 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.ByteEnd-1)); err != nil { 2672 2691 return err 2673 2692 } 2674 2693 } 2675 2694 2676 - // t.Start (int64) (int64) 2677 - if len("start") > cbg.MaxLength { 2678 - return xerrors.Errorf("Value in field \"start\" was too long") 2695 + // t.ByteStart (int64) (int64) 2696 + if len("byteStart") > cbg.MaxLength { 2697 + return xerrors.Errorf("Value in field \"byteStart\" was too long") 2679 2698 } 2680 2699 2681 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("start"))); err != nil { 2700 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("byteStart"))); err != nil { 2682 2701 return err 2683 2702 } 2684 - if _, err := io.WriteString(w, string("start")); err != nil { 2703 + if _, err := io.WriteString(w, string("byteStart")); err != nil { 2685 2704 return err 2686 2705 } 2687 2706 2688 - if t.Start >= 0 { 2689 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Start)); err != nil { 2707 + if t.ByteStart >= 0 { 2708 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ByteStart)); err != nil { 2690 2709 return err 2691 2710 } 2692 2711 } else { 2693 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Start-1)); err != nil { 2712 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.ByteStart-1)); err != nil { 2694 2713 return err 2695 2714 } 2696 2715 } ··· 2720 2739 return nil 2721 2740 } 2722 2741 2723 - func (t *RichtextFacet_TextSlice) UnmarshalCBOR(r io.Reader) (err error) { 2724 - *t = RichtextFacet_TextSlice{} 2742 + func (t *RichtextFacet_ByteSlice) UnmarshalCBOR(r io.Reader) (err error) { 2743 + *t = RichtextFacet_ByteSlice{} 2725 2744 2726 2745 cr := cbg.NewCborReader(r) 2727 2746 ··· 2740 2759 } 2741 2760 2742 2761 if extra > cbg.MaxLength { 2743 - return fmt.Errorf("RichtextFacet_TextSlice: map struct too large (%d)", extra) 2762 + return fmt.Errorf("RichtextFacet_ByteSlice: map struct too large (%d)", extra) 2744 2763 } 2745 2764 2746 2765 var name string ··· 2758 2777 } 2759 2778 2760 2779 switch name { 2761 - // t.End (int64) (int64) 2762 - case "end": 2780 + // t.ByteEnd (int64) (int64) 2781 + case "byteEnd": 2763 2782 { 2764 2783 maj, extra, err := cr.ReadHeader() 2765 2784 var extraI int64 ··· 2782 2801 return fmt.Errorf("wrong type for int64 field: %d", maj) 2783 2802 } 2784 2803 2785 - t.End = int64(extraI) 2804 + t.ByteEnd = int64(extraI) 2786 2805 } 2787 - // t.Start (int64) (int64) 2788 - case "start": 2806 + // t.ByteStart (int64) (int64) 2807 + case "byteStart": 2789 2808 { 2790 2809 maj, extra, err := cr.ReadHeader() 2791 2810 var extraI int64 ··· 2808 2827 return fmt.Errorf("wrong type for int64 field: %d", maj) 2809 2828 } 2810 2829 2811 - t.Start = int64(extraI) 2830 + t.ByteStart = int64(extraI) 2812 2831 } 2813 2832 // t.LexiconTypeID (string) (string) 2814 2833 case "LexiconTypeID": ··· 2830 2849 2831 2850 return nil 2832 2851 } 2833 - func (t *RichtextFacet_Value) MarshalCBOR(w io.Writer) error { 2852 + func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error { 2834 2853 if t == nil { 2835 2854 _, err := w.Write(cbg.CborNull) 2836 2855 return err ··· 2876 2895 return nil 2877 2896 } 2878 2897 2879 - func (t *RichtextFacet_Value) UnmarshalCBOR(r io.Reader) (err error) { 2880 - *t = RichtextFacet_Value{} 2898 + func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) (err error) { 2899 + *t = RichtextFacet_Features_Elem{} 2881 2900 2882 2901 cr := cbg.NewCborReader(r) 2883 2902 ··· 2896 2915 } 2897 2916 2898 2917 if extra > cbg.MaxLength { 2899 - return fmt.Errorf("RichtextFacet_Value: map struct too large (%d)", extra) 2918 + return fmt.Errorf("RichtextFacet_Features_Elem: map struct too large (%d)", extra) 2900 2919 } 2901 2920 2902 2921 var name string
+19 -19
api/bsky/richtextfacet.go
··· 13 13 } 14 14 15 15 type RichtextFacet struct { 16 - LexiconTypeID string `json:"$type,omitempty"` 17 - Index *RichtextFacet_TextSlice `json:"index" cborgen:"index"` 18 - Value *RichtextFacet_Value `json:"value" cborgen:"value"` 16 + LexiconTypeID string `json:"$type,omitempty"` 17 + Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"` 18 + Index *RichtextFacet_ByteSlice `json:"index" cborgen:"index"` 19 19 } 20 20 21 - type RichtextFacet_Link struct { 21 + type RichtextFacet_ByteSlice struct { 22 22 LexiconTypeID string `json:"$type,omitempty"` 23 - Uri string `json:"uri" cborgen:"uri"` 24 - } 25 - 26 - type RichtextFacet_Mention struct { 27 - LexiconTypeID string `json:"$type,omitempty"` 28 - Did string `json:"did" cborgen:"did"` 29 - } 30 - 31 - type RichtextFacet_TextSlice struct { 32 - LexiconTypeID string `json:"$type,omitempty"` 33 - End int64 `json:"end" cborgen:"end"` 34 - Start int64 `json:"start" cborgen:"start"` 23 + ByteEnd int64 `json:"byteEnd" cborgen:"byteEnd"` 24 + ByteStart int64 `json:"byteStart" cborgen:"byteStart"` 35 25 } 36 26 37 - type RichtextFacet_Value struct { 27 + type RichtextFacet_Features_Elem struct { 38 28 RichtextFacet_Mention *RichtextFacet_Mention 39 29 RichtextFacet_Link *RichtextFacet_Link 40 30 } 41 31 42 - func (t *RichtextFacet_Value) MarshalJSON() ([]byte, error) { 32 + func (t *RichtextFacet_Features_Elem) MarshalJSON() ([]byte, error) { 43 33 if t.RichtextFacet_Mention != nil { 44 34 t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" 45 35 return json.Marshal(t.RichtextFacet_Mention) ··· 50 40 } 51 41 return nil, fmt.Errorf("cannot marshal empty enum") 52 42 } 53 - func (t *RichtextFacet_Value) UnmarshalJSON(b []byte) error { 43 + func (t *RichtextFacet_Features_Elem) UnmarshalJSON(b []byte) error { 54 44 typ, err := util.TypeExtract(b) 55 45 if err != nil { 56 46 return err ··· 68 58 return nil 69 59 } 70 60 } 61 + 62 + type RichtextFacet_Link struct { 63 + LexiconTypeID string `json:"$type,omitempty"` 64 + Uri string `json:"uri" cborgen:"uri"` 65 + } 66 + 67 + type RichtextFacet_Mention struct { 68 + LexiconTypeID string `json:"$type,omitempty"` 69 + Did string `json:"did" cborgen:"did"` 70 + }
+1 -1
gen/main.go
··· 24 24 panic(err) 25 25 } 26 26 27 - if err := cbg.WriteMapEncodersToFile("api/bsky/cbor_gen.go", "bsky", bsky.FeedPost{}, bsky.FeedRepost{}, bsky.FeedPost_Entity{}, bsky.FeedPost_ReplyRef{}, bsky.FeedPost_TextSlice{}, bsky.EmbedImages{}, bsky.EmbedExternal{}, bsky.EmbedExternal_External{}, bsky.EmbedImages_Image{}, bsky.GraphFollow{}, bsky.ActorProfile{}, bsky.EmbedRecord{}, bsky.FeedLike{}, bsky.RichtextFacet{}, bsky.RichtextFacet_TextSlice{}, bsky.RichtextFacet_Value{}, bsky.RichtextFacet_Link{}, bsky.RichtextFacet_Mention{}, bsky.EmbedRecordWithMedia{}, bsky.EmbedRecordWithMedia_Media{}); err != nil { 27 + if err := cbg.WriteMapEncodersToFile("api/bsky/cbor_gen.go", "bsky", bsky.FeedPost{}, bsky.FeedRepost{}, bsky.FeedPost_Entity{}, bsky.FeedPost_ReplyRef{}, bsky.FeedPost_TextSlice{}, bsky.EmbedImages{}, bsky.EmbedExternal{}, bsky.EmbedExternal_External{}, bsky.EmbedImages_Image{}, bsky.GraphFollow{}, bsky.ActorProfile{}, bsky.EmbedRecord{}, bsky.FeedLike{}, bsky.RichtextFacet{}, bsky.RichtextFacet_ByteSlice{}, bsky.RichtextFacet_Features_Elem{}, bsky.RichtextFacet_Link{}, bsky.RichtextFacet_Mention{}, bsky.EmbedRecordWithMedia{}, bsky.EmbedRecordWithMedia_Media{}); err != nil { 28 28 panic(err) 29 29 } 30 30