Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
6.2 kB · 176 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.vod.updateDraft
package placestream
import ( "context" "encoding/json" "fmt" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
type VodUpdateDraft_Input struct { LexiconTypeID string `json:"$type,omitempty"` Activity *VodUpdateDraft_Input_Activity `json:"activity,omitempty"` ContentRights *MetadataContentRights `json:"contentRights,omitempty"` ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` Description *string `json:"description,omitempty"` DescriptionFacets []RichtextVideoFacet `json:"descriptionFacets,omitempty"` Tags []string `json:"tags,omitempty"` Thumb *glex.Blob `json:"thumb,omitempty"` Title *string `json:"title,omitempty"` // uri: The ats:// URI of the draft to update. Uri string `json:"uri"`}
// RecordTypeID implements glex.Record.func (t *VodUpdateDraft_Input) RecordTypeID() string { return "place.stream.vod.updateDraft" }
func (t *VodUpdateDraft_Input) 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.updateDraft" return glex.MarshalCBOR(w, &cp)}
func (t *VodUpdateDraft_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type VodUpdateDraft_Input_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 VodUpdateDraft_Input_Activity and *VodUpdateDraft_Input_Activity marshal correctly.func (t VodUpdateDraft_Input_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 VodUpdateDraft_Input_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodUpdateDraft_Input_Activity as JSON")}
func (t *VodUpdateDraft_Input_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 VodUpdateDraft_Input_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 VodUpdateDraft_Input_Activity", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union VodUpdateDraft_Input_Activity as CBOR")}
func (t *VodUpdateDraft_Input_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 VodUpdateDraft_Output struct { LexiconTypeID string `json:"$type,omitempty"` Draft VodDraftDefs_DraftView `json:"draft"`}
// RecordTypeID implements glex.Record.func (t *VodUpdateDraft_Output) RecordTypeID() string { return "place.stream.vod.updateDraft" }
func (t *VodUpdateDraft_Output) 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.updateDraft" return glex.MarshalCBOR(w, &cp)}
func (t *VodUpdateDraft_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// VodUpdateDraft calls the XRPC method "place.stream.vod.updateDraft".//// Update a draft VOD's editable metadata. Server-authoritative fields (source, durationMs, status) are preserved. Editing is allowed in any status, so the user can pre-fill metadata while processing. All fields except uri are optional (partial update).func VodUpdateDraft(ctx context.Context, c glex.LexClient, input *VodUpdateDraft_Input) (*VodUpdateDraft_Output, error) { var out VodUpdateDraft_Output
if err := c.LexDo(ctx, glex.Procedure, "application/json", "place.stream.vod.updateDraft", nil, input, &out); err != nil { return nil, err } return &out, nil}