Skip to content

Data Models

小树 edited this page Aug 2, 2026 · 2 revisions

All models use frozen, slotted dataclasses. Attribute assignment is blocked, but contained dictionaries and arbitrary values are not deeply immutable.

Documents

V1Document

Contains friendly_name, link, func, apicore_version, parameters, response, intro, and icon.

V2Document

Adds configs, handlers, and v2.1 metadata fields. Python field schema_url represents the source $schema key. Unknown root fields are preserved in extra.

Document is the union of V1Document and V2Document.

Parameters

Parameter

Represents standard or custom parameters. Common fields include:

Field Meaning
enable Whether the UI exposes the parameter
name Request parameter name
type Standard or custom type name
required Whether an empty value is submitted
value Default or selected value
friendly_name String or v2.1 language map
options v2.1 enum options
friendly_options Labels corresponding to options
show_if v2.1 conditional UI rule
extra Unknown custom parameter fields

ShowIf

Python field in_values represents the source in key. Exactly one of equals or in_values is present in validated documents.

Responses

  • ResponseImage: legacy image mapping.
  • ResponseMedia: v2.1 image, audio, video, text, Markdown, or file mapping.
  • ResponseDataField: one additional extracted value.
  • ResponseGroup: a labeled collection of additional values.
  • ResponseConfig: response mappings and preferred_media compatibility property.

ResponseConfig.preferred_media returns media directly when present. For image-only documents it creates an equivalent ResponseMedia(type="image", ...) adapter.

Request And Runtime Configuration

  • RequestConfig: headers, timeout, body type, and body template.
  • RetryPolicy: network retry count and delay.
  • RateLimit: frequency and time unit.
  • PollingConfig: asynchronous task polling settings.
  • Configs: optional aggregate of these settings.

The library validates these settings but does not execute requests, retries, rate limits, or polling.

Handlers

HandlerRule represents one HTTP status action. Supported actions are response, success, warning, error, message, browser, run, retry, and return.

The library never opens browser links or executes scripts. Applications must treat run as untrusted high-risk input and require explicit authorization before execution.

Type Aliases

  • APICoreFamily: v1 or v2
  • APICoreVersion: compatibility alias for the public family values v1 or v2
  • APICoreSpecVersion: exact document specification version 1.0, 2.0, or 2.1
  • VersionSelector: accepted API override values
  • FormatName: json, yaml, or toml
  • I18nString: plain string or locale-to-string mapping

Clone this wiki locally