Metadata-Version: 2.4
Name: drf_response_wrappers
Version: 1.2.7
Summary: DRF middleware to wrap all API responses
Home-page: https://github.com/yourusername/drf-response-wrapper
Author: Md Harun Or Roshed Riyad
Author-email: rieadhasan499@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: Framework :: Django
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-python
Dynamic: summary

# DRF Response Wrapper

A Django REST Framework middleware that automatically wraps **all API responses** into a consistent format.  
No need to modify your views or APIView classes.

---

## 🚀 Features

- Standardized success & error responses
- Works with all DRF APIViews
- Simple integration: just add middleware
- No changes needed in your views

---

## 📦 Installation

Install the package from PyPI:

```bash
pip install drf-response-wrapper
```

---

## ⚙️ Usage / User Guide

### 1️⃣ Add Middleware

Open your Django project's `settings.py` and add the middleware:

```python
MIDDLEWARE = [
    # Other middlewares
    "drf_response_wrapper.middleware.APIResponseWrapperMiddleware",
]
```

> This middleware automatically wraps all DRF API responses, so you don't need to manually call `success_response()` or `error_response()` in your views.

---

### 2️⃣ Example API Responses

**Success response example:**

```json
{
  "success": true,
  "message": "Request successful",
  "status": 200,
  "data": {
    "id": 1,
    "name": "Example Item"
  }
}
```

**Error response example:**

```json
{
  "success": false,
  "message": "Something went wrong",
  "status": 400,
  "data": {}
}
```

---

### 3️⃣ Notes / Tips

- Works with any DRF APIView returning `Response`.
- Can be used with `BaseAPIView` or standard `APIView`.
- Ensures all API responses follow the same structure automatically.
- No changes needed in your existing views.
- Compatible with existing DRF projects—just add middleware.
- Ideal for projects where consistent API response format is required.

---

## 📝 License

MIT License
