1- # FastAPI wrapper for interactions.py
1+ # interactions restful
22
3- An Extension library to add restful API for your interactions.py bot.
3+ A library for interactions.py allowing runtime API structures
44
55## Installation
66
7- `` pip install interactions-restful ``
7+ Using pip:
8+ ` pip install interactions-restful `
9+
10+ Using poetry:
11+ ` poetry add interactions-restful `
12+
13+ Don't forget to specify backend you want to use:
14+ - flask ` pip install interactions-restful[flask] `
15+ - fastapi ` pip install interactions-restful[fastapi] `
816
917## Simple example
1018
1119### Main file
1220
1321``` python
1422import interactions
15- from interactions_restful import APIExtension
23+ from interactions_restful import setup
24+ from interactions_restful.backends.fast_api import FastAPI
1625
1726client = interactions.Client()
1827
19- APIExtension (client, " 127.0.0.1" , 5000 , " flask " )
28+ setup (client, FastAPI, " 127.0.0.1" , 5000 )
2029
2130client.load_extension(" api" )
2231
@@ -34,13 +43,17 @@ from interactions_restful import route
3443class MyAPI (interactions .Extension ):
3544 @route (" GET" , " /" )
3645 def index (self ):
37- return {" status" : " success" }
46+ return {" status" : " Hello, i.py" }
47+
48+ @interactions.slash_command ()
49+ async def test_command (self , ctx ):
50+ await ctx.send(" Hello, API" )
3851
3952```
4053
41- ## Modes
54+ ## Backends
4255
43- Extension support both flask and fastapi as backend for building an api, but if you don't want to use them you could create own backend.
56+ 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.
4457
4558## Documentation
4659
0 commit comments