Metadata-Version: 2.4
Name: tinycontracts
Version: 0.1.1
Summary: serve a folder of json/csv/parquet files as a rest api
Author-email: Aditya Kumar <adityakuma0308@gmail.com>
License-Expression: MIT
Keywords: api,cli,csv,fastapi,json,parquet,rest
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.128.0
Requires-Dist: pandas>=3.0.0
Requires-Dist: pyarrow>=23.0.0
Requires-Dist: rich>=14.3.2
Requires-Dist: typer>=0.21.1
Requires-Dist: uvicorn>=0.40.0
Description-Content-Type: text/markdown

# tinycontracts

Turn JSON, CSV, and Parquet files into REST APIs instantly.

## Install

```bash
pip install tinycontracts
```

## Usage

```bash
tc ./data
```

Or with options:

```bash
tc ./data --port 8000 --host 0.0.0.0
```

## Example

Given this structure:
```
data/
  users.json
  orders.csv
  config.json
```

You get:
```
GET /users          # list all users
GET /users/1        # get user by id
GET /orders         # list all orders
GET /config         # get config

GET /_help          # api documentation
GET /_schema        # all schemas
GET /docs           # swagger ui
```

## Filtering & Pagination

```bash
# filter by field
curl "localhost:4242/users?active=true"

# pagination
curl "localhost:4242/orders?_limit=10&_offset=20"

# sorting
curl "localhost:4242/orders?_sort=-created_at"

# combine
curl "localhost:4242/orders?status=pending&_limit=5&_sort=-amount"
```

## Schema

```bash
# all schemas
curl localhost:4242/_schema

# single resource schema
curl localhost:4242/users/_schema
```
