// Code generated by glex; DO NOT EDIT. // Lexicon schema: com.atproto.repo.strongRef package comatproto import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("com.atproto.repo.strongRef#main", &RepoStrongRef{}) } type RepoStrongRef struct { LexiconTypeID string `json:"$type,omitempty"` Cid string `json:"cid"` Uri string `json:"uri"` } // RecordTypeID implements glex.Record. func (t *RepoStrongRef) RecordTypeID() string { return "com.atproto.repo.strongRef" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // RepoStrongRef and *RepoStrongRef marshal with $type. func (t RepoStrongRef) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "com.atproto.repo.strongRef" type alias RepoStrongRef return json.Marshal((alias)(t)) } func (t *RepoStrongRef) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "com.atproto.repo.strongRef" return glex.MarshalCBOR(w, &cp) } func (t *RepoStrongRef) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }