mediaform

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var ErrFormRequired = errors.New("multipart form is required")

ErrFormRequired reports a call that reached a multipart path without a parsed form.

View Source
var ErrUploadUnreadable = errors.New("upload could not be read")

ErrUploadUnreadable reports a part the gateway could not read.

Functions

func File

func File(form *multipart.Form, field string) (inference.UploadedFile, error)

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

func Float(form *multipart.Form, field string) *float64

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

func Int(form *multipart.Form, field string) 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

func Transcription(form *multipart.Form, translate bool) (inference.TranscriptionRequest, error)

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.

func Value

func Value(form *multipart.Form, field string) string

Value reads one text field, or the empty string when the form carries none.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL