266 lines
6.6 KiB
JSON
266 lines
6.6 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"version": "1.0.0",
|
|
"title": "R/AGB",
|
|
"description": "Une API pour choisir les couleurs en agb. Il existe un endpoint SSE pour être notifié des mises à jour des couleurs à l'addresse [https://agb.hackens.org/api/sse](https://agb.hackens.org/api/sse). Une description du plan d'addressage au format JSON est disponible: [/api-docs/patch.json](/api-docs/patch.json). On peut récupérer le token d'API à l'addresse: [/token](/token)."
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://agb.hackens.org/api"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/values": {
|
|
"get": {
|
|
"summary": "Get the colors for all the channels",
|
|
"operationId": "getValues",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of colors",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Color"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Change multiple colors",
|
|
"description": "Change multiple colors. This request has a cooldown of 500ms.",
|
|
"operationId": "changeColors",
|
|
"security": [
|
|
{
|
|
"bearerAuth": [
|
|
"exp",
|
|
"scope",
|
|
"user",
|
|
"sub"
|
|
]
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "Colors to change",
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"address": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"value": {
|
|
"$ref": "#/components/schemas/Color"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Color updated successfully",
|
|
"content": {
|
|
}
|
|
},
|
|
"429": {
|
|
"description": "You're being rate-limited",
|
|
"content": {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/values/{id}": {
|
|
"get": {
|
|
"summary": "Get channel colors by ID",
|
|
"operationId": "find color by id",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "ID of color to fetch",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Color of specific channel",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Color"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Changes channel color",
|
|
"description": "Changes channel color",
|
|
"operationId": "changeColor",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "ID of color to fetch",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
}
|
|
}
|
|
],
|
|
"security": [
|
|
{
|
|
"bearerAuth": [
|
|
"exp",
|
|
"scope",
|
|
"user",
|
|
"sub"
|
|
]
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "Color to change",
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Color"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Color updated successfully",
|
|
"content": {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/control-box": {
|
|
"get": {
|
|
"summary": "Get control box information",
|
|
"operationId": "viewBox",
|
|
"parameters": [],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Control box info",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Box"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Change box state",
|
|
"description": "Changes box state, you need to be cof to act on this endpoint. The json do not need to contain all fields, it can be partial and only the provided values will be updated.",
|
|
"operationId": "changeBox",
|
|
"parameters": [],
|
|
"security": [
|
|
{
|
|
"bearerAuth": [
|
|
"exp",
|
|
"scope",
|
|
"user",
|
|
"is_cof",
|
|
"sub"
|
|
]
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "Box state",
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Box"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Box state updated successfully",
|
|
"content": {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Color": {
|
|
"type": "object",
|
|
"required": [
|
|
"red",
|
|
"green",
|
|
"blue"
|
|
],
|
|
"properties": {
|
|
"red": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
},
|
|
"green": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
},
|
|
"blue": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
}
|
|
}
|
|
},
|
|
"Box": {
|
|
"type": "object",
|
|
"required": [ ],
|
|
"properties": {
|
|
"pan": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
},
|
|
"tilt": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
},
|
|
"focus": {
|
|
"type": "integer",
|
|
"format": "int8"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"bearerAuth": {
|
|
"type": "http",
|
|
"scheme": "bearer",
|
|
"bearerFormat": "JWT"
|
|
}
|
|
}
|
|
}
|
|
}
|