Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
21 kB · 557 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.livestream
package placestream
import ( "encoding/json" "fmt" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" appbsky "stream.place/streamplace/pkg/appbsky" comatproto "stream.place/streamplace/pkg/comatproto")
func init() { glex.RegisterType("place.stream.livestream", &Livestream{})}
// Record announcing a livestream is happeningtype Livestream struct { LexiconTypeID string `json:"$type,omitempty"` // activity: The game or activity being streamed. Activity *Livestream_Activity `json:"activity,omitempty"` // agent: The source of the livestream, if available, in a User Agent format: `<product> / <product-version> <comment>` e.g. Streamplace/0.7.5 iOS Agent *string `json:"agent,omitempty"` // canonicalUrl: The primary URL where this livestream can be viewed, if available. CanonicalUrl *string `json:"canonicalUrl,omitempty"` // createdAt: Client-declared timestamp when this livestream started. CreatedAt string `json:"createdAt"` // endedAt: Client-declared timestamp when this livestream ended. Ended livestreams are not supposed to start up again. EndedAt *string `json:"endedAt,omitempty"` // idleTimeoutSeconds: Time in seconds after which this livestream should be automatically ended if idle. Zero means no timeout. IdleTimeoutSeconds *int64 `json:"idleTimeoutSeconds,omitempty"` // lastSeenAt: Client-declared timestamp when this livestream was last seen by the Streamplace station. LastSeenAt *string `json:"lastSeenAt,omitempty"` NotificationSettings *Livestream_NotificationSettings `json:"notificationSettings,omitempty"` // post: The post that announced this livestream. Post *comatproto.RepoStrongRef `json:"post,omitempty"` // tags: Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language). Tags []string `json:"tags,omitempty"` Thumb *glex.Blob `json:"thumb,omitempty"` // title: The title of the livestream, as it will be announced to followers. Title string `json:"title"` // url: The URL where this stream can be found. This is primarily a hint for other Streamplace nodes to locate and replicate the stream. Url *string `json:"url,omitempty"`}
// RecordTypeID implements glex.Record.func (t *Livestream) RecordTypeID() string { return "place.stream.livestream" }
// MarshalJSON stamps the $type field, like MarshalCBOR does. The value// receiver operates on a copy, so the record is never mutated and both// Livestream and *Livestream marshal with $type.func (t Livestream) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.livestream" type alias Livestream return json.Marshal((alias)(t))}
func (t *Livestream) 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.livestream" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// The game or activity being streamed.type Livestream_Activity struct { Defs_ActivityGame *Defs_ActivityGame Defs_ActivityLabel *Defs_ActivityLabel // Raw preserves a variant whose $type is not in this union's generated // set, so unrecognized variants still round-trip losslessly through // decode/re-encode. Nil when a known variant is set. Raw *glex.RawRecord}
// MarshalJSON emits the set variant, stamped with its $type, per the atproto// union wire format. The value receiver stamps a copy, so the variant is// never mutated and both Livestream_Activity and *Livestream_Activity marshal correctly.func (t Livestream_Activity) MarshalJSON() ([]byte, error) { if t.Defs_ActivityGame != nil { cp := *t.Defs_ActivityGame cp.LexiconTypeID = "place.stream.defs#activityGame" return json.Marshal(&cp) } if t.Defs_ActivityLabel != nil { cp := *t.Defs_ActivityLabel cp.LexiconTypeID = "place.stream.defs#activityLabel" return json.Marshal(&cp) } if t.Raw != nil { if t.Raw.Encoding != "json" { return nil, fmt.Errorf("cannot marshal raw %s record as JSON in union Livestream_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union Livestream_Activity as JSON")}
func (t *Livestream_Activity) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.defs#activityGame": t.Defs_ActivityGame = new(Defs_ActivityGame) return json.Unmarshal(b, t.Defs_ActivityGame) case "place.stream.defs#activityLabel": t.Defs_ActivityLabel = new(Defs_ActivityLabel) return json.Unmarshal(b, t.Defs_ActivityLabel) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "json", Bytes: append([]byte(nil), b...)} return nil }}
// MarshalCBOR implements drisl.Marshaler, emitting the set variant (stamped// with its $type) per the atproto union wire format. go-dasl invokes this// when the union appears inside another record, so nested unions serialize// correctly.func (t Livestream_Activity) MarshalCBOR() ([]byte, error) { if t.Defs_ActivityGame != nil { cp := *t.Defs_ActivityGame cp.LexiconTypeID = "place.stream.defs#activityGame" return glex.MarshalCBORBytes(&cp) } if t.Defs_ActivityLabel != nil { cp := *t.Defs_ActivityLabel cp.LexiconTypeID = "place.stream.defs#activityLabel" return glex.MarshalCBORBytes(&cp) } if t.Raw != nil { if t.Raw.Encoding != "cbor" { return nil, fmt.Errorf("cannot marshal raw %s record as CBOR in union Livestream_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union Livestream_Activity as CBOR")}
func (t *Livestream_Activity) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.defs#activityGame": t.Defs_ActivityGame = new(Defs_ActivityGame) return glex.UnmarshalCBORBytes(b, t.Defs_ActivityGame) case "place.stream.defs#activityLabel": t.Defs_ActivityLabel = new(Defs_ActivityLabel) return glex.UnmarshalCBORBytes(b, t.Defs_ActivityLabel) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}
// Livestream_LivestreamView is a "livestreamView" in the place.stream.livestream schema.type Livestream_LivestreamView struct { LexiconTypeID string `json:"$type,omitempty"` Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` Cid string `json:"cid"` IndexedAt string `json:"indexedAt"` Record *glex.LexiconTypeDecoder `json:"record"` Uri string `json:"uri"` // viewerCount: The number of viewers watching this livestream. Use when you can't reasonably use #viewerCount directly. ViewerCount *Livestream_ViewerCount `json:"viewerCount,omitempty"`}
// RecordTypeID implements glex.Record.func (t *Livestream_LivestreamView) RecordTypeID() string { return "place.stream.livestream#livestreamView"}
func (t *Livestream_LivestreamView) 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.livestream#livestreamView" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_LivestreamView) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// Livestream_NotificationSettings is a "notificationSettings" in the place.stream.livestream schema.type Livestream_NotificationSettings struct { LexiconTypeID string `json:"$type,omitempty"` // pushNotification: Whether this livestream should trigger a push notification to followers. PushNotification *bool `json:"pushNotification,omitempty"`}
// RecordTypeID implements glex.Record.func (t *Livestream_NotificationSettings) RecordTypeID() string { return "place.stream.livestream#notificationSettings"}
func (t *Livestream_NotificationSettings) 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.livestream#notificationSettings" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_NotificationSettings) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// Livestream_StreamplaceAnything is a "streamplaceAnything" in the place.stream.livestream schema.type Livestream_StreamplaceAnything struct { LexiconTypeID string `json:"$type,omitempty"` Livestream Livestream_StreamplaceAnything_Livestream `json:"livestream"`}
// RecordTypeID implements glex.Record.func (t *Livestream_StreamplaceAnything) RecordTypeID() string { return "place.stream.livestream#streamplaceAnything"}
func (t *Livestream_StreamplaceAnything) 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.livestream#streamplaceAnything" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_StreamplaceAnything) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type Livestream_StreamplaceAnything_Livestream struct { ChatDefs_MessageView *ChatDefs_MessageView ChatDefs_PinnedRecordView *ChatDefs_PinnedRecordView Defs_BlockView *Defs_BlockView Defs_Rendition *Defs_Rendition Defs_Renditions *Defs_Renditions Livestream_LivestreamView *Livestream_LivestreamView Livestream_TeleportArrival *Livestream_TeleportArrival Livestream_TeleportCanceled *Livestream_TeleportCanceled Livestream_ViewerCount *Livestream_ViewerCount // Raw preserves a variant whose $type is not in this union's generated // set, so unrecognized variants still round-trip losslessly through // decode/re-encode. Nil when a known variant is set. Raw *glex.RawRecord}
// MarshalJSON emits the set variant, stamped with its $type, per the atproto// union wire format. The value receiver stamps a copy, so the variant is// never mutated and both Livestream_StreamplaceAnything_Livestream and *Livestream_StreamplaceAnything_Livestream marshal correctly.func (t Livestream_StreamplaceAnything_Livestream) MarshalJSON() ([]byte, error) { if t.ChatDefs_MessageView != nil { cp := *t.ChatDefs_MessageView cp.LexiconTypeID = "place.stream.chat.defs#messageView" return json.Marshal(&cp) } if t.ChatDefs_PinnedRecordView != nil { cp := *t.ChatDefs_PinnedRecordView cp.LexiconTypeID = "place.stream.chat.defs#pinnedRecordView" return json.Marshal(&cp) } if t.Defs_BlockView != nil { cp := *t.Defs_BlockView cp.LexiconTypeID = "place.stream.defs#blockView" return json.Marshal(&cp) } if t.Defs_Rendition != nil { cp := *t.Defs_Rendition cp.LexiconTypeID = "place.stream.defs#rendition" return json.Marshal(&cp) } if t.Defs_Renditions != nil { cp := *t.Defs_Renditions cp.LexiconTypeID = "place.stream.defs#renditions" return json.Marshal(&cp) } if t.Livestream_LivestreamView != nil { cp := *t.Livestream_LivestreamView cp.LexiconTypeID = "place.stream.livestream#livestreamView" return json.Marshal(&cp) } if t.Livestream_TeleportArrival != nil { cp := *t.Livestream_TeleportArrival cp.LexiconTypeID = "place.stream.livestream#teleportArrival" return json.Marshal(&cp) } if t.Livestream_TeleportCanceled != nil { cp := *t.Livestream_TeleportCanceled cp.LexiconTypeID = "place.stream.livestream#teleportCanceled" return json.Marshal(&cp) } if t.Livestream_ViewerCount != nil { cp := *t.Livestream_ViewerCount cp.LexiconTypeID = "place.stream.livestream#viewerCount" return json.Marshal(&cp) } if t.Raw != nil { if t.Raw.Encoding != "json" { return nil, fmt.Errorf("cannot marshal raw %s record as JSON in union Livestream_StreamplaceAnything_Livestream", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union Livestream_StreamplaceAnything_Livestream as JSON")}
func (t *Livestream_StreamplaceAnything_Livestream) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.chat.defs#messageView": t.ChatDefs_MessageView = new(ChatDefs_MessageView) return json.Unmarshal(b, t.ChatDefs_MessageView) case "place.stream.chat.defs#pinnedRecordView": t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) return json.Unmarshal(b, t.ChatDefs_PinnedRecordView) case "place.stream.defs#blockView": t.Defs_BlockView = new(Defs_BlockView) return json.Unmarshal(b, t.Defs_BlockView) case "place.stream.defs#rendition": t.Defs_Rendition = new(Defs_Rendition) return json.Unmarshal(b, t.Defs_Rendition) case "place.stream.defs#renditions": t.Defs_Renditions = new(Defs_Renditions) return json.Unmarshal(b, t.Defs_Renditions) case "place.stream.livestream#livestreamView": t.Livestream_LivestreamView = new(Livestream_LivestreamView) return json.Unmarshal(b, t.Livestream_LivestreamView) case "place.stream.livestream#teleportArrival": t.Livestream_TeleportArrival = new(Livestream_TeleportArrival) return json.Unmarshal(b, t.Livestream_TeleportArrival) case "place.stream.livestream#teleportCanceled": t.Livestream_TeleportCanceled = new(Livestream_TeleportCanceled) return json.Unmarshal(b, t.Livestream_TeleportCanceled) case "place.stream.livestream#viewerCount": t.Livestream_ViewerCount = new(Livestream_ViewerCount) return json.Unmarshal(b, t.Livestream_ViewerCount) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "json", Bytes: append([]byte(nil), b...)} return nil }}
// MarshalCBOR implements drisl.Marshaler, emitting the set variant (stamped// with its $type) per the atproto union wire format. go-dasl invokes this// when the union appears inside another record, so nested unions serialize// correctly.func (t Livestream_StreamplaceAnything_Livestream) MarshalCBOR() ([]byte, error) { if t.ChatDefs_MessageView != nil { cp := *t.ChatDefs_MessageView cp.LexiconTypeID = "place.stream.chat.defs#messageView" return glex.MarshalCBORBytes(&cp) } if t.ChatDefs_PinnedRecordView != nil { cp := *t.ChatDefs_PinnedRecordView cp.LexiconTypeID = "place.stream.chat.defs#pinnedRecordView" return glex.MarshalCBORBytes(&cp) } if t.Defs_BlockView != nil { cp := *t.Defs_BlockView cp.LexiconTypeID = "place.stream.defs#blockView" return glex.MarshalCBORBytes(&cp) } if t.Defs_Rendition != nil { cp := *t.Defs_Rendition cp.LexiconTypeID = "place.stream.defs#rendition" return glex.MarshalCBORBytes(&cp) } if t.Defs_Renditions != nil { cp := *t.Defs_Renditions cp.LexiconTypeID = "place.stream.defs#renditions" return glex.MarshalCBORBytes(&cp) } if t.Livestream_LivestreamView != nil { cp := *t.Livestream_LivestreamView cp.LexiconTypeID = "place.stream.livestream#livestreamView" return glex.MarshalCBORBytes(&cp) } if t.Livestream_TeleportArrival != nil { cp := *t.Livestream_TeleportArrival cp.LexiconTypeID = "place.stream.livestream#teleportArrival" return glex.MarshalCBORBytes(&cp) } if t.Livestream_TeleportCanceled != nil { cp := *t.Livestream_TeleportCanceled cp.LexiconTypeID = "place.stream.livestream#teleportCanceled" return glex.MarshalCBORBytes(&cp) } if t.Livestream_ViewerCount != nil { cp := *t.Livestream_ViewerCount cp.LexiconTypeID = "place.stream.livestream#viewerCount" return glex.MarshalCBORBytes(&cp) } if t.Raw != nil { if t.Raw.Encoding != "cbor" { return nil, fmt.Errorf("cannot marshal raw %s record as CBOR in union Livestream_StreamplaceAnything_Livestream", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union Livestream_StreamplaceAnything_Livestream as CBOR")}
func (t *Livestream_StreamplaceAnything_Livestream) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.chat.defs#messageView": t.ChatDefs_MessageView = new(ChatDefs_MessageView) return glex.UnmarshalCBORBytes(b, t.ChatDefs_MessageView) case "place.stream.chat.defs#pinnedRecordView": t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) return glex.UnmarshalCBORBytes(b, t.ChatDefs_PinnedRecordView) case "place.stream.defs#blockView": t.Defs_BlockView = new(Defs_BlockView) return glex.UnmarshalCBORBytes(b, t.Defs_BlockView) case "place.stream.defs#rendition": t.Defs_Rendition = new(Defs_Rendition) return glex.UnmarshalCBORBytes(b, t.Defs_Rendition) case "place.stream.defs#renditions": t.Defs_Renditions = new(Defs_Renditions) return glex.UnmarshalCBORBytes(b, t.Defs_Renditions) case "place.stream.livestream#livestreamView": t.Livestream_LivestreamView = new(Livestream_LivestreamView) return glex.UnmarshalCBORBytes(b, t.Livestream_LivestreamView) case "place.stream.livestream#teleportArrival": t.Livestream_TeleportArrival = new(Livestream_TeleportArrival) return glex.UnmarshalCBORBytes(b, t.Livestream_TeleportArrival) case "place.stream.livestream#teleportCanceled": t.Livestream_TeleportCanceled = new(Livestream_TeleportCanceled) return glex.UnmarshalCBORBytes(b, t.Livestream_TeleportCanceled) case "place.stream.livestream#viewerCount": t.Livestream_ViewerCount = new(Livestream_ViewerCount) return glex.UnmarshalCBORBytes(b, t.Livestream_ViewerCount) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}
// Livestream_TeleportArrival is a "teleportArrival" in the place.stream.livestream schema.type Livestream_TeleportArrival struct { LexiconTypeID string `json:"$type,omitempty"` // chatProfile: The chat profile of the source streamer ChatProfile *ChatProfile `json:"chatProfile,omitempty"` // source: The streamer who is teleporting their viewers here Source appbsky.ActorDefs_ProfileViewBasic `json:"source"` // startsAt: When this teleport started StartsAt string `json:"startsAt"` // teleportUri: The URI of the teleport record TeleportUri string `json:"teleportUri"` // viewerCount: How many viewers are arriving from this teleport ViewerCount int64 `json:"viewerCount"`}
// RecordTypeID implements glex.Record.func (t *Livestream_TeleportArrival) RecordTypeID() string { return "place.stream.livestream#teleportArrival"}
func (t *Livestream_TeleportArrival) 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.livestream#teleportArrival" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_TeleportArrival) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// Livestream_TeleportCanceled is a "teleportCanceled" in the place.stream.livestream schema.type Livestream_TeleportCanceled struct { LexiconTypeID string `json:"$type,omitempty"` // reason: Why this teleport was canceled Reason string `json:"reason"` // teleportUri: The URI of the teleport record that was canceled TeleportUri string `json:"teleportUri"`}
// RecordTypeID implements glex.Record.func (t *Livestream_TeleportCanceled) RecordTypeID() string { return "place.stream.livestream#teleportCanceled"}
func (t *Livestream_TeleportCanceled) 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.livestream#teleportCanceled" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_TeleportCanceled) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// Livestream_ViewerCount is a "viewerCount" in the place.stream.livestream schema.type Livestream_ViewerCount struct { LexiconTypeID string `json:"$type,omitempty"` Count int64 `json:"count"`}
// RecordTypeID implements glex.Record.func (t *Livestream_ViewerCount) RecordTypeID() string { return "place.stream.livestream#viewerCount" }
func (t *Livestream_ViewerCount) 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.livestream#viewerCount" return glex.MarshalCBOR(w, &cp)}
func (t *Livestream_ViewerCount) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}