燈光
燈光資源與畫布和當前播放的特效進行互動。您可以在此查看當前特效、更改它、更改其預設,或迭代使用者所有已安裝的特效。
| 方法 | 端點 |
|---|---|
| GET | lighting |
| PATCH | lighting/global_brightness |
| PATCH | lighting/enabled |
| GET | lighting/effects |
| GET | lighting/effect/:id |
| GET | lighting/effect/:id/presets |
| PATCH | lighting/effect/:id/presets |
| POST | lighting/effect/:id/apply |
| GET | lighting/next |
| POST | lighting/next |
| GET | lighting/previous |
| POST | lighting/previous |
| POST | lighting/shuffle |
獲取當前特效
Section titled “獲取當前特效”獲取有關當前播放特效、全域亮度和畫布播放狀態的資訊。如需要,可使用 self 連結獲取有關此特效的更多資訊。
curl http://localhost:16038/api/v1/lighting{ "api_version": "1.0", "data": { "attributes": { "enabled": true, "global_brightness": 50, "name": "Neon Shift" }, "id": "Neon Shift.html", "links": { "self": "/api/v1/lighting/effects/Neon Shift.html" }, "type": "current_effect" }, "id": 6, "method": "/api/v1/lighting", "params": {}, "status": "ok"}設定全域亮度
Section titled “設定全域亮度”設定當前全域亮度。
curl -X PATCH -d "{\"global_brightness\":73}" http://localhost:16038/api/v1/lighting/global_brightness{ "api_version": "1.0", "data": { "attributes": { "enabled": true, "global_brightness": 73 }, "type": "effect" }, "id": 3, "method": "/api/v1/lighting/global_brightness", "params": { "body": { "global_brightness": 73 } }, "status": "ok"}播放/暫停畫布
Section titled “播放/暫停畫布”設定畫布是否當前活躍。停用時,所有裝置的所有顏色請求將接收黑色(#000000)。
curl -X PATCH -d "{\"enabled\":false}" http://localhost:16038/api/v1/lighting/enabled{ "api_version": "1.0", "data": { "attributes": { "enabled": false, "global_brightness": 73 }, "type": "effect" }, "id": 4, "method": "/api/v1/lighting/enabled", "params": { "body": { "enabled": false } }, "status": "ok"}獲取已安裝的特效
Section titled “獲取已安裝的特效”返回使用者所有已安裝特效的列表。
- 鑑於此端點的潛在有效載荷大小,應注意減少對其的呼叫次數。
curl http://localhost:16038/api/v1/lighting/effects{ "apiVersion": "1.0", "data": { "items": [ { "attributes": { "name": " Wolfenstein II: TNC" }, "id": "-MQtFeX-o2hMR6sv8aFr", "links": { "apply": "/api/v1/lighting/effects/-MQtFeX-o2hMR6sv8aFr/apply", "self": "/api/v1/lighting/effects/-MQtFeX-o2hMR6sv8aFr" }, "type": "effect" }, { "attributes": { "name": "4th Dimension" }, "id": "-N-YhDDs2ZIGJ42azDgJ", "links": { "apply": "/api/v1/lighting/effects/-N-YhDDs2ZIGJ42azDgJ/apply", "self": "/api/v1/lighting/effects/-N-YhDDs2ZIGJ42azDgJ" }, "type": "effect" }, ... ], "type": "effects" }, "id": 7, "method": "/api/v1/lighting/effects", "params": {}, "status": "ok"}獲取特效資訊
Section titled “獲取特效資訊”返回有關特定特效的詳細資訊。
- 如果給定的特效 id 不存在,此端點將返回 404 錯誤。
curl http://localhost:16038/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS{ "api_version": "1.0", "data": { "attributes": { "description": "A colorful drizzle of softly moving lines.", "developer_effect": false, "image": "https://imagedelivery.net/uPA_EtOZxmT3DaI0aRG2mQ/-Mg1qujV9F4rabJxlSOS/main/dashcard", "name": "Drizzle", "parameters": { "backColorMode": { "label": "Background Color Mode", "type": "combobox", "value": "Static" }, "backHue": { "label": "Background Color (Static)", "type": "color", "value": "#320056" }, "confHue": { "label": "Line Color (Static)", "type": "color", "value": "#ff0000" }, "confLength": { "label": "Line Length", "type": "number", "value": 70 } }, "publisher": "SignalRGB", "uses_audio": false, "uses_input": false, "uses_meters": false, "uses_video": false }, "id": "-Mg1qujV9F4rabJxlSOS", "links": { "apply": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/apply", "self": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS" }, "type": "effect" }, "id": 1, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS", "params": { "id": "-Mg1qujV9F4rabJxlSOS" }, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "404", "detail": "The requested effect was not found", "title": "Not Found" } ], "id": 2, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSO", "params": { "id": "-Mg1qujV9F4rabJxlSO" }, "status": "error"}獲取特效預設
Section titled “獲取特效預設”返回此特效的可用預設列表。
- 如果給定的特效 id 不存在,此端點將返回 404 錯誤。
curl http://localhost:16038/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/presets{ "api_version": "1.0", "data": { "id": "-Mg1qujV9F4rabJxlSOS", "items": [ { "id": "My Fancy Preset 1", "type": "preset" }, { "id": "My Other Preset", "type": "preset" } ], "type": "presets" }, "id": 1, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/presets", "params": { "id": "-Mg1qujV9F4rabJxlSOS" }, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "404", "detail": "The requested effect was not found", "title": "Not Found" } ], "id": 4, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSS/presets", "params": { "id": "-Mg1qujV9F4rabJxlSS" }, "status": "error"}應用特效預設
Section titled “應用特效預設”應用給定特效 id 的目標特效預設。
- 如果給定的特效 id 或預設不存在,此端點將返回 404 錯誤。
curl -X PATCH -d "{\"preset\":\"My Fancy Preset 1\"}" http://localhost:16038/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/presets應用給定的特效 id(如果存在)。
- 如果給定的特效 id 不存在,此端點將返回 404 錯誤。
curl -X POST http://localhost:16038/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/apply{ "api_version": "1.0", "id": 3, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS/apply", "params": { "id": "-Mg1qujV9F4rabJxlSOS" }, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "404", "detail": "The requested effect was not found", "title": "Not Found" } ], "id": 4, "method": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSS/apply", "params": { "id": "-Mg1qujV9F4rabJxlSS" }, "status": "error"}獲取下一個特效
Section titled “獲取下一個特效”如果可用,返回歷史記錄中下一個特效的資訊。如果特效歷史記錄不包含下一個特效,則此端點將返回 409 錯誤。
curl http://localhost:16038/api/v1/lighting/next{ "api_version": "1.0", "data": { "attributes": { "name": "Drizzle" }, "id": "-Mg1qujV9F4rabJxlSOS", "links": { "self": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS" }, "type": "effect" }, "id": 5, "method": "/api/v1/lighting/next", "params": {}, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "409", "detail": "Effect History doesn't contain a next effect", "title": "No Next Effect" } ], "id": 24, "method": "/api/v1/lighting/next", "params": {}, "status": "error"}應用下一個特效
Section titled “應用下一個特效”模擬對當前播放特效的媒體快進操作。如果歷史記錄中沒有下一個特效,SignalRGB 將隨機切換到一個已安裝的非遊戲整合、非開發者特效。
返回新應用的特效。
curl -X POST http://localhost:16038/api/v1/lighting/next{ "api_version": "1.0", "data": { "attributes": { "name": "Drizzle" }, "id": "-Mg1qujV9F4rabJxlSOS", "links": { "self": "/api/v1/lighting/effects/-Mg1qujV9F4rabJxlSOS" }, "type": "effect" }, "id": 5, "method": "/api/v1/lighting/next", "params": {}, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "409", "detail": "Effect History doesn't contain a next effect", "title": "No Next Effect" } ], "id": 24, "method": "/api/v1/lighting/next", "params": {}, "status": "error"}獲取上一個特效
Section titled “獲取上一個特效”如果可用,返回歷史記錄中上一個特效的資訊。如果特效歷史記錄不包含上一個特效,則此端點將返回 409 錯誤。
curl http://localhost:16038/api/v1/lighting/previous{ "api_version": "1.0", "data": { "attributes": { "name": "Gradient Generator" }, "id": "-MA7wCKkv_359cmwPOEK", "links": { "self": "/api/v1/lighting/effects/-MA7wCKkv_359cmwPOEK" }, "type": "effect" }, "id": 7, "method": "/api/v1/lighting/previous", "params": {}, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "409", "detail": "Effect History doesn't contain a previous effect", "title": "No Previous Effect" } ], "id": 15, "method": "/api/v1/lighting/previous", "params": {}, "status": "error"}應用上一個特效
Section titled “應用上一個特效”模擬對當前播放特效的媒體倒退操作。如果歷史記錄中沒有上一個特效,則返回 409 錯誤。
返回新應用的特效。
curl -X POST http://localhost:16038/api/v1/lighting/previous{ "api_version": "1.0", "data": { "attributes": { "name": "Gradient Generator" }, "id": "-MA7wCKkv_359cmwPOEK", "links": { "self": "/api/v1/lighting/effects/-MA7wCKkv_359cmwPOEK" }, "type": "effect" }, "id": 7, "method": "/api/v1/lighting/previous", "params": {}, "status": "ok"}{ "api_version": "1.0", "errors": [ { "code": "409", "detail": "Effect History doesn't contain a previous effect", "title": "No Previous Effect" } ], "id": 15, "method": "/api/v1/lighting/previous", "params": {}, "status": "error"}應用隨機特效
Section titled “應用隨機特效”模擬對當前播放特效的媒體隨機播放操作。SignalRGB 將隨機切換到一個已安裝的非遊戲整合、非開發者特效。
返回新應用的特效。
curl -X POST http://localhost:16038/api/v1/lighting/shuffle{ "api_version": "1.0", "data": { "attributes": { "name": "Borealis" }, "id": "-N1LC8HkC4fZ6IlFA30j", "links": { "self": "/api/v1/lighting/effects/-N1LC8HkC4fZ6IlFA30j" }, "type": "effect" }, "id": 6, "method": "/api/v1/lighting/shuffle", "params": {}, "status": "ok"}