···49754976 return nil
4977}
4978+func (t *LiveRecommendations) MarshalCBOR(w io.Writer) error {
4979+ if t == nil {
4980+ _, err := w.Write(cbg.CborNull)
4981+ return err
4982+ }
4983+4984+ cw := cbg.NewCborWriter(w)
4985+4986+ if _, err := cw.Write([]byte{163}); err != nil {
4987+ return err
4988+ }
4989+4990+ // t.LexiconTypeID (string) (string)
4991+ if len("$type") > 1000000 {
4992+ return xerrors.Errorf("Value in field \"$type\" was too long")
4993+ }
4994+4995+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
4996+ return err
4997+ }
4998+ if _, err := cw.WriteString(string("$type")); err != nil {
4999+ return err
5000+ }
5001+5002+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.live.recommendations"))); err != nil {
5003+ return err
5004+ }
5005+ if _, err := cw.WriteString(string("place.stream.live.recommendations")); err != nil {
5006+ return err
5007+ }
5008+5009+ // t.CreatedAt (string) (string)
5010+ if len("createdAt") > 1000000 {
5011+ return xerrors.Errorf("Value in field \"createdAt\" was too long")
5012+ }
5013+5014+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
5015+ return err
5016+ }
5017+ if _, err := cw.WriteString(string("createdAt")); err != nil {
5018+ return err
5019+ }
5020+5021+ if len(t.CreatedAt) > 1000000 {
5022+ return xerrors.Errorf("Value in field t.CreatedAt was too long")
5023+ }
5024+5025+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
5026+ return err
5027+ }
5028+ if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
5029+ return err
5030+ }
5031+5032+ // t.Streamers ([]string) (slice)
5033+ if len("streamers") > 1000000 {
5034+ return xerrors.Errorf("Value in field \"streamers\" was too long")
5035+ }
5036+5037+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("streamers"))); err != nil {
5038+ return err
5039+ }
5040+ if _, err := cw.WriteString(string("streamers")); err != nil {
5041+ return err
5042+ }
5043+5044+ if len(t.Streamers) > 8192 {
5045+ return xerrors.Errorf("Slice value in field t.Streamers was too long")
5046+ }
5047+5048+ if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Streamers))); err != nil {
5049+ return err
5050+ }
5051+ for _, v := range t.Streamers {
5052+ if len(v) > 1000000 {
5053+ return xerrors.Errorf("Value in field v was too long")
5054+ }
5055+5056+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
5057+ return err
5058+ }
5059+ if _, err := cw.WriteString(string(v)); err != nil {
5060+ return err
5061+ }
5062+5063+ }
5064+ return nil
5065+}
5066+5067+func (t *LiveRecommendations) UnmarshalCBOR(r io.Reader) (err error) {
5068+ *t = LiveRecommendations{}
5069+5070+ cr := cbg.NewCborReader(r)
5071+5072+ maj, extra, err := cr.ReadHeader()
5073+ if err != nil {
5074+ return err
5075+ }
5076+ defer func() {
5077+ if err == io.EOF {
5078+ err = io.ErrUnexpectedEOF
5079+ }
5080+ }()
5081+5082+ if maj != cbg.MajMap {
5083+ return fmt.Errorf("cbor input should be of type map")
5084+ }
5085+5086+ if extra > cbg.MaxLength {
5087+ return fmt.Errorf("LiveRecommendations: map struct too large (%d)", extra)
5088+ }
5089+5090+ n := extra
5091+5092+ nameBuf := make([]byte, 9)
5093+ for i := uint64(0); i < n; i++ {
5094+ nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
5095+ if err != nil {
5096+ return err
5097+ }
5098+5099+ if !ok {
5100+ // Field doesn't exist on this type, so ignore it
5101+ if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
5102+ return err
5103+ }
5104+ continue
5105+ }
5106+5107+ switch string(nameBuf[:nameLen]) {
5108+ // t.LexiconTypeID (string) (string)
5109+ case "$type":
5110+5111+ {
5112+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
5113+ if err != nil {
5114+ return err
5115+ }
5116+5117+ t.LexiconTypeID = string(sval)
5118+ }
5119+ // t.CreatedAt (string) (string)
5120+ case "createdAt":
5121+5122+ {
5123+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
5124+ if err != nil {
5125+ return err
5126+ }
5127+5128+ t.CreatedAt = string(sval)
5129+ }
5130+ // t.Streamers ([]string) (slice)
5131+ case "streamers":
5132+5133+ maj, extra, err = cr.ReadHeader()
5134+ if err != nil {
5135+ return err
5136+ }
5137+5138+ if extra > 8192 {
5139+ return fmt.Errorf("t.Streamers: array too large (%d)", extra)
5140+ }
5141+5142+ if maj != cbg.MajArray {
5143+ return fmt.Errorf("expected cbor array")
5144+ }
5145+5146+ if extra > 0 {
5147+ t.Streamers = make([]string, extra)
5148+ }
5149+5150+ for i := 0; i < int(extra); i++ {
5151+ {
5152+ var maj byte
5153+ var extra uint64
5154+ var err error
5155+ _ = maj
5156+ _ = extra
5157+ _ = err
5158+5159+ {
5160+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
5161+ if err != nil {
5162+ return err
5163+ }
5164+5165+ t.Streamers[i] = string(sval)
5166+ }
5167+5168+ }
5169+ }
5170+5171+ default:
5172+ // Field doesn't exist on this type, so ignore it
5173+ if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
5174+ return err
5175+ }
5176+ }
5177+ }
5178+5179+ return nil
5180+}
+34
pkg/streamplace/livegetRecommendations.go
···0000000000000000000000000000000000
···1+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2+3+package streamplace
4+5+// schema: place.stream.live.getRecommendations
6+7+import (
8+ "context"
9+10+ "github.com/bluesky-social/indigo/lex/util"
11+)
12+13+// LiveGetRecommendations_Output is the output of a place.stream.live.getRecommendations call.
14+type LiveGetRecommendations_Output struct {
15+ // streamers: Ordered list of recommended streamer DIDs
16+ Streamers []string `json:"streamers" cborgen:"streamers"`
17+ // userDID: The user who created this recommendation list
18+ UserDID *string `json:"userDID,omitempty" cborgen:"userDID,omitempty"`
19+}
20+21+// LiveGetRecommendations calls the XRPC method "place.stream.live.getRecommendations".
22+//
23+// userDID: The DID of the user whose recommendations to fetch
24+func LiveGetRecommendations(ctx context.Context, c util.LexClient, userDID string) (*LiveGetRecommendations_Output, error) {
25+ var out LiveGetRecommendations_Output
26+27+ params := map[string]interface{}{}
28+ params["userDID"] = userDID
29+ if err := c.LexDo(ctx, util.Query, "", "place.stream.live.getRecommendations", params, nil, &out); err != nil {
30+ return nil, err
31+ }
32+33+ return &out, nil
34+}
+21
pkg/streamplace/liverecommendations.go
···000000000000000000000
···1+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2+3+package streamplace
4+5+// schema: place.stream.live.recommendations
6+7+import (
8+ "github.com/bluesky-social/indigo/lex/util"
9+)
10+11+func init() {
12+ util.RegisterType("place.stream.live.recommendations", &LiveRecommendations{})
13+} //
14+// RECORDTYPE: LiveRecommendations
15+type LiveRecommendations struct {
16+ LexiconTypeID string `json:"$type,const=place.stream.live.recommendations" cborgen:"$type,const=place.stream.live.recommendations"`
17+ // createdAt: Client-declared timestamp when this list was created.
18+ CreatedAt string `json:"createdAt" cborgen:"createdAt"`
19+ // streamers: Ordered list of recommended streamer DIDs
20+ Streamers []string `json:"streamers" cborgen:"streamers"`
21+}
+44
pkg/streamplace/livesearchActorsTypeahead.go
···00000000000000000000000000000000000000000000
···1+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2+3+package streamplace
4+5+// schema: place.stream.live.searchActorsTypeahead
6+7+import (
8+ "context"
9+10+ "github.com/bluesky-social/indigo/lex/util"
11+)
12+13+// LiveSearchActorsTypeahead_Actor is a "actor" in the place.stream.live.searchActorsTypeahead schema.
14+type LiveSearchActorsTypeahead_Actor struct {
15+ // did: The actor's DID
16+ Did string `json:"did" cborgen:"did"`
17+ // handle: The actor's handle
18+ Handle string `json:"handle" cborgen:"handle"`
19+}
20+21+// LiveSearchActorsTypeahead_Output is the output of a place.stream.live.searchActorsTypeahead call.
22+type LiveSearchActorsTypeahead_Output struct {
23+ Actors []*LiveSearchActorsTypeahead_Actor `json:"actors" cborgen:"actors"`
24+}
25+26+// LiveSearchActorsTypeahead calls the XRPC method "place.stream.live.searchActorsTypeahead".
27+//
28+// q: Search query prefix; not a full query string.
29+func LiveSearchActorsTypeahead(ctx context.Context, c util.LexClient, limit int64, q string) (*LiveSearchActorsTypeahead_Output, error) {
30+ var out LiveSearchActorsTypeahead_Output
31+32+ params := map[string]interface{}{}
33+ if limit != 0 {
34+ params["limit"] = limit
35+ }
36+ if q != "" {
37+ params["q"] = q
38+ }
39+ if err := c.LexDo(ctx, util.Query, "", "place.stream.live.searchActorsTypeahead", params, nil, &out); err != nil {
40+ return nil, err
41+ }
42+43+ return &out, nil
44+}