// Code generated by glex; DO NOT EDIT. // Lexicon schema: app.bsky.graph.follow package appbsky import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { glex.RegisterType("app.bsky.graph.follow", &GraphFollow{}) } // Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. type GraphFollow struct { LexiconTypeID string `json:"$type,omitempty"` CreatedAt string `json:"createdAt"` Subject string `json:"subject"` Via *comatproto.RepoStrongRef `json:"via,omitempty"` } // RecordTypeID implements glex.Record. func (t *GraphFollow) RecordTypeID() string { return "app.bsky.graph.follow" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // GraphFollow and *GraphFollow marshal with $type. func (t GraphFollow) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "app.bsky.graph.follow" type alias GraphFollow return json.Marshal((alias)(t)) } func (t *GraphFollow) 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 = "app.bsky.graph.follow" return glex.MarshalCBOR(w, &cp) } func (t *GraphFollow) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }