Просмотр исходного кода

Create route to rotate api key.

Lee Morgan 2 месяцев назад
Родитель
Сommit
df713455ff
2 измененных файлов с 51 добавлено и 0 удалено
  1. 3 0
      docs/openapi.yaml
  2. 48 0
      docs/paths/home/rotate_key.yaml

+ 3 - 0
docs/openapi.yaml

@@ -58,6 +58,9 @@ paths:
   /home/{home_id}:
     delete:
       $ref: "./paths/home/delete.yaml"
+  /home/{home_id}/apikey/:
+    post:
+      $ref: "./paths/home/rotate_key.yaml"
 
   #Devices
   /home/{home_id}/device:

+ 48 - 0
docs/paths/home/rotate_key.yaml

@@ -0,0 +1,48 @@
+operationId: homeRotateKey
+summary: Rotate API Key
+security:
+  - UserAuth: []
+description: Rotate the API key
+tags: [Home]
+parameters:
+  - name: home_id
+    in: path
+    description: ID of home
+    required: true
+    schema:
+      type: string
+      format: uuid
+      example: c27f3ac5-c6e7-4cda-a383-26115e6f5620
+requestBody:
+  content:
+    application/json:
+      schema:
+        type: object
+        required:
+          - password
+        properties:
+          password:
+            type: string
+            description: Current user password
+            example: password123
+
+responses:
+  "200":
+    description: "API key changed (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"