camparchimedes commited on
Commit
47de06c
ยท
verified ยท
1 Parent(s): daf2ab5

Create api_docs.py

Browse files
Files changed (1) hide show
  1. api_docs.py +61 -0
api_docs.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### api_docs.py
2
+
3
+ import json
4
+
5
+ daysoff_api_docs = {
6
+ "base_url": "https://aivisions.no/data/daysoff/api/v1/booking/",
7
+ "endpoints": {
8
+ "method": "POST",
9
+ "description": "Retrieve booking information for a given booking ID (โ€™bestillingsnummerโ€™).",
10
+ "parameters": {
11
+ "auth_token": {
12
+ "type": "string",
13
+ "description": "The authorization token for the API request."
14
+ },
15
+ "booking_id": {
16
+ "type": "string",
17
+ "description": "The unique identifier of the booking to retrieve."
18
+ }
19
+ },
20
+ "headers": {
21
+ "Authorization": "Bearer <auth_token>",
22
+ "Content-Type": "application/json"
23
+ },
24
+ "response": {
25
+ "description": "A JSON object containing booking details (โ€™Informasjon om bestillingen)",
26
+ "content_type": "application/json",
27
+ "fields": {
28
+ "booking_id": "response.get('booking_id', 'N/A')",
29
+ "full_name": "response.get('full_name', 'N/A')",
30
+ "amount": "response.get('amount', 'N/A')",
31
+ "checkin": "response.get('checkin', 'N/A')",
32
+ "checkout": "response.get('checkout', 'N/A')",
33
+ "address": "response.get('address', 'N/A')",
34
+ "user_id": "response.get('user_id', 'N/A')"
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ decode_booking_info(response):
41
+ "fields": {
42
+ "booking_id": "response.get('booking_id', 'N/A')",
43
+ "full_name": "response.get('full_name', 'N/A')",
44
+ "amount": "response.get('amount', 'N/A')",
45
+ "checkin": "response.get('checkin', 'N/A')",
46
+ "checkout": "response.get('checkout', 'N/A')",
47
+ "address": "response.get('address', 'N/A')",
48
+ "user_id": "response.get('user_id', 'N/A')"
49
+ }
50
+
51
+ json_decode = (
52
+ f"Booking ID: {booking_info['booking_id']}\n"
53
+ f"Full Name: {booking_info['full_name']}\n"
54
+ f"Amount: {booking_info['amount']}\n"
55
+ f"Check-in: {booking_info['checkin']}\n"
56
+ f"Check-out: {booking_info['checkout']}\n"
57
+ f"Address: {booking_info['address']}\n"
58
+ f"User ID: {booking_info['user_id']}"
59
+ )
60
+
61
+ return json_decode