Update api_docs.py
Browse files- api_docs.py +23 -19
api_docs.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
### api_docs.py
|
| 2 |
|
| 3 |
import json
|
|
|
|
| 4 |
|
| 5 |
api_docs = {
|
| 6 |
"base_url": "https://aivisions.no/data/daysoff/api/v1/booking/",
|
|
@@ -13,29 +14,35 @@ api_docs = {
|
|
| 13 |
"body": {
|
| 14 |
"booking_id": "string"
|
| 15 |
},
|
| 16 |
-
"headers": {
|
| 17 |
-
"Authorization": "Bearer <auth_token>",
|
| 18 |
-
"Content-Type": "application/json"
|
| 19 |
-
},
|
| 20 |
-
|
| 21 |
"response": {
|
| 22 |
"description": "A JSON object containing booking details for a specific booking id.",
|
| 23 |
"content_type": "application/json",
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
}
|
| 36 |
}
|
| 37 |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# --actual response handling with .get() and mapping entries methods are request handling code, not in here (API documentation).
|
| 40 |
#"response": {
|
| 41 |
#"description": "A JSON object containing booking details for a specific booking ID.",
|
|
@@ -52,6 +59,3 @@ api_docs = {
|
|
| 52 |
#"included": {"description": "Details of services included in the booking.", "mapping": "response.get('included', 'N/A')"}
|
| 53 |
#}
|
| 54 |
#}
|
| 55 |
-
|
| 56 |
-
api_docs_str = json.dumps(api_docs, indent=2)
|
| 57 |
-
api_docs_str
|
|
|
|
| 1 |
### api_docs.py
|
| 2 |
|
| 3 |
import json
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
api_docs = {
|
| 7 |
"base_url": "https://aivisions.no/data/daysoff/api/v1/booking/",
|
|
|
|
| 14 |
"body": {
|
| 15 |
"booking_id": "string"
|
| 16 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
"response": {
|
| 18 |
"description": "A JSON object containing booking details for a specific booking id.",
|
| 19 |
"content_type": "application/json",
|
| 20 |
+
"fields": {
|
| 21 |
+
"booking_id": "The unique identifier for the booking.",
|
| 22 |
+
"full_name": "The full name of the customer associated with the booking.",
|
| 23 |
+
"amount": "The total amount for the booking (integer).",
|
| 24 |
+
"checkin": "The check-in date for the booking.",
|
| 25 |
+
"checkout": "The check-out date for the booking.",
|
| 26 |
+
"address": "The address associated with the booking.",
|
| 27 |
+
"user_id": "The user ID associated with the booking (integer).",
|
| 28 |
+
"infotext": "Additional information related to the booking.",
|
| 29 |
+
"included": "Details of services included in the booking."
|
| 30 |
+
}
|
| 31 |
}
|
| 32 |
}
|
| 33 |
|
| 34 |
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
auth_token = os.environ.get("CHAINLIT_AUTH_SECRET")
|
| 38 |
+
headers = {
|
| 39 |
+
"Authorization": f"Bearer {auth_token}",
|
| 40 |
+
"Content-Type": "application/json"
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
api_docs_str = json.dumps(api_docs, indent=2)
|
| 44 |
+
api_docs_str
|
| 45 |
+
|
| 46 |
# --actual response handling with .get() and mapping entries methods are request handling code, not in here (API documentation).
|
| 47 |
#"response": {
|
| 48 |
#"description": "A JSON object containing booking details for a specific booking ID.",
|
|
|
|
| 59 |
#"included": {"description": "Details of services included in the booking.", "mapping": "response.get('included', 'N/A')"}
|
| 60 |
#}
|
| 61 |
#}
|
|
|
|
|
|
|
|
|