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 := 6
1757
1758 if t.AddedAt == nil {
1759 fieldCount--
1760 }
1761
1762 if t.Description == nil {
1763 fieldCount--
1764 }
1765
1766 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1767 return err
1768 }
1769
1770 // t.Knot (string) (string)
1771 if len("knot") > 1000000 {
1772 return xerrors.Errorf("Value in field \"knot\" was too long")
1773 }
1774
1775 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil {
1776 return err
1777 }
1778 if _, err := cw.WriteString(string("knot")); err != nil {
1779 return err
1780 }
1781
1782 if len(t.Knot) > 1000000 {
1783 return xerrors.Errorf("Value in field t.Knot was too long")
1784 }
1785
1786 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil {
1787 return err
1788 }
1789 if _, err := cw.WriteString(string(t.Knot)); err != nil {
1790 return err
1791 }
1792
1793 // t.Name (string) (string)
1794 if len("name") > 1000000 {
1795 return xerrors.Errorf("Value in field \"name\" was too long")
1796 }
1797
1798 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
1799 return err
1800 }
1801 if _, err := cw.WriteString(string("name")); err != nil {
1802 return err
1803 }
1804
1805 if len(t.Name) > 1000000 {
1806 return xerrors.Errorf("Value in field t.Name was too long")
1807 }
1808
1809 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
1810 return err
1811 }
1812 if _, err := cw.WriteString(string(t.Name)); err != nil {
1813 return err
1814 }
1815
1816 // t.LexiconTypeID (string) (string)
1817 if len("$type") > 1000000 {
1818 return xerrors.Errorf("Value in field \"$type\" was too long")
1819 }
1820
1821 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1822 return err
1823 }
1824 if _, err := cw.WriteString(string("$type")); err != nil {
1825 return err
1826 }
1827
1828 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo"))); err != nil {
1829 return err
1830 }
1831 if _, err := cw.WriteString(string("sh.tangled.repo")); err != nil {
1832 return err
1833 }
1834
1835 // t.Owner (string) (string)
1836 if len("owner") > 1000000 {
1837 return xerrors.Errorf("Value in field \"owner\" was too long")
1838 }
1839
1840 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
1841 return err
1842 }
1843 if _, err := cw.WriteString(string("owner")); err != nil {
1844 return err
1845 }
1846
1847 if len(t.Owner) > 1000000 {
1848 return xerrors.Errorf("Value in field t.Owner was too long")
1849 }
1850
1851 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Owner))); err != nil {
1852 return err
1853 }
1854 if _, err := cw.WriteString(string(t.Owner)); err != nil {
1855 return err
1856 }
1857
1858 // t.AddedAt (string) (string)
1859 if t.AddedAt != nil {
1860
1861 if len("addedAt") > 1000000 {
1862 return xerrors.Errorf("Value in field \"addedAt\" was too long")
1863 }
1864
1865 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("addedAt"))); err != nil {
1866 return err
1867 }
1868 if _, err := cw.WriteString(string("addedAt")); err != nil {
1869 return err
1870 }
1871
1872 if t.AddedAt == nil {
1873 if _, err := cw.Write(cbg.CborNull); err != nil {
1874 return err
1875 }
1876 } else {
1877 if len(*t.AddedAt) > 1000000 {
1878 return xerrors.Errorf("Value in field t.AddedAt was too long")
1879 }
1880
1881 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.AddedAt))); err != nil {
1882 return err
1883 }
1884 if _, err := cw.WriteString(string(*t.AddedAt)); err != nil {
1885 return err
1886 }
1887 }
1888 }
1889
1890 // t.Description (string) (string)
1891 if t.Description != nil {
1892
1893 if len("description") > 1000000 {
1894 return xerrors.Errorf("Value in field \"description\" was too long")
1895 }
1896
1897 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
1898 return err
1899 }
1900 if _, err := cw.WriteString(string("description")); err != nil {
1901 return err
1902 }
1903
1904 if t.Description == nil {
1905 if _, err := cw.Write(cbg.CborNull); err != nil {
1906 return err
1907 }
1908 } else {
1909 if len(*t.Description) > 1000000 {
1910 return xerrors.Errorf("Value in field t.Description was too long")
1911 }
1912
1913 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
1914 return err
1915 }
1916 if _, err := cw.WriteString(string(*t.Description)); err != nil {
1917 return err
1918 }
1919 }
1920 }
1921 return nil
1922}
1923
1924func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) {
1925 *t = Repo{}
1926
1927 cr := cbg.NewCborReader(r)
1928
1929 maj, extra, err := cr.ReadHeader()
1930 if err != nil {
1931 return err
1932 }
1933 defer func() {
1934 if err == io.EOF {
1935 err = io.ErrUnexpectedEOF
1936 }
1937 }()
1938
1939 if maj != cbg.MajMap {
1940 return fmt.Errorf("cbor input should be of type map")
1941 }
1942
1943 if extra > cbg.MaxLength {
1944 return fmt.Errorf("Repo: map struct too large (%d)", extra)
1945 }
1946
1947 n := extra
1948
1949 nameBuf := make([]byte, 11)
1950 for i := uint64(0); i < n; i++ {
1951 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1952 if err != nil {
1953 return err
1954 }
1955
1956 if !ok {
1957 // Field doesn't exist on this type, so ignore it
1958 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1959 return err
1960 }
1961 continue
1962 }
1963
1964 switch string(nameBuf[:nameLen]) {
1965 // t.Knot (string) (string)
1966 case "knot":
1967
1968 {
1969 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1970 if err != nil {
1971 return err
1972 }
1973
1974 t.Knot = string(sval)
1975 }
1976 // t.Name (string) (string)
1977 case "name":
1978
1979 {
1980 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1981 if err != nil {
1982 return err
1983 }
1984
1985 t.Name = string(sval)
1986 }
1987 // t.LexiconTypeID (string) (string)
1988 case "$type":
1989
1990 {
1991 sval, err := cbg.ReadStringWithMax(cr, 1000000)
1992 if err != nil {
1993 return err
1994 }
1995
1996 t.LexiconTypeID = string(sval)
1997 }
1998 // t.Owner (string) (string)
1999 case "owner":
2000
2001 {
2002 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2003 if err != nil {
2004 return err
2005 }
2006
2007 t.Owner = string(sval)
2008 }
2009 // t.AddedAt (string) (string)
2010 case "addedAt":
2011
2012 {
2013 b, err := cr.ReadByte()
2014 if err != nil {
2015 return err
2016 }
2017 if b != cbg.CborNull[0] {
2018 if err := cr.UnreadByte(); err != nil {
2019 return err
2020 }
2021
2022 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2023 if err != nil {
2024 return err
2025 }
2026
2027 t.AddedAt = (*string)(&sval)
2028 }
2029 }
2030 // t.Description (string) (string)
2031 case "description":
2032
2033 {
2034 b, err := cr.ReadByte()
2035 if err != nil {
2036 return err
2037 }
2038 if b != cbg.CborNull[0] {
2039 if err := cr.UnreadByte(); err != nil {
2040 return err
2041 }
2042
2043 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2044 if err != nil {
2045 return err
2046 }
2047
2048 t.Description = (*string)(&sval)
2049 }
2050 }
2051
2052 default:
2053 // Field doesn't exist on this type, so ignore it
2054 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2055 return err
2056 }
2057 }
2058 }
2059
2060 return nil
2061}
2062func (t *RepoPull) MarshalCBOR(w io.Writer) error {
2063 if t == nil {
2064 _, err := w.Write(cbg.CborNull)
2065 return err
2066 }
2067
2068 cw := cbg.NewCborWriter(w)
2069 fieldCount := 9
2070
2071 if t.Body == nil {
2072 fieldCount--
2073 }
2074
2075 if t.CreatedAt == nil {
2076 fieldCount--
2077 }
2078
2079 if t.Source == nil {
2080 fieldCount--
2081 }
2082
2083 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2084 return err
2085 }
2086
2087 // t.Body (string) (string)
2088 if t.Body != nil {
2089
2090 if len("body") > 1000000 {
2091 return xerrors.Errorf("Value in field \"body\" was too long")
2092 }
2093
2094 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
2095 return err
2096 }
2097 if _, err := cw.WriteString(string("body")); err != nil {
2098 return err
2099 }
2100
2101 if t.Body == nil {
2102 if _, err := cw.Write(cbg.CborNull); err != nil {
2103 return err
2104 }
2105 } else {
2106 if len(*t.Body) > 1000000 {
2107 return xerrors.Errorf("Value in field t.Body was too long")
2108 }
2109
2110 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
2111 return err
2112 }
2113 if _, err := cw.WriteString(string(*t.Body)); err != nil {
2114 return err
2115 }
2116 }
2117 }
2118
2119 // t.LexiconTypeID (string) (string)
2120 if len("$type") > 1000000 {
2121 return xerrors.Errorf("Value in field \"$type\" was too long")
2122 }
2123
2124 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2125 return err
2126 }
2127 if _, err := cw.WriteString(string("$type")); err != nil {
2128 return err
2129 }
2130
2131 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull"))); err != nil {
2132 return err
2133 }
2134 if _, err := cw.WriteString(string("sh.tangled.repo.pull")); err != nil {
2135 return err
2136 }
2137
2138 // t.Patch (string) (string)
2139 if len("patch") > 1000000 {
2140 return xerrors.Errorf("Value in field \"patch\" was too long")
2141 }
2142
2143 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil {
2144 return err
2145 }
2146 if _, err := cw.WriteString(string("patch")); err != nil {
2147 return err
2148 }
2149
2150 if len(t.Patch) > 1000000 {
2151 return xerrors.Errorf("Value in field t.Patch was too long")
2152 }
2153
2154 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Patch))); err != nil {
2155 return err
2156 }
2157 if _, err := cw.WriteString(string(t.Patch)); err != nil {
2158 return err
2159 }
2160
2161 // t.Title (string) (string)
2162 if len("title") > 1000000 {
2163 return xerrors.Errorf("Value in field \"title\" was too long")
2164 }
2165
2166 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
2167 return err
2168 }
2169 if _, err := cw.WriteString(string("title")); err != nil {
2170 return err
2171 }
2172
2173 if len(t.Title) > 1000000 {
2174 return xerrors.Errorf("Value in field t.Title was too long")
2175 }
2176
2177 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
2178 return err
2179 }
2180 if _, err := cw.WriteString(string(t.Title)); err != nil {
2181 return err
2182 }
2183
2184 // t.PullId (int64) (int64)
2185 if len("pullId") > 1000000 {
2186 return xerrors.Errorf("Value in field \"pullId\" was too long")
2187 }
2188
2189 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil {
2190 return err
2191 }
2192 if _, err := cw.WriteString(string("pullId")); err != nil {
2193 return err
2194 }
2195
2196 if t.PullId >= 0 {
2197 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil {
2198 return err
2199 }
2200 } else {
2201 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil {
2202 return err
2203 }
2204 }
2205
2206 // t.Source (tangled.RepoPull_Source) (struct)
2207 if t.Source != nil {
2208
2209 if len("source") > 1000000 {
2210 return xerrors.Errorf("Value in field \"source\" was too long")
2211 }
2212
2213 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
2214 return err
2215 }
2216 if _, err := cw.WriteString(string("source")); err != nil {
2217 return err
2218 }
2219
2220 if err := t.Source.MarshalCBOR(cw); err != nil {
2221 return err
2222 }
2223 }
2224
2225 // t.CreatedAt (string) (string)
2226 if t.CreatedAt != nil {
2227
2228 if len("createdAt") > 1000000 {
2229 return xerrors.Errorf("Value in field \"createdAt\" was too long")
2230 }
2231
2232 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
2233 return err
2234 }
2235 if _, err := cw.WriteString(string("createdAt")); err != nil {
2236 return err
2237 }
2238
2239 if t.CreatedAt == nil {
2240 if _, err := cw.Write(cbg.CborNull); err != nil {
2241 return err
2242 }
2243 } else {
2244 if len(*t.CreatedAt) > 1000000 {
2245 return xerrors.Errorf("Value in field t.CreatedAt was too long")
2246 }
2247
2248 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
2249 return err
2250 }
2251 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
2252 return err
2253 }
2254 }
2255 }
2256
2257 // t.TargetRepo (string) (string)
2258 if len("targetRepo") > 1000000 {
2259 return xerrors.Errorf("Value in field \"targetRepo\" was too long")
2260 }
2261
2262 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetRepo"))); err != nil {
2263 return err
2264 }
2265 if _, err := cw.WriteString(string("targetRepo")); err != nil {
2266 return err
2267 }
2268
2269 if len(t.TargetRepo) > 1000000 {
2270 return xerrors.Errorf("Value in field t.TargetRepo was too long")
2271 }
2272
2273 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetRepo))); err != nil {
2274 return err
2275 }
2276 if _, err := cw.WriteString(string(t.TargetRepo)); err != nil {
2277 return err
2278 }
2279
2280 // t.TargetBranch (string) (string)
2281 if len("targetBranch") > 1000000 {
2282 return xerrors.Errorf("Value in field \"targetBranch\" was too long")
2283 }
2284
2285 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetBranch"))); err != nil {
2286 return err
2287 }
2288 if _, err := cw.WriteString(string("targetBranch")); err != nil {
2289 return err
2290 }
2291
2292 if len(t.TargetBranch) > 1000000 {
2293 return xerrors.Errorf("Value in field t.TargetBranch was too long")
2294 }
2295
2296 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetBranch))); err != nil {
2297 return err
2298 }
2299 if _, err := cw.WriteString(string(t.TargetBranch)); err != nil {
2300 return err
2301 }
2302 return nil
2303}
2304
2305func (t *RepoPull) UnmarshalCBOR(r io.Reader) (err error) {
2306 *t = RepoPull{}
2307
2308 cr := cbg.NewCborReader(r)
2309
2310 maj, extra, err := cr.ReadHeader()
2311 if err != nil {
2312 return err
2313 }
2314 defer func() {
2315 if err == io.EOF {
2316 err = io.ErrUnexpectedEOF
2317 }
2318 }()
2319
2320 if maj != cbg.MajMap {
2321 return fmt.Errorf("cbor input should be of type map")
2322 }
2323
2324 if extra > cbg.MaxLength {
2325 return fmt.Errorf("RepoPull: map struct too large (%d)", extra)
2326 }
2327
2328 n := extra
2329
2330 nameBuf := make([]byte, 12)
2331 for i := uint64(0); i < n; i++ {
2332 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2333 if err != nil {
2334 return err
2335 }
2336
2337 if !ok {
2338 // Field doesn't exist on this type, so ignore it
2339 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2340 return err
2341 }
2342 continue
2343 }
2344
2345 switch string(nameBuf[:nameLen]) {
2346 // t.Body (string) (string)
2347 case "body":
2348
2349 {
2350 b, err := cr.ReadByte()
2351 if err != nil {
2352 return err
2353 }
2354 if b != cbg.CborNull[0] {
2355 if err := cr.UnreadByte(); err != nil {
2356 return err
2357 }
2358
2359 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2360 if err != nil {
2361 return err
2362 }
2363
2364 t.Body = (*string)(&sval)
2365 }
2366 }
2367 // t.LexiconTypeID (string) (string)
2368 case "$type":
2369
2370 {
2371 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2372 if err != nil {
2373 return err
2374 }
2375
2376 t.LexiconTypeID = string(sval)
2377 }
2378 // t.Patch (string) (string)
2379 case "patch":
2380
2381 {
2382 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2383 if err != nil {
2384 return err
2385 }
2386
2387 t.Patch = string(sval)
2388 }
2389 // t.Title (string) (string)
2390 case "title":
2391
2392 {
2393 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2394 if err != nil {
2395 return err
2396 }
2397
2398 t.Title = string(sval)
2399 }
2400 // t.PullId (int64) (int64)
2401 case "pullId":
2402 {
2403 maj, extra, err := cr.ReadHeader()
2404 if err != nil {
2405 return err
2406 }
2407 var extraI int64
2408 switch maj {
2409 case cbg.MajUnsignedInt:
2410 extraI = int64(extra)
2411 if extraI < 0 {
2412 return fmt.Errorf("int64 positive overflow")
2413 }
2414 case cbg.MajNegativeInt:
2415 extraI = int64(extra)
2416 if extraI < 0 {
2417 return fmt.Errorf("int64 negative overflow")
2418 }
2419 extraI = -1 - extraI
2420 default:
2421 return fmt.Errorf("wrong type for int64 field: %d", maj)
2422 }
2423
2424 t.PullId = int64(extraI)
2425 }
2426 // t.Source (tangled.RepoPull_Source) (struct)
2427 case "source":
2428
2429 {
2430
2431 b, err := cr.ReadByte()
2432 if err != nil {
2433 return err
2434 }
2435 if b != cbg.CborNull[0] {
2436 if err := cr.UnreadByte(); err != nil {
2437 return err
2438 }
2439 t.Source = new(RepoPull_Source)
2440 if err := t.Source.UnmarshalCBOR(cr); err != nil {
2441 return xerrors.Errorf("unmarshaling t.Source pointer: %w", err)
2442 }
2443 }
2444
2445 }
2446 // t.CreatedAt (string) (string)
2447 case "createdAt":
2448
2449 {
2450 b, err := cr.ReadByte()
2451 if err != nil {
2452 return err
2453 }
2454 if b != cbg.CborNull[0] {
2455 if err := cr.UnreadByte(); err != nil {
2456 return err
2457 }
2458
2459 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2460 if err != nil {
2461 return err
2462 }
2463
2464 t.CreatedAt = (*string)(&sval)
2465 }
2466 }
2467 // t.TargetRepo (string) (string)
2468 case "targetRepo":
2469
2470 {
2471 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2472 if err != nil {
2473 return err
2474 }
2475
2476 t.TargetRepo = string(sval)
2477 }
2478 // t.TargetBranch (string) (string)
2479 case "targetBranch":
2480
2481 {
2482 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2483 if err != nil {
2484 return err
2485 }
2486
2487 t.TargetBranch = string(sval)
2488 }
2489
2490 default:
2491 // Field doesn't exist on this type, so ignore it
2492 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2493 return err
2494 }
2495 }
2496 }
2497
2498 return nil
2499}
2500func (t *RepoPull_Source) MarshalCBOR(w io.Writer) error {
2501 if t == nil {
2502 _, err := w.Write(cbg.CborNull)
2503 return err
2504 }
2505
2506 cw := cbg.NewCborWriter(w)
2507 fieldCount := 2
2508
2509 if t.Repo == nil {
2510 fieldCount--
2511 }
2512
2513 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2514 return err
2515 }
2516
2517 // t.Repo (string) (string)
2518 if t.Repo != nil {
2519
2520 if len("repo") > 1000000 {
2521 return xerrors.Errorf("Value in field \"repo\" was too long")
2522 }
2523
2524 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
2525 return err
2526 }
2527 if _, err := cw.WriteString(string("repo")); err != nil {
2528 return err
2529 }
2530
2531 if t.Repo == nil {
2532 if _, err := cw.Write(cbg.CborNull); err != nil {
2533 return err
2534 }
2535 } else {
2536 if len(*t.Repo) > 1000000 {
2537 return xerrors.Errorf("Value in field t.Repo was too long")
2538 }
2539
2540 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
2541 return err
2542 }
2543 if _, err := cw.WriteString(string(*t.Repo)); err != nil {
2544 return err
2545 }
2546 }
2547 }
2548
2549 // t.Branch (string) (string)
2550 if len("branch") > 1000000 {
2551 return xerrors.Errorf("Value in field \"branch\" was too long")
2552 }
2553
2554 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
2555 return err
2556 }
2557 if _, err := cw.WriteString(string("branch")); err != nil {
2558 return err
2559 }
2560
2561 if len(t.Branch) > 1000000 {
2562 return xerrors.Errorf("Value in field t.Branch was too long")
2563 }
2564
2565 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
2566 return err
2567 }
2568 if _, err := cw.WriteString(string(t.Branch)); err != nil {
2569 return err
2570 }
2571 return nil
2572}
2573
2574func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) {
2575 *t = RepoPull_Source{}
2576
2577 cr := cbg.NewCborReader(r)
2578
2579 maj, extra, err := cr.ReadHeader()
2580 if err != nil {
2581 return err
2582 }
2583 defer func() {
2584 if err == io.EOF {
2585 err = io.ErrUnexpectedEOF
2586 }
2587 }()
2588
2589 if maj != cbg.MajMap {
2590 return fmt.Errorf("cbor input should be of type map")
2591 }
2592
2593 if extra > cbg.MaxLength {
2594 return fmt.Errorf("RepoPull_Source: map struct too large (%d)", extra)
2595 }
2596
2597 n := extra
2598
2599 nameBuf := make([]byte, 6)
2600 for i := uint64(0); i < n; i++ {
2601 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2602 if err != nil {
2603 return err
2604 }
2605
2606 if !ok {
2607 // Field doesn't exist on this type, so ignore it
2608 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2609 return err
2610 }
2611 continue
2612 }
2613
2614 switch string(nameBuf[:nameLen]) {
2615 // t.Repo (string) (string)
2616 case "repo":
2617
2618 {
2619 b, err := cr.ReadByte()
2620 if err != nil {
2621 return err
2622 }
2623 if b != cbg.CborNull[0] {
2624 if err := cr.UnreadByte(); err != nil {
2625 return err
2626 }
2627
2628 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2629 if err != nil {
2630 return err
2631 }
2632
2633 t.Repo = (*string)(&sval)
2634 }
2635 }
2636 // t.Branch (string) (string)
2637 case "branch":
2638
2639 {
2640 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2641 if err != nil {
2642 return err
2643 }
2644
2645 t.Branch = string(sval)
2646 }
2647
2648 default:
2649 // Field doesn't exist on this type, so ignore it
2650 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2651 return err
2652 }
2653 }
2654 }
2655
2656 return nil
2657}
2658func (t *RepoPullStatus) MarshalCBOR(w io.Writer) error {
2659 if t == nil {
2660 _, err := w.Write(cbg.CborNull)
2661 return err
2662 }
2663
2664 cw := cbg.NewCborWriter(w)
2665 fieldCount := 3
2666
2667 if t.Status == nil {
2668 fieldCount--
2669 }
2670
2671 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2672 return err
2673 }
2674
2675 // t.Pull (string) (string)
2676 if len("pull") > 1000000 {
2677 return xerrors.Errorf("Value in field \"pull\" was too long")
2678 }
2679
2680 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
2681 return err
2682 }
2683 if _, err := cw.WriteString(string("pull")); err != nil {
2684 return err
2685 }
2686
2687 if len(t.Pull) > 1000000 {
2688 return xerrors.Errorf("Value in field t.Pull was too long")
2689 }
2690
2691 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
2692 return err
2693 }
2694 if _, err := cw.WriteString(string(t.Pull)); err != nil {
2695 return err
2696 }
2697
2698 // t.LexiconTypeID (string) (string)
2699 if len("$type") > 1000000 {
2700 return xerrors.Errorf("Value in field \"$type\" was too long")
2701 }
2702
2703 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2704 return err
2705 }
2706 if _, err := cw.WriteString(string("$type")); err != nil {
2707 return err
2708 }
2709
2710 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.status"))); err != nil {
2711 return err
2712 }
2713 if _, err := cw.WriteString(string("sh.tangled.repo.pull.status")); err != nil {
2714 return err
2715 }
2716
2717 // t.Status (string) (string)
2718 if t.Status != nil {
2719
2720 if len("status") > 1000000 {
2721 return xerrors.Errorf("Value in field \"status\" was too long")
2722 }
2723
2724 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
2725 return err
2726 }
2727 if _, err := cw.WriteString(string("status")); err != nil {
2728 return err
2729 }
2730
2731 if t.Status == nil {
2732 if _, err := cw.Write(cbg.CborNull); err != nil {
2733 return err
2734 }
2735 } else {
2736 if len(*t.Status) > 1000000 {
2737 return xerrors.Errorf("Value in field t.Status was too long")
2738 }
2739
2740 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil {
2741 return err
2742 }
2743 if _, err := cw.WriteString(string(*t.Status)); err != nil {
2744 return err
2745 }
2746 }
2747 }
2748 return nil
2749}
2750
2751func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) {
2752 *t = RepoPullStatus{}
2753
2754 cr := cbg.NewCborReader(r)
2755
2756 maj, extra, err := cr.ReadHeader()
2757 if err != nil {
2758 return err
2759 }
2760 defer func() {
2761 if err == io.EOF {
2762 err = io.ErrUnexpectedEOF
2763 }
2764 }()
2765
2766 if maj != cbg.MajMap {
2767 return fmt.Errorf("cbor input should be of type map")
2768 }
2769
2770 if extra > cbg.MaxLength {
2771 return fmt.Errorf("RepoPullStatus: map struct too large (%d)", extra)
2772 }
2773
2774 n := extra
2775
2776 nameBuf := make([]byte, 6)
2777 for i := uint64(0); i < n; i++ {
2778 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
2779 if err != nil {
2780 return err
2781 }
2782
2783 if !ok {
2784 // Field doesn't exist on this type, so ignore it
2785 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
2786 return err
2787 }
2788 continue
2789 }
2790
2791 switch string(nameBuf[:nameLen]) {
2792 // t.Pull (string) (string)
2793 case "pull":
2794
2795 {
2796 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2797 if err != nil {
2798 return err
2799 }
2800
2801 t.Pull = string(sval)
2802 }
2803 // t.LexiconTypeID (string) (string)
2804 case "$type":
2805
2806 {
2807 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2808 if err != nil {
2809 return err
2810 }
2811
2812 t.LexiconTypeID = string(sval)
2813 }
2814 // t.Status (string) (string)
2815 case "status":
2816
2817 {
2818 b, err := cr.ReadByte()
2819 if err != nil {
2820 return err
2821 }
2822 if b != cbg.CborNull[0] {
2823 if err := cr.UnreadByte(); err != nil {
2824 return err
2825 }
2826
2827 sval, err := cbg.ReadStringWithMax(cr, 1000000)
2828 if err != nil {
2829 return err
2830 }
2831
2832 t.Status = (*string)(&sval)
2833 }
2834 }
2835
2836 default:
2837 // Field doesn't exist on this type, so ignore it
2838 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
2839 return err
2840 }
2841 }
2842 }
2843
2844 return nil
2845}
2846func (t *RepoPullComment) MarshalCBOR(w io.Writer) error {
2847 if t == nil {
2848 _, err := w.Write(cbg.CborNull)
2849 return err
2850 }
2851
2852 cw := cbg.NewCborWriter(w)
2853 fieldCount := 7
2854
2855 if t.Body == nil {
2856 fieldCount--
2857 }
2858
2859 if t.CommentId == nil {
2860 fieldCount--
2861 }
2862
2863 if t.CreatedAt == nil {
2864 fieldCount--
2865 }
2866
2867 if t.Owner == nil {
2868 fieldCount--
2869 }
2870
2871 if t.Repo == nil {
2872 fieldCount--
2873 }
2874
2875 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
2876 return err
2877 }
2878
2879 // t.Body (string) (string)
2880 if t.Body != nil {
2881
2882 if len("body") > 1000000 {
2883 return xerrors.Errorf("Value in field \"body\" was too long")
2884 }
2885
2886 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
2887 return err
2888 }
2889 if _, err := cw.WriteString(string("body")); err != nil {
2890 return err
2891 }
2892
2893 if t.Body == nil {
2894 if _, err := cw.Write(cbg.CborNull); err != nil {
2895 return err
2896 }
2897 } else {
2898 if len(*t.Body) > 1000000 {
2899 return xerrors.Errorf("Value in field t.Body was too long")
2900 }
2901
2902 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
2903 return err
2904 }
2905 if _, err := cw.WriteString(string(*t.Body)); err != nil {
2906 return err
2907 }
2908 }
2909 }
2910
2911 // t.Pull (string) (string)
2912 if len("pull") > 1000000 {
2913 return xerrors.Errorf("Value in field \"pull\" was too long")
2914 }
2915
2916 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
2917 return err
2918 }
2919 if _, err := cw.WriteString(string("pull")); err != nil {
2920 return err
2921 }
2922
2923 if len(t.Pull) > 1000000 {
2924 return xerrors.Errorf("Value in field t.Pull was too long")
2925 }
2926
2927 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
2928 return err
2929 }
2930 if _, err := cw.WriteString(string(t.Pull)); err != nil {
2931 return err
2932 }
2933
2934 // t.Repo (string) (string)
2935 if t.Repo != nil {
2936
2937 if len("repo") > 1000000 {
2938 return xerrors.Errorf("Value in field \"repo\" was too long")
2939 }
2940
2941 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
2942 return err
2943 }
2944 if _, err := cw.WriteString(string("repo")); err != nil {
2945 return err
2946 }
2947
2948 if t.Repo == nil {
2949 if _, err := cw.Write(cbg.CborNull); err != nil {
2950 return err
2951 }
2952 } else {
2953 if len(*t.Repo) > 1000000 {
2954 return xerrors.Errorf("Value in field t.Repo was too long")
2955 }
2956
2957 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
2958 return err
2959 }
2960 if _, err := cw.WriteString(string(*t.Repo)); err != nil {
2961 return err
2962 }
2963 }
2964 }
2965
2966 // t.LexiconTypeID (string) (string)
2967 if len("$type") > 1000000 {
2968 return xerrors.Errorf("Value in field \"$type\" was too long")
2969 }
2970
2971 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
2972 return err
2973 }
2974 if _, err := cw.WriteString(string("$type")); err != nil {
2975 return err
2976 }
2977
2978 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil {
2979 return err
2980 }
2981 if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil {
2982 return err
2983 }
2984
2985 // t.Owner (string) (string)
2986 if t.Owner != nil {
2987
2988 if len("owner") > 1000000 {
2989 return xerrors.Errorf("Value in field \"owner\" was too long")
2990 }
2991
2992 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
2993 return err
2994 }
2995 if _, err := cw.WriteString(string("owner")); err != nil {
2996 return err
2997 }
2998
2999 if t.Owner == nil {
3000 if _, err := cw.Write(cbg.CborNull); err != nil {
3001 return err
3002 }
3003 } else {
3004 if len(*t.Owner) > 1000000 {
3005 return xerrors.Errorf("Value in field t.Owner was too long")
3006 }
3007
3008 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
3009 return err
3010 }
3011 if _, err := cw.WriteString(string(*t.Owner)); err != nil {
3012 return err
3013 }
3014 }
3015 }
3016
3017 // t.CommentId (int64) (int64)
3018 if t.CommentId != nil {
3019
3020 if len("commentId") > 1000000 {
3021 return xerrors.Errorf("Value in field \"commentId\" was too long")
3022 }
3023
3024 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
3025 return err
3026 }
3027 if _, err := cw.WriteString(string("commentId")); err != nil {
3028 return err
3029 }
3030
3031 if t.CommentId == nil {
3032 if _, err := cw.Write(cbg.CborNull); err != nil {
3033 return err
3034 }
3035 } else {
3036 if *t.CommentId >= 0 {
3037 if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
3038 return err
3039 }
3040 } else {
3041 if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
3042 return err
3043 }
3044 }
3045 }
3046
3047 }
3048
3049 // t.CreatedAt (string) (string)
3050 if t.CreatedAt != nil {
3051
3052 if len("createdAt") > 1000000 {
3053 return xerrors.Errorf("Value in field \"createdAt\" was too long")
3054 }
3055
3056 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
3057 return err
3058 }
3059 if _, err := cw.WriteString(string("createdAt")); err != nil {
3060 return err
3061 }
3062
3063 if t.CreatedAt == nil {
3064 if _, err := cw.Write(cbg.CborNull); err != nil {
3065 return err
3066 }
3067 } else {
3068 if len(*t.CreatedAt) > 1000000 {
3069 return xerrors.Errorf("Value in field t.CreatedAt was too long")
3070 }
3071
3072 if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil {
3073 return err
3074 }
3075 if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
3076 return err
3077 }
3078 }
3079 }
3080 return nil
3081}
3082
3083func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) {
3084 *t = RepoPullComment{}
3085
3086 cr := cbg.NewCborReader(r)
3087
3088 maj, extra, err := cr.ReadHeader()
3089 if err != nil {
3090 return err
3091 }
3092 defer func() {
3093 if err == io.EOF {
3094 err = io.ErrUnexpectedEOF
3095 }
3096 }()
3097
3098 if maj != cbg.MajMap {
3099 return fmt.Errorf("cbor input should be of type map")
3100 }
3101
3102 if extra > cbg.MaxLength {
3103 return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra)
3104 }
3105
3106 n := extra
3107
3108 nameBuf := make([]byte, 9)
3109 for i := uint64(0); i < n; i++ {
3110 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
3111 if err != nil {
3112 return err
3113 }
3114
3115 if !ok {
3116 // Field doesn't exist on this type, so ignore it
3117 if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
3118 return err
3119 }
3120 continue
3121 }
3122
3123 switch string(nameBuf[:nameLen]) {
3124 // t.Body (string) (string)
3125 case "body":
3126
3127 {
3128 b, err := cr.ReadByte()
3129 if err != nil {
3130 return err
3131 }
3132 if b != cbg.CborNull[0] {
3133 if err := cr.UnreadByte(); err != nil {
3134 return err
3135 }
3136
3137 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3138 if err != nil {
3139 return err
3140 }
3141
3142 t.Body = (*string)(&sval)
3143 }
3144 }
3145 // t.Pull (string) (string)
3146 case "pull":
3147
3148 {
3149 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3150 if err != nil {
3151 return err
3152 }
3153
3154 t.Pull = string(sval)
3155 }
3156 // t.Repo (string) (string)
3157 case "repo":
3158
3159 {
3160 b, err := cr.ReadByte()
3161 if err != nil {
3162 return err
3163 }
3164 if b != cbg.CborNull[0] {
3165 if err := cr.UnreadByte(); err != nil {
3166 return err
3167 }
3168
3169 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3170 if err != nil {
3171 return err
3172 }
3173
3174 t.Repo = (*string)(&sval)
3175 }
3176 }
3177 // t.LexiconTypeID (string) (string)
3178 case "$type":
3179
3180 {
3181 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3182 if err != nil {
3183 return err
3184 }
3185
3186 t.LexiconTypeID = string(sval)
3187 }
3188 // t.Owner (string) (string)
3189 case "owner":
3190
3191 {
3192 b, err := cr.ReadByte()
3193 if err != nil {
3194 return err
3195 }
3196 if b != cbg.CborNull[0] {
3197 if err := cr.UnreadByte(); err != nil {
3198 return err
3199 }
3200
3201 sval, err := cbg.ReadStringWithMax(cr, 1000000)
3202 if err != nil {
3203 return err
3204 }
3205
3206 t.Owner = (*string)(&sval)
3207 }
3208 }
3209 // t.CommentId (int64) (int64)
3210 case "commentId":
3211 {
3212
3213 b, err := cr.ReadByte()
3214 if err != nil {
3215 return err
3216 }
3217 if b != cbg.CborNull[0] {
3218 if err := cr.UnreadByte(); err != nil {
3219 return err
3220 }
3221 maj, extra, err := cr.ReadHeader()
3222 if err != nil {
3223 return err
3224 }
3225 var extraI int64
3226 switch maj {
3227 case cbg.MajUnsignedInt:
3228 extraI = int64(extra)
3229 if extraI < 0 {
3230 return fmt.Errorf("int64 positive overflow")
3231 }
3232 case cbg.MajNegativeInt:
3233 extraI = int64(extra)
3234 if extraI < 0 {
3235 return fmt.Errorf("int64 negative overflow")
3236 }
3237 extraI = -1 - extraI
3238 default:
3239 return fmt.Errorf("wrong type for int64 field: %d", maj)
3240 }
3241
3242 t.CommentId = (*int64)(&extraI)
3243 }
3244 }
3245 // t.CreatedAt (string) (string)
3246 case "createdAt":
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.CreatedAt = (*string)(&sval)
3264 }
3265 }
3266
3267 default:
3268 // Field doesn't exist on this type, so ignore it
3269 if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
3270 return err
3271 }
3272 }
3273 }
3274
3275 return nil
3276}