// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.permission package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.moderation.permission", &ModerationPermission{}) } // Record granting moderation permissions to a user for this streamer's content. type ModerationPermission struct { LexiconTypeID string `json:"$type,omitempty"` // createdAt: Client-declared timestamp when this moderator was added. CreatedAt string `json:"createdAt"` // expirationTime: Optional expiration time for this delegation. If set, the delegation is invalid after this time. ExpirationTime *string `json:"expirationTime,omitempty"` // moderator: The DID of the user granted moderator permissions. Moderator string `json:"moderator"` // permissions: Array of permissions granted to this moderator. 'ban' covers blocks/bans (with optional expiration), 'hide' covers message gates, 'livestream.manage' allows updating livestream metadata. Permissions []string `json:"permissions"` } // RecordTypeID implements glex.Record. func (t *ModerationPermission) RecordTypeID() string { return "place.stream.moderation.permission" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // ModerationPermission and *ModerationPermission marshal with $type. func (t ModerationPermission) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.moderation.permission" type alias ModerationPermission return json.Marshal((alias)(t)) } func (t *ModerationPermission) 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 = "place.stream.moderation.permission" return glex.MarshalCBOR(w, &cp) } func (t *ModerationPermission) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }