灯光
灯光资源与画布和当前播放的效果进行交互。在这里您可以查看当前效果、更改效果、更改其预设,或遍历用户当前安装的所有效果。
| 方法 | 端点 |
|---|---|
| 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"}