From 4f15eee72bcd3873a0edb61bc77638a0ff5e3724 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Sat, 8 Jun 2024 11:24:30 +0200 Subject: [PATCH] API doc changes --- src/routes/Control.svelte | 4 +--- static/swagger.json | 8 +++++--- static/swagger.yml | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/routes/Control.svelte b/src/routes/Control.svelte index 9475ac9..88502d2 100644 --- a/src/routes/Control.svelte +++ b/src/routes/Control.svelte @@ -18,7 +18,6 @@ export let settings = {}; export let customText: string; - export let ledColor: string = '#FFCC00'; export let status: Writable<{ leds: [] }>; let ledStatus = []; let keepLedsSameColor = false; @@ -41,8 +40,7 @@ }; const setLEDcolor = () => { - console.log(`${PUBLIC_BASE_URL}/api/lights/${ledColor}`); - fetch(`${PUBLIC_BASE_URL}/api/lights`, { + fetch(`${PUBLIC_BASE_URL}/api/lights/set`, { headers: { 'Content-Type': 'application/json' }, diff --git a/static/swagger.json b/static/swagger.json index 2c68675..04efa57 100644 --- a/static/swagger.json +++ b/static/swagger.json @@ -43,7 +43,7 @@ "content": { "application/json": { "schema": { - "$ref": null + "$ref": "#/components/schemas/ArrayOfLeds" } } } @@ -202,7 +202,9 @@ } } } - }, + } + }, + "/lights/set": { "patch": { "tags": ["lights"], "summary": "Set individual LEDs", @@ -225,7 +227,7 @@ } } }, - "/lights/{color}": { + "/lights/color/{color}": { "get": { "tags": ["lights"], "summary": "Turn on LEDs with specific color", diff --git a/static/swagger.yml b/static/swagger.yml index 6ed774d..15d918c 100644 --- a/static/swagger.yml +++ b/static/swagger.yml @@ -33,7 +33,7 @@ paths: content: application/json: schema: - $ref: #/components/schemas/ArrayOfLeds + $ref: '#/components/schemas/ArrayOfLeds' post: tags: - system @@ -139,6 +139,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ArrayOfLeds' + /lights/set: patch: tags: - lights @@ -153,7 +154,7 @@ paths: description: succesful operation '400': description: invalid colors or wrong amount of LEDs - /lights/{color}: + /lights/color/{color}: get: tags: - lights