72 lines
1.9 KiB
Python
72 lines
1.9 KiB
Python
"""HTTP adapters for human; business logic lives in services."""
|
|
|
|
from flask import Blueprint, current_app, request
|
|
|
|
from .. import human_service
|
|
|
|
bp = Blueprint('human', __name__)
|
|
|
|
@bp.route('/api/human/request', methods=['POST'])
|
|
def human_request():
|
|
return human_service.human_request(request.json)
|
|
|
|
|
|
@bp.route('/api/human/poll')
|
|
def human_poll():
|
|
return human_service.human_poll(request.args.get('sid', type=int), request.args.get('after', 0, type=int), current_app.extensions['human_typing'])
|
|
|
|
|
|
@bp.route('/api/human/send', methods=['POST'])
|
|
def human_send():
|
|
return human_service.human_send(request.json)
|
|
|
|
|
|
@bp.route('/api/human/queue')
|
|
def human_queue():
|
|
return human_service.human_queue()
|
|
|
|
|
|
@bp.route('/api/human/active')
|
|
def human_active():
|
|
return human_service.human_active()
|
|
|
|
|
|
@bp.route('/api/human/accept', methods=['POST'])
|
|
def human_accept():
|
|
return human_service.human_accept(request.json)
|
|
|
|
|
|
@bp.route('/api/human/close', methods=['POST'])
|
|
def human_close():
|
|
return human_service.human_close(request.json)
|
|
|
|
|
|
@bp.route('/api/human/transfer', methods=['POST'])
|
|
def human_transfer():
|
|
return human_service.human_transfer(request.json or {}, current_app.extensions['human_typing'])
|
|
|
|
|
|
@bp.route('/api/human/note', methods=['POST'])
|
|
def human_note():
|
|
return human_service.human_note(request.json or {})
|
|
|
|
|
|
@bp.route('/api/human/recall', methods=['POST'])
|
|
def human_recall():
|
|
return human_service.human_recall(request.json or {})
|
|
|
|
|
|
@bp.route('/api/human/typing', methods=['POST'])
|
|
def human_typing():
|
|
return human_service.human_typing(request.json, current_app.extensions['human_typing'])
|
|
|
|
|
|
@bp.route('/api/human/stop_typing', methods=['POST'])
|
|
def human_stop_typing():
|
|
return human_service.human_stop_typing(request.json, current_app.extensions['human_typing'])
|
|
|
|
|
|
@bp.route('/api/human/read', methods=['POST'])
|
|
def human_read():
|
|
return human_service.human_read(request.json)
|