Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
3.3 kB · 85 lines
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.media.createUpload
package placestream
import ( "context" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
type MediaCreateUpload_Input struct { LexiconTypeID string `json:"$type,omitempty"` // draftUri: Optional ats:// URI of a draft VOD created via place.stream.vod.createDraft. When supplied, the upload's processing fills that draft (rather than creating a new one), so the user can edit metadata while the upload runs and re-upload if it fails. The draft's origin_upload_id is set to this upload. DraftUri *string `json:"draftUri,omitempty"` // filename: Optional filename hint to attach as upload metadata. Filename *string `json:"filename,omitempty"` // mimeType: MIME type of the content being uploaded (e.g. video/mp4). MimeType string `json:"mimeType"` // size: Total size of the upload in bytes. Size int64 `json:"size"`}
// RecordTypeID implements glex.Record.func (t *MediaCreateUpload_Input) RecordTypeID() string { return "place.stream.media.createUpload" }
func (t *MediaCreateUpload_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.media.createUpload" return glex.MarshalCBOR(w, &cp)}
func (t *MediaCreateUpload_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type MediaCreateUpload_Output struct { LexiconTypeID string `json:"$type,omitempty"` // expiresAt: When the upload token expires. ExpiresAt string `json:"expiresAt"` // uploadId: Server-side identifier for this upload. UploadId string `json:"uploadId"` // uploadToken: Short-lived bearer token bound to this upload. Send as 'Authorization: Bearer <token>' on TUS requests. UploadToken string `json:"uploadToken"` // uploadUrl: Absolute URL to PATCH/HEAD per the TUS protocol. UploadUrl string `json:"uploadUrl"`}
// RecordTypeID implements glex.Record.func (t *MediaCreateUpload_Output) RecordTypeID() string { return "place.stream.media.createUpload" }
func (t *MediaCreateUpload_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.media.createUpload" return glex.MarshalCBOR(w, &cp)}
func (t *MediaCreateUpload_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// MediaCreateUpload calls the XRPC method "place.stream.media.createUpload".//// Start a resumable upload of arbitrary media content. Returns a TUS upload URL and a short-lived bearer token used to authenticate subsequent chunk requests (no DPoP required on chunks). The DID of the authenticated user is recorded against the upload; on completion a VOD processing task is enqueued.func MediaCreateUpload(ctx context.Context, c glex.LexClient, input *MediaCreateUpload_Input) (*MediaCreateUpload_Output, error) { var out MediaCreateUpload_Output
if err := c.LexDo(ctx, glex.Procedure, "application/json", "place.stream.media.createUpload", nil, input, &out); err != nil { return nil, err } return &out, nil}