From 0203b5b1541eec7ba78f5404e0687c3e702c4f1d Mon Sep 17 00:00:00 2001 From: Timothy Date: Tue, 7 Jul 2026 18:31:46 +0200 Subject: [PATCH] chore(api): regenerate OpenAPI spec for templates + block copy endpoints #144 S2 (#162) Co-Authored-By: Claude Fable 5 --- ErsatzTV/wwwroot/openapi/v1.json | 1034 ++++++++++++++++++++++++++++++ 1 file changed, 1034 insertions(+) diff --git a/ErsatzTV/wwwroot/openapi/v1.json b/ErsatzTV/wwwroot/openapi/v1.json index eb41db993..fb3b9e7ed 100644 --- a/ErsatzTV/wwwroot/openapi/v1.json +++ b/ErsatzTV/wwwroot/openapi/v1.json @@ -770,6 +770,113 @@ } } }, + "/api/blocks/{id}/copy": { + "post": { + "tags": [ + "Blocks" + ], + "summary": "Copy a block", + "description": "Copies the block and its items into another (or the same) block group under a new name.", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/CopyBlockRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CopyBlockRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CopyBlockRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CopyBlockRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/BlockResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/BlockResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/BlockResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, "/api/channels": { "get": { "tags": [ @@ -7041,6 +7148,714 @@ } } }, + "/api/templates/groups": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get all template groups", + "operationId": "GetTemplateGroups", + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + } + } + } + } + } + }, + "post": { + "tags": [ + "Templates" + ], + "summary": "Create a template group", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateGroupRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateGroupRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateGroupRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateGroupRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TemplateGroupResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/api/templates/groups/{id}": { + "delete": { + "tags": [ + "Templates" + ], + "summary": "Delete a template group", + "description": "Deletes the template group. The database cascade removes every template (and its items) in the group.", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/api/templates": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get all templates", + "description": "Returns every template. Pass templateGroupId to filter to the templates in a single template group.", + "parameters": [ + { + "name": "templateGroupId", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + } + } + } + } + }, + "post": { + "tags": [ + "Templates" + ], + "summary": "Create a template", + "description": "Creates an empty template in the given template group.", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateTemplateRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/api/templates/{id}": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get a template by id", + "operationId": "GetTemplateById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Templates" + ], + "summary": "Delete a template", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "Templates" + ], + "summary": "Replace a template and its items", + "description": "Replaces the template's name and its full item list. Each item assigns a block to a start time of day; items must not overlap (an item's end time is its start time plus the assigned block's duration).", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/ReplaceTemplateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReplaceTemplateRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ReplaceTemplateRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/ReplaceTemplateRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TemplateWithItemsResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateWithItemsResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TemplateWithItemsResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/api/templates/{id}/items": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get template items", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateItemResponseModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateItemResponseModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateItemResponseModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/api/templates/{id}/copy": { + "post": { + "tags": [ + "Templates" + ], + "summary": "Copy a template", + "description": "Copies the template and its items into another (or the same) template group under a new name.", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/CopyTemplateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CopyTemplateRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CopyTemplateRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CopyTemplateRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TemplateResponseModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, "/api/trakt/lists": { "get": { "tags": [ @@ -9465,6 +10280,44 @@ } } }, + "CopyBlockRequest": { + "required": [ + "blockGroupId", + "name" + ], + "type": "object", + "properties": { + "blockGroupId": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": [ + "null", + "string" + ] + } + } + }, + "CopyTemplateRequest": { + "required": [ + "templateGroupId", + "name" + ], + "type": "object", + "properties": { + "templateGroupId": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": [ + "null", + "string" + ] + } + } + }, "CreateBlockGroupRequest": { "required": [ "name" @@ -10531,6 +11384,39 @@ } } }, + "CreateTemplateGroupRequest": { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": [ + "null", + "string" + ] + } + } + }, + "CreateTemplateRequest": { + "required": [ + "templateGroupId", + "name" + ], + "type": "object", + "properties": { + "templateGroupId": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": [ + "null", + "string" + ] + } + } + }, "CreateWatermarkRequest": { "required": [ "name", @@ -12526,6 +13412,30 @@ } } }, + "ReplaceTemplateRequest": { + "required": [ + "name", + "items" + ], + "type": "object", + "properties": { + "name": { + "type": [ + "null", + "string" + ] + }, + "items": { + "type": [ + "null", + "array" + ], + "items": { + "$ref": "#/components/schemas/TemplateItemRequest" + } + } + } + }, "RerunCollectionViewModel": { "required": [ "id", @@ -13097,6 +14007,127 @@ ], "type": "string" }, + "TemplateGroupResponseModel": { + "required": [ + "id", + "name", + "templateCount" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "templateCount": { + "type": "integer", + "format": "int32" + } + } + }, + "TemplateItemRequest": { + "required": [ + "blockId", + "startTime" + ], + "type": "object", + "properties": { + "blockId": { + "type": "integer", + "format": "int32" + }, + "startTime": { + "pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$", + "type": "string" + } + } + }, + "TemplateItemResponseModel": { + "required": [ + "blockId", + "blockName", + "blockMinutes", + "startTime" + ], + "type": "object", + "properties": { + "blockId": { + "type": "integer", + "format": "int32" + }, + "blockName": { + "type": "string" + }, + "blockMinutes": { + "type": "integer", + "format": "int32" + }, + "startTime": { + "pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$", + "type": "string" + } + } + }, + "TemplateResponseModel": { + "required": [ + "id", + "templateGroupId", + "groupName", + "name" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "templateGroupId": { + "type": "integer", + "format": "int32" + }, + "groupName": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "TemplateWithItemsResponseModel": { + "required": [ + "id", + "templateGroupId", + "groupName", + "name", + "items" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "templateGroupId": { + "type": "integer", + "format": "int32" + }, + "groupName": { + "type": "string" + }, + "name": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateItemResponseModel" + } + } + } + }, "TraktListResponseModel": { "required": [ "id", @@ -14506,6 +15537,9 @@ { "name": "Smart Collections" }, + { + "name": "Templates" + }, { "name": "Trakt" },