// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.multistream.target package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.multistream.target", &MultistreamTarget{}) } // An external server for rebroadcasting a Streamplace stream type MultistreamTarget struct { LexiconTypeID string `json:"$type,omitempty"` // active: Whether this target is currently active. Active bool `json:"active"` // createdAt: When this target was created. CreatedAt string `json:"createdAt"` // name: A user-friendly name for this target. Name *string `json:"name,omitempty"` // url: The rtmp:// or rtmps:// url of the target server. Url string `json:"url"` } // RecordTypeID implements glex.Record. func (t *MultistreamTarget) RecordTypeID() string { return "place.stream.multistream.target" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // MultistreamTarget and *MultistreamTarget marshal with $type. func (t MultistreamTarget) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.multistream.target" type alias MultistreamTarget return json.Marshal((alias)(t)) } func (t *MultistreamTarget) 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.multistream.target" return glex.MarshalCBOR(w, &cp) } func (t *MultistreamTarget) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }