Skip to content

core

konigle.models.core

Core resource models for the Konigle SDK.

This module exports models for core platform resources like media assets, uploads, sites, connections, and forms.

Connection

Bases: TimestampedResource

Connection resource model.

Represents a third-party API integration connection with OAuth or API key authentication. Connections are site-specific and store credentials, tokens, and metadata for external service integrations.

provider = Field(..., title='Provider Code', description='Provider code identifying the third-party service.') class-attribute instance-attribute

Provider code identifying the third-party service.

root_resource_id = Field(default=None, title='Root Resource ID', description='Authorized resource ID (e.g., account ID, email).') class-attribute instance-attribute

Authorized resource ID (e.g., account ID, email).

root_resource_name = Field(default=None, title='Root Resource Name', description='Authorized resource name (e.g., account name).') class-attribute instance-attribute

Authorized resource name (e.g., account name).

scopes = Field(default_factory=list, title='OAuth Scopes', description='List of OAuth scopes authorized for this connection.') class-attribute instance-attribute

List of OAuth scopes authorized for this connection.

status = Field(default=(ConnectionStatus.ACTIVE), title='Connection Status', description='Current status of the connection.') class-attribute instance-attribute

Current status of the connection.

token_expires_at = Field(default=None, title='Token Expiry', description='Expiration timestamp for the access token.') class-attribute instance-attribute

Expiration timestamp for the access token.

Document

Bases: BaseAsset

Document asset model.

DocumentCreate

Bases: BaseAssetCreate

Create model for document assets.

file = Field(..., title='File', description='Document file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)') class-attribute instance-attribute

Document file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)

normalize_file()

Convert file paths or bytes to FileInput.

validate_document_file(v) classmethod

Ensure we're uploading a supported document file.

DocumentUpdate

Bases: BaseAssetUpdate

Update model for document assets - file cannot be updated.

Form

Bases: BaseResource, TimestampMixin

Form resource model.

Represents a form with fields from the forms service. Uses integer ID as it comes from a separate service.

captcha_enabled = Field(default=None, title='Captcha Enabled', description='Whether CAPTCHA is enabled for this form.') class-attribute instance-attribute

Whether CAPTCHA is enabled for this form.

captcha_site_key = Field(default=None, title='Captcha Site Key', description='CAPTCHA site key for client-side validation.') class-attribute instance-attribute

CAPTCHA site key for client-side validation.

endpoint_url = Field(..., title='Endpoint URL', description='The URL endpoint for form submissions.', serialization_alias='submission_url') class-attribute instance-attribute

The URL endpoint for form submissions.

id = Field(..., title='Form ID', description='Unique identifier for the form.') class-attribute instance-attribute

Unique identifier for the form.

is_active = Field(..., title='Is Active', description='Whether the form is active.') class-attribute instance-attribute

Whether the form is active.

name = Field(..., title='Form Name', description='The name of the form.') class-attribute instance-attribute

The name of the form.

slug = Field(..., title='Slug', description='URL-friendly slug for the form.') class-attribute instance-attribute

URL-friendly slug for the form.

FormCreate

Bases: CreateModel

Form creation model.

Defines fields required when creating a new form. The slug is auto-generated from the name.

name = Field(..., title='Form Name', description='The name of the form.') class-attribute instance-attribute

The name of the form.

FormSubmission

Bases: BaseResource

Form submission resource model.

Represents a submission to a form with all metadata and spam detection.

country = Field(default=None, title='Country', description='ISO country code (2 characters).') class-attribute instance-attribute

ISO country code (2 characters).

emails_sent = Field(default=None, title='Emails Sent', description='List of email addresses that were sent notifications.') class-attribute instance-attribute

List of email addresses that were sent notifications.

form_data = Field(default=None, title='Form Data', description='The submitted form data as key-value pairs.') class-attribute instance-attribute

The submitted form data as key-value pairs.

form_name = Field(default=None, title='Form Name', description='Name of the form that was submitted.') class-attribute instance-attribute

Name of the form that was submitted.

form_slug = Field(default=None, title='Form Slug', description='Slug of the form that was submitted.') class-attribute instance-attribute

Slug of the form that was submitted.

id = Field(..., title='Submission ID', description='Unique identifier for the form submission.') class-attribute instance-attribute

Unique identifier for the form submission.

ip_address = Field(..., title='IP Address', description='IP address of the submitter.') class-attribute instance-attribute

IP address of the submitter.

is_spam = Field(default=False, title='Is Spam', description='Whether this submission was detected as spam.') class-attribute instance-attribute

Whether this submission was detected as spam.

spam_confidence = Field(default=0.0, ge=0.0, le=1.0, title='Spam Confidence', description='Confidence score for spam detection (0.0 to 1.0).') class-attribute instance-attribute

Confidence score for spam detection (0.0 to 1.0).

spam_reason = Field(default=None, title='Spam Reason', description='Reason why submission was marked as spam.') class-attribute instance-attribute

Reason why submission was marked as spam.

submitted_at = Field(..., title='Submitted At', description='Timestamp when the form was submitted.') class-attribute instance-attribute

Timestamp when the form was submitted.

user_agent = Field(default=None, title='User Agent', description='Browser user agent string.') class-attribute instance-attribute

Browser user agent string.

Image

Bases: BaseAsset

Image asset model.

image_height = Field(None, ge=0, title='Image Height', description='Image height in pixels') class-attribute instance-attribute

Image height in pixels

image_width = Field(None, ge=0, title='Image Width', description='Image width in pixels') class-attribute instance-attribute

Image width in pixels

ImageCreate

Bases: BaseAssetCreate

Create model for image assets.

image = Field(..., title='Image', description='Image file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)') class-attribute instance-attribute

Image file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)

normalize_file()

Convert file paths or bytes to FileInput.

validate_image_file(v) classmethod

Ensure we're uploading an image file.

ImageGenerate

Bases: CreateModel

Model for generating images from text prompts.

aspect_ratio = Field(default='1:1', title='Aspect Ratio', description='Aspect ratio of the generated image') class-attribute instance-attribute

Aspect ratio of the generated image

output_format = Field(default='webp', title='Output Format', description='Output format of the generated image') class-attribute instance-attribute

Output format of the generated image

prompt = Field(..., title='Prompt', description='Text prompt to generate the image') class-attribute instance-attribute

Text prompt to generate the image

ImageUpdate

Bases: BaseAssetUpdate

Update model for image assets - file cannot be updated.

Site

Bases: BaseResource

Site resource model.

Represents a complete site/website with all available fields from the detail endpoint.

address1 = Field(default=None, title='Address Line 1', description="First line of the site's address.") class-attribute instance-attribute

First line of the site's address.

address2 = Field(default=None, title='Address Line 2', description="Second line of the site's address.") class-attribute instance-attribute

Second line of the site's address.

asset_bucket = Field(default=None, title='Asset Bucket', description='Storage bucket for site assets.') class-attribute instance-attribute

Storage bucket for site assets.

asset_domain = Field(default=None, title='Asset Domain', description='CDN domain for serving site assets.') class-attribute instance-attribute

CDN domain for serving site assets.

city = Field(default=None, title='City', description="City of the site's address.") class-attribute instance-attribute

City of the site's address.

country = Field(default=None, title='Country', description="Country of the site's address.") class-attribute instance-attribute

Country of the site's address.

currency = Field(default=None, title='Currency', description='Default currency code for the site.') class-attribute instance-attribute

Default currency code for the site.

domain = Field(..., title='Domain', description='The primary domain of the site.') class-attribute instance-attribute

The primary domain of the site.

email = Field(default=None, title='Email', description='Contact email address for the site.') class-attribute instance-attribute

Contact email address for the site.

id property

Alias for uid to provide uniform interface.

konigle_domain = Field(..., title='Konigle Domain', description='The konigle.net domain.') class-attribute instance-attribute

The konigle.net domain.

name = Field(..., title='Site Name', description='The name of the website.') class-attribute instance-attribute

The name of the site/website.

password_enabled = Field(default=False, title='Password Enabled', description='Whether password protection is enabled for the site.') class-attribute instance-attribute

Whether password protection is enabled for the site.

phone = Field(default=None, title='Phone Number', description='Contact phone number for the site.') class-attribute instance-attribute

Contact phone number for the site.

province = Field(default=None, title='Province/State', description="Province or state of the site's address.") class-attribute instance-attribute

Province or state of the site's address.

uid = Field(..., title='UID', description='Unique identifier of the site.') class-attribute instance-attribute

Unique identifier of the site.

SiteUpdate

Bases: UpdateModel

Site update model.

Defines fields that can be updated for a site. Only includes mutable fields from the mutation serializer.

address1 = Field(default=None, title='Address Line 1', description="First line of the site's address.") class-attribute instance-attribute

First line of the site's address.

address2 = Field(default=None, title='Address Line 2', description="Second line of the site's address.") class-attribute instance-attribute

Second line of the site's address.

city = Field(default=None, title='City', description="City of the site's address.") class-attribute instance-attribute

City of the site's address.

country = Field(default=None, title='Country', description="Country of the site's address.") class-attribute instance-attribute

Country of the site's address.

name = Field(default=None, title='Site Name', description='The name of the site/website.') class-attribute instance-attribute

The name of the site/website.

phone = Field(default=None, title='Phone Number', description='Contact phone number for the site.') class-attribute instance-attribute

Contact phone number for the site.

province = Field(default=None, title='Province/State', description="Province or state of the site's address.") class-attribute instance-attribute

Province or state of the site's address.

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.

Video

Bases: BaseAsset

Video asset model.

VideoCreate

Bases: BaseAssetCreate

Create model for video assets.

file = Field(..., title='File', description='Video file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)') class-attribute instance-attribute

Video file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)

normalize_file()

Convert file paths or bytes to FileInput.

validate_video_file(v) classmethod

Ensure we're uploading a video file.

VideoUpdate

Bases: BaseAssetUpdate

Update model for video assets - file cannot be updated.