Metadata-Version: 2.1
Name: object-api
Version: 0.0.1
Summary: 
Author: Jacob Valdez
Author-email: jacobfv123@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: black (>=23.7.0,<24.0.0)
Requires-Dist: fastapi (>=0.101.0,<0.102.0)
Requires-Dist: httpx (>=0.24.1,<0.25.0)
Requires-Dist: inspect-mate-pp (>=0.0.4,<0.0.5)
Requires-Dist: pydantic (>=1.8.2,<2.0.0)
Requires-Dist: scheduler (>=0.8.4,<0.9.0)
Requires-Dist: sqlmodel (>=0.0.8,<0.0.9)
Requires-Dist: stringcase (>=1.2.0,<2.0.0)
Description-Content-Type: text/markdown

# The Object API

ObjectAPI provides a concise negative-boilerplate paradigm for creating full-stack web applications with Python. It is built on top of [FastAPI](https://fastapi.tiangolo.com/), [SQLModel](https://sqlmodel.tiangolo.com/), and [pydantic](https://docs.pydantic.dev/latest/).

## Features

- Active record pattern for database access
- Automatic get_by_id lookup for instance methods with route decorators
- Automatic CRUD routes
- Scheduled service methods
- Managed DB sessions for service methods and for each request

## Installation

```bash
pip install object-api
```

## Usage

```python
from object_api import App, Entity, RouterBuilder, ServiceBuilder

app = App()

class User(Entity):
    class Meta:
        service = ServiceBuilder()
        router = RouterBuilder()

        new_private = ["pass"]

    name: str
    pass: str
    age: int

    @service.servicemethod
    @classmethod
    def remove_inactive(cls):
        for user in User.get_all():
            if user.age > 100:
                user.delete()
    
    @router.route()
    def get_name(self):
        return self.name

    @router.post("/change_name")
    def change_name(self, name: str):
        self.name = name
        self.save()

app = App()

app.run()
```

## Documentation

<https://github.com/ComputaCo/object-api>

## License

[MIT](https://choosealicense.com/licenses/mit/)

