// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.teleport package placestream 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("place.stream.live.teleport", &LiveTeleport{}) } // Record defining a 'teleport', that is active during a certain time. type LiveTeleport struct { LexiconTypeID string `json:"$type,omitempty"` // durationSeconds: The time limit in seconds for the teleport. If not set, the teleport is permanent. Must be at least 60 seconds, and no more than 32,400 seconds (9 hours). DurationSeconds *int64 `json:"durationSeconds,omitempty"` // livestream: The source livestream this teleport is sending viewers away from. When the teleport fires, this is the livestream that gets ended (the same update place.stream.live.stopLivestream performs), so the source streamer returns to pre-live. Teleports without an origin livestream are treated as a no-op. Livestream *comatproto.RepoStrongRef `json:"livestream,omitempty"` // startsAt: The time the teleport becomes active. StartsAt string `json:"startsAt"` // streamer: The DID of the streamer to teleport to. Streamer string `json:"streamer"` } // RecordTypeID implements glex.Record. func (t *LiveTeleport) RecordTypeID() string { return "place.stream.live.teleport" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // LiveTeleport and *LiveTeleport marshal with $type. func (t LiveTeleport) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.live.teleport" type alias LiveTeleport return json.Marshal((alias)(t)) } func (t *LiveTeleport) 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.live.teleport" return glex.MarshalCBOR(w, &cp) } func (t *LiveTeleport) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }