Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.8 kB · 57 lines
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.live.viewerCount
package placestream
import ( "encoding/json" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
func init() { glex.RegisterType("place.stream.live.viewerCount", &LiveViewerCount{})}
// Current viewer count for a livestream on a particular server. Record keys are streamer_did::server_did by convention.type LiveViewerCount struct { LexiconTypeID string `json:"$type,omitempty"` // count: The current view count for the livestream. Count int64 `json:"count"` // server: The DID of the server to get the view count for. Server string `json:"server"` // streamer: The DID of the streamer to teleport to. Streamer string `json:"streamer"` // updatedAt: The time the view count was last updated. UpdatedAt *string `json:"updatedAt,omitempty"`}
// RecordTypeID implements glex.Record.func (t *LiveViewerCount) RecordTypeID() string { return "place.stream.live.viewerCount" }
// MarshalJSON stamps the $type field, like MarshalCBOR does. The value// receiver operates on a copy, so the record is never mutated and both// LiveViewerCount and *LiveViewerCount marshal with $type.func (t LiveViewerCount) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.live.viewerCount" type alias LiveViewerCount return json.Marshal((alias)(t))}
func (t *LiveViewerCount) 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.viewerCount" return glex.MarshalCBOR(w, &cp)}
func (t *LiveViewerCount) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}