// Code generated by glex; DO NOT EDIT. // Lexicon schema: app.bsky.graph.block package appbsky import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("app.bsky.graph.block", &GraphBlock{}) } // Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. type GraphBlock struct { LexiconTypeID string `json:"$type,omitempty"` CreatedAt string `json:"createdAt"` // subject: DID of the account to be blocked. Subject string `json:"subject"` } // RecordTypeID implements glex.Record. func (t *GraphBlock) RecordTypeID() string { return "app.bsky.graph.block" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // GraphBlock and *GraphBlock marshal with $type. func (t GraphBlock) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "app.bsky.graph.block" type alias GraphBlock return json.Marshal((alias)(t)) } func (t *GraphBlock) 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.block" return glex.MarshalCBOR(w, &cp) } func (t *GraphBlock) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }