upload
konigle.models.core.upload
¶
Upload models for the Konigle SDK.
This module defines models for file uploads - general purpose private file uploads that represent temporary uploads for files in the Konigle platform. These differ from StorefrontAsset as they are not used directly in the site but contribute to site storage.
Upload
¶
Bases: Resource
Upload model for general purpose file uploads.
created_at = Field(..., title='Created At', description='Creation timestamp.')
class-attribute
instance-attribute
¶
Creation timestamp.
description = Field(default='', max_length=1000, title='Description', description='Optional description of the upload')
class-attribute
instance-attribute
¶
Optional description of the upload
etag = Field(default='', max_length=64, title='ETag', description='ETag or checksum of the file content')
class-attribute
instance-attribute
¶
ETag or checksum of the file content
meta = Field(default_factory=dict, title='Metadata', description='Additional metadata such as width, height for images')
class-attribute
instance-attribute
¶
Additional metadata such as width, height for images
mime_type = Field(..., max_length=100, title='MIME Type', description='MIME type of the uploaded file')
class-attribute
instance-attribute
¶
MIME type of the uploaded file
name = Field(default='', max_length=255, title='Name', description='Name of the file for display and search purposes')
class-attribute
instance-attribute
¶
Name of the file for display and search purposes
size = Field(default=0, ge=0, title='Size', description='Size of the file in bytes')
class-attribute
instance-attribute
¶
Size of the file in bytes
status = Field(default=(UploadStatus.COMPLETED), title='Status', description='Status of the upload')
class-attribute
instance-attribute
¶
Status of the upload
storage_path = Field(default='', max_length=500, title='Storage Path', description='Object key or path in the storage backend')
class-attribute
instance-attribute
¶
Object key or path in the storage backend
tags = Field(default_factory=list, title='Tags', description='Tags for categorization')
class-attribute
instance-attribute
¶
Tags for categorization
upload_ended_at = Field(None, title='Upload Ended At', description='Timestamp when the upload ended')
class-attribute
instance-attribute
¶
Timestamp when the upload ended
upload_started_at = Field(None, title='Upload Started At', description='Timestamp when the upload started')
class-attribute
instance-attribute
¶
Timestamp when the upload started
url = Field(..., title='File URL', description='URL to access the uploaded file')
class-attribute
instance-attribute
¶
URL to access the uploaded file
UploadCreate
¶
Bases: CreateModel
Create model for file uploads.
description = Field(default=None, title='Description', description='Optional description of the upload')
class-attribute
instance-attribute
¶
Optional description of the upload
file = Field(..., title='File', description='File to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)')
class-attribute
instance-attribute
¶
File to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)
meta = Field(default=None, title='Meta', description='Optional metadata dictionary')
class-attribute
instance-attribute
¶
Optional metadata dictionary
name = Field(default='', max_length=255, title='Name', description='Name of the file for display and search purposes')
class-attribute
instance-attribute
¶
Name of the file for display and search purposes
tags = Field(default='', title='Tags', description='Tags for categorization. Comma-separated string.')
class-attribute
instance-attribute
¶
Tags for categorization. Comma-separated string.
normalize_file()
¶
Convert file paths or bytes to FileInput.
validate_file(v)
classmethod
¶
Ensure we're uploading a supported file type.
UploadStatus
¶
Bases: str, Enum
Upload status enumeration.