Metadata-Version: 2.1
Name: interactions-restful
Version: 1.0.0
Summary: A library for interactions.py allowing runtime API structures
Home-page: https://github.com/interactions-py/restful
Author: Damego
Author-email: damego.dev@gmail.com
License: MIT
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: discord-py-interactions (<6.0.0,>=5.0.0)
Provides-Extra: fastapi
Requires-Dist: fastapi (>=0.92.0) ; extra == 'fastapi'
Requires-Dist: uvicorn (>=0.20.0) ; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask (<=3.0.0,>=2.0.0) ; extra == 'flask'

# interactions restful

A library for interactions.py allowing runtime API structures

## Installation

Using pip:  
`pip install interactions-restful`

Using poetry:  
`poetry add interactions-restful`

Don't forget to specify backend you want to use:
- flask `pip install interactions-restful[flask]`
- fastapi  `pip install interactions-restful[fastapi]`

## Simple example

### Main file

```python
import interactions
from interactions_restful import setup
from interactions_restful.backends.fast_api import FastAPI

client = interactions.Client()

setup(client, FastAPI, "127.0.0.1", 5000)

client.load_extension("api")

client.start("token")
```

### Extension file
- `api.py`

```python
import interactions
from interactions_restful import route


class MyAPI(interactions.Extension):
    @route("GET", "/")
    def index(self):
        return {"status": "Hello, i.py"}
    
    @interactions.slash_command()
    async def test_command(self, ctx):
        await ctx.send("Hello, API")

```

## Backends

Currently, library support only flask and fastapi as a backend for building an api, but if you don't want to use them you can create own backend.

## Documentation

[FastAPI documentation](https://fastapi.tiangolo.com/)
