daysoff_assistant / api_docs.py
camparchimedes's picture
Create api_docs.py
47de06c verified
raw
history blame
2.25 kB
### api_docs.py
import json
daysoff_api_docs = {
"base_url": "https://aivisions.no/data/daysoff/api/v1/booking/",
"endpoints": {
"method": "POST",
"description": "Retrieve booking information for a given booking ID (โ€™bestillingsnummerโ€™).",
"parameters": {
"auth_token": {
"type": "string",
"description": "The authorization token for the API request."
},
"booking_id": {
"type": "string",
"description": "The unique identifier of the booking to retrieve."
}
},
"headers": {
"Authorization": "Bearer <auth_token>",
"Content-Type": "application/json"
},
"response": {
"description": "A JSON object containing booking details (โ€™Informasjon om bestillingen)",
"content_type": "application/json",
"fields": {
"booking_id": "response.get('booking_id', 'N/A')",
"full_name": "response.get('full_name', 'N/A')",
"amount": "response.get('amount', 'N/A')",
"checkin": "response.get('checkin', 'N/A')",
"checkout": "response.get('checkout', 'N/A')",
"address": "response.get('address', 'N/A')",
"user_id": "response.get('user_id', 'N/A')"
}
}
}
}
decode_booking_info(response):
"fields": {
"booking_id": "response.get('booking_id', 'N/A')",
"full_name": "response.get('full_name', 'N/A')",
"amount": "response.get('amount', 'N/A')",
"checkin": "response.get('checkin', 'N/A')",
"checkout": "response.get('checkout', 'N/A')",
"address": "response.get('address', 'N/A')",
"user_id": "response.get('user_id', 'N/A')"
}
json_decode = (
f"Booking ID: {booking_info['booking_id']}\n"
f"Full Name: {booking_info['full_name']}\n"
f"Amount: {booking_info['amount']}\n"
f"Check-in: {booking_info['checkin']}\n"
f"Check-out: {booking_info['checkout']}\n"
f"Address: {booking_info['address']}\n"
f"User ID: {booking_info['user_id']}"
)
return json_decode