From e26be9ca4ee1a870a2a9aaff9158347041d0ef83 Mon Sep 17 00:00:00 2001
From: David Trattnig <david@subsquare.at>
Date: Thu, 18 May 2023 13:54:54 +0200
Subject: [PATCH] feat: ablity to generate steering API model

---
 .openapi-client-steering.yml  |  2 +
 Makefile                      |  6 ++-
 schemas/openapi-steering.json | 92 +++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 .openapi-client-steering.yml
 create mode 100644 schemas/openapi-steering.json

diff --git a/.openapi-client-steering.yml b/.openapi-client-steering.yml
new file mode 100644
index 00000000..2122f947
--- /dev/null
+++ b/.openapi-client-steering.yml
@@ -0,0 +1,2 @@
+project_name_override: .build
+package_name_override: aura_steering_api
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 857dace8..1f6bef0a 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,11 @@ build.models::
 	cp -r .build/aura_tank_api/models src/aura_tank_api
 	cp .build/aura_tank_api/py.typed src/aura_tank_api
 	cp .build/aura_tank_api/types.py src/aura_tank_api
-
+	rm -rf .build
+	poetry run openapi-python-client generate --path schemas/openapi-steering.json --config .openapi-client-steering.yml
+	cp -r .build/aura_steering_api/models src/aura_steering_api
+	cp .build/aura_steering_api/py.typed src/aura_steering_api
+	cp .build/aura_steering_api/types.py src/aura_steering_api
 
 lint::
 	poetry run python3 -m flake8 .
diff --git a/schemas/openapi-steering.json b/schemas/openapi-steering.json
new file mode 100644
index 00000000..345e5775
--- /dev/null
+++ b/schemas/openapi-steering.json
@@ -0,0 +1,92 @@
+{
+    "openapi": "3.0.3",
+    "info": {
+        "title": "AURA Steering API",
+        "version": "1.0.0",
+        "description": "Programme/schedule management for Aura"
+    },
+    "paths": {},
+    "components": {
+        "schemas": {
+            "Timeslot": {
+                "type": "object",
+                "properties": {
+                    "id": {
+                        "type": "integer"
+                    },
+                    "start": {
+                        "type": "string",
+                        "format": "date-time"
+                    },
+                    "end": {
+                        "type": "string",
+                        "format": "date-time"
+                    },
+                    "title": {
+                        "type": "integer"
+                    },
+                    "schedule_id": {
+                        "type": "integer"
+                    },
+                    "is_repetition": {
+                        "type": "boolean",
+                        "nullable": true
+                    },
+                    "playlist_id": {
+                        "type": "integer",
+                        "nullable": true
+                    },
+                    "schedule_default_playlist_id": {
+                        "type": "integer",
+                        "nullable": true
+                    },
+                    "show_default_playlist_id": {
+                        "type": "integer",
+                        "nullable": true
+                    },
+                    "show_id": {
+                        "type": "integer"
+                    },
+                    "show_name": {
+                        "type": "string"
+                    },
+                    "show_hosts": {
+                        "type": "string"
+                    },
+                    "show_type": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "show_categories": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "show_topics": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "show_musicfocus": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "show_languages": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "show_fundingcategory": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "memo": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "className": {
+                        "type": "string",
+                        "nullable": true
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
-- 
GitLab