Sfoglia il codice sorgente

Create docs for send signal route

Lee Morgan 2 mesi fa
parent
commit
30902b07df
2 ha cambiato i file con 70 aggiunte e 0 eliminazioni
  1. 3 0
      docs/openapi.yaml
  2. 67 0
      docs/paths/device/signal.yaml

+ 3 - 0
docs/openapi.yaml

@@ -66,3 +66,6 @@ paths:
   /home/{home_id}/device/{device_id}:
     delete: 
       $ref: "./paths/device/delete.yaml"
+  /home/{home_id}?device/{device_id}/signal:
+    post:
+      $ref: "./paths/device/signal.yaml"

+ 67 - 0
docs/paths/device/signal.yaml

@@ -0,0 +1,67 @@
+operationId: deviceSignal
+summary: Send Signal
+security:
+  - UserAuth: []
+description: Send a signal to a device to control it
+tags: [Device]
+parameters:
+  - name: home_id
+    in: path
+    description: ID of the home the device belongs to
+    required: true
+    schema:
+      type: string
+      format: uuid
+      example: 019e1d64-6ad9-71e8-a976-ae99ad44c678
+  - name: device_id
+    in: path
+    description: ID of the device
+    required: true
+    schema:
+      type: string
+      format: uuid
+      example: 019e1d65-01ad-78b0-a70a-7200523c548f
+requestBody:
+  content:
+    application/json:
+      schema:
+        type: object
+        required:
+          - device_type
+          - signal
+        properties:
+          device_type:
+            type: string
+            description: Type of the device
+            example: on_off_switch
+            enum:
+              - on_off_switch
+          signal:
+            description: Command to send (must match device_type)
+            oneOf:
+              - type: string
+                description: on_off_switch
+                enum:
+                  - on
+                  - off
+
+responses:
+  "200":
+    description: "Signal success (always returns '{success: true}')"
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            success:
+              type: boolean
+  "400":
+    $ref: "#/components/responses/400"
+  "401":
+    $ref: "#/components/responses/401"
+  "403":
+    $ref: "#/components/responses/403"
+  "404":
+    $ref: "#/components/responses/404"
+  "500":
+    $ref: "#/components/responses/500"