Documentation
¶
Overview ¶
Package uploadurl issues short-lived URLs that accept a file for one file form field in a single PUT request. Clients that cannot run the chunked upload protocol of the Web UI, such as AI agents using curl, use these URLs.
Index ¶
Constants ¶
const DefaultTTL = 30 * time.Minute
DefaultTTL is how long an issued upload URL accepts uploads.
const StatusProcessing = "PROCESSING"
StatusProcessing is the upload status reported while a file is being stored or verified.
Variables ¶
var ( // ErrUnknownURL is returned when an upload URL token was never issued or has already been claimed. ErrUnknownURL = errors.New("unknown upload URL") // ErrExpiredURL is returned when an upload URL token is used after it expires. ErrExpiredURL = errors.New("upload URL has expired") )
Functions ¶
This section is empty.
Types ¶
type Grant ¶
type Grant struct {
// URL is the address that accepts the file body with a PUT request.
URL string
// FieldID is the ID of the file form field that receives the file.
FieldID string
// MaxSizeBytes is the largest file size the URL accepts.
MaxSizeBytes int64
// ExpiresAt is the time after which the URL rejects uploads.
ExpiresAt time.Time
}
Grant describes an issued upload URL.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler stores files sent to upload URLs. It uses the same persistence and verification path as Web UI uploads.
func NewHandler ¶
func NewHandler(issuer *Issuer, manager *upload.FileParameterUploadManager) *Handler
NewHandler returns a Handler that accepts uploads for URLs issued by issuer and stores them with manager.
func (*Handler) ServeUpload ¶
ServeUpload stores the request body as the file of the field that urlToken was issued for. The request must declare the body size in Content-Length.
type Issuer ¶
type Issuer struct {
// contains filtered or unexported fields
}
Issuer issues upload URLs and claims the URL tokens in them. Each URL is bound to the upload token of one file form field.