insightfy-bloom-ms-ans / scripts /add_request_examples.py
MukeshKapoor25's picture
docs(widgets): Add comprehensive request examples and improve API documentation
d954b70
"""
Script to add request body examples to chart widget endpoints.
"""
# Mapping of endpoint paths to their widget IDs and example bodies
ENDPOINT_EXAMPLES = {
"/gross-margin-trend": {
"widget_id": "wid_gross_margin_trend_12m_001",
"chart_type": "line",
"months": 12,
"period_window": "last_12_months"
},
"/channel-mix": {
"widget_id": "wid_channel_mix_001",
"chart_type": "donut",
"period_window": "last_12_months"
},
"/top-skus": {
"widget_id": "wid_top_5_skus_001",
"chart_type": "bar",
"limit": 5,
"period_window": "last_12_months"
},
"/inventory-status": {
"widget_id": "wid_inventory_status_001",
"chart_type": "donut"
},
"/top-selling-products": {
"widget_id": "wid_top_selling_products_30d_001",
"chart_type": "bar",
"window_days": 30,
"limit": 10
},
"/staff-performance": {
"widget_id": "wid_staff_performance_001",
"chart_type": "bar",
"window_days": 30,
"limit": 10
},
"/my-sales-trend": {
"widget_id": "wid_personal_sales_trend_30d_001",
"chart_type": "line",
"window_days": 30
},
"/my-top-products": {
"widget_id": "wid_top_products_sold_by_me_001",
"chart_type": "bar",
"window_days": 30,
"limit": 5
}
}
print("Chart Widget Request Body Examples:")
print("=" * 80)
for endpoint, example in ENDPOINT_EXAMPLES.items():
print(f"\n{endpoint}:")
print(f" {example}")