// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.getVideo package placestream import ( "context" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" appbsky "stream.place/streamplace/pkg/appbsky" ) // MediaGetVideo calls the XRPC method "place.stream.media.getVideo". // // Get a hydrated view of a place.stream.video record — the record itself plus author info plus aggregated view counts summed across every reporting node we've indexed. View counts come from place.stream.media.viewCount records; consumers see one number per metric, with the underlying multi-reporter detail collapsed away. // // uri: AT-URI of the place.stream.video record. func MediaGetVideo(ctx context.Context, c glex.LexClient, uri string) (*MediaGetVideo_VideoView, error) { var out MediaGetVideo_VideoView params := map[string]interface{}{} params["uri"] = uri if err := c.LexDo(ctx, glex.Query, "", "place.stream.media.getVideo", params, nil, &out); err != nil { return nil, err } return &out, nil } // MediaGetVideo_VideoView is a "videoView" in the place.stream.media.getVideo schema. type MediaGetVideo_VideoView struct { LexiconTypeID string `json:"$type,omitempty"` Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` Cid string `json:"cid"` // likeCount: Total number of place.stream.like records whose subject is this video. Always present; zero when none, so consumers can render a count unconditionally. LikeCount int64 `json:"likeCount"` Record *glex.LexiconTypeDecoder `json:"record"` Tracks []MediaTrack_TrackView `json:"tracks,omitempty"` Uri string `json:"uri"` // viewCounts: Aggregated view counts across every indexed reporter. Always present; zero-valued (count=0, reporters=0) when no place.stream.media.viewCount records have been observed yet, so consumers can render a count unconditionally. ViewCounts MediaGetVideo_ViewCountSummary `json:"viewCounts"` } // RecordTypeID implements glex.Record. func (t *MediaGetVideo_VideoView) RecordTypeID() string { return "place.stream.media.getVideo#videoView" } func (t *MediaGetVideo_VideoView) 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.media.getVideo#videoView" return glex.MarshalCBOR(w, &cp) } func (t *MediaGetVideo_VideoView) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // MediaGetVideo_ViewCountSummary is a "viewCountSummary" in the place.stream.media.getVideo schema. // // Sums across every place.stream.media.viewCount record indexed for this video, regardless of reporter or window. The underlying records are window-bounded; the consumer sees a running total. type MediaGetVideo_ViewCountSummary struct { LexiconTypeID string `json:"$type,omitempty"` // bytes: Sum of bytes transferred across every track row in every indexed report. Bytes int64 `json:"bytes"` // count: Sum of `count` across every indexed report. Count int64 `json:"count"` // durationMs: Sum of playback duration (ms) across every track row in every indexed report. DurationMs int64 `json:"durationMs"` // reporters: Number of distinct streamplace nodes that have contributed at least one viewCount record for this video. Reporters int64 `json:"reporters"` } // RecordTypeID implements glex.Record. func (t *MediaGetVideo_ViewCountSummary) RecordTypeID() string { return "place.stream.media.getVideo#viewCountSummary" } func (t *MediaGetVideo_ViewCountSummary) 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.media.getVideo#viewCountSummary" return glex.MarshalCBOR(w, &cp) } func (t *MediaGetVideo_ViewCountSummary) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }