forked from
tangled.org/core
fork
Configure Feed
Select the types of activity you want to include in your feed.
Monorepo for Tangled
fork
Configure Feed
Select the types of activity you want to include in your feed.
1// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
2
3package tangled
4
5import (
6 "fmt"
7 "io"
8 "math"
9 "sort"
10
11 cid "github.com/ipfs/go-cid"
12 cbg "github.com/whyrusleeping/cbor-gen"
13 xerrors "golang.org/x/xerrors"
14)
15
16var _ = xerrors.Errorf
17var _ = cid.Undef
18var _ = math.E
19var _ = sort.Sort
20
21func (t *FeedStar) MarshalCBOR(w io.Writer) error {
22 if t == nil {
23 _, err := w.Write(cbg.CborNull)
24 return err
25 }
26
27 cw := cbg.NewCborWriter(w)
28
29 if _, err := cw.Write([]byte{163}); err != nil {
30 return err
31 }
32
33 // t.LexiconTypeID (string) (string)
34 if len("$type") > 1000000 {
35 return xerrors.Errorf("Value in field \"$type\" was too long")
36 }
37
38 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
39 return err
40 }
41 if _, err := cw.WriteString(string("$type")); err != nil {
42 return err
43 }
44
45 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.feed.star"))); err != nil {
46 return err
47 }
48 if _, err := cw.WriteString(string("sh.tangled.feed.star")); err != nil {
49 return err
50 }
51
52 // t.Subject (string) (string)
53 if len("subject") > 1000000 {
54 return xerrors.Errorf("Value in field \"subject\" was too long")
55 }
56
57 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
58 return err
59 }
60 if _, err := cw.WriteString(string("subject")); err != nil {
61 return err
62 }
63
64 if len(t.Subject) > 1000000 {
65 return xerrors.Errorf("Value in field t.Subject was too long")
66 }
67
68 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
69 return err
70 }
71 if _, err := cw.WriteString(string(t.Subject)); err != nil {
72 return err
73 }
74
75 // t.CreatedAt (string) (string)
76 if len("createdAt") > 1000000 {
77 return xerrors.Errorf("Value in field \"createdAt\" was too long")
78 }
79
80 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
81 return err
82 }
83 if _, err := cw.WriteString(string("createdAt")); err != nil {
84 return err
85 }
86
87 if len(t.CreatedAt) > 1000000 {
88 return xerrors.Errorf("Value in field t.CreatedAt was too long")
89 }
90
91 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
92 return err
93 }
94 if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
95 return err
96 }
97 return nil
98}
99
100func (t *FeedStar) UnmarshalCBOR(r io.Reader) (err error) {
101 *t = FeedStar{}
102
103 cr := cbg.NewCborReader(r)
104
105 maj, extra, err := cr.ReadHeader()
106 if err != nil {
107 return err
108 }
109 defer func() {
110 if err == io.EOF {
111 err = io.ErrUnexpectedEOF
112 }
113 }()
114
115 if maj != cbg.MajMap {
116 return fmt.Errorf("cbor input should be of type map")
117 }
118
119 if extra > cbg.MaxLength {
120 return fmt.Errorf("FeedStar: map struct too large (%d)", extra)
121 }
122
123 n := extra
124
125 nameBuf := make([]byte, 9)
126 for i := uint64(0); i < n; i++ {
127 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
128 if err != nil {
129 return err
130 }
131
132 if !ok {
133 // Field doesn't exist on this type, so ignore it
134 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
135 return err
136 }
137 continue
138 }
139
140 switch string(nameBuf[:nameLen]) {
141 // t.LexiconTypeID (string) (string)
142 case "$type":
143
144 {
145 sval, err := cbg.ReadStringWithMax(cr, 1000000)
146 if err != nil {
147 return err
148 }
149
150 t.LexiconTypeID = string(sval)
151 }
152 // t.Subject (string) (string)
153 case "subject":
154
155 {
156 sval, err := cbg.ReadStringWithMax(cr, 1000000)
157 if err != nil {
158 return err
159 }
160
161 t.Subject = string(sval)
162 }
163 // t.CreatedAt (string) (string)
164 case "createdAt":
165
166 {
167 sval, err := cbg.ReadStringWithMax(cr, 1000000)
168 if err != nil {
169 return err
170 }
171
172 t.CreatedAt = string(sval)
173 }
174
175 default:
176 // Field doesn't exist on this type, so ignore it
177 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
178 return err
179 }
180 }
181 }
182
183 return nil
184}
185func (t *GraphFollow) MarshalCBOR(w io.Writer) error {
186 if t == nil {
187 _, err := w.Write(cbg.CborNull)
188 return err
189 }
190
191 cw := cbg.NewCborWriter(w)
192
193 if _, err := cw.Write([]byte{163}); err != nil {
194 return err
195 }
196
197 // t.LexiconTypeID (string) (string)
198 if len("$type") > 1000000 {
199 return xerrors.Errorf("Value in field \"$type\" was too long")
200 }
201
202 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
203 return err
204 }
205 if _, err := cw.WriteString(string("$type")); err != nil {
206 return err
207 }
208
209 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.graph.follow"))); err != nil {
210 return err
211 }
212 if _, err := cw.WriteString(string("sh.tangled.graph.follow")); err != nil {
213 return err
214 }
215
216 // t.Subject (string) (string)
217 if len("subject") > 1000000 {
218 return xerrors.Errorf("Value in field \"subject\" was too long")
219 }
220
221 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
222 return err
223 }
224 if _, err := cw.WriteString(string("subject")); err != nil {
225 return err
226 }
227
228 if len(t.Subject) > 1000000 {
229 return xerrors.Errorf("Value in field t.Subject was too long")
230 }
231
232 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
233 return err
234 }
235 if _, err := cw.WriteString(string(t.Subject)); err != nil {
236 return err
237 }
238
239 // t.CreatedAt (string) (string)
240 if len("createdAt") > 1000000 {
241 return xerrors.Errorf("Value in field \"createdAt\" was too long")
242 }
243
244 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
245 return err
246 }
247 if _, err := cw.WriteString(string("createdAt")); err != nil {
248 return err
249 }
250
251 if len(t.CreatedAt) > 1000000 {
252 return xerrors.Errorf("Value in field t.CreatedAt was too long")
253 }
254
255 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
256 return err
257 }
258 if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
259 return err
260 }
261 return nil
262}
263
264func (t *GraphFollow) UnmarshalCBOR(r io.Reader) (err error) {
265 *t = GraphFollow{}
266
267 cr := cbg.NewCborReader(r)
268
269 maj, extra, err := cr.ReadHeader()
270 if err != nil {
271 return err
272 }
273 defer func() {
274 if err == io.EOF {
275 err = io.ErrUnexpectedEOF
276 }
277 }()
278
279 if maj != cbg.MajMap {
280 return fmt.Errorf("cbor input should be of type map")
281 }
282
283 if extra > cbg.MaxLength {
284 return fmt.Errorf("GraphFollow: map struct too large (%d)", extra)
285 }
286
287 n := extra
288
289 nameBuf := make([]byte, 9)
290 for i := uint64(0); i < n; i++ {
291 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
292 if err != nil {
293 return err
294 }
295
296 if !ok {
297 // Field doesn't exist on this type, so ignore it
298 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
299 return err
300 }
301 continue
302 }
303
304 switch string(nameBuf[:nameLen]) {
305 // t.LexiconTypeID (string) (string)
306 case "$type":
307
308 {
309 sval, err := cbg.ReadStringWithMax(cr, 1000000)
310 if err != nil {
311 return err
312 }
313
314 t.LexiconTypeID = string(sval)
315 }
316 // t.Subject (string) (string)
317 case "subject":
318
319 {
320 sval, err := cbg.ReadStringWithMax(cr, 1000000)
321 if err != nil {
322 return err
323 }
324
325 t.Subject = string(sval)
326 }
327 // t.CreatedAt (string) (string)
328 case "createdAt":
329
330 {
331 sval, err := cbg.ReadStringWithMax(cr, 1000000)
332 if err != nil {
333 return err
334 }
335
336 t.CreatedAt = string(sval)
337 }
338
339 default:
340 // Field doesn't exist on this type, so ignore it
341 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
342 return err
343 }
344 }
345 }
346
347 return nil
348}
349func (t *KnotMember) MarshalCBOR(w io.Writer) error {
350 if t == nil {
351 _, err := w.Write(cbg.CborNull)
352 return err
353 }
354
355 cw := cbg.NewCborWriter(w)
356 fieldCount := 4
357
358 if t.AddedAt == nil {
359 fieldCount--
360 }
361
362 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
363 return err
364 }
365
366 // t.LexiconTypeID (string) (string)
367 if len("$type") > 1000000 {
368 return xerrors.Errorf("Value in field \"$type\" was too long")
369 }
370
371 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
372 return err
373 }
374 if _, err := cw.WriteString(string("$type")); err != nil {
375 return err
376 }
377
378 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.knot.member"))); err != nil {
379 return err
380 }
381 if _, err := cw.WriteString(string("sh.tangled.knot.member")); err != nil {
382 return err
383 }
384
385 // t.Domain (string) (string)
386 if len("domain") > 1000000 {
387 return xerrors.Errorf("Value in field \"domain\" was too long")
388 }
389
390 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("domain"))); err != nil {
391 return err
392 }
393 if _, err := cw.WriteString(string("domain")); err != nil {
394 return err
395 }
396
397 if len(t.Domain) > 1000000 {
398 return xerrors.Errorf("Value in field t.Domain was too long")
399 }
400
401 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Domain))); err != nil {
402 return err
403 }
404 if _, err := cw.WriteString(string(t.Domain)); err != nil {
405 return err
406 }
407
408 // t.Member (string) (string)
409 if len("member") > 1000000 {
410 return xerrors.Errorf("Value in field \"member\" was too long")
411 }
412
413 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("member"))); err != nil {
414 return err
415 }
416 if _, err := cw.WriteString(string("member")); err != nil {
417 return err
418 }
419
420 if len(t.Member) > 1000000 {
421 return xerrors.Errorf("Value in field t.Member was too long")
422 }
423
424 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Member))); err != nil {
425 return err
426 }
427 if _, err := cw.WriteString(string(t.Member)); err != nil {
428 return err
429 }
430
431 // t.AddedAt (string) (string)
432 if t.AddedAt != nil {
433
434 if len("addedAt") > 1000000 {
435 return xerrors.Errorf("Value in field \"addedAt\" was too long")
436 }
437
438 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("addedAt"))); err != nil {
439 return err
440 }
441 if _, err := cw.WriteString(string("addedAt")); err != nil {
442 return err
443 }
444
445 if t.AddedAt == nil {
446 if _, err := cw.Write(cbg.CborNull); err != nil {
447 return err
448 }
449 } else {
450 if len(*t.AddedAt) > 1000000 {
451 return xerrors.Errorf("Value in field t.AddedAt was too long")
452 }
453
454 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.AddedAt))); err != nil {
455 return err
456 }
457 if _, err := cw.WriteString(string(*t.AddedAt)); err != nil {
458 return err
459 }
460 }
461 }
462 return nil
463}
464
465func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) {
466 *t = KnotMember{}
467
468 cr := cbg.NewCborReader(r)
469
470 maj, extra, err := cr.ReadHeader()
471 if err != nil {
472 return err
473 }
474 defer func() {
475 if err == io.EOF {
476 err = io.ErrUnexpectedEOF
477 }
478 }()
479
480 if maj != cbg.MajMap {
481 return fmt.Errorf("cbor input should be of type map")
482 }
483
484 if extra > cbg.MaxLength {
485 return fmt.Errorf("KnotMember: map struct too large (%d)", extra)
486 }
487
488 n := extra
489
490 nameBuf := make([]byte, 7)
491 for i := uint64(0); i < n; i++ {
492 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
493 if err != nil {
494 return err
495 }
496
497 if !ok {
498 // Field doesn't exist on this type, so ignore it
499 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
500 return err
501 }
502 continue
503 }
504
505 switch string(nameBuf[:nameLen]) {
506 // t.LexiconTypeID (string) (string)
507 case "$type":
508
509 {
510 sval, err := cbg.ReadStringWithMax(cr, 1000000)
511 if err != nil {
512 return err
513 }
514
515 t.LexiconTypeID = string(sval)
516 }
517 // t.Domain (string) (string)
518 case "domain":
519
520 {
521 sval, err := cbg.ReadStringWithMax(cr, 1000000)
522 if err != nil {
523 return err
524 }
525
526 t.Domain = string(sval)
527 }
528 // t.Member (string) (string)
529 case "member":
530
531 {
532 sval, err := cbg.ReadStringWithMax(cr, 1000000)
533 if err != nil {
534 return err
535 }
536
537 t.Member = string(sval)
538 }
539 // t.AddedAt (string) (string)
540 case "addedAt":
541
542 {
543 b, err := cr.ReadByte()
544 if err != nil {
545 return err
546 }
547 if b != cbg.CborNull[0] {
548 if err := cr.UnreadByte(); err != nil {
549 return err
550 }
551
552 sval, err := cbg.ReadStringWithMax(cr, 1000000)
553 if err != nil {
554 return err
555 }
556
557 t.AddedAt = (*string)(&sval)
558 }
559 }
560
561 default:
562 // Field doesn't exist on this type, so ignore it
563 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
564 return err
565 }
566 }
567 }
568
569 return nil
570}
571func (t *PublicKey) MarshalCBOR(w io.Writer) error {
572 if t == nil {
573 _, err := w.Write(cbg.CborNull)
574 return err
575 }
576
577 cw := cbg.NewCborWriter(w)
578
579 if _, err := cw.Write([]byte{164}); err != nil {
580 return err
581 }
582
583 // t.Key (string) (string)
584 if len("key") > 1000000 {
585 return xerrors.Errorf("Value in field \"key\" was too long")
586 }
587
588 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
589 return err
590 }
591 if _, err := cw.WriteString(string("key")); err != nil {
592 return err
593 }
594
595 if len(t.Key) > 1000000 {
596 return xerrors.Errorf("Value in field t.Key was too long")
597 }
598
599 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
600 return err
601 }
602 if _, err := cw.WriteString(string(t.Key)); err != nil {
603 return err
604 }
605
606 // t.Name (string) (string)
607 if len("name") > 1000000 {
608 return xerrors.Errorf("Value in field \"name\" was too long")
609 }
610
611 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
612 return err
613 }
614 if _, err := cw.WriteString(string("name")); err != nil {
615 return err
616 }
617
618 if len(t.Name) > 1000000 {
619 return xerrors.Errorf("Value in field t.Name was too long")
620 }
621
622 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
623 return err
624 }
625 if _, err := cw.WriteString(string(t.Name)); err != nil {
626 return err
627 }
628
629 // t.LexiconTypeID (string) (string)
630 if len("$type") > 1000000 {
631 return xerrors.Errorf("Value in field \"$type\" was too long")
632 }
633
634 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
635 return err
636 }
637 if _, err := cw.WriteString(string("$type")); err != nil {
638 return err
639 }
640
641 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.publicKey"))); err != nil {
642 return err
643 }
644 if _, err := cw.WriteString(string("sh.tangled.publicKey")); err != nil {
645 return err
646 }
647
648 // t.Created (string) (string)
649 if len("created") > 1000000 {
650 return xerrors.Errorf("Value in field \"created\" was too long")
651 }
652
653 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("created"))); err != nil {
654 return err
655 }
656 if _, err := cw.WriteString(string("created")); err != nil {
657 return err
658 }
659
660 if len(t.Created) > 1000000 {
661 return xerrors.Errorf("Value in field t.Created was too long")
662 }
663
664 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Created))); err != nil {
665 return err
666 }
667 if _, err := cw.WriteString(string(t.Created)); err != nil {
668 return err
669 }
670 return nil
671}
672
673func (t *PublicKey) UnmarshalCBOR(r io.Reader) (err error) {
674 *t = PublicKey{}
675
676 cr := cbg.NewCborReader(r)
677
678 maj, extra, err := cr.ReadHeader()
679 if err != nil {
680 return err
681 }
682 defer func() {
683 if err == io.EOF {
684 err = io.ErrUnexpectedEOF
685 }
686 }()
687
688 if maj != cbg.MajMap {
689 return fmt.Errorf("cbor input should be of type map")
690 }
691
692 if extra > cbg.MaxLength {
693 return fmt.Errorf("PublicKey: map struct too large (%d)", extra)
694 }
695
696 n := extra
697
698 nameBuf := make([]byte, 7)
699 for i := uint64(0); i < n; i++ {
700 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
701 if err != nil {
702 return err
703 }
704
705 if !ok {
706 // Field doesn't exist on this type, so ignore it
707 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
708 return err
709 }
710 continue
711 }
712
713 switch string(nameBuf[:nameLen]) {
714 // t.Key (string) (string)
715 case "key":
716
717 {
718 sval, err := cbg.ReadStringWithMax(cr, 1000000)
719 if err != nil {
720 return err
721 }
722
723 t.Key = string(sval)
724 }
725 // t.Name (string) (string)
726 case "name":
727
728 {
729 sval, err := cbg.ReadStringWithMax(cr, 1000000)
730 if err != nil {
731 return err
732 }
733
734 t.Name = string(sval)
735 }
736 // t.LexiconTypeID (string) (string)
737 case "$type":
738
739 {
740 sval, err := cbg.ReadStringWithMax(cr, 1000000)
741 if err != nil {
742 return err
743 }
744
745 t.LexiconTypeID = string(sval)
746 }
747 // t.Created (string) (string)
748 case "created":
749
750 {
751 sval, err := cbg.ReadStringWithMax(cr, 1000000)
752 if err != nil {
753 return err
754 }
755
756 t.Created = string(sval)
757 }
758
759 default:
760 // Field doesn't exist on this type, so ignore it
761 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
762 return err
763 }
764 }
765 }
766
767 return nil
768}
769func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error {
770 if t == nil {
771 _, err := w.Write(cbg.CborNull)
772 return err
773 }
774
775 cw := cbg.NewCborWriter(w)
776 fieldCount := 7
777
778 if t.Body == nil {
779 fieldCount--
780 }
781
782 if t.CommentId == nil {
783 fieldCount--
784 }
785
786 if t.CreatedAt == nil {
787 fieldCount--
788 }
789
790 if t.Owner == nil {
791 fieldCount--
792 }
793
794 if t.Repo == nil {
795 fieldCount--
796 }
797
798 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
799 return err
800 }
801
802 // t.Body (string) (string)
803 if t.Body != nil {
804
805 if len("body") > 1000000 {
806 return xerrors.Errorf("Value in field \"body\" was too long")
807 }
808
809 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
810 return err
811 }
812 if _, err := cw.WriteString(string("body")); err != nil {
813 return err
814 }
815
816 if t.Body == nil {
817 if _, err := cw.Write(cbg.CborNull); err != nil {
818 return err
819 }
820 } else {
821 if len(*t.Body) > 1000000 {
822 return xerrors.Errorf("Value in field t.Body was too long")
823 }
824
825 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
826 return err
827 }
828 if _, err := cw.WriteString(string(*t.Body)); err != nil {
829 return err
830 }
831 }
832 }
833
834 // t.Repo (string) (string)
835 if t.Repo != nil {
836
837 if len("repo") > 1000000 {
838 return xerrors.Errorf("Value in field \"repo\" was too long")
839 }
840
841 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
842 return err
843 }
844 if _, err := cw.WriteString(string("repo")); err != nil {
845 return err
846 }
847
848 if t.Repo == nil {
849 if _, err := cw.Write(cbg.CborNull); err != nil {
850 return err
851 }
852 } else {
853 if len(*t.Repo) > 1000000 {
854 return xerrors.Errorf("Value in field t.Repo was too long")
855 }
856
857 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
858 return err
859 }
860 if _, err := cw.WriteString(string(*t.Repo)); err != nil {
861 return err
862 }
863 }
864 }
865
866 // t.LexiconTypeID (string) (string)
867 if len("$type") > 1000000 {
868 return xerrors.Errorf("Value in field \"$type\" was too long")
869 }
870
871 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
872 return err
873 }
874 if _, err := cw.WriteString(string("$type")); err != nil {
875 return err
876 }
877
878 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.comment"))); err != nil {
879 return err
880 }
881 if _, err := cw.WriteString(string("sh.tangled.repo.issue.comment")); err != nil {
882 return err
883 }
884
885 // t.Issue (string) (string)
886 if len("issue") > 1000000 {
887 return xerrors.Errorf("Value in field \"issue\" was too long")
888 }
889
890 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil {
891 return err
892 }
893 if _, err := cw.WriteString(string("issue")); err != nil {
894 return err
895 }
896
897 if len(t.Issue) > 1000000 {
898 return xerrors.Errorf("Value in field t.Issue was too long")
899 }
900
901 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil {
902 return err
903 }
904 if _, err := cw.WriteString(string(t.Issue)); err != nil {
905 return err
906 }
907
908 // t.Owner (string) (string)
909 if t.Owner != nil {
910
911 if len("owner") > 1000000 {
912 return xerrors.Errorf("Value in field \"owner\" was too long")
913 }
914
915 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
916 return err
917 }
918 if _, err := cw.WriteString(string("owner")); err != nil {
919 return err
920 }
921
922 if t.Owner == nil {
923 if _, err := cw.Write(cbg.CborNull); err != nil {
924 return err
925 }
926 } else {
927 if len(*t.Owner) > 1000000 {
928 return xerrors.Errorf("Value in field t.Owner was too long")
929 }
930
931 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
932 return err
933 }
934 if _, err := cw.WriteString(string(*t.Owner)); err != nil {
935 return err
936 }
937 }
938 }
939
940 // t.CommentId (int64) (int64)
941 if t.CommentId != nil {
942
943 if len("commentId") > 1000000 {
944 return xerrors.Errorf("Value in field \"commentId\" was too long")
945 }
946
947 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
948 return err
949 }
950 if _, err := cw.WriteString(string("commentId")); err != nil {
951 return err
952 }
953
954 if t.CommentId == nil {
955 if _, err := cw.Write(cbg.CborNull); err != nil {
956 return err
957 }
958 } else {
959 if *t.CommentId >= 0 {
960 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
961 return err
962 }
963 } else {
964 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
965 return err
966 }
967 }
968 }
969
970 }
971
972 // t.CreatedAt (string) (string)
973 if t.CreatedAt != nil {
974
975 if len("createdAt") > 1000000 {
976 return xerrors.Errorf("Value in field \"createdAt\" was too long")
977 }
978
979 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
980 return err
981 }
982 if _, err := cw.WriteString(string("createdAt")); err != nil {
983 return err
984 }
985
986 if t.CreatedAt == nil {
987 if _, err := cw.Write(cbg.CborNull); err != nil {
988 return err
989 }
990 } else {
991 if len(*t.CreatedAt) > 1000000 {
992 return xerrors.Errorf("Value in field t.CreatedAt was too long")
993 }
994
995 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
996 return err
997 }
998 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
999 return err
1000 }
1001 }
1002 }
1003 return nil
1004}
1005
1006func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) {
1007 *t = RepoIssueComment{}
1008
1009 cr := cbg.NewCborReader(r)
1010
1011 maj, extra, err := cr.ReadHeader()
1012 if err != nil {
1013 return err
1014 }
1015 defer func() {
1016 if err == io.EOF {
1017 err = io.ErrUnexpectedEOF
1018 }
1019 }()
1020
1021 if maj != cbg.MajMap {
1022 return fmt.Errorf("cbor input should be of type map")
1023 }
1024
1025 if extra > cbg.MaxLength {
1026 return fmt.Errorf("RepoIssueComment: map struct too large (%d)", extra)
1027 }
1028
1029 n := extra
1030
1031 nameBuf := make([]byte, 9)
1032 for i := uint64(0); i < n; i++ {
1033 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1034 if err != nil {
1035 return err
1036 }
1037
1038 if !ok {
1039 // Field doesn't exist on this type, so ignore it
1040 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1041 return err
1042 }
1043 continue
1044 }
1045
1046 switch string(nameBuf[:nameLen]) {
1047 // t.Body (string) (string)
1048 case "body":
1049
1050 {
1051 b, err := cr.ReadByte()
1052 if err != nil {
1053 return err
1054 }
1055 if b != cbg.CborNull[0] {
1056 if err := cr.UnreadByte(); err != nil {
1057 return err
1058 }
1059
1060 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1061 if err != nil {
1062 return err
1063 }
1064
1065 t.Body = (*string)(&sval)
1066 }
1067 }
1068 // t.Repo (string) (string)
1069 case "repo":
1070
1071 {
1072 b, err := cr.ReadByte()
1073 if err != nil {
1074 return err
1075 }
1076 if b != cbg.CborNull[0] {
1077 if err := cr.UnreadByte(); err != nil {
1078 return err
1079 }
1080
1081 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1082 if err != nil {
1083 return err
1084 }
1085
1086 t.Repo = (*string)(&sval)
1087 }
1088 }
1089 // t.LexiconTypeID (string) (string)
1090 case "$type":
1091
1092 {
1093 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1094 if err != nil {
1095 return err
1096 }
1097
1098 t.LexiconTypeID = string(sval)
1099 }
1100 // t.Issue (string) (string)
1101 case "issue":
1102
1103 {
1104 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1105 if err != nil {
1106 return err
1107 }
1108
1109 t.Issue = string(sval)
1110 }
1111 // t.Owner (string) (string)
1112 case "owner":
1113
1114 {
1115 b, err := cr.ReadByte()
1116 if err != nil {
1117 return err
1118 }
1119 if b != cbg.CborNull[0] {
1120 if err := cr.UnreadByte(); err != nil {
1121 return err
1122 }
1123
1124 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1125 if err != nil {
1126 return err
1127 }
1128
1129 t.Owner = (*string)(&sval)
1130 }
1131 }
1132 // t.CommentId (int64) (int64)
1133 case "commentId":
1134 {
1135
1136 b, err := cr.ReadByte()
1137 if err != nil {
1138 return err
1139 }
1140 if b != cbg.CborNull[0] {
1141 if err := cr.UnreadByte(); err != nil {
1142 return err
1143 }
1144 maj, extra, err := cr.ReadHeader()
1145 if err != nil {
1146 return err
1147 }
1148 var extraI int64
1149 switch maj {
1150 case cbg.MajUnsignedInt:
1151 extraI = int64(extra)
1152 if extraI < 0 {
1153 return fmt.Errorf("int64 positive overflow")
1154 }
1155 case cbg.MajNegativeInt:
1156 extraI = int64(extra)
1157 if extraI < 0 {
1158 return fmt.Errorf("int64 negative overflow")
1159 }
1160 extraI = -1 - extraI
1161 default:
1162 return fmt.Errorf("wrong type for int64 field: %d", maj)
1163 }
1164
1165 t.CommentId = (*int64)(&extraI)
1166 }
1167 }
1168 // t.CreatedAt (string) (string)
1169 case "createdAt":
1170
1171 {
1172 b, err := cr.ReadByte()
1173 if err != nil {
1174 return err
1175 }
1176 if b != cbg.CborNull[0] {
1177 if err := cr.UnreadByte(); err != nil {
1178 return err
1179 }
1180
1181 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1182 if err != nil {
1183 return err
1184 }
1185
1186 t.CreatedAt = (*string)(&sval)
1187 }
1188 }
1189
1190 default:
1191 // Field doesn't exist on this type, so ignore it
1192 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1193 return err
1194 }
1195 }
1196 }
1197
1198 return nil
1199}
1200func (t *RepoIssueState) MarshalCBOR(w io.Writer) error {
1201 if t == nil {
1202 _, err := w.Write(cbg.CborNull)
1203 return err
1204 }
1205
1206 cw := cbg.NewCborWriter(w)
1207 fieldCount := 3
1208
1209 if t.State == nil {
1210 fieldCount--
1211 }
1212
1213 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1214 return err
1215 }
1216
1217 // t.LexiconTypeID (string) (string)
1218 if len("$type") > 1000000 {
1219 return xerrors.Errorf("Value in field \"$type\" was too long")
1220 }
1221
1222 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1223 return err
1224 }
1225 if _, err := cw.WriteString(string("$type")); err != nil {
1226 return err
1227 }
1228
1229 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.state"))); err != nil {
1230 return err
1231 }
1232 if _, err := cw.WriteString(string("sh.tangled.repo.issue.state")); err != nil {
1233 return err
1234 }
1235
1236 // t.Issue (string) (string)
1237 if len("issue") > 1000000 {
1238 return xerrors.Errorf("Value in field \"issue\" was too long")
1239 }
1240
1241 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil {
1242 return err
1243 }
1244 if _, err := cw.WriteString(string("issue")); err != nil {
1245 return err
1246 }
1247
1248 if len(t.Issue) > 1000000 {
1249 return xerrors.Errorf("Value in field t.Issue was too long")
1250 }
1251
1252 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil {
1253 return err
1254 }
1255 if _, err := cw.WriteString(string(t.Issue)); err != nil {
1256 return err
1257 }
1258
1259 // t.State (string) (string)
1260 if t.State != nil {
1261
1262 if len("state") > 1000000 {
1263 return xerrors.Errorf("Value in field \"state\" was too long")
1264 }
1265
1266 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil {
1267 return err
1268 }
1269 if _, err := cw.WriteString(string("state")); err != nil {
1270 return err
1271 }
1272
1273 if t.State == nil {
1274 if _, err := cw.Write(cbg.CborNull); err != nil {
1275 return err
1276 }
1277 } else {
1278 if len(*t.State) > 1000000 {
1279 return xerrors.Errorf("Value in field t.State was too long")
1280 }
1281
1282 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.State))); err != nil {
1283 return err
1284 }
1285 if _, err := cw.WriteString(string(*t.State)); err != nil {
1286 return err
1287 }
1288 }
1289 }
1290 return nil
1291}
1292
1293func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) {
1294 *t = RepoIssueState{}
1295
1296 cr := cbg.NewCborReader(r)
1297
1298 maj, extra, err := cr.ReadHeader()
1299 if err != nil {
1300 return err
1301 }
1302 defer func() {
1303 if err == io.EOF {
1304 err = io.ErrUnexpectedEOF
1305 }
1306 }()
1307
1308 if maj != cbg.MajMap {
1309 return fmt.Errorf("cbor input should be of type map")
1310 }
1311
1312 if extra > cbg.MaxLength {
1313 return fmt.Errorf("RepoIssueState: map struct too large (%d)", extra)
1314 }
1315
1316 n := extra
1317
1318 nameBuf := make([]byte, 5)
1319 for i := uint64(0); i < n; i++ {
1320 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1321 if err != nil {
1322 return err
1323 }
1324
1325 if !ok {
1326 // Field doesn't exist on this type, so ignore it
1327 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1328 return err
1329 }
1330 continue
1331 }
1332
1333 switch string(nameBuf[:nameLen]) {
1334 // t.LexiconTypeID (string) (string)
1335 case "$type":
1336
1337 {
1338 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1339 if err != nil {
1340 return err
1341 }
1342
1343 t.LexiconTypeID = string(sval)
1344 }
1345 // t.Issue (string) (string)
1346 case "issue":
1347
1348 {
1349 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1350 if err != nil {
1351 return err
1352 }
1353
1354 t.Issue = string(sval)
1355 }
1356 // t.State (string) (string)
1357 case "state":
1358
1359 {
1360 b, err := cr.ReadByte()
1361 if err != nil {
1362 return err
1363 }
1364 if b != cbg.CborNull[0] {
1365 if err := cr.UnreadByte(); err != nil {
1366 return err
1367 }
1368
1369 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1370 if err != nil {
1371 return err
1372 }
1373
1374 t.State = (*string)(&sval)
1375 }
1376 }
1377
1378 default:
1379 // Field doesn't exist on this type, so ignore it
1380 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1381 return err
1382 }
1383 }
1384 }
1385
1386 return nil
1387}
1388func (t *RepoIssue) MarshalCBOR(w io.Writer) error {
1389 if t == nil {
1390 _, err := w.Write(cbg.CborNull)
1391 return err
1392 }
1393
1394 cw := cbg.NewCborWriter(w)
1395 fieldCount := 7
1396
1397 if t.Body == nil {
1398 fieldCount--
1399 }
1400
1401 if t.CreatedAt == nil {
1402 fieldCount--
1403 }
1404
1405 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1406 return err
1407 }
1408
1409 // t.Body (string) (string)
1410 if t.Body != nil {
1411
1412 if len("body") > 1000000 {
1413 return xerrors.Errorf("Value in field \"body\" was too long")
1414 }
1415
1416 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
1417 return err
1418 }
1419 if _, err := cw.WriteString(string("body")); err != nil {
1420 return err
1421 }
1422
1423 if t.Body == nil {
1424 if _, err := cw.Write(cbg.CborNull); err != nil {
1425 return err
1426 }
1427 } else {
1428 if len(*t.Body) > 1000000 {
1429 return xerrors.Errorf("Value in field t.Body was too long")
1430 }
1431
1432 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
1433 return err
1434 }
1435 if _, err := cw.WriteString(string(*t.Body)); err != nil {
1436 return err
1437 }
1438 }
1439 }
1440
1441 // t.Repo (string) (string)
1442 if len("repo") > 1000000 {
1443 return xerrors.Errorf("Value in field \"repo\" was too long")
1444 }
1445
1446 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
1447 return err
1448 }
1449 if _, err := cw.WriteString(string("repo")); err != nil {
1450 return err
1451 }
1452
1453 if len(t.Repo) > 1000000 {
1454 return xerrors.Errorf("Value in field t.Repo was too long")
1455 }
1456
1457 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
1458 return err
1459 }
1460 if _, err := cw.WriteString(string(t.Repo)); err != nil {
1461 return err
1462 }
1463
1464 // t.LexiconTypeID (string) (string)
1465 if len("$type") > 1000000 {
1466 return xerrors.Errorf("Value in field \"$type\" was too long")
1467 }
1468
1469 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1470 return err
1471 }
1472 if _, err := cw.WriteString(string("$type")); err != nil {
1473 return err
1474 }
1475
1476 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue"))); err != nil {
1477 return err
1478 }
1479 if _, err := cw.WriteString(string("sh.tangled.repo.issue")); err != nil {
1480 return err
1481 }
1482
1483 // t.Owner (string) (string)
1484 if len("owner") > 1000000 {
1485 return xerrors.Errorf("Value in field \"owner\" was too long")
1486 }
1487
1488 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
1489 return err
1490 }
1491 if _, err := cw.WriteString(string("owner")); err != nil {
1492 return err
1493 }
1494
1495 if len(t.Owner) > 1000000 {
1496 return xerrors.Errorf("Value in field t.Owner was too long")
1497 }
1498
1499 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Owner))); err != nil {
1500 return err
1501 }
1502 if _, err := cw.WriteString(string(t.Owner)); err != nil {
1503 return err
1504 }
1505
1506 // t.Title (string) (string)
1507 if len("title") > 1000000 {
1508 return xerrors.Errorf("Value in field \"title\" was too long")
1509 }
1510
1511 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
1512 return err
1513 }
1514 if _, err := cw.WriteString(string("title")); err != nil {
1515 return err
1516 }
1517
1518 if len(t.Title) > 1000000 {
1519 return xerrors.Errorf("Value in field t.Title was too long")
1520 }
1521
1522 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
1523 return err
1524 }
1525 if _, err := cw.WriteString(string(t.Title)); err != nil {
1526 return err
1527 }
1528
1529 // t.IssueId (int64) (int64)
1530 if len("issueId") > 1000000 {
1531 return xerrors.Errorf("Value in field \"issueId\" was too long")
1532 }
1533
1534 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issueId"))); err != nil {
1535 return err
1536 }
1537 if _, err := cw.WriteString(string("issueId")); err != nil {
1538 return err
1539 }
1540
1541 if t.IssueId >= 0 {
1542 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.IssueId)); err != nil {
1543 return err
1544 }
1545 } else {
1546 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.IssueId-1)); err != nil {
1547 return err
1548 }
1549 }
1550
1551 // t.CreatedAt (string) (string)
1552 if t.CreatedAt != nil {
1553
1554 if len("createdAt") > 1000000 {
1555 return xerrors.Errorf("Value in field \"createdAt\" was too long")
1556 }
1557
1558 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
1559 return err
1560 }
1561 if _, err := cw.WriteString(string("createdAt")); err != nil {
1562 return err
1563 }
1564
1565 if t.CreatedAt == nil {
1566 if _, err := cw.Write(cbg.CborNull); err != nil {
1567 return err
1568 }
1569 } else {
1570 if len(*t.CreatedAt) > 1000000 {
1571 return xerrors.Errorf("Value in field t.CreatedAt was too long")
1572 }
1573
1574 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
1575 return err
1576 }
1577 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
1578 return err
1579 }
1580 }
1581 }
1582 return nil
1583}
1584
1585func (t *RepoIssue) UnmarshalCBOR(r io.Reader) (err error) {
1586 *t = RepoIssue{}
1587
1588 cr := cbg.NewCborReader(r)
1589
1590 maj, extra, err := cr.ReadHeader()
1591 if err != nil {
1592 return err
1593 }
1594 defer func() {
1595 if err == io.EOF {
1596 err = io.ErrUnexpectedEOF
1597 }
1598 }()
1599
1600 if maj != cbg.MajMap {
1601 return fmt.Errorf("cbor input should be of type map")
1602 }
1603
1604 if extra > cbg.MaxLength {
1605 return fmt.Errorf("RepoIssue: map struct too large (%d)", extra)
1606 }
1607
1608 n := extra
1609
1610 nameBuf := make([]byte, 9)
1611 for i := uint64(0); i < n; i++ {
1612 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1613 if err != nil {
1614 return err
1615 }
1616
1617 if !ok {
1618 // Field doesn't exist on this type, so ignore it
1619 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1620 return err
1621 }
1622 continue
1623 }
1624
1625 switch string(nameBuf[:nameLen]) {
1626 // t.Body (string) (string)
1627 case "body":
1628
1629 {
1630 b, err := cr.ReadByte()
1631 if err != nil {
1632 return err
1633 }
1634 if b != cbg.CborNull[0] {
1635 if err := cr.UnreadByte(); err != nil {
1636 return err
1637 }
1638
1639 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1640 if err != nil {
1641 return err
1642 }
1643
1644 t.Body = (*string)(&sval)
1645 }
1646 }
1647 // t.Repo (string) (string)
1648 case "repo":
1649
1650 {
1651 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1652 if err != nil {
1653 return err
1654 }
1655
1656 t.Repo = string(sval)
1657 }
1658 // t.LexiconTypeID (string) (string)
1659 case "$type":
1660
1661 {
1662 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1663 if err != nil {
1664 return err
1665 }
1666
1667 t.LexiconTypeID = string(sval)
1668 }
1669 // t.Owner (string) (string)
1670 case "owner":
1671
1672 {
1673 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1674 if err != nil {
1675 return err
1676 }
1677
1678 t.Owner = string(sval)
1679 }
1680 // t.Title (string) (string)
1681 case "title":
1682
1683 {
1684 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1685 if err != nil {
1686 return err
1687 }
1688
1689 t.Title = string(sval)
1690 }
1691 // t.IssueId (int64) (int64)
1692 case "issueId":
1693 {
1694 maj, extra, err := cr.ReadHeader()
1695 if err != nil {
1696 return err
1697 }
1698 var extraI int64
1699 switch maj {
1700 case cbg.MajUnsignedInt:
1701 extraI = int64(extra)
1702 if extraI < 0 {
1703 return fmt.Errorf("int64 positive overflow")
1704 }
1705 case cbg.MajNegativeInt:
1706 extraI = int64(extra)
1707 if extraI < 0 {
1708 return fmt.Errorf("int64 negative overflow")
1709 }
1710 extraI = -1 - extraI
1711 default:
1712 return fmt.Errorf("wrong type for int64 field: %d", maj)
1713 }
1714
1715 t.IssueId = int64(extraI)
1716 }
1717 // t.CreatedAt (string) (string)
1718 case "createdAt":
1719
1720 {
1721 b, err := cr.ReadByte()
1722 if err != nil {
1723 return err
1724 }
1725 if b != cbg.CborNull[0] {
1726 if err := cr.UnreadByte(); err != nil {
1727 return err
1728 }
1729
1730 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1731 if err != nil {
1732 return err
1733 }
1734
1735 t.CreatedAt = (*string)(&sval)
1736 }
1737 }
1738
1739 default:
1740 // Field doesn't exist on this type, so ignore it
1741 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1742 return err
1743 }
1744 }
1745 }
1746
1747 return nil
1748}
1749func (t *Repo) MarshalCBOR(w io.Writer) error {
1750 if t == nil {
1751 _, err := w.Write(cbg.CborNull)
1752 return err
1753 }
1754
1755 cw := cbg.NewCborWriter(w)
1756 fieldCount := 7
1757
1758 if t.AddedAt == nil {
1759 fieldCount--
1760 }
1761
1762 if t.Description == nil {
1763 fieldCount--
1764 }
1765
1766 if t.Source == nil {
1767 fieldCount--
1768 }
1769
1770 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1771 return err
1772 }
1773
1774 // t.Knot (string) (string)
1775 if len("knot") > 1000000 {
1776 return xerrors.Errorf("Value in field \"knot\" was too long")
1777 }
1778
1779 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil {
1780 return err
1781 }
1782 if _, err := cw.WriteString(string("knot")); err != nil {
1783 return err
1784 }
1785
1786 if len(t.Knot) > 1000000 {
1787 return xerrors.Errorf("Value in field t.Knot was too long")
1788 }
1789
1790 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil {
1791 return err
1792 }
1793 if _, err := cw.WriteString(string(t.Knot)); err != nil {
1794 return err
1795 }
1796
1797 // t.Name (string) (string)
1798 if len("name") > 1000000 {
1799 return xerrors.Errorf("Value in field \"name\" was too long")
1800 }
1801
1802 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
1803 return err
1804 }
1805 if _, err := cw.WriteString(string("name")); err != nil {
1806 return err
1807 }
1808
1809 if len(t.Name) > 1000000 {
1810 return xerrors.Errorf("Value in field t.Name was too long")
1811 }
1812
1813 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
1814 return err
1815 }
1816 if _, err := cw.WriteString(string(t.Name)); err != nil {
1817 return err
1818 }
1819
1820 // t.LexiconTypeID (string) (string)
1821 if len("$type") > 1000000 {
1822 return xerrors.Errorf("Value in field \"$type\" was too long")
1823 }
1824
1825 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1826 return err
1827 }
1828 if _, err := cw.WriteString(string("$type")); err != nil {
1829 return err
1830 }
1831
1832 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo"))); err != nil {
1833 return err
1834 }
1835 if _, err := cw.WriteString(string("sh.tangled.repo")); err != nil {
1836 return err
1837 }
1838
1839 // t.Owner (string) (string)
1840 if len("owner") > 1000000 {
1841 return xerrors.Errorf("Value in field \"owner\" was too long")
1842 }
1843
1844 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
1845 return err
1846 }
1847 if _, err := cw.WriteString(string("owner")); err != nil {
1848 return err
1849 }
1850
1851 if len(t.Owner) > 1000000 {
1852 return xerrors.Errorf("Value in field t.Owner was too long")
1853 }
1854
1855 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Owner))); err != nil {
1856 return err
1857 }
1858 if _, err := cw.WriteString(string(t.Owner)); err != nil {
1859 return err
1860 }
1861
1862 // t.Source (string) (string)
1863 if t.Source != nil {
1864
1865 if len("source") > 1000000 {
1866 return xerrors.Errorf("Value in field \"source\" was too long")
1867 }
1868
1869 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
1870 return err
1871 }
1872 if _, err := cw.WriteString(string("source")); err != nil {
1873 return err
1874 }
1875
1876 if t.Source == nil {
1877 if _, err := cw.Write(cbg.CborNull); err != nil {
1878 return err
1879 }
1880 } else {
1881 if len(*t.Source) > 1000000 {
1882 return xerrors.Errorf("Value in field t.Source was too long")
1883 }
1884
1885 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Source))); err != nil {
1886 return err
1887 }
1888 if _, err := cw.WriteString(string(*t.Source)); err != nil {
1889 return err
1890 }
1891 }
1892 }
1893
1894 // t.AddedAt (string) (string)
1895 if t.AddedAt != nil {
1896
1897 if len("addedAt") > 1000000 {
1898 return xerrors.Errorf("Value in field \"addedAt\" was too long")
1899 }
1900
1901 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("addedAt"))); err != nil {
1902 return err
1903 }
1904 if _, err := cw.WriteString(string("addedAt")); err != nil {
1905 return err
1906 }
1907
1908 if t.AddedAt == nil {
1909 if _, err := cw.Write(cbg.CborNull); err != nil {
1910 return err
1911 }
1912 } else {
1913 if len(*t.AddedAt) > 1000000 {
1914 return xerrors.Errorf("Value in field t.AddedAt was too long")
1915 }
1916
1917 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.AddedAt))); err != nil {
1918 return err
1919 }
1920 if _, err := cw.WriteString(string(*t.AddedAt)); err != nil {
1921 return err
1922 }
1923 }
1924 }
1925
1926 // t.Description (string) (string)
1927 if t.Description != nil {
1928
1929 if len("description") > 1000000 {
1930 return xerrors.Errorf("Value in field \"description\" was too long")
1931 }
1932
1933 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
1934 return err
1935 }
1936 if _, err := cw.WriteString(string("description")); err != nil {
1937 return err
1938 }
1939
1940 if t.Description == nil {
1941 if _, err := cw.Write(cbg.CborNull); err != nil {
1942 return err
1943 }
1944 } else {
1945 if len(*t.Description) > 1000000 {
1946 return xerrors.Errorf("Value in field t.Description was too long")
1947 }
1948
1949 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
1950 return err
1951 }
1952 if _, err := cw.WriteString(string(*t.Description)); err != nil {
1953 return err
1954 }
1955 }
1956 }
1957 return nil
1958}
1959
1960func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) {
1961 *t = Repo{}
1962
1963 cr := cbg.NewCborReader(r)
1964
1965 maj, extra, err := cr.ReadHeader()
1966 if err != nil {
1967 return err
1968 }
1969 defer func() {
1970 if err == io.EOF {
1971 err = io.ErrUnexpectedEOF
1972 }
1973 }()
1974
1975 if maj != cbg.MajMap {
1976 return fmt.Errorf("cbor input should be of type map")
1977 }
1978
1979 if extra > cbg.MaxLength {
1980 return fmt.Errorf("Repo: map struct too large (%d)", extra)
1981 }
1982
1983 n := extra
1984
1985 nameBuf := make([]byte, 11)
1986 for i := uint64(0); i < n; i++ {
1987 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1988 if err != nil {
1989 return err
1990 }
1991
1992 if !ok {
1993 // Field doesn't exist on this type, so ignore it
1994 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1995 return err
1996 }
1997 continue
1998 }
1999
2000 switch string(nameBuf[:nameLen]) {
2001 // t.Knot (string) (string)
2002 case "knot":
2003
2004 {
2005 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2006 if err != nil {
2007 return err
2008 }
2009
2010 t.Knot = string(sval)
2011 }
2012 // t.Name (string) (string)
2013 case "name":
2014
2015 {
2016 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2017 if err != nil {
2018 return err
2019 }
2020
2021 t.Name = string(sval)
2022 }
2023 // t.LexiconTypeID (string) (string)
2024 case "$type":
2025
2026 {
2027 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2028 if err != nil {
2029 return err
2030 }
2031
2032 t.LexiconTypeID = string(sval)
2033 }
2034 // t.Owner (string) (string)
2035 case "owner":
2036
2037 {
2038 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2039 if err != nil {
2040 return err
2041 }
2042
2043 t.Owner = string(sval)
2044 }
2045 // t.Source (string) (string)
2046 case "source":
2047
2048 {
2049 b, err := cr.ReadByte()
2050 if err != nil {
2051 return err
2052 }
2053 if b != cbg.CborNull[0] {
2054 if err := cr.UnreadByte(); err != nil {
2055 return err
2056 }
2057
2058 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2059 if err != nil {
2060 return err
2061 }
2062
2063 t.Source = (*string)(&sval)
2064 }
2065 }
2066 // t.AddedAt (string) (string)
2067 case "addedAt":
2068
2069 {
2070 b, err := cr.ReadByte()
2071 if err != nil {
2072 return err
2073 }
2074 if b != cbg.CborNull[0] {
2075 if err := cr.UnreadByte(); err != nil {
2076 return err
2077 }
2078
2079 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2080 if err != nil {
2081 return err
2082 }
2083
2084 t.AddedAt = (*string)(&sval)
2085 }
2086 }
2087 // t.Description (string) (string)
2088 case "description":
2089
2090 {
2091 b, err := cr.ReadByte()
2092 if err != nil {
2093 return err
2094 }
2095 if b != cbg.CborNull[0] {
2096 if err := cr.UnreadByte(); err != nil {
2097 return err
2098 }
2099
2100 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2101 if err != nil {
2102 return err
2103 }
2104
2105 t.Description = (*string)(&sval)
2106 }
2107 }
2108
2109 default:
2110 // Field doesn't exist on this type, so ignore it
2111 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2112 return err
2113 }
2114 }
2115 }
2116
2117 return nil
2118}
2119func (t *RepoPull) MarshalCBOR(w io.Writer) error {
2120 if t == nil {
2121 _, err := w.Write(cbg.CborNull)
2122 return err
2123 }
2124
2125 cw := cbg.NewCborWriter(w)
2126 fieldCount := 9
2127
2128 if t.Body == nil {
2129 fieldCount--
2130 }
2131
2132 if t.CreatedAt == nil {
2133 fieldCount--
2134 }
2135
2136 if t.Source == nil {
2137 fieldCount--
2138 }
2139
2140 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2141 return err
2142 }
2143
2144 // t.Body (string) (string)
2145 if t.Body != nil {
2146
2147 if len("body") > 1000000 {
2148 return xerrors.Errorf("Value in field \"body\" was too long")
2149 }
2150
2151 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
2152 return err
2153 }
2154 if _, err := cw.WriteString(string("body")); err != nil {
2155 return err
2156 }
2157
2158 if t.Body == nil {
2159 if _, err := cw.Write(cbg.CborNull); err != nil {
2160 return err
2161 }
2162 } else {
2163 if len(*t.Body) > 1000000 {
2164 return xerrors.Errorf("Value in field t.Body was too long")
2165 }
2166
2167 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
2168 return err
2169 }
2170 if _, err := cw.WriteString(string(*t.Body)); err != nil {
2171 return err
2172 }
2173 }
2174 }
2175
2176 // t.LexiconTypeID (string) (string)
2177 if len("$type") > 1000000 {
2178 return xerrors.Errorf("Value in field \"$type\" was too long")
2179 }
2180
2181 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2182 return err
2183 }
2184 if _, err := cw.WriteString(string("$type")); err != nil {
2185 return err
2186 }
2187
2188 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull"))); err != nil {
2189 return err
2190 }
2191 if _, err := cw.WriteString(string("sh.tangled.repo.pull")); err != nil {
2192 return err
2193 }
2194
2195 // t.Patch (string) (string)
2196 if len("patch") > 1000000 {
2197 return xerrors.Errorf("Value in field \"patch\" was too long")
2198 }
2199
2200 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil {
2201 return err
2202 }
2203 if _, err := cw.WriteString(string("patch")); err != nil {
2204 return err
2205 }
2206
2207 if len(t.Patch) > 1000000 {
2208 return xerrors.Errorf("Value in field t.Patch was too long")
2209 }
2210
2211 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Patch))); err != nil {
2212 return err
2213 }
2214 if _, err := cw.WriteString(string(t.Patch)); err != nil {
2215 return err
2216 }
2217
2218 // t.Title (string) (string)
2219 if len("title") > 1000000 {
2220 return xerrors.Errorf("Value in field \"title\" was too long")
2221 }
2222
2223 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
2224 return err
2225 }
2226 if _, err := cw.WriteString(string("title")); err != nil {
2227 return err
2228 }
2229
2230 if len(t.Title) > 1000000 {
2231 return xerrors.Errorf("Value in field t.Title was too long")
2232 }
2233
2234 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
2235 return err
2236 }
2237 if _, err := cw.WriteString(string(t.Title)); err != nil {
2238 return err
2239 }
2240
2241 // t.PullId (int64) (int64)
2242 if len("pullId") > 1000000 {
2243 return xerrors.Errorf("Value in field \"pullId\" was too long")
2244 }
2245
2246 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil {
2247 return err
2248 }
2249 if _, err := cw.WriteString(string("pullId")); err != nil {
2250 return err
2251 }
2252
2253 if t.PullId >= 0 {
2254 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil {
2255 return err
2256 }
2257 } else {
2258 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil {
2259 return err
2260 }
2261 }
2262
2263 // t.Source (tangled.RepoPull_Source) (struct)
2264 if t.Source != nil {
2265
2266 if len("source") > 1000000 {
2267 return xerrors.Errorf("Value in field \"source\" was too long")
2268 }
2269
2270 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
2271 return err
2272 }
2273 if _, err := cw.WriteString(string("source")); err != nil {
2274 return err
2275 }
2276
2277 if err := t.Source.MarshalCBOR(cw); err != nil {
2278 return err
2279 }
2280 }
2281
2282 // t.CreatedAt (string) (string)
2283 if t.CreatedAt != nil {
2284
2285 if len("createdAt") > 1000000 {
2286 return xerrors.Errorf("Value in field \"createdAt\" was too long")
2287 }
2288
2289 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
2290 return err
2291 }
2292 if _, err := cw.WriteString(string("createdAt")); err != nil {
2293 return err
2294 }
2295
2296 if t.CreatedAt == nil {
2297 if _, err := cw.Write(cbg.CborNull); err != nil {
2298 return err
2299 }
2300 } else {
2301 if len(*t.CreatedAt) > 1000000 {
2302 return xerrors.Errorf("Value in field t.CreatedAt was too long")
2303 }
2304
2305 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
2306 return err
2307 }
2308 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
2309 return err
2310 }
2311 }
2312 }
2313
2314 // t.TargetRepo (string) (string)
2315 if len("targetRepo") > 1000000 {
2316 return xerrors.Errorf("Value in field \"targetRepo\" was too long")
2317 }
2318
2319 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetRepo"))); err != nil {
2320 return err
2321 }
2322 if _, err := cw.WriteString(string("targetRepo")); err != nil {
2323 return err
2324 }
2325
2326 if len(t.TargetRepo) > 1000000 {
2327 return xerrors.Errorf("Value in field t.TargetRepo was too long")
2328 }
2329
2330 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetRepo))); err != nil {
2331 return err
2332 }
2333 if _, err := cw.WriteString(string(t.TargetRepo)); err != nil {
2334 return err
2335 }
2336
2337 // t.TargetBranch (string) (string)
2338 if len("targetBranch") > 1000000 {
2339 return xerrors.Errorf("Value in field \"targetBranch\" was too long")
2340 }
2341
2342 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetBranch"))); err != nil {
2343 return err
2344 }
2345 if _, err := cw.WriteString(string("targetBranch")); err != nil {
2346 return err
2347 }
2348
2349 if len(t.TargetBranch) > 1000000 {
2350 return xerrors.Errorf("Value in field t.TargetBranch was too long")
2351 }
2352
2353 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetBranch))); err != nil {
2354 return err
2355 }
2356 if _, err := cw.WriteString(string(t.TargetBranch)); err != nil {
2357 return err
2358 }
2359 return nil
2360}
2361
2362func (t *RepoPull) UnmarshalCBOR(r io.Reader) (err error) {
2363 *t = RepoPull{}
2364
2365 cr := cbg.NewCborReader(r)
2366
2367 maj, extra, err := cr.ReadHeader()
2368 if err != nil {
2369 return err
2370 }
2371 defer func() {
2372 if err == io.EOF {
2373 err = io.ErrUnexpectedEOF
2374 }
2375 }()
2376
2377 if maj != cbg.MajMap {
2378 return fmt.Errorf("cbor input should be of type map")
2379 }
2380
2381 if extra > cbg.MaxLength {
2382 return fmt.Errorf("RepoPull: map struct too large (%d)", extra)
2383 }
2384
2385 n := extra
2386
2387 nameBuf := make([]byte, 12)
2388 for i := uint64(0); i < n; i++ {
2389 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2390 if err != nil {
2391 return err
2392 }
2393
2394 if !ok {
2395 // Field doesn't exist on this type, so ignore it
2396 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2397 return err
2398 }
2399 continue
2400 }
2401
2402 switch string(nameBuf[:nameLen]) {
2403 // t.Body (string) (string)
2404 case "body":
2405
2406 {
2407 b, err := cr.ReadByte()
2408 if err != nil {
2409 return err
2410 }
2411 if b != cbg.CborNull[0] {
2412 if err := cr.UnreadByte(); err != nil {
2413 return err
2414 }
2415
2416 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2417 if err != nil {
2418 return err
2419 }
2420
2421 t.Body = (*string)(&sval)
2422 }
2423 }
2424 // t.LexiconTypeID (string) (string)
2425 case "$type":
2426
2427 {
2428 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2429 if err != nil {
2430 return err
2431 }
2432
2433 t.LexiconTypeID = string(sval)
2434 }
2435 // t.Patch (string) (string)
2436 case "patch":
2437
2438 {
2439 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2440 if err != nil {
2441 return err
2442 }
2443
2444 t.Patch = string(sval)
2445 }
2446 // t.Title (string) (string)
2447 case "title":
2448
2449 {
2450 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2451 if err != nil {
2452 return err
2453 }
2454
2455 t.Title = string(sval)
2456 }
2457 // t.PullId (int64) (int64)
2458 case "pullId":
2459 {
2460 maj, extra, err := cr.ReadHeader()
2461 if err != nil {
2462 return err
2463 }
2464 var extraI int64
2465 switch maj {
2466 case cbg.MajUnsignedInt:
2467 extraI = int64(extra)
2468 if extraI < 0 {
2469 return fmt.Errorf("int64 positive overflow")
2470 }
2471 case cbg.MajNegativeInt:
2472 extraI = int64(extra)
2473 if extraI < 0 {
2474 return fmt.Errorf("int64 negative overflow")
2475 }
2476 extraI = -1 - extraI
2477 default:
2478 return fmt.Errorf("wrong type for int64 field: %d", maj)
2479 }
2480
2481 t.PullId = int64(extraI)
2482 }
2483 // t.Source (tangled.RepoPull_Source) (struct)
2484 case "source":
2485
2486 {
2487
2488 b, err := cr.ReadByte()
2489 if err != nil {
2490 return err
2491 }
2492 if b != cbg.CborNull[0] {
2493 if err := cr.UnreadByte(); err != nil {
2494 return err
2495 }
2496 t.Source = new(RepoPull_Source)
2497 if err := t.Source.UnmarshalCBOR(cr); err != nil {
2498 return xerrors.Errorf("unmarshaling t.Source pointer: %w", err)
2499 }
2500 }
2501
2502 }
2503 // t.CreatedAt (string) (string)
2504 case "createdAt":
2505
2506 {
2507 b, err := cr.ReadByte()
2508 if err != nil {
2509 return err
2510 }
2511 if b != cbg.CborNull[0] {
2512 if err := cr.UnreadByte(); err != nil {
2513 return err
2514 }
2515
2516 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2517 if err != nil {
2518 return err
2519 }
2520
2521 t.CreatedAt = (*string)(&sval)
2522 }
2523 }
2524 // t.TargetRepo (string) (string)
2525 case "targetRepo":
2526
2527 {
2528 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2529 if err != nil {
2530 return err
2531 }
2532
2533 t.TargetRepo = string(sval)
2534 }
2535 // t.TargetBranch (string) (string)
2536 case "targetBranch":
2537
2538 {
2539 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2540 if err != nil {
2541 return err
2542 }
2543
2544 t.TargetBranch = string(sval)
2545 }
2546
2547 default:
2548 // Field doesn't exist on this type, so ignore it
2549 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2550 return err
2551 }
2552 }
2553 }
2554
2555 return nil
2556}
2557func (t *RepoPull_Source) MarshalCBOR(w io.Writer) error {
2558 if t == nil {
2559 _, err := w.Write(cbg.CborNull)
2560 return err
2561 }
2562
2563 cw := cbg.NewCborWriter(w)
2564 fieldCount := 2
2565
2566 if t.Repo == nil {
2567 fieldCount--
2568 }
2569
2570 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2571 return err
2572 }
2573
2574 // t.Repo (string) (string)
2575 if t.Repo != nil {
2576
2577 if len("repo") > 1000000 {
2578 return xerrors.Errorf("Value in field \"repo\" was too long")
2579 }
2580
2581 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
2582 return err
2583 }
2584 if _, err := cw.WriteString(string("repo")); err != nil {
2585 return err
2586 }
2587
2588 if t.Repo == nil {
2589 if _, err := cw.Write(cbg.CborNull); err != nil {
2590 return err
2591 }
2592 } else {
2593 if len(*t.Repo) > 1000000 {
2594 return xerrors.Errorf("Value in field t.Repo was too long")
2595 }
2596
2597 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
2598 return err
2599 }
2600 if _, err := cw.WriteString(string(*t.Repo)); err != nil {
2601 return err
2602 }
2603 }
2604 }
2605
2606 // t.Branch (string) (string)
2607 if len("branch") > 1000000 {
2608 return xerrors.Errorf("Value in field \"branch\" was too long")
2609 }
2610
2611 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
2612 return err
2613 }
2614 if _, err := cw.WriteString(string("branch")); err != nil {
2615 return err
2616 }
2617
2618 if len(t.Branch) > 1000000 {
2619 return xerrors.Errorf("Value in field t.Branch was too long")
2620 }
2621
2622 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
2623 return err
2624 }
2625 if _, err := cw.WriteString(string(t.Branch)); err != nil {
2626 return err
2627 }
2628 return nil
2629}
2630
2631func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) {
2632 *t = RepoPull_Source{}
2633
2634 cr := cbg.NewCborReader(r)
2635
2636 maj, extra, err := cr.ReadHeader()
2637 if err != nil {
2638 return err
2639 }
2640 defer func() {
2641 if err == io.EOF {
2642 err = io.ErrUnexpectedEOF
2643 }
2644 }()
2645
2646 if maj != cbg.MajMap {
2647 return fmt.Errorf("cbor input should be of type map")
2648 }
2649
2650 if extra > cbg.MaxLength {
2651 return fmt.Errorf("RepoPull_Source: map struct too large (%d)", extra)
2652 }
2653
2654 n := extra
2655
2656 nameBuf := make([]byte, 6)
2657 for i := uint64(0); i < n; i++ {
2658 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2659 if err != nil {
2660 return err
2661 }
2662
2663 if !ok {
2664 // Field doesn't exist on this type, so ignore it
2665 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2666 return err
2667 }
2668 continue
2669 }
2670
2671 switch string(nameBuf[:nameLen]) {
2672 // t.Repo (string) (string)
2673 case "repo":
2674
2675 {
2676 b, err := cr.ReadByte()
2677 if err != nil {
2678 return err
2679 }
2680 if b != cbg.CborNull[0] {
2681 if err := cr.UnreadByte(); err != nil {
2682 return err
2683 }
2684
2685 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2686 if err != nil {
2687 return err
2688 }
2689
2690 t.Repo = (*string)(&sval)
2691 }
2692 }
2693 // t.Branch (string) (string)
2694 case "branch":
2695
2696 {
2697 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2698 if err != nil {
2699 return err
2700 }
2701
2702 t.Branch = string(sval)
2703 }
2704
2705 default:
2706 // Field doesn't exist on this type, so ignore it
2707 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2708 return err
2709 }
2710 }
2711 }
2712
2713 return nil
2714}
2715func (t *RepoPullStatus) MarshalCBOR(w io.Writer) error {
2716 if t == nil {
2717 _, err := w.Write(cbg.CborNull)
2718 return err
2719 }
2720
2721 cw := cbg.NewCborWriter(w)
2722 fieldCount := 3
2723
2724 if t.Status == nil {
2725 fieldCount--
2726 }
2727
2728 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2729 return err
2730 }
2731
2732 // t.Pull (string) (string)
2733 if len("pull") > 1000000 {
2734 return xerrors.Errorf("Value in field \"pull\" was too long")
2735 }
2736
2737 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
2738 return err
2739 }
2740 if _, err := cw.WriteString(string("pull")); err != nil {
2741 return err
2742 }
2743
2744 if len(t.Pull) > 1000000 {
2745 return xerrors.Errorf("Value in field t.Pull was too long")
2746 }
2747
2748 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
2749 return err
2750 }
2751 if _, err := cw.WriteString(string(t.Pull)); err != nil {
2752 return err
2753 }
2754
2755 // t.LexiconTypeID (string) (string)
2756 if len("$type") > 1000000 {
2757 return xerrors.Errorf("Value in field \"$type\" was too long")
2758 }
2759
2760 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2761 return err
2762 }
2763 if _, err := cw.WriteString(string("$type")); err != nil {
2764 return err
2765 }
2766
2767 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.status"))); err != nil {
2768 return err
2769 }
2770 if _, err := cw.WriteString(string("sh.tangled.repo.pull.status")); err != nil {
2771 return err
2772 }
2773
2774 // t.Status (string) (string)
2775 if t.Status != nil {
2776
2777 if len("status") > 1000000 {
2778 return xerrors.Errorf("Value in field \"status\" was too long")
2779 }
2780
2781 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
2782 return err
2783 }
2784 if _, err := cw.WriteString(string("status")); err != nil {
2785 return err
2786 }
2787
2788 if t.Status == nil {
2789 if _, err := cw.Write(cbg.CborNull); err != nil {
2790 return err
2791 }
2792 } else {
2793 if len(*t.Status) > 1000000 {
2794 return xerrors.Errorf("Value in field t.Status was too long")
2795 }
2796
2797 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil {
2798 return err
2799 }
2800 if _, err := cw.WriteString(string(*t.Status)); err != nil {
2801 return err
2802 }
2803 }
2804 }
2805 return nil
2806}
2807
2808func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) {
2809 *t = RepoPullStatus{}
2810
2811 cr := cbg.NewCborReader(r)
2812
2813 maj, extra, err := cr.ReadHeader()
2814 if err != nil {
2815 return err
2816 }
2817 defer func() {
2818 if err == io.EOF {
2819 err = io.ErrUnexpectedEOF
2820 }
2821 }()
2822
2823 if maj != cbg.MajMap {
2824 return fmt.Errorf("cbor input should be of type map")
2825 }
2826
2827 if extra > cbg.MaxLength {
2828 return fmt.Errorf("RepoPullStatus: map struct too large (%d)", extra)
2829 }
2830
2831 n := extra
2832
2833 nameBuf := make([]byte, 6)
2834 for i := uint64(0); i < n; i++ {
2835 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2836 if err != nil {
2837 return err
2838 }
2839
2840 if !ok {
2841 // Field doesn't exist on this type, so ignore it
2842 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2843 return err
2844 }
2845 continue
2846 }
2847
2848 switch string(nameBuf[:nameLen]) {
2849 // t.Pull (string) (string)
2850 case "pull":
2851
2852 {
2853 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2854 if err != nil {
2855 return err
2856 }
2857
2858 t.Pull = string(sval)
2859 }
2860 // t.LexiconTypeID (string) (string)
2861 case "$type":
2862
2863 {
2864 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2865 if err != nil {
2866 return err
2867 }
2868
2869 t.LexiconTypeID = string(sval)
2870 }
2871 // t.Status (string) (string)
2872 case "status":
2873
2874 {
2875 b, err := cr.ReadByte()
2876 if err != nil {
2877 return err
2878 }
2879 if b != cbg.CborNull[0] {
2880 if err := cr.UnreadByte(); err != nil {
2881 return err
2882 }
2883
2884 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2885 if err != nil {
2886 return err
2887 }
2888
2889 t.Status = (*string)(&sval)
2890 }
2891 }
2892
2893 default:
2894 // Field doesn't exist on this type, so ignore it
2895 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2896 return err
2897 }
2898 }
2899 }
2900
2901 return nil
2902}
2903func (t *RepoPullComment) MarshalCBOR(w io.Writer) error {
2904 if t == nil {
2905 _, err := w.Write(cbg.CborNull)
2906 return err
2907 }
2908
2909 cw := cbg.NewCborWriter(w)
2910 fieldCount := 7
2911
2912 if t.Body == nil {
2913 fieldCount--
2914 }
2915
2916 if t.CommentId == nil {
2917 fieldCount--
2918 }
2919
2920 if t.CreatedAt == nil {
2921 fieldCount--
2922 }
2923
2924 if t.Owner == nil {
2925 fieldCount--
2926 }
2927
2928 if t.Repo == nil {
2929 fieldCount--
2930 }
2931
2932 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2933 return err
2934 }
2935
2936 // t.Body (string) (string)
2937 if t.Body != nil {
2938
2939 if len("body") > 1000000 {
2940 return xerrors.Errorf("Value in field \"body\" was too long")
2941 }
2942
2943 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
2944 return err
2945 }
2946 if _, err := cw.WriteString(string("body")); err != nil {
2947 return err
2948 }
2949
2950 if t.Body == nil {
2951 if _, err := cw.Write(cbg.CborNull); err != nil {
2952 return err
2953 }
2954 } else {
2955 if len(*t.Body) > 1000000 {
2956 return xerrors.Errorf("Value in field t.Body was too long")
2957 }
2958
2959 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
2960 return err
2961 }
2962 if _, err := cw.WriteString(string(*t.Body)); err != nil {
2963 return err
2964 }
2965 }
2966 }
2967
2968 // t.Pull (string) (string)
2969 if len("pull") > 1000000 {
2970 return xerrors.Errorf("Value in field \"pull\" was too long")
2971 }
2972
2973 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
2974 return err
2975 }
2976 if _, err := cw.WriteString(string("pull")); err != nil {
2977 return err
2978 }
2979
2980 if len(t.Pull) > 1000000 {
2981 return xerrors.Errorf("Value in field t.Pull was too long")
2982 }
2983
2984 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
2985 return err
2986 }
2987 if _, err := cw.WriteString(string(t.Pull)); err != nil {
2988 return err
2989 }
2990
2991 // t.Repo (string) (string)
2992 if t.Repo != nil {
2993
2994 if len("repo") > 1000000 {
2995 return xerrors.Errorf("Value in field \"repo\" was too long")
2996 }
2997
2998 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
2999 return err
3000 }
3001 if _, err := cw.WriteString(string("repo")); err != nil {
3002 return err
3003 }
3004
3005 if t.Repo == nil {
3006 if _, err := cw.Write(cbg.CborNull); err != nil {
3007 return err
3008 }
3009 } else {
3010 if len(*t.Repo) > 1000000 {
3011 return xerrors.Errorf("Value in field t.Repo was too long")
3012 }
3013
3014 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
3015 return err
3016 }
3017 if _, err := cw.WriteString(string(*t.Repo)); err != nil {
3018 return err
3019 }
3020 }
3021 }
3022
3023 // t.LexiconTypeID (string) (string)
3024 if len("$type") > 1000000 {
3025 return xerrors.Errorf("Value in field \"$type\" was too long")
3026 }
3027
3028 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
3029 return err
3030 }
3031 if _, err := cw.WriteString(string("$type")); err != nil {
3032 return err
3033 }
3034
3035 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil {
3036 return err
3037 }
3038 if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil {
3039 return err
3040 }
3041
3042 // t.Owner (string) (string)
3043 if t.Owner != nil {
3044
3045 if len("owner") > 1000000 {
3046 return xerrors.Errorf("Value in field \"owner\" was too long")
3047 }
3048
3049 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
3050 return err
3051 }
3052 if _, err := cw.WriteString(string("owner")); err != nil {
3053 return err
3054 }
3055
3056 if t.Owner == nil {
3057 if _, err := cw.Write(cbg.CborNull); err != nil {
3058 return err
3059 }
3060 } else {
3061 if len(*t.Owner) > 1000000 {
3062 return xerrors.Errorf("Value in field t.Owner was too long")
3063 }
3064
3065 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
3066 return err
3067 }
3068 if _, err := cw.WriteString(string(*t.Owner)); err != nil {
3069 return err
3070 }
3071 }
3072 }
3073
3074 // t.CommentId (int64) (int64)
3075 if t.CommentId != nil {
3076
3077 if len("commentId") > 1000000 {
3078 return xerrors.Errorf("Value in field \"commentId\" was too long")
3079 }
3080
3081 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
3082 return err
3083 }
3084 if _, err := cw.WriteString(string("commentId")); err != nil {
3085 return err
3086 }
3087
3088 if t.CommentId == nil {
3089 if _, err := cw.Write(cbg.CborNull); err != nil {
3090 return err
3091 }
3092 } else {
3093 if *t.CommentId >= 0 {
3094 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
3095 return err
3096 }
3097 } else {
3098 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
3099 return err
3100 }
3101 }
3102 }
3103
3104 }
3105
3106 // t.CreatedAt (string) (string)
3107 if t.CreatedAt != nil {
3108
3109 if len("createdAt") > 1000000 {
3110 return xerrors.Errorf("Value in field \"createdAt\" was too long")
3111 }
3112
3113 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
3114 return err
3115 }
3116 if _, err := cw.WriteString(string("createdAt")); err != nil {
3117 return err
3118 }
3119
3120 if t.CreatedAt == nil {
3121 if _, err := cw.Write(cbg.CborNull); err != nil {
3122 return err
3123 }
3124 } else {
3125 if len(*t.CreatedAt) > 1000000 {
3126 return xerrors.Errorf("Value in field t.CreatedAt was too long")
3127 }
3128
3129 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
3130 return err
3131 }
3132 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
3133 return err
3134 }
3135 }
3136 }
3137 return nil
3138}
3139
3140func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) {
3141 *t = RepoPullComment{}
3142
3143 cr := cbg.NewCborReader(r)
3144
3145 maj, extra, err := cr.ReadHeader()
3146 if err != nil {
3147 return err
3148 }
3149 defer func() {
3150 if err == io.EOF {
3151 err = io.ErrUnexpectedEOF
3152 }
3153 }()
3154
3155 if maj != cbg.MajMap {
3156 return fmt.Errorf("cbor input should be of type map")
3157 }
3158
3159 if extra > cbg.MaxLength {
3160 return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra)
3161 }
3162
3163 n := extra
3164
3165 nameBuf := make([]byte, 9)
3166 for i := uint64(0); i < n; i++ {
3167 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
3168 if err != nil {
3169 return err
3170 }
3171
3172 if !ok {
3173 // Field doesn't exist on this type, so ignore it
3174 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
3175 return err
3176 }
3177 continue
3178 }
3179
3180 switch string(nameBuf[:nameLen]) {
3181 // t.Body (string) (string)
3182 case "body":
3183
3184 {
3185 b, err := cr.ReadByte()
3186 if err != nil {
3187 return err
3188 }
3189 if b != cbg.CborNull[0] {
3190 if err := cr.UnreadByte(); err != nil {
3191 return err
3192 }
3193
3194 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3195 if err != nil {
3196 return err
3197 }
3198
3199 t.Body = (*string)(&sval)
3200 }
3201 }
3202 // t.Pull (string) (string)
3203 case "pull":
3204
3205 {
3206 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3207 if err != nil {
3208 return err
3209 }
3210
3211 t.Pull = string(sval)
3212 }
3213 // t.Repo (string) (string)
3214 case "repo":
3215
3216 {
3217 b, err := cr.ReadByte()
3218 if err != nil {
3219 return err
3220 }
3221 if b != cbg.CborNull[0] {
3222 if err := cr.UnreadByte(); err != nil {
3223 return err
3224 }
3225
3226 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3227 if err != nil {
3228 return err
3229 }
3230
3231 t.Repo = (*string)(&sval)
3232 }
3233 }
3234 // t.LexiconTypeID (string) (string)
3235 case "$type":
3236
3237 {
3238 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3239 if err != nil {
3240 return err
3241 }
3242
3243 t.LexiconTypeID = string(sval)
3244 }
3245 // t.Owner (string) (string)
3246 case "owner":
3247
3248 {
3249 b, err := cr.ReadByte()
3250 if err != nil {
3251 return err
3252 }
3253 if b != cbg.CborNull[0] {
3254 if err := cr.UnreadByte(); err != nil {
3255 return err
3256 }
3257
3258 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3259 if err != nil {
3260 return err
3261 }
3262
3263 t.Owner = (*string)(&sval)
3264 }
3265 }
3266 // t.CommentId (int64) (int64)
3267 case "commentId":
3268 {
3269
3270 b, err := cr.ReadByte()
3271 if err != nil {
3272 return err
3273 }
3274 if b != cbg.CborNull[0] {
3275 if err := cr.UnreadByte(); err != nil {
3276 return err
3277 }
3278 maj, extra, err := cr.ReadHeader()
3279 if err != nil {
3280 return err
3281 }
3282 var extraI int64
3283 switch maj {
3284 case cbg.MajUnsignedInt:
3285 extraI = int64(extra)
3286 if extraI < 0 {
3287 return fmt.Errorf("int64 positive overflow")
3288 }
3289 case cbg.MajNegativeInt:
3290 extraI = int64(extra)
3291 if extraI < 0 {
3292 return fmt.Errorf("int64 negative overflow")
3293 }
3294 extraI = -1 - extraI
3295 default:
3296 return fmt.Errorf("wrong type for int64 field: %d", maj)
3297 }
3298
3299 t.CommentId = (*int64)(&extraI)
3300 }
3301 }
3302 // t.CreatedAt (string) (string)
3303 case "createdAt":
3304
3305 {
3306 b, err := cr.ReadByte()
3307 if err != nil {
3308 return err
3309 }
3310 if b != cbg.CborNull[0] {
3311 if err := cr.UnreadByte(); err != nil {
3312 return err
3313 }
3314
3315 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3316 if err != nil {
3317 return err
3318 }
3319
3320 t.CreatedAt = (*string)(&sval)
3321 }
3322 }
3323
3324 default:
3325 // Field doesn't exist on this type, so ignore it
3326 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
3327 return err
3328 }
3329 }
3330 }
3331
3332 return nil
3333}