File size: 3,000 Bytes
47de06c
 
 
a43b0e7
47de06c
103353a
abe7880
47de06c
abe7880
3824e8e
abe7880
47de06c
abe7880
bd90590
 
 
abe7880
253e119
 
a43b0e7
 
 
 
 
 
 
 
 
 
 
47de06c
 
 
2b0dfac
a43b0e7
 
 
 
 
 
 
 
 
 
 
253e119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
### api_docs.py

import json
import os

api_docs = {
    "base_url": "https://aivisions.no/data/daysoff/api/v1/booking/",
    "endpoints": {
        "/": {
            "method": "POST",
            "description": "Retrieve booking information associated with a booking ID.",
        }
    },
    "body": {
        "booking_id": "string" 
    },
    "response": {
        "description": "A JSON object containing booking details for a specific booking id.",
        "content_type": "application/json",
        "fields": {
            "booking_id": "The unique identifier for the booking.",
            "full_name": "The full name of the customer associated with the booking.",
            "amount": "The total amount for the booking (integer).",
            "checkin": "The check-in date for the booking.",
            "checkout": "The check-out date for the booking.",
            "address": "The address associated with the booking.",
            "user_id": "The user ID associated with the booking (integer).",
            "infotext": "Additional information related to the booking.",
            "included": "Details of services included in the booking."
        }
    }
}




auth_token = os.environ.get("CHAINLIT_AUTH_SECRET")
headers = {
    "Authorization": f"Bearer {auth_token}",
    "Content-Type": "application/json"
}

api_docs_str = json.dumps(api_docs, indent=2)
api_docs_str

# --actual response handling with .get() and mapping entries methods are request handling code, not in here (API documentation).
 #"response": {
        #"description": "A JSON object containing booking details for a specific booking ID.",
        #"content_type": "application/json",
        #"booking_info": {
             #"booking_id": {"description": "The unique identifier for the booking.", "mapping": "response.get('booking_id', 'N/A')"},
             #"full_name": {"description": "The full name of the customer associated with the booking.", "mapping": "response.get('full_name', 'N/A')"},
             #"amount": {"description": "The total amount for the booking (integer).", "mapping": "response.get('amount', 0)"},
             #"checkin": {"description": "The check-in date for the booking (ISO 8601).", "mapping": "response.get('checkin', 'N/A')"}, # --datetime format is 2024-12-20T15:00:00
             #"checkout": {"description": "The check-out date for the booking (ISO 8601).", "mapping": "response.get('checkout', 'N/A')"},
             #"address": {"description": "The address associated with the booking.", "mapping": "response.get('address', 'N/A')"},
             #"user_id": {"description": "The user ID associated with the booking (integer).", "mapping": "response.get('user_id', 0)"},
             #"infotext": {"description": "Additional information related to the booking.", "mapping": "response.get('infotext', 'N/A')"},
             #"included": {"description": "Details of services included in the booking.", "mapping": "response.get('included', 'N/A')"}
         #}
     #}