Skip to content

Commit ae3ca19

Browse files
committed
docs: Add endpoint examples and update README with API docs info
1 parent 9074d00 commit ae3ca19

File tree

2 files changed

+85
-4
lines changed

2 files changed

+85
-4
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ Content-Type: application/json
8282
}
8383
```
8484

85+
## 📚 API Documentation
86+
87+
Interactive API documentation is available at:
88+
➡️ **http://localhost:5000/api/docs/**
89+
90+
The Swagger UI provides:
91+
- Complete API endpoint documentation
92+
- Request/response schemas
93+
- Try-it-out functionality
94+
- Authentication support
95+
8596
---
8697

8798
## 🧱 Tech Stack

api_docs.py

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
title='ChatForge API',
99
description='Scalable AI Chatbot API built with Flask, OpenAI, and vector memory',
1010
doc='/docs/',
11-
prefix='/api'
11+
prefix='/api',
12+
authorizations={
13+
'Bearer': {
14+
'type': 'apiKey',
15+
'in': 'header',
16+
'name': 'Authorization',
17+
'description': 'Type in the *\'Value\'* input box: **Bearer {token}**'
18+
}
19+
},
20+
security='Bearer'
1221
)
1322

1423
# Namespace definitions
@@ -78,12 +87,73 @@
7887
@api_blueprint.route('/')
7988
class APIInfo(Resource):
8089
@api.doc('api_info')
90+
@api.marshal_with(success_response_model)
8191
def get(self):
8292
"""API information and health check"""
8393
return {
8494
'message': 'ChatForge API is running',
85-
'status': 'healthy',
86-
'version': '1.0.0',
87-
'docs': '/api/docs/'
95+
'status': 200,
96+
'data': {
97+
'version': '1.0.0',
98+
'docs': '/api/docs/'
99+
}
88100
}
89101

102+
# Auth namespace endpoints
103+
@auth_ns.route('/login')
104+
class Login(Resource):
105+
@auth_ns.doc('login')
106+
@auth_ns.expect(login_model)
107+
@auth_ns.marshal_with(success_response_model, code=200)
108+
@auth_ns.marshal_with(error_response_model, code=401)
109+
def post(self):
110+
"""
111+
User login endpoint
112+
113+
Returns JWT access token on successful authentication
114+
"""
115+
pass
116+
117+
@auth_ns.route('/register')
118+
class Register(Resource):
119+
@auth_ns.doc('register')
120+
@auth_ns.expect(register_model)
121+
@auth_ns.marshal_with(success_response_model, code=201)
122+
@auth_ns.marshal_with(error_response_model, code=400)
123+
def post(self):
124+
"""
125+
User registration endpoint
126+
127+
Creates a new user account
128+
"""
129+
pass
130+
131+
# Bot namespace endpoints
132+
@bot_ns.route('/query')
133+
class ChatQuery(Resource):
134+
@bot_ns.doc('chat_query')
135+
@bot_ns.expect(chat_query_model)
136+
@bot_ns.marshal_with(success_response_model, code=200)
137+
@bot_ns.marshal_with(error_response_model, code=403)
138+
def post(self):
139+
"""
140+
Send a chat query to the bot
141+
142+
Processes user message and returns AI-generated response
143+
"""
144+
pass
145+
146+
@bot_ns.route('/create_bot')
147+
class CreateBot(Resource):
148+
@bot_ns.doc('create_bot', security='Bearer')
149+
@bot_ns.expect(create_bot_model)
150+
@bot_ns.marshal_with(success_response_model, code=201)
151+
@bot_ns.marshal_with(error_response_model, code=400)
152+
def post(self):
153+
"""
154+
Create a new chatbot
155+
156+
Requires JWT authentication
157+
"""
158+
pass
159+

0 commit comments

Comments
 (0)