// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.broadcast.origin package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.broadcast.origin", &BroadcastOrigin{}) } // Record indicating a livestream is published and available for replication at a given address. By convention, the record key is streamer::server type BroadcastOrigin struct { LexiconTypeID string `json:"$type,omitempty"` // broadcaster: did of the broadcaster that operates the server syndicating the livestream Broadcaster *string `json:"broadcaster,omitempty"` // irohTicket: Iroh ticket that can be used to access the livestream from the server IrohTicket *string `json:"irohTicket,omitempty"` // server: did of the server that's currently rebroadcasting the livestream Server string `json:"server"` // streamer: DID of the streamer whose livestream is being published Streamer string `json:"streamer"` // updatedAt: Periodically updated timestamp when this origin last saw a livestream UpdatedAt string `json:"updatedAt"` // websocketURL: URL of the websocket endpoint for the livestream WebsocketURL *string `json:"websocketURL,omitempty"` } // RecordTypeID implements glex.Record. func (t *BroadcastOrigin) RecordTypeID() string { return "place.stream.broadcast.origin" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // BroadcastOrigin and *BroadcastOrigin marshal with $type. func (t BroadcastOrigin) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.broadcast.origin" type alias BroadcastOrigin return json.Marshal((alias)(t)) } func (t *BroadcastOrigin) 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.broadcast.origin" return glex.MarshalCBOR(w, &cp) } func (t *BroadcastOrigin) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }