fork of indigo with slightly nicer lexgen

Gen new lexicons (#1109)

authored by Jaz and committed by GitHub 843b937d 919ab895

-3
api/atproto/cbor_gen.go
··· 1206 1206 1207 1207 return nil 1208 1208 } 1209 - 1210 1209 func (t *SyncSubscribeRepos_Identity) MarshalCBOR(w io.Writer) error { 1211 1210 if t == nil { 1212 1211 _, err := w.Write(cbg.CborNull) ··· 1879 1878 1880 1879 return nil 1881 1880 } 1882 - 1883 1881 func (t *SyncSubscribeRepos_RepoOp) MarshalCBOR(w io.Writer) error { 1884 1882 if t == nil { 1885 1883 _, err := w.Write(cbg.CborNull) ··· 2094 2092 2095 2093 return nil 2096 2094 } 2097 - 2098 2095 func (t *LabelDefs_SelfLabels) MarshalCBOR(w io.Writer) error { 2099 2096 if t == nil { 2100 2097 _, err := w.Write(cbg.CborNull)
+19 -10
api/bsky/actordefs.go
··· 379 379 380 380 // ActorDefs_ProfileAssociated is a "profileAssociated" in the app.bsky.actor.defs schema. 381 381 type ActorDefs_ProfileAssociated struct { 382 - Chat *ActorDefs_ProfileAssociatedChat `json:"chat,omitempty" cborgen:"chat,omitempty"` 383 - Feedgens *int64 `json:"feedgens,omitempty" cborgen:"feedgens,omitempty"` 384 - Labeler *bool `json:"labeler,omitempty" cborgen:"labeler,omitempty"` 385 - Lists *int64 `json:"lists,omitempty" cborgen:"lists,omitempty"` 386 - StarterPacks *int64 `json:"starterPacks,omitempty" cborgen:"starterPacks,omitempty"` 382 + ActivitySubscription *ActorDefs_ProfileAssociatedActivitySubscription `json:"activitySubscription,omitempty" cborgen:"activitySubscription,omitempty"` 383 + Chat *ActorDefs_ProfileAssociatedChat `json:"chat,omitempty" cborgen:"chat,omitempty"` 384 + Feedgens *int64 `json:"feedgens,omitempty" cborgen:"feedgens,omitempty"` 385 + Labeler *bool `json:"labeler,omitempty" cborgen:"labeler,omitempty"` 386 + Lists *int64 `json:"lists,omitempty" cborgen:"lists,omitempty"` 387 + StarterPacks *int64 `json:"starterPacks,omitempty" cborgen:"starterPacks,omitempty"` 388 + } 389 + 390 + // ActorDefs_ProfileAssociatedActivitySubscription is a "profileAssociatedActivitySubscription" in the app.bsky.actor.defs schema. 391 + type ActorDefs_ProfileAssociatedActivitySubscription struct { 392 + AllowSubscriptions string `json:"allowSubscriptions" cborgen:"allowSubscriptions"` 387 393 } 388 394 389 395 // ActorDefs_ProfileAssociatedChat is a "profileAssociatedChat" in the app.bsky.actor.defs schema. ··· 562 568 // 563 569 // Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. 564 570 type ActorDefs_ViewerState struct { 565 - BlockedBy *bool `json:"blockedBy,omitempty" cborgen:"blockedBy,omitempty"` 566 - Blocking *string `json:"blocking,omitempty" cborgen:"blocking,omitempty"` 567 - BlockingByList *GraphDefs_ListViewBasic `json:"blockingByList,omitempty" cborgen:"blockingByList,omitempty"` 568 - FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` 569 - Following *string `json:"following,omitempty" cborgen:"following,omitempty"` 571 + // activitySubscription: This property is present only in selected cases, as an optimization. 572 + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription,omitempty" cborgen:"activitySubscription,omitempty"` 573 + BlockedBy *bool `json:"blockedBy,omitempty" cborgen:"blockedBy,omitempty"` 574 + Blocking *string `json:"blocking,omitempty" cborgen:"blocking,omitempty"` 575 + BlockingByList *GraphDefs_ListViewBasic `json:"blockingByList,omitempty" cborgen:"blockingByList,omitempty"` 576 + FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` 577 + Following *string `json:"following,omitempty" cborgen:"following,omitempty"` 578 + // knownFollowers: This property is present only in selected cases, as an optimization. 570 579 KnownFollowers *ActorDefs_KnownFollowers `json:"knownFollowers,omitempty" cborgen:"knownFollowers,omitempty"` 571 580 Muted *bool `json:"muted,omitempty" cborgen:"muted,omitempty"` 572 581 MutedByList *GraphDefs_ListViewBasic `json:"mutedByList,omitempty" cborgen:"mutedByList,omitempty"`
+222 -4
api/bsky/cbor_gen.go
··· 645 645 } 646 646 647 647 cw := cbg.NewCborWriter(w) 648 + fieldCount := 4 648 649 649 - if _, err := cw.Write([]byte{163}); err != nil { 650 + if t.Via == nil { 651 + fieldCount-- 652 + } 653 + 654 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 650 655 return err 656 + } 657 + 658 + // t.Via (atproto.RepoStrongRef) (struct) 659 + if t.Via != nil { 660 + 661 + if len("via") > 1000000 { 662 + return xerrors.Errorf("Value in field \"via\" was too long") 663 + } 664 + 665 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("via"))); err != nil { 666 + return err 667 + } 668 + if _, err := cw.WriteString(string("via")); err != nil { 669 + return err 670 + } 671 + 672 + if err := t.Via.MarshalCBOR(cw); err != nil { 673 + return err 674 + } 651 675 } 652 676 653 677 // t.LexiconTypeID (string) (string) ··· 751 775 } 752 776 753 777 switch string(nameBuf[:nameLen]) { 754 - // t.LexiconTypeID (string) (string) 778 + // t.Via (atproto.RepoStrongRef) (struct) 779 + case "via": 780 + 781 + { 782 + 783 + b, err := cr.ReadByte() 784 + if err != nil { 785 + return err 786 + } 787 + if b != cbg.CborNull[0] { 788 + if err := cr.UnreadByte(); err != nil { 789 + return err 790 + } 791 + t.Via = new(atproto.RepoStrongRef) 792 + if err := t.Via.UnmarshalCBOR(cr); err != nil { 793 + return xerrors.Errorf("unmarshaling t.Via pointer: %w", err) 794 + } 795 + } 796 + 797 + } 798 + // t.LexiconTypeID (string) (string) 755 799 case "$type": 756 800 757 801 { ··· 2756 2800 } 2757 2801 2758 2802 cw := cbg.NewCborWriter(w) 2803 + fieldCount := 4 2759 2804 2760 - if _, err := cw.Write([]byte{163}); err != nil { 2805 + if t.Via == nil { 2806 + fieldCount-- 2807 + } 2808 + 2809 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2761 2810 return err 2811 + } 2812 + 2813 + // t.Via (atproto.RepoStrongRef) (struct) 2814 + if t.Via != nil { 2815 + 2816 + if len("via") > 1000000 { 2817 + return xerrors.Errorf("Value in field \"via\" was too long") 2818 + } 2819 + 2820 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("via"))); err != nil { 2821 + return err 2822 + } 2823 + if _, err := cw.WriteString(string("via")); err != nil { 2824 + return err 2825 + } 2826 + 2827 + if err := t.Via.MarshalCBOR(cw); err != nil { 2828 + return err 2829 + } 2762 2830 } 2763 2831 2764 2832 // t.LexiconTypeID (string) (string) ··· 2862 2930 } 2863 2931 2864 2932 switch string(nameBuf[:nameLen]) { 2865 - // t.LexiconTypeID (string) (string) 2933 + // t.Via (atproto.RepoStrongRef) (struct) 2934 + case "via": 2935 + 2936 + { 2937 + 2938 + b, err := cr.ReadByte() 2939 + if err != nil { 2940 + return err 2941 + } 2942 + if b != cbg.CborNull[0] { 2943 + if err := cr.UnreadByte(); err != nil { 2944 + return err 2945 + } 2946 + t.Via = new(atproto.RepoStrongRef) 2947 + if err := t.Via.UnmarshalCBOR(cr); err != nil { 2948 + return xerrors.Errorf("unmarshaling t.Via pointer: %w", err) 2949 + } 2950 + } 2951 + 2952 + } 2953 + // t.LexiconTypeID (string) (string) 2866 2954 case "$type": 2867 2955 2868 2956 { ··· 9020 9108 9021 9109 return nil 9022 9110 } 9111 + func (t *NotificationDeclaration) MarshalCBOR(w io.Writer) error { 9112 + if t == nil { 9113 + _, err := w.Write(cbg.CborNull) 9114 + return err 9115 + } 9116 + 9117 + cw := cbg.NewCborWriter(w) 9118 + 9119 + if _, err := cw.Write([]byte{162}); err != nil { 9120 + return err 9121 + } 9122 + 9123 + // t.LexiconTypeID (string) (string) 9124 + if len("$type") > 1000000 { 9125 + return xerrors.Errorf("Value in field \"$type\" was too long") 9126 + } 9127 + 9128 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 9129 + return err 9130 + } 9131 + if _, err := cw.WriteString(string("$type")); err != nil { 9132 + return err 9133 + } 9134 + 9135 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.notification.declaration"))); err != nil { 9136 + return err 9137 + } 9138 + if _, err := cw.WriteString(string("app.bsky.notification.declaration")); err != nil { 9139 + return err 9140 + } 9141 + 9142 + // t.AllowSubscriptions (string) (string) 9143 + if len("allowSubscriptions") > 1000000 { 9144 + return xerrors.Errorf("Value in field \"allowSubscriptions\" was too long") 9145 + } 9146 + 9147 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("allowSubscriptions"))); err != nil { 9148 + return err 9149 + } 9150 + if _, err := cw.WriteString(string("allowSubscriptions")); err != nil { 9151 + return err 9152 + } 9153 + 9154 + if len(t.AllowSubscriptions) > 1000000 { 9155 + return xerrors.Errorf("Value in field t.AllowSubscriptions was too long") 9156 + } 9157 + 9158 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.AllowSubscriptions))); err != nil { 9159 + return err 9160 + } 9161 + if _, err := cw.WriteString(string(t.AllowSubscriptions)); err != nil { 9162 + return err 9163 + } 9164 + return nil 9165 + } 9166 + 9167 + func (t *NotificationDeclaration) UnmarshalCBOR(r io.Reader) (err error) { 9168 + *t = NotificationDeclaration{} 9169 + 9170 + cr := cbg.NewCborReader(r) 9171 + 9172 + maj, extra, err := cr.ReadHeader() 9173 + if err != nil { 9174 + return err 9175 + } 9176 + defer func() { 9177 + if err == io.EOF { 9178 + err = io.ErrUnexpectedEOF 9179 + } 9180 + }() 9181 + 9182 + if maj != cbg.MajMap { 9183 + return fmt.Errorf("cbor input should be of type map") 9184 + } 9185 + 9186 + if extra > cbg.MaxLength { 9187 + return fmt.Errorf("NotificationDeclaration: map struct too large (%d)", extra) 9188 + } 9189 + 9190 + n := extra 9191 + 9192 + nameBuf := make([]byte, 18) 9193 + for i := uint64(0); i < n; i++ { 9194 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9195 + if err != nil { 9196 + return err 9197 + } 9198 + 9199 + if !ok { 9200 + // Field doesn't exist on this type, so ignore it 9201 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 9202 + return err 9203 + } 9204 + continue 9205 + } 9206 + 9207 + switch string(nameBuf[:nameLen]) { 9208 + // t.LexiconTypeID (string) (string) 9209 + case "$type": 9210 + 9211 + { 9212 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9213 + if err != nil { 9214 + return err 9215 + } 9216 + 9217 + t.LexiconTypeID = string(sval) 9218 + } 9219 + // t.AllowSubscriptions (string) (string) 9220 + case "allowSubscriptions": 9221 + 9222 + { 9223 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9224 + if err != nil { 9225 + return err 9226 + } 9227 + 9228 + t.AllowSubscriptions = string(sval) 9229 + } 9230 + 9231 + default: 9232 + // Field doesn't exist on this type, so ignore it 9233 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 9234 + return err 9235 + } 9236 + } 9237 + } 9238 + 9239 + return nil 9240 + }
+19
api/bsky/notificationdeclaration.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.notification.declaration 6 + 7 + import ( 8 + "github.com/bluesky-social/indigo/lex/util" 9 + ) 10 + 11 + func init() { 12 + util.RegisterType("app.bsky.notification.declaration", &NotificationDeclaration{}) 13 + } // 14 + // RECORDTYPE: NotificationDeclaration 15 + type NotificationDeclaration struct { 16 + LexiconTypeID string `json:"$type,const=app.bsky.notification.declaration" cborgen:"$type,const=app.bsky.notification.declaration"` 17 + // allowSubscriptions: A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'. 18 + AllowSubscriptions string `json:"allowSubscriptions" cborgen:"allowSubscriptions"` 19 + }
+14
api/bsky/notificationdefs.go
··· 4 4 5 5 // schema: app.bsky.notification.defs 6 6 7 + // NotificationDefs_ActivitySubscription is a "activitySubscription" in the app.bsky.notification.defs schema. 8 + type NotificationDefs_ActivitySubscription struct { 9 + Post bool `json:"post" cborgen:"post"` 10 + Reply bool `json:"reply" cborgen:"reply"` 11 + } 12 + 7 13 // NotificationDefs_ChatPreference is a "chatPreference" in the app.bsky.notification.defs schema. 8 14 type NotificationDefs_ChatPreference struct { 9 15 Include string `json:"include" cborgen:"include"` ··· 43 49 // NotificationDefs_RecordDeleted is a "recordDeleted" in the app.bsky.notification.defs schema. 44 50 type NotificationDefs_RecordDeleted struct { 45 51 } 52 + 53 + // NotificationDefs_SubjectActivitySubscription is a "subjectActivitySubscription" in the app.bsky.notification.defs schema. 54 + // 55 + // Object used to store activity subscription data in stash. 56 + type NotificationDefs_SubjectActivitySubscription struct { 57 + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription" cborgen:"activitySubscription"` 58 + Subject string `json:"subject" cborgen:"subject"` 59 + }
+35
api/bsky/notificationlistActivitySubscriptions.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.notification.listActivitySubscriptions 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + // NotificationListActivitySubscriptions_Output is the output of a app.bsky.notification.listActivitySubscriptions call. 14 + type NotificationListActivitySubscriptions_Output struct { 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Subscriptions []*ActorDefs_ProfileView `json:"subscriptions" cborgen:"subscriptions"` 17 + } 18 + 19 + // NotificationListActivitySubscriptions calls the XRPC method "app.bsky.notification.listActivitySubscriptions". 20 + func NotificationListActivitySubscriptions(ctx context.Context, c util.LexClient, cursor string, limit int64) (*NotificationListActivitySubscriptions_Output, error) { 21 + var out NotificationListActivitySubscriptions_Output 22 + 23 + params := map[string]interface{}{} 24 + if cursor != "" { 25 + params["cursor"] = cursor 26 + } 27 + if limit != 0 { 28 + params["limit"] = limit 29 + } 30 + if err := c.LexDo(ctx, util.Query, "", "app.bsky.notification.listActivitySubscriptions", params, nil, &out); err != nil { 31 + return nil, err 32 + } 33 + 34 + return &out, nil 35 + }
+33
api/bsky/notificationputActivitySubscription.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.notification.putActivitySubscription 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + // NotificationPutActivitySubscription_Input is the input argument to a app.bsky.notification.putActivitySubscription call. 14 + type NotificationPutActivitySubscription_Input struct { 15 + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription" cborgen:"activitySubscription"` 16 + Subject string `json:"subject" cborgen:"subject"` 17 + } 18 + 19 + // NotificationPutActivitySubscription_Output is the output of a app.bsky.notification.putActivitySubscription call. 20 + type NotificationPutActivitySubscription_Output struct { 21 + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription,omitempty" cborgen:"activitySubscription,omitempty"` 22 + Subject string `json:"subject" cborgen:"subject"` 23 + } 24 + 25 + // NotificationPutActivitySubscription calls the XRPC method "app.bsky.notification.putActivitySubscription". 26 + func NotificationPutActivitySubscription(ctx context.Context, c util.LexClient, input *NotificationPutActivitySubscription_Input) (*NotificationPutActivitySubscription_Output, error) { 27 + var out NotificationPutActivitySubscription_Output 28 + if err := c.LexDo(ctx, util.Procedure, "application/json", "app.bsky.notification.putActivitySubscription", nil, input, &out); err != nil { 29 + return nil, err 30 + } 31 + 32 + return &out, nil 33 + }
+40
api/bsky/unspecceddefs.go
··· 31 31 Topic string `json:"topic" cborgen:"topic"` 32 32 } 33 33 34 + // UnspeccedDefs_ThreadItemBlocked is a "threadItemBlocked" in the app.bsky.unspecced.defs schema. 35 + // 36 + // RECORDTYPE: UnspeccedDefs_ThreadItemBlocked 37 + type UnspeccedDefs_ThreadItemBlocked struct { 38 + LexiconTypeID string `json:"$type,const=app.bsky.unspecced.defs#threadItemBlocked" cborgen:"$type,const=app.bsky.unspecced.defs#threadItemBlocked"` 39 + Author *FeedDefs_BlockedAuthor `json:"author" cborgen:"author"` 40 + } 41 + 42 + // UnspeccedDefs_ThreadItemNoUnauthenticated is a "threadItemNoUnauthenticated" in the app.bsky.unspecced.defs schema. 43 + // 44 + // RECORDTYPE: UnspeccedDefs_ThreadItemNoUnauthenticated 45 + type UnspeccedDefs_ThreadItemNoUnauthenticated struct { 46 + LexiconTypeID string `json:"$type,const=app.bsky.unspecced.defs#threadItemNoUnauthenticated" cborgen:"$type,const=app.bsky.unspecced.defs#threadItemNoUnauthenticated"` 47 + } 48 + 49 + // UnspeccedDefs_ThreadItemNotFound is a "threadItemNotFound" in the app.bsky.unspecced.defs schema. 50 + // 51 + // RECORDTYPE: UnspeccedDefs_ThreadItemNotFound 52 + type UnspeccedDefs_ThreadItemNotFound struct { 53 + LexiconTypeID string `json:"$type,const=app.bsky.unspecced.defs#threadItemNotFound" cborgen:"$type,const=app.bsky.unspecced.defs#threadItemNotFound"` 54 + } 55 + 56 + // UnspeccedDefs_ThreadItemPost is a "threadItemPost" in the app.bsky.unspecced.defs schema. 57 + // 58 + // RECORDTYPE: UnspeccedDefs_ThreadItemPost 59 + type UnspeccedDefs_ThreadItemPost struct { 60 + LexiconTypeID string `json:"$type,const=app.bsky.unspecced.defs#threadItemPost" cborgen:"$type,const=app.bsky.unspecced.defs#threadItemPost"` 61 + // hiddenByThreadgate: The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread. 62 + HiddenByThreadgate bool `json:"hiddenByThreadgate" cborgen:"hiddenByThreadgate"` 63 + // moreParents: This post has more parents that were not present in the response. This is just a boolean, without the number of parents. 64 + MoreParents bool `json:"moreParents" cborgen:"moreParents"` 65 + // moreReplies: This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate. 66 + MoreReplies int64 `json:"moreReplies" cborgen:"moreReplies"` 67 + // mutedByViewer: This is by an account muted by the viewer requesting it. 68 + MutedByViewer bool `json:"mutedByViewer" cborgen:"mutedByViewer"` 69 + // opThread: This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread. 70 + OpThread bool `json:"opThread" cborgen:"opThread"` 71 + Post *FeedDefs_PostView `json:"post" cborgen:"post"` 72 + } 73 + 34 74 // UnspeccedDefs_TrendView is a "trendView" in the app.bsky.unspecced.defs schema. 35 75 type UnspeccedDefs_TrendView struct { 36 76 Actors []*ActorDefs_ProfileViewBasic `json:"actors" cborgen:"actors"`
+73
api/bsky/unspeccedgetPostThreadOtherV2.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.unspecced.getPostThreadOtherV2 6 + 7 + import ( 8 + "context" 9 + "encoding/json" 10 + "fmt" 11 + 12 + "github.com/bluesky-social/indigo/lex/util" 13 + ) 14 + 15 + // UnspeccedGetPostThreadOtherV2_Output is the output of a app.bsky.unspecced.getPostThreadOtherV2 call. 16 + type UnspeccedGetPostThreadOtherV2_Output struct { 17 + // thread: A flat list of other thread items. The depth of each item is indicated by the depth property inside the item. 18 + Thread []*UnspeccedGetPostThreadOtherV2_ThreadItem `json:"thread" cborgen:"thread"` 19 + } 20 + 21 + // UnspeccedGetPostThreadOtherV2_ThreadItem is a "threadItem" in the app.bsky.unspecced.getPostThreadOtherV2 schema. 22 + type UnspeccedGetPostThreadOtherV2_ThreadItem struct { 23 + // depth: The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. 24 + Depth int64 `json:"depth" cborgen:"depth"` 25 + Uri string `json:"uri" cborgen:"uri"` 26 + Value *UnspeccedGetPostThreadOtherV2_ThreadItem_Value `json:"value" cborgen:"value"` 27 + } 28 + 29 + type UnspeccedGetPostThreadOtherV2_ThreadItem_Value struct { 30 + UnspeccedDefs_ThreadItemPost *UnspeccedDefs_ThreadItemPost 31 + } 32 + 33 + func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) MarshalJSON() ([]byte, error) { 34 + if t.UnspeccedDefs_ThreadItemPost != nil { 35 + t.UnspeccedDefs_ThreadItemPost.LexiconTypeID = "app.bsky.unspecced.defs#threadItemPost" 36 + return json.Marshal(t.UnspeccedDefs_ThreadItemPost) 37 + } 38 + return nil, fmt.Errorf("cannot marshal empty enum") 39 + } 40 + func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) UnmarshalJSON(b []byte) error { 41 + typ, err := util.TypeExtract(b) 42 + if err != nil { 43 + return err 44 + } 45 + 46 + switch typ { 47 + case "app.bsky.unspecced.defs#threadItemPost": 48 + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) 49 + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemPost) 50 + 51 + default: 52 + return nil 53 + } 54 + } 55 + 56 + // UnspeccedGetPostThreadOtherV2 calls the XRPC method "app.bsky.unspecced.getPostThreadOtherV2". 57 + // 58 + // anchor: Reference (AT-URI) to post record. This is the anchor post. 59 + // prioritizeFollowedUsers: Whether to prioritize posts from followed users. It only has effect when the user is authenticated. 60 + func UnspeccedGetPostThreadOtherV2(ctx context.Context, c util.LexClient, anchor string, prioritizeFollowedUsers bool) (*UnspeccedGetPostThreadOtherV2_Output, error) { 61 + var out UnspeccedGetPostThreadOtherV2_Output 62 + 63 + params := map[string]interface{}{} 64 + params["anchor"] = anchor 65 + if prioritizeFollowedUsers { 66 + params["prioritizeFollowedUsers"] = prioritizeFollowedUsers 67 + } 68 + if err := c.LexDo(ctx, util.Query, "", "app.bsky.unspecced.getPostThreadOtherV2", params, nil, &out); err != nil { 69 + return nil, err 70 + } 71 + 72 + return &out, nil 73 + }
+116
api/bsky/unspeccedgetPostThreadV2.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.unspecced.getPostThreadV2 6 + 7 + import ( 8 + "context" 9 + "encoding/json" 10 + "fmt" 11 + 12 + "github.com/bluesky-social/indigo/lex/util" 13 + ) 14 + 15 + // UnspeccedGetPostThreadV2_Output is the output of a app.bsky.unspecced.getPostThreadV2 call. 16 + type UnspeccedGetPostThreadV2_Output struct { 17 + // hasOtherReplies: Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them. 18 + HasOtherReplies bool `json:"hasOtherReplies" cborgen:"hasOtherReplies"` 19 + // thread: A flat list of thread items. The depth of each item is indicated by the depth property inside the item. 20 + Thread []*UnspeccedGetPostThreadV2_ThreadItem `json:"thread" cborgen:"thread"` 21 + Threadgate *FeedDefs_ThreadgateView `json:"threadgate,omitempty" cborgen:"threadgate,omitempty"` 22 + } 23 + 24 + // UnspeccedGetPostThreadV2_ThreadItem is a "threadItem" in the app.bsky.unspecced.getPostThreadV2 schema. 25 + type UnspeccedGetPostThreadV2_ThreadItem struct { 26 + // depth: The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. 27 + Depth int64 `json:"depth" cborgen:"depth"` 28 + Uri string `json:"uri" cborgen:"uri"` 29 + Value *UnspeccedGetPostThreadV2_ThreadItem_Value `json:"value" cborgen:"value"` 30 + } 31 + 32 + type UnspeccedGetPostThreadV2_ThreadItem_Value struct { 33 + UnspeccedDefs_ThreadItemPost *UnspeccedDefs_ThreadItemPost 34 + UnspeccedDefs_ThreadItemNoUnauthenticated *UnspeccedDefs_ThreadItemNoUnauthenticated 35 + UnspeccedDefs_ThreadItemNotFound *UnspeccedDefs_ThreadItemNotFound 36 + UnspeccedDefs_ThreadItemBlocked *UnspeccedDefs_ThreadItemBlocked 37 + } 38 + 39 + func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) MarshalJSON() ([]byte, error) { 40 + if t.UnspeccedDefs_ThreadItemPost != nil { 41 + t.UnspeccedDefs_ThreadItemPost.LexiconTypeID = "app.bsky.unspecced.defs#threadItemPost" 42 + return json.Marshal(t.UnspeccedDefs_ThreadItemPost) 43 + } 44 + if t.UnspeccedDefs_ThreadItemNoUnauthenticated != nil { 45 + t.UnspeccedDefs_ThreadItemNoUnauthenticated.LexiconTypeID = "app.bsky.unspecced.defs#threadItemNoUnauthenticated" 46 + return json.Marshal(t.UnspeccedDefs_ThreadItemNoUnauthenticated) 47 + } 48 + if t.UnspeccedDefs_ThreadItemNotFound != nil { 49 + t.UnspeccedDefs_ThreadItemNotFound.LexiconTypeID = "app.bsky.unspecced.defs#threadItemNotFound" 50 + return json.Marshal(t.UnspeccedDefs_ThreadItemNotFound) 51 + } 52 + if t.UnspeccedDefs_ThreadItemBlocked != nil { 53 + t.UnspeccedDefs_ThreadItemBlocked.LexiconTypeID = "app.bsky.unspecced.defs#threadItemBlocked" 54 + return json.Marshal(t.UnspeccedDefs_ThreadItemBlocked) 55 + } 56 + return nil, fmt.Errorf("cannot marshal empty enum") 57 + } 58 + func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) UnmarshalJSON(b []byte) error { 59 + typ, err := util.TypeExtract(b) 60 + if err != nil { 61 + return err 62 + } 63 + 64 + switch typ { 65 + case "app.bsky.unspecced.defs#threadItemPost": 66 + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) 67 + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemPost) 68 + case "app.bsky.unspecced.defs#threadItemNoUnauthenticated": 69 + t.UnspeccedDefs_ThreadItemNoUnauthenticated = new(UnspeccedDefs_ThreadItemNoUnauthenticated) 70 + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemNoUnauthenticated) 71 + case "app.bsky.unspecced.defs#threadItemNotFound": 72 + t.UnspeccedDefs_ThreadItemNotFound = new(UnspeccedDefs_ThreadItemNotFound) 73 + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemNotFound) 74 + case "app.bsky.unspecced.defs#threadItemBlocked": 75 + t.UnspeccedDefs_ThreadItemBlocked = new(UnspeccedDefs_ThreadItemBlocked) 76 + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemBlocked) 77 + 78 + default: 79 + return nil 80 + } 81 + } 82 + 83 + // UnspeccedGetPostThreadV2 calls the XRPC method "app.bsky.unspecced.getPostThreadV2". 84 + // 85 + // above: Whether to include parents above the anchor. 86 + // anchor: Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post. 87 + // below: How many levels of replies to include below the anchor. 88 + // branchingFactor: Maximum of replies to include at each level of the thread, except for the direct replies to the anchor, which are (NOTE: currently, during unspecced phase) all returned (NOTE: later they might be paginated). 89 + // prioritizeFollowedUsers: Whether to prioritize posts from followed users. It only has effect when the user is authenticated. 90 + // sort: Sorting for the thread replies. 91 + func UnspeccedGetPostThreadV2(ctx context.Context, c util.LexClient, above bool, anchor string, below int64, branchingFactor int64, prioritizeFollowedUsers bool, sort string) (*UnspeccedGetPostThreadV2_Output, error) { 92 + var out UnspeccedGetPostThreadV2_Output 93 + 94 + params := map[string]interface{}{} 95 + if above { 96 + params["above"] = above 97 + } 98 + params["anchor"] = anchor 99 + if below != 0 { 100 + params["below"] = below 101 + } 102 + if branchingFactor != 0 { 103 + params["branchingFactor"] = branchingFactor 104 + } 105 + if prioritizeFollowedUsers { 106 + params["prioritizeFollowedUsers"] = prioritizeFollowedUsers 107 + } 108 + if sort != "" { 109 + params["sort"] = sort 110 + } 111 + if err := c.LexDo(ctx, util.Query, "", "app.bsky.unspecced.getPostThreadV2", params, nil, &out); err != nil { 112 + return nil, err 113 + } 114 + 115 + return &out, nil 116 + }
+1
gen/main.go
··· 76 76 bsky.FeedPostgate_DisableRule{}, 77 77 bsky.GraphVerification{}, 78 78 bsky.ActorStatus{}, 79 + bsky.NotificationDeclaration{}, 79 80 /*bsky.EmbedImages_View{}, 80 81 bsky.EmbedRecord_View{}, bsky.EmbedRecordWithMedia_View{}, 81 82 bsky.EmbedExternal_View{}, bsky.EmbedImages_ViewImage{},