// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT. package org_tangled import ( "fmt" "io" "math" "sort" cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) var _ = xerrors.Errorf var _ = cid.Undef var _ = math.E var _ = sort.Sort func (t *CiSubscribePipelineLogs_Control) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) fieldCount := 7 if t.Command == nil { fieldCount-- } if t.Kind == nil { fieldCount-- } if t.Status == nil { fieldCount-- } if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } // t.Kind (string) (string) if t.Kind != nil { if len("kind") > 1000000 { return xerrors.Errorf("Value in field \"kind\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("kind"))); err != nil { return err } if _, err := cw.WriteString(string("kind")); err != nil { return err } if t.Kind == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { if len(*t.Kind) > 1000000 { return xerrors.Errorf("Value in field t.Kind was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Kind))); err != nil { return err } if _, err := cw.WriteString(string(*t.Kind)); err != nil { return err } } } // t.Step (int64) (int64) if len("step") > 1000000 { return xerrors.Errorf("Value in field \"step\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { return err } if _, err := cw.WriteString(string("step")); err != nil { return err } if t.Step >= 0 { if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { return err } } else { if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { return err } } // t.Time (string) (string) if len("time") > 1000000 { return xerrors.Errorf("Value in field \"time\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { return err } if _, err := cw.WriteString(string("time")); err != nil { return err } if len(t.Time) > 1000000 { return xerrors.Errorf("Value in field t.Time was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { return err } if _, err := cw.WriteString(string(t.Time)); err != nil { return err } // t.Status (string) (string) if t.Status != nil { if len("status") > 1000000 { return xerrors.Errorf("Value in field \"status\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { return err } if _, err := cw.WriteString(string("status")); err != nil { return err } if t.Status == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { if len(*t.Status) > 1000000 { return xerrors.Errorf("Value in field t.Status was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { return err } if _, err := cw.WriteString(string(*t.Status)); err != nil { return err } } } // t.Command (string) (string) if t.Command != nil { if len("command") > 1000000 { return xerrors.Errorf("Value in field \"command\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("command"))); err != nil { return err } if _, err := cw.WriteString(string("command")); err != nil { return err } if t.Command == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { if len(*t.Command) > 1000000 { return xerrors.Errorf("Value in field t.Command was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Command))); err != nil { return err } if _, err := cw.WriteString(string(*t.Command)); err != nil { return err } } } // t.Content (string) (string) if len("content") > 1000000 { return xerrors.Errorf("Value in field \"content\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { return err } if _, err := cw.WriteString(string("content")); err != nil { return err } if len(t.Content) > 1000000 { return xerrors.Errorf("Value in field t.Content was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { return err } if _, err := cw.WriteString(string(t.Content)); err != nil { return err } // t.Workflow (string) (string) if len("workflow") > 1000000 { return xerrors.Errorf("Value in field \"workflow\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { return err } if _, err := cw.WriteString(string("workflow")); err != nil { return err } if len(t.Workflow) > 1000000 { return xerrors.Errorf("Value in field t.Workflow was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { return err } if _, err := cw.WriteString(string(t.Workflow)); err != nil { return err } return nil } func (t *CiSubscribePipelineLogs_Control) UnmarshalCBOR(r io.Reader) (err error) { *t = CiSubscribePipelineLogs_Control{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("CiSubscribePipelineLogs_Control: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 8) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Kind (string) (string) case "kind": { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Kind = (*string)(&sval) } } // t.Step (int64) (int64) case "step": { maj, extra, err := cr.ReadHeader() if err != nil { return err } var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) if extraI < 0 { return fmt.Errorf("int64 positive overflow") } case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } t.Step = int64(extraI) } // t.Time (string) (string) case "time": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Time = string(sval) } // t.Status (string) (string) case "status": { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Status = (*string)(&sval) } } // t.Command (string) (string) case "command": { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Command = (*string)(&sval) } } // t.Content (string) (string) case "content": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Content = string(sval) } // t.Workflow (string) (string) case "workflow": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Workflow = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *CiSubscribePipelineLogs_Data) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{165}); err != nil { return err } // t.Step (int64) (int64) if len("step") > 1000000 { return xerrors.Errorf("Value in field \"step\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { return err } if _, err := cw.WriteString(string("step")); err != nil { return err } if t.Step >= 0 { if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { return err } } else { if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { return err } } // t.Time (string) (string) if len("time") > 1000000 { return xerrors.Errorf("Value in field \"time\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { return err } if _, err := cw.WriteString(string("time")); err != nil { return err } if len(t.Time) > 1000000 { return xerrors.Errorf("Value in field t.Time was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { return err } if _, err := cw.WriteString(string(t.Time)); err != nil { return err } // t.Stream (string) (string) if len("stream") > 1000000 { return xerrors.Errorf("Value in field \"stream\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("stream"))); err != nil { return err } if _, err := cw.WriteString(string("stream")); err != nil { return err } if len(t.Stream) > 1000000 { return xerrors.Errorf("Value in field t.Stream was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Stream))); err != nil { return err } if _, err := cw.WriteString(string(t.Stream)); err != nil { return err } // t.Content (string) (string) if len("content") > 1000000 { return xerrors.Errorf("Value in field \"content\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { return err } if _, err := cw.WriteString(string("content")); err != nil { return err } if len(t.Content) > 1000000 { return xerrors.Errorf("Value in field t.Content was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { return err } if _, err := cw.WriteString(string(t.Content)); err != nil { return err } // t.Workflow (string) (string) if len("workflow") > 1000000 { return xerrors.Errorf("Value in field \"workflow\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { return err } if _, err := cw.WriteString(string("workflow")); err != nil { return err } if len(t.Workflow) > 1000000 { return xerrors.Errorf("Value in field t.Workflow was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { return err } if _, err := cw.WriteString(string(t.Workflow)); err != nil { return err } return nil } func (t *CiSubscribePipelineLogs_Data) UnmarshalCBOR(r io.Reader) (err error) { *t = CiSubscribePipelineLogs_Data{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("CiSubscribePipelineLogs_Data: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 8) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Step (int64) (int64) case "step": { maj, extra, err := cr.ReadHeader() if err != nil { return err } var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) if extraI < 0 { return fmt.Errorf("int64 positive overflow") } case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } t.Step = int64(extraI) } // t.Time (string) (string) case "time": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Time = string(sval) } // t.Stream (string) (string) case "stream": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Stream = string(sval) } // t.Content (string) (string) case "content": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Content = string(sval) } // t.Workflow (string) (string) case "workflow": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Workflow = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *CiTriggerManual) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) fieldCount := 5 if t.Inputs == nil { fieldCount-- } if t.Ref == nil { fieldCount-- } if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } // t.Ref (string) (string) if t.Ref != nil { if len("ref") > 1000000 { return xerrors.Errorf("Value in field \"ref\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { return err } if _, err := cw.WriteString(string("ref")); err != nil { return err } if t.Ref == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { if len(*t.Ref) > 1000000 { return xerrors.Errorf("Value in field t.Ref was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Ref))); err != nil { return err } if _, err := cw.WriteString(string(*t.Ref)); err != nil { return err } } } // t.Repo (string) (string) if len("repo") > 1000000 { return xerrors.Errorf("Value in field \"repo\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { return err } if _, err := cw.WriteString(string("repo")); err != nil { return err } if len(t.Repo) > 1000000 { return xerrors.Errorf("Value in field t.Repo was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { return err } if _, err := cw.WriteString(string(t.Repo)); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.ci.trigger.manual"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.ci.trigger.manual")); err != nil { return err } // t.Commit (string) (string) if len("commit") > 1000000 { return xerrors.Errorf("Value in field \"commit\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commit"))); err != nil { return err } if _, err := cw.WriteString(string("commit")); err != nil { return err } if len(t.Commit) > 1000000 { return xerrors.Errorf("Value in field t.Commit was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Commit))); err != nil { return err } if _, err := cw.WriteString(string(t.Commit)); err != nil { return err } // t.Inputs ([]*org_tangled.CiTriggerManual_Pair) (slice) if t.Inputs != nil { if len("inputs") > 1000000 { return xerrors.Errorf("Value in field \"inputs\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil { return err } if _, err := cw.WriteString(string("inputs")); err != nil { return err } if len(t.Inputs) > 8192 { return xerrors.Errorf("Slice value in field t.Inputs was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil { return err } for _, v := range t.Inputs { if err := v.MarshalCBOR(cw); err != nil { return err } } } return nil } func (t *CiTriggerManual) UnmarshalCBOR(r io.Reader) (err error) { *t = CiTriggerManual{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("CiTriggerManual: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 6) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Ref (string) (string) case "ref": { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Ref = (*string)(&sval) } } // t.Repo (string) (string) case "repo": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Repo = string(sval) } // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } // t.Commit (string) (string) case "commit": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Commit = string(sval) } // t.Inputs ([]*org_tangled.CiTriggerManual_Pair) (slice) case "inputs": maj, extra, err = cr.ReadHeader() if err != nil { return err } if extra > 8192 { return fmt.Errorf("t.Inputs: array too large (%d)", extra) } if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } if extra > 0 { t.Inputs = make([]*CiTriggerManual_Pair, extra) } for i := 0; i < int(extra); i++ { { var maj byte var extra uint64 var err error _ = maj _ = extra _ = err { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } t.Inputs[i] = new(CiTriggerManual_Pair) if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil { return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err) } } } } } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *CiTriggerManual_Pair) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{162}); err != nil { return err } // t.Key (string) (string) if len("key") > 1000000 { return xerrors.Errorf("Value in field \"key\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { return err } if _, err := cw.WriteString(string("key")); err != nil { return err } if len(t.Key) > 1000000 { return xerrors.Errorf("Value in field t.Key was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil { return err } if _, err := cw.WriteString(string(t.Key)); err != nil { return err } // t.Value (string) (string) if len("value") > 1000000 { return xerrors.Errorf("Value in field \"value\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { return err } if _, err := cw.WriteString(string("value")); err != nil { return err } if len(t.Value) > 1000000 { return xerrors.Errorf("Value in field t.Value was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { return err } if _, err := cw.WriteString(string(t.Value)); err != nil { return err } return nil } func (t *CiTriggerManual_Pair) UnmarshalCBOR(r io.Reader) (err error) { *t = CiTriggerManual_Pair{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("CiTriggerManual_Pair: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Key (string) (string) case "key": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Key = string(sval) } // t.Value (string) (string) case "value": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Value = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *EventPullRequest) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{161}); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.event.pullRequest"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.event.pullRequest")); err != nil { return err } return nil } func (t *EventPullRequest) UnmarshalCBOR(r io.Reader) (err error) { *t = EventPullRequest{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("EventPullRequest: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *EventPush) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{161}); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.event.push"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.event.push")); err != nil { return err } return nil } func (t *EventPush) UnmarshalCBOR(r io.Reader) (err error) { *t = EventPush{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("EventPush: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *FeedSubscription) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{163}); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.feed.subscription"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.feed.subscription")); err != nil { return err } // t.Subject (org_tangled.FeedSubscription_Subject) (struct) if len("subject") > 1000000 { return xerrors.Errorf("Value in field \"subject\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { return err } if _, err := cw.WriteString(string("subject")); err != nil { return err } if err := t.Subject.MarshalCBOR(cw); err != nil { return err } // t.CreatedAt (string) (string) if len("createdAt") > 1000000 { return xerrors.Errorf("Value in field \"createdAt\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { return err } if _, err := cw.WriteString(string("createdAt")); err != nil { return err } if len(t.CreatedAt) > 1000000 { return xerrors.Errorf("Value in field t.CreatedAt was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { return err } if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } return nil } func (t *FeedSubscription) UnmarshalCBOR(r io.Reader) (err error) { *t = FeedSubscription{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("FeedSubscription: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 9) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } // t.Subject (org_tangled.FeedSubscription_Subject) (struct) case "subject": { b, err := cr.ReadByte() if err != nil { return err } if b != cbg.CborNull[0] { if err := cr.UnreadByte(); err != nil { return err } t.Subject = new(FeedSubscription_Subject) if err := t.Subject.UnmarshalCBOR(cr); err != nil { return xerrors.Errorf("unmarshaling t.Subject pointer: %w", err) } } } // t.CreatedAt (string) (string) case "createdAt": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.CreatedAt = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *FeedSubscription_Record) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{162}); err != nil { return err } // t.Uri (string) (string) if len("uri") > 1000000 { return xerrors.Errorf("Value in field \"uri\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("uri"))); err != nil { return err } if _, err := cw.WriteString(string("uri")); err != nil { return err } if len(t.Uri) > 1000000 { return xerrors.Errorf("Value in field t.Uri was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil { return err } if _, err := cw.WriteString(string(t.Uri)); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.feed.subscription#record"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.feed.subscription#record")); err != nil { return err } return nil } func (t *FeedSubscription_Record) UnmarshalCBOR(r io.Reader) (err error) { *t = FeedSubscription_Record{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("FeedSubscription_Record: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Uri (string) (string) case "uri": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Uri = string(sval) } // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil } func (t *FeedSubscription_Repo) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) if _, err := cw.Write([]byte{162}); err != nil { return err } // t.Did (string) (string) if len("did") > 1000000 { return xerrors.Errorf("Value in field \"did\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil { return err } if _, err := cw.WriteString(string("did")); err != nil { return err } if len(t.Did) > 1000000 { return xerrors.Errorf("Value in field t.Did was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil { return err } if _, err := cw.WriteString(string(t.Did)); err != nil { return err } // t.LexiconTypeID (string) (string) if len("$type") > 1000000 { return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } if _, err := cw.WriteString(string("$type")); err != nil { return err } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("org.tangled.feed.subscription#repo"))); err != nil { return err } if _, err := cw.WriteString(string("org.tangled.feed.subscription#repo")); err != nil { return err } return nil } func (t *FeedSubscription_Repo) UnmarshalCBOR(r io.Reader) (err error) { *t = FeedSubscription_Repo{} cr := cbg.NewCborReader(r) maj, extra, err := cr.ReadHeader() if err != nil { return err } defer func() { if err == io.EOF { err = io.ErrUnexpectedEOF } }() if maj != cbg.MajMap { return fmt.Errorf("cbor input should be of type map") } if extra > cbg.MaxLength { return fmt.Errorf("FeedSubscription_Repo: map struct too large (%d)", extra) } n := extra nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { return err } if !ok { // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } continue } switch string(nameBuf[:nameLen]) { // t.Did (string) (string) case "did": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.Did = string(sval) } // t.LexiconTypeID (string) (string) case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } t.LexiconTypeID = string(sval) } default: // Field doesn't exist on this type, so ignore it if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { return err } } } return nil }