// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package bsky // schema: app.bsky.feed.postgate import ( "bytes" "encoding/json" "fmt" "io" "github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { util.RegisterType("app.bsky.feed.postgate", &FeedPostgate{}) } // // RECORDTYPE: FeedPostgate type FeedPostgate struct { LexiconTypeID string `json:"$type,const=app.bsky.feed.postgate" cborgen:"$type,const=app.bsky.feed.postgate"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` // detachedEmbeddingUris: List of AT-URIs embedding this post that the author has detached from. DetachedEmbeddingUris []string `json:"detachedEmbeddingUris,omitempty" cborgen:"detachedEmbeddingUris,omitempty"` // embeddingRules: List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed. EmbeddingRules []*FeedPostgate_EmbeddingRules_Elem `json:"embeddingRules,omitempty" cborgen:"embeddingRules,omitempty"` // post: Reference (AT-URI) to the post record. Post string `json:"post" cborgen:"post"` } // FeedPostgate_DisableRule is a "disableRule" in the app.bsky.feed.postgate schema. // // Disables embedding of this post. // // RECORDTYPE: FeedPostgate_DisableRule type FeedPostgate_DisableRule struct { LexiconTypeID string `json:"$type,const=app.bsky.feed.postgate#disableRule" cborgen:"$type,const=app.bsky.feed.postgate#disableRule"` } type FeedPostgate_EmbeddingRules_Elem struct { FeedPostgate_DisableRule *FeedPostgate_DisableRule } func (t *FeedPostgate_EmbeddingRules_Elem) MarshalJSON() ([]byte, error) { if t.FeedPostgate_DisableRule != nil { t.FeedPostgate_DisableRule.LexiconTypeID = "app.bsky.feed.postgate#disableRule" return json.Marshal(t.FeedPostgate_DisableRule) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *FeedPostgate_EmbeddingRules_Elem) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "app.bsky.feed.postgate#disableRule": t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) return json.Unmarshal(b, t.FeedPostgate_DisableRule) default: return nil } } func (t *FeedPostgate_EmbeddingRules_Elem) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.FeedPostgate_DisableRule != nil { return t.FeedPostgate_DisableRule.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum") } func (t *FeedPostgate_EmbeddingRules_Elem) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "app.bsky.feed.postgate#disableRule": t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) return t.FeedPostgate_DisableRule.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } }