Metadata-Version: 2.4
Name: edobase
Version: 1.0.0
Summary: Official Python SDK for Edobase — collections & documents, auth, storage, and mail.
License: MIT
Keywords: edobase,backend,baas,database,api
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0

# edobase (Python)

Official Python SDK for [Edobase](https://github.com/Guruganeshkannan/edobase) — collections & documents, end-user auth, file storage, and mail.

## Install

```bash
pip install edobase
```

## Quick start

```python
from edobase import Edobase

db = Edobase(url="https://db.yourdomain.com", api_key="edb_pk_your_key_here")

# Create a document
product = db.collection("products").create({"name": "Widget", "price": 9.99})

# List with filtering, sorting, pagination
result = db.collection("products").list(
    limit=20,
    filter={"price": {"gt": 5}},
    sort="price",
    order="asc",
)
for item in result:
    print(item)

# Get, update, delete
db.collection("products").get(product["id"])
db.collection("products").update(product["id"], {"price": 12.99})
db.collection("products").delete(product["id"])
```

## Auth (end-users of your app)

```python
auth = db.auth.register(email="user@example.com", password="secret123")
db.auth.login("user@example.com", "secret123")
me = db.auth.me()
db.auth.logout()
```

## Storage

```python
# From a file path
db.storage.upload("photo.jpg")

# From an open file object
with open("photo.jpg", "rb") as f:
    db.storage.upload(f, filename="photo.jpg")
```

## Mail

```python
db.mail.send(to="user@example.com", subject="Welcome!", html="<p>Thanks for signing up.</p>")
```

## Error handling

Every SDK method raises `EdobaseError` on a non-2xx response:

```python
from edobase import EdobaseError

try:
    db.collection("products").get("nonexistent-id")
except EdobaseError as e:
    print(e.status, e.code, e.message)  # 404 NOT_FOUND "Document not found"
```

## API keys

- **Public keys** (`edb_pk_...`) — safe for client-side/mobile code.
- **Secret keys** (`edb_sk_...`) — full access, server-side only. Never ship in client code.

## License

MIT
