357 lines
6.5 KiB
JSON
357 lines
6.5 KiB
JSON
{
|
|
"openapi": "3.0.1",
|
|
"info": {
|
|
"title": "Scheduler API",
|
|
"description": "API for managing scheduled prompts. Cron expressions run in America/New_York (EST).",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "/",
|
|
"description": "Current server"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/api/schedules": {
|
|
"get": {
|
|
"summary": "List schedules",
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ok": {
|
|
"type": "boolean",
|
|
"example": true
|
|
},
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Schedule"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/Unauthorized"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Create or replace a schedule",
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ScheduleInput"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Schedule created or updated",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ok": {
|
|
"type": "boolean",
|
|
"example": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/BadRequest"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/Unauthorized"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/schedules/{name}": {
|
|
"delete": {
|
|
"summary": "Delete a schedule",
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "path",
|
|
"description": "Schedule name (raw or scoped)",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Schedule deleted"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/Unauthorized"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/Forbidden"
|
|
},
|
|
"404": {
|
|
"$ref": "#/components/responses/NotFound"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"securitySchemes": {
|
|
"BearerAuth": {
|
|
"type": "http",
|
|
"scheme": "bearer",
|
|
"bearerFormat": "JWT"
|
|
}
|
|
},
|
|
"schemas": {
|
|
"Schedule": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Scoped identifier used internally"
|
|
},
|
|
"displayName": {
|
|
"type": "string"
|
|
},
|
|
"userId": {
|
|
"type": "string"
|
|
},
|
|
"schedules": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"description": "Cron expression"
|
|
}
|
|
},
|
|
"startAt": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"nullable": true
|
|
},
|
|
"oneShot": {
|
|
"type": "boolean"
|
|
},
|
|
"templateRef": {
|
|
"$ref": "#/components/schemas/TemplateRef"
|
|
},
|
|
"prompt": {
|
|
"type": "string"
|
|
},
|
|
"model": {
|
|
"type": "string"
|
|
},
|
|
"tools": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"features": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"files": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fname": {
|
|
"type": "string"
|
|
},
|
|
"fkey": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"name",
|
|
"userId",
|
|
"schedules",
|
|
"oneShot"
|
|
]
|
|
},
|
|
"ScheduleInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"when": {
|
|
"$ref": "#/components/schemas/ScheduleWhen"
|
|
},
|
|
"oneShot": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"template": {
|
|
"$ref": "#/components/schemas/TemplateInput"
|
|
},
|
|
"parameters": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
},
|
|
"files": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fname": {
|
|
"type": "string"
|
|
},
|
|
"fkey": {
|
|
"type": "string",
|
|
"description": "Optional previously stored file reference"
|
|
},
|
|
"content": {
|
|
"type": "string",
|
|
"description": "Base64 encoded file contents"
|
|
}
|
|
},
|
|
"required": [
|
|
"fname"
|
|
]
|
|
}
|
|
},
|
|
"prompt": {
|
|
"type": "string"
|
|
},
|
|
"model": {
|
|
"type": "string"
|
|
},
|
|
"tools": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"features": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"name",
|
|
"when",
|
|
"template",
|
|
"parameters",
|
|
"prompt",
|
|
"model",
|
|
"tools"
|
|
]
|
|
},
|
|
"ScheduleWhen": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cron": {
|
|
"type": "string",
|
|
"description": "5-field cron expression evaluated in America/New_York"
|
|
},
|
|
"start": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"description": "Optional start gate; required when oneShot is true"
|
|
}
|
|
},
|
|
"required": []
|
|
},
|
|
"TemplateInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"clusterScope": {
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
},
|
|
"required": [
|
|
"name"
|
|
]
|
|
},
|
|
"TemplateRef": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"clusterScope": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"name"
|
|
]
|
|
}
|
|
},
|
|
"responses": {
|
|
"Unauthorized": {
|
|
"description": "Missing or invalid credentials"
|
|
},
|
|
"BadRequest": {
|
|
"description": "Invalid request payload",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ok": {
|
|
"type": "boolean",
|
|
"example": false
|
|
},
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Forbidden": {
|
|
"description": "Schedule exists but belongs to another user"
|
|
},
|
|
"NotFound": {
|
|
"description": "Schedule not found"
|
|
}
|
|
}
|
|
}
|
|
} |