Files
pigway-frame-flow/tests/schema-contract.json
T

757 lines
15 KiB
JSON
Raw Normal View History

{
"Device": {
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"driver": {
"type": "string",
"const": "kokonna",
"title": "Driver",
"default": "kokonna"
},
"status": {
"type": "string",
"enum": [
"online",
"offline"
],
"title": "Status"
},
"model": {
"type": "string",
"title": "Model"
},
"model_code": {
"type": "string",
"title": "Model Code"
},
"firmware": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Firmware"
},
"display": {
"$ref": "#/components/schemas/DisplayGeometry"
},
"power": {
"$ref": "#/components/schemas/Power"
},
"current_content": {
"$ref": "#/components/schemas/CurrentContent"
},
"last_seen_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Last Seen At"
},
"timezone": {
"type": "string",
"title": "Timezone"
},
"capabilities": {
"$ref": "#/components/schemas/Capabilities"
},
"slideshow": {
"additionalProperties": true,
"type": "object",
"title": "Slideshow"
},
"storage_used_bytes": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Storage Used Bytes"
},
"model_verified": {
"type": "boolean",
"title": "Model Verified",
"default": false
},
"can_restore": {
"type": "boolean",
"title": "Can Restore",
"default": false
}
},
"type": "object",
"required": [
"id",
"name",
"status",
"model",
"model_code",
"firmware",
"display",
"power",
"current_content",
"last_seen_at",
"timezone"
],
"title": "Device"
},
"Capabilities": {
"properties": {
"upload": {
"type": "boolean",
"title": "Upload",
"default": true
},
"gallery": {
"type": "boolean",
"title": "Gallery",
"default": true
},
"delete": {
"type": "boolean",
"title": "Delete",
"default": true
},
"switch": {
"type": "boolean",
"title": "Switch",
"default": true
},
"remote_refresh": {
"type": "boolean",
"title": "Remote Refresh",
"default": true
},
"battery": {
"type": "boolean",
"title": "Battery",
"default": true
},
"color": {
"type": "boolean",
"title": "Color",
"default": true
},
"cloud_upload_without_display": {
"type": "boolean",
"title": "Cloud Upload Without Display",
"default": false
}
},
"type": "object",
"title": "Capabilities"
},
"DisplayGeometry": {
"properties": {
"width": {
"type": "integer",
"title": "Width"
},
"height": {
"type": "integer",
"title": "Height"
},
"rotation": {
"type": "integer",
"title": "Rotation"
},
"color_mode": {
"$ref": "#/components/schemas/Profile",
"default": "color"
}
},
"type": "object",
"required": [
"width",
"height",
"rotation"
],
"title": "DisplayGeometry"
},
"Power": {
"properties": {
"battery_percent": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Battery Percent"
},
"charging": {
"type": "boolean",
"title": "Charging"
}
},
"type": "object",
"required": [
"battery_percent",
"charging"
],
"title": "Power"
},
"CurrentContent": {
"properties": {
"type": {
"type": "string",
"const": "image",
"title": "Type",
"default": "image"
},
"id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Id"
},
"cover_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Cover Id"
},
"synced": {
"type": "boolean",
"title": "Synced"
}
},
"type": "object",
"required": [
"id",
"cover_id",
"synced"
],
"title": "CurrentContent"
},
"GalleryImage": {
"properties": {
"width": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Width"
},
"height": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Height"
},
"size_bytes": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Size Bytes"
},
"media_type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Media Type"
},
"image_id": {
"type": "integer",
"title": "Image Id"
},
"name": {
"type": "string",
"title": "Name"
},
"created_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Created At"
},
"current": {
"type": "boolean",
"title": "Current"
},
"url": {
"type": "string",
"title": "Url"
}
},
"type": "object",
"required": [
"image_id",
"name",
"created_at",
"current",
"url"
],
"title": "GalleryImage"
},
"DisplayRequest": {
"properties": {
"device_id": {
"type": "string",
"title": "Device Id",
"default": "living-room"
},
"content": {
"oneOf": [
{
"$ref": "#/components/schemas/ImageContent"
},
{
"$ref": "#/components/schemas/URLContent"
},
{
"$ref": "#/components/schemas/TemplateContent"
},
{
"$ref": "#/components/schemas/FutureContent"
}
],
"title": "Content",
"discriminator": {
"propertyName": "type",
"mapping": {
"html": "#/components/schemas/FutureContent",
"image": "#/components/schemas/ImageContent",
"image_url": "#/components/schemas/URLContent",
"markdown": "#/components/schemas/FutureContent",
"template": "#/components/schemas/TemplateContent"
}
}
},
"options": {
"$ref": "#/components/schemas/Options"
},
"source": {
"$ref": "#/components/schemas/Source"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"content"
],
"title": "DisplayRequest"
},
"ImageContent": {
"properties": {
"type": {
"type": "string",
"const": "image",
"title": "Type"
},
"image_id": {
"anyOf": [
{
"type": "integer",
"exclusiveMinimum": 0.0
},
{
"type": "null"
}
],
"title": "Image Id"
},
"image_name": {
"anyOf": [
{
"type": "string",
"maxLength": 120,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Image Name"
},
"asset_id": {
"anyOf": [
{
"type": "string",
"pattern": "^[a-f0-9]{32}$"
},
{
"type": "null"
}
],
"title": "Asset Id"
},
"base64": {
"anyOf": [
{
"type": "string",
"maxLength": 28000000
},
{
"type": "null"
}
],
"title": "Base64"
},
"name": {
"type": "string",
"maxLength": 120,
"minLength": 1,
"title": "Name",
"default": "image.jpg"
},
"fit": {
"$ref": "#/components/schemas/Fit",
"default": "contain"
},
"profile": {
"$ref": "#/components/schemas/Profile",
"default": "color"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"type"
],
"title": "ImageContent"
},
"URLContent": {
"properties": {
"type": {
"type": "string",
"const": "image_url",
"title": "Type"
},
"url": {
"type": "string",
"maxLength": 2048,
"title": "Url"
},
"name": {
"type": "string",
"maxLength": 120,
"title": "Name",
"default": "image.jpg"
},
"fit": {
"$ref": "#/components/schemas/Fit",
"default": "contain"
},
"profile": {
"$ref": "#/components/schemas/Profile",
"default": "color"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"type",
"url"
],
"title": "URLContent"
},
"TemplateContent": {
"properties": {
"type": {
"type": "string",
"const": "template",
"title": "Type"
},
"template": {
"type": "string",
"pattern": "^[a-z0-9-]{1,60}$",
"title": "Template"
},
"data": {
"additionalProperties": true,
"type": "object",
"title": "Data"
},
"profile": {
"$ref": "#/components/schemas/Profile",
"default": "color"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"type",
"template"
],
"title": "TemplateContent"
},
"Options": {
"properties": {
"duration": {
"type": "integer",
"maximum": 604800.0,
"minimum": 0.0,
"title": "Duration",
"default": 0
},
"restore_previous": {
"type": "boolean",
"title": "Restore Previous",
"default": false
},
"priority": {
"type": "integer",
"maximum": 100.0,
"minimum": 0.0,
"title": "Priority",
"default": 50
}
},
"additionalProperties": false,
"type": "object",
"title": "Options"
},
"Accepted": {
"properties": {
"operation_id": {
"type": "string",
"title": "Operation Id"
},
"job_id": {
"type": "string",
"title": "Job Id"
},
"status": {
"type": "string",
"const": "accepted",
"title": "Status",
"default": "accepted"
}
},
"type": "object",
"required": [
"operation_id",
"job_id"
],
"title": "Accepted"
},
"Operation": {
"properties": {
"operation_id": {
"type": "string",
"title": "Operation Id"
},
"status": {
"$ref": "#/components/schemas/OperationStatus"
},
"device_id": {
"type": "string",
"title": "Device Id"
},
"created_at": {
"type": "string",
"title": "Created At"
},
"updated_at": {
"type": "string",
"title": "Updated At"
},
"result": {
"anyOf": [
{
"$ref": "#/components/schemas/OperationResult"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"$ref": "#/components/schemas/ErrorBody"
},
{
"type": "null"
}
]
},
"request_id": {
"type": "string",
"title": "Request Id"
},
"client_id": {
"type": "string",
"title": "Client Id"
},
"action": {
"type": "string",
"title": "Action"
}
},
"type": "object",
"required": [
"operation_id",
"status",
"device_id",
"created_at",
"updated_at",
"request_id",
"client_id",
"action"
],
"title": "Operation"
},
"OperationResult": {
"properties": {
"image_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Image Id"
},
"asset_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Asset Id"
},
"rendered_asset_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Rendered Asset Id"
},
"url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Url"
},
"deferred": {
"type": "boolean",
"title": "Deferred",
"default": false
}
},
"type": "object",
"title": "OperationResult"
},
"OperationStatus": {
"type": "string",
"enum": [
"QUEUED",
"RENDERING",
"UPLOADING",
"SYNCING",
"COMPLETED",
"FAILED",
"UNKNOWN"
],
"title": "OperationStatus"
},
"ErrorBody": {
"properties": {
"code": {
"$ref": "#/components/schemas/ErrorCode"
},
"message": {
"type": "string",
"title": "Message"
},
"request_id": {
"type": "string",
"title": "Request Id"
},
"details": {
"additionalProperties": true,
"type": "object",
"title": "Details"
}
},
"type": "object",
"required": [
"code",
"message",
"request_id"
],
"title": "ErrorBody"
},
"ErrorResponse": {
"properties": {
"error": {
"$ref": "#/components/schemas/ErrorBody"
}
},
"type": "object",
"required": [
"error"
],
"title": "ErrorResponse"
}
}