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