Documentation
¶
Overview ¶
Package mediaform reads one media request that arrived as multipart form data. An image edit and an audio transcription carry a file, so neither can arrive as JSON. Both protocol families spell the parts the same way, so the reading is owned once here rather than copied into each codec, where two copies would drift into two contracts for one wire format.
Index ¶
- Variables
- func File(form *multipart.Form, field string) (inference.UploadedFile, error)
- func Float(form *multipart.Form, field string) *float64
- func Images(form *multipart.Form) (inference.ImagesRequest, error)
- func Int(form *multipart.Form, field string) int
- func Transcription(form *multipart.Form, translate bool) (inference.TranscriptionRequest, error)
- func Value(form *multipart.Form, field string) string
Constants ¶
This section is empty.
Variables ¶
var ErrFormRequired = errors.New("multipart form is required")
ErrFormRequired reports a call that reached a multipart path without a parsed form.
var ErrUploadUnreadable = errors.New("upload could not be read")
ErrUploadUnreadable reports a part the gateway could not read.
Functions ¶
func File ¶
File reads one named upload whole. The bytes are held rather than streamed because a route plan retries across providers, and a reader consumed by the first attempt would arrive empty at the second.
func Float ¶
Float reads one optional decimal field. A field the form omits stays nil, which is not the same as zero: a provider reads nil as its own default.
func Images ¶
func Images(form *multipart.Form) (inference.ImagesRequest, error)
Images reads one image edit request. The source image is what separates an edit from a generation, so a form carrying none reads as a generation and the router plans it as one.
func Int ¶
Int reads one whole-number field. An unparsable value reads as zero, which the validator then reports by name rather than this reader guessing at it.
func Transcription ¶
Transcription reads one speech-to-text request. translate states whether the caller reached the translation path, which is a routing fact and not a form field.
Types ¶
This section is empty.