Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
13 kB · 342 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.vod.draftVideo
package placestream
import ( "encoding/json" "fmt" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
func init() { glex.RegisterType("place.stream.vod.draftVideo", &VodDraftVideo{})}
// A draft VOD: pre-publication video metadata and processing state. Modeled as a permissioned-data-style record (CBOR-serialized, addressed by an ats:// URI) stored in statedb until the permissioned-data spec ships (bluesky-social/proposals PR #94, the 0016-permissioned-data proposal). Publishing promotes it to a public place.stream.video record.type VodDraftVideo struct { LexiconTypeID string `json:"$type,omitempty"` // activity: The game or activity in the video. Activity *VodDraftVideo_Activity `json:"activity,omitempty"` // connections: Related records (e.g. the source livestream for a finalized VOD). Connections []VodDraftVideo_Connections_Elem `json:"connections,omitempty"` ContentRights *MetadataContentRights `json:"contentRights,omitempty"` ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` CreatedAt string `json:"createdAt"` // description: Description of the video. Description *string `json:"description,omitempty"` // descriptionFacets: Annotations of text (mentions, URLs, etc). DescriptionFacets []RichtextVideoFacet `json:"descriptionFacets,omitempty"` // durationMs: Duration in milliseconds. Filled when status is 'ready'. DurationMs *int64 `json:"durationMs,omitempty"` // error: Error message when status is 'error'. Error *string `json:"error,omitempty"` // source: Source tracks. Filled by the server when processing completes (status 'ready'). Source *VodDraftVideo_Source `json:"source,omitempty"` // status: Processing state: 'processing' while the job runs, 'ready' when publishable, 'error' if processing failed. Status string `json:"status"` // tags: Freeform tags (same rules as place.stream.video). Tags []string `json:"tags,omitempty"` // thumb: Thumbnail image. Generated by the server at publish time if absent. Thumb *glex.Blob `json:"thumb,omitempty"` // title: Title of the video. May be a placeholder while processing; the user edits before publishing. Title string `json:"title"`}
// RecordTypeID implements glex.Record.func (t *VodDraftVideo) RecordTypeID() string { return "place.stream.vod.draftVideo" }
// MarshalJSON stamps the $type field, like MarshalCBOR does. The value// receiver operates on a copy, so the record is never mutated and both// VodDraftVideo and *VodDraftVideo marshal with $type.func (t VodDraftVideo) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.vod.draftVideo" type alias VodDraftVideo return json.Marshal((alias)(t))}
func (t *VodDraftVideo) 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.vod.draftVideo" return glex.MarshalCBOR(w, &cp)}
func (t *VodDraftVideo) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// The game or activity in the video.type VodDraftVideo_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 VodDraftVideo_Activity and *VodDraftVideo_Activity marshal correctly.func (t VodDraftVideo_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 VodDraftVideo_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Activity as JSON")}
func (t *VodDraftVideo_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 VodDraftVideo_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 VodDraftVideo_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Activity as CBOR")}
func (t *VodDraftVideo_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 }}
type VodDraftVideo_Connections_Elem struct { Video_Connection *Video_Connection // 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 VodDraftVideo_Connections_Elem and *VodDraftVideo_Connections_Elem marshal correctly.func (t VodDraftVideo_Connections_Elem) MarshalJSON() ([]byte, error) { if t.Video_Connection != nil { cp := *t.Video_Connection cp.LexiconTypeID = "place.stream.video#connection" 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 VodDraftVideo_Connections_Elem", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Connections_Elem as JSON")}
func (t *VodDraftVideo_Connections_Elem) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.video#connection": t.Video_Connection = new(Video_Connection) return json.Unmarshal(b, t.Video_Connection) 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 VodDraftVideo_Connections_Elem) MarshalCBOR() ([]byte, error) { if t.Video_Connection != nil { cp := *t.Video_Connection cp.LexiconTypeID = "place.stream.video#connection" 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 VodDraftVideo_Connections_Elem", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Connections_Elem as CBOR")}
func (t *VodDraftVideo_Connections_Elem) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.video#connection": t.Video_Connection = new(Video_Connection) return glex.UnmarshalCBORBytes(b, t.Video_Connection) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}
// Source tracks. Filled by the server when processing completes (status 'ready').type VodDraftVideo_Source struct { MediaDefs_SourceClip *MediaDefs_SourceClip MediaDefs_SourceTracks *MediaDefs_SourceTracks // 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 VodDraftVideo_Source and *VodDraftVideo_Source marshal correctly.func (t VodDraftVideo_Source) MarshalJSON() ([]byte, error) { if t.MediaDefs_SourceClip != nil { cp := *t.MediaDefs_SourceClip cp.LexiconTypeID = "place.stream.media.defs#sourceClip" return json.Marshal(&cp) } if t.MediaDefs_SourceTracks != nil { cp := *t.MediaDefs_SourceTracks cp.LexiconTypeID = "place.stream.media.defs#sourceTracks" 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 VodDraftVideo_Source", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Source as JSON")}
func (t *VodDraftVideo_Source) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return json.Unmarshal(b, t.MediaDefs_SourceClip) case "place.stream.media.defs#sourceTracks": t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) return json.Unmarshal(b, t.MediaDefs_SourceTracks) 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 VodDraftVideo_Source) MarshalCBOR() ([]byte, error) { if t.MediaDefs_SourceClip != nil { cp := *t.MediaDefs_SourceClip cp.LexiconTypeID = "place.stream.media.defs#sourceClip" return glex.MarshalCBORBytes(&cp) } if t.MediaDefs_SourceTracks != nil { cp := *t.MediaDefs_SourceTracks cp.LexiconTypeID = "place.stream.media.defs#sourceTracks" 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 VodDraftVideo_Source", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodDraftVideo_Source as CBOR")}
func (t *VodDraftVideo_Source) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return glex.UnmarshalCBORBytes(b, t.MediaDefs_SourceClip) case "place.stream.media.defs#sourceTracks": t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) return glex.UnmarshalCBORBytes(b, t.MediaDefs_SourceTracks) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}