{
    "openapi": "3.0.3",
    "info": {
        "title": "Ticos Systems Update Portal \u2014 Client API",
        "version": "1.0.0",
        "description": "Versionen abfragen und Binaries herunterladen. Auth: Bearer-Token pro Client."
    },
    "servers": [
        {
            "url": "https://updates.ticos-systems.cloud"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "Artifact": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "platform": {
                        "type": "string"
                    },
                    "arch": {
                        "type": "string",
                        "nullable": true
                    },
                    "file_type": {
                        "type": "string"
                    },
                    "filename": {
                        "type": "string"
                    },
                    "size": {
                        "type": "integer"
                    },
                    "sha256": {
                        "type": "string"
                    },
                    "signature": {
                        "type": "string",
                        "nullable": true
                    },
                    "signature_type": {
                        "type": "string",
                        "nullable": true
                    },
                    "download_url": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            },
            "Version": {
                "type": "object",
                "properties": {
                    "version": {
                        "type": "string"
                    },
                    "version_code": {
                        "type": "integer",
                        "nullable": true
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "release_notes": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_mandatory": {
                        "type": "boolean"
                    },
                    "min_supported_version": {
                        "type": "string",
                        "nullable": true
                    },
                    "released_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "channels": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "artifacts": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Artifact"
                        }
                    }
                }
            }
        }
    },
    "paths": {
        "/api/v1/apps": {
            "get": {
                "summary": "Erlaubte Apps + Channels auflisten",
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Nicht authentifiziert"
                    },
                    "403": {
                        "description": "Keine Berechtigung"
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    },
                    "422": {
                        "description": "Validierungsfehler"
                    }
                }
            }
        },
        "/api/v1/apps/{app}/channels/{channel}/latest": {
            "get": {
                "summary": "Neueste ver\u00f6ffentlichte Version im Channel",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Version"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Nicht authentifiziert"
                    },
                    "403": {
                        "description": "Keine Berechtigung"
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    },
                    "422": {
                        "description": "Validierungsfehler"
                    }
                },
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "channel",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "platform",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "arch",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/api/v1/apps/{app}/channels/{channel}/versions": {
            "get": {
                "summary": "Versionsliste (paginiert)",
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Nicht authentifiziert"
                    },
                    "403": {
                        "description": "Keine Berechtigung"
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    },
                    "422": {
                        "description": "Validierungsfehler"
                    }
                },
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "channel",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/api/v1/apps/{app}/versions/{version}": {
            "get": {
                "summary": "Versionsdetails",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Version"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Nicht authentifiziert"
                    },
                    "403": {
                        "description": "Keine Berechtigung"
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    },
                    "422": {
                        "description": "Validierungsfehler"
                    }
                },
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "version",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/api/v1/checkin": {
            "post": {
                "summary": "Installierte Version melden",
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Nicht authentifiziert"
                    },
                    "403": {
                        "description": "Keine Berechtigung"
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    },
                    "422": {
                        "description": "Validierungsfehler"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "app": {
                                        "type": "string"
                                    },
                                    "installed_version": {
                                        "type": "string"
                                    },
                                    "channel": {
                                        "type": "string"
                                    },
                                    "platform": {
                                        "type": "string"
                                    },
                                    "arch": {
                                        "type": "string"
                                    },
                                    "os_version": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/download/{artifact}": {
            "get": {
                "summary": "Bin\u00e4r-Download \u00fcber signierte URL",
                "description": "Die vollst\u00e4ndige URL stammt aus dem latest-/version-Endpunkt (Felder expires & signature). Kein Bearer-Token n\u00f6tig.",
                "security": [],
                "parameters": [
                    {
                        "name": "artifact",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "expires",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "signature",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Bin\u00e4rdatei (octet-stream)"
                    },
                    "403": {
                        "description": "Signatur ung\u00fcltig/abgelaufen"
                    }
                }
            }
        }
    }
}