add empty webhooks blueprint

This commit is contained in:
Luna Mendes 2018-07-06 16:07:42 -03:00
parent 1e8672656c
commit 93933fd8f5
4 changed files with 71 additions and 1 deletions

View File

@ -3,3 +3,4 @@ from .auth import bp as auth
from .users import bp as users
from .guilds import bp as guilds
from .channels import bp as channels
from .webhooks import bp as webhooks

View File

@ -0,0 +1,66 @@
from quart import Blueprint
bp = Blueprint('webhooks', __name__)
@bp.route('/channels/<int:channel_id>/webhooks', methods=['POST'])
async def create_webhook(channel_id):
pass
@bp.route('/channels/<int:channel_id>/webhooks', methods=['GET'])
async def get_channel_webhook(channel_id):
pass
@bp.route('/guilds/<int:guild_id>/webhooks', methods=['GET'])
async def get_guild_webhook(guild_id):
pass
@bp.route('/webhooks/<int:webhook_id>', methods=['GET'])
async def get_single_webhook(webhook_id):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>', methods=['GET'])
async def get_tokened_webhook(webhook_id, webhook_token):
pass
@bp.route('/webhooks/<int:webhook_id>', methods=['PATCH'])
async def modify_webhook(webhook_id):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>', methods=['PATCH'])
async def modify_webhook_tokened(webhook_id, webhook_token):
pass
@bp.route('/webhooks/<int:webhook_id>', methods=['DELETE'])
async def del_webhook(webhook_id):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>', methods=['DELETE'])
async def del_webhook_tokened(webhook_id, webhook_token):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>', methods=['POST'])
async def execute_webhook(webhook_id, webhook_token):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>/slack',
methods=['POST'])
async def execute_slack_webhook(webhook_id, webhook_token):
pass
@bp.route('/webhooks/<int:webhook_id>/<str:webhook_token>/github',
methods=['POST'])
async def execute_github_webhook(webhook_id, webhook_token):
pass

View File

@ -401,5 +401,7 @@ class GatewayWebsocket:
log.exception('An exception has occoured. state={}', self.state)
await self.ws.close(code=4000, reason=repr(err))
finally:
self.ext.state_manager.remove(self)
if self.state:
self.state.ws = None

3
run.py
View File

@ -10,7 +10,7 @@ from logbook import StreamHandler, Logger
from logbook.compat import redirect_logging
import config
from litecord.blueprints import gateway, auth, users, guilds, channels
from litecord.blueprints import gateway, auth, users, guilds, channels, webhooks
from litecord.gateway import websocket_handler
from litecord.errors import LitecordError
from litecord.gateway.state_manager import StateManager
@ -43,6 +43,7 @@ app.register_blueprint(auth, url_prefix='/api/v6')
app.register_blueprint(users, url_prefix='/api/v6/users')
app.register_blueprint(guilds, url_prefix='/api/v6/guilds')
app.register_blueprint(channels, url_prefix='/api/v6/channels')
app.register_blueprint(webhooks, url_prefix='/api/v6')
@app.before_serving