# Path: pushmanager/core/db.py
# def UnsignedInteger():
# def init_db():
# def finalize_db():
# def execute_cb(query, callback_fn):
# def execute_transaction_cb(queries, callback_fn, condition=None):
# def prefix_insert_ignore(insert_ignore, compiler, **kw):
# def prefix_insert_ignore_sqlite(insert_ignore, compiler, **kw):
# class DatabaseError(Exception):
# class PushCheckList(Base):
# class PushPlans(Base):
# class PushPushContents(Base):
# class PushPushes(Base):
# class PushRemovals(Base):
# class PushRequests(Base):
# class InsertIgnore(Insert):


import json
import sqlalchemy as SA
from pushmanager.core import db
from pushmanager.core import util
from pushmanager.core.requesthandler import RequestHandler




class APIServlet(RequestHandler):

    # Regexp part of the URLSpec, to be used in
    # tornado.web.Application initialization with APIServlet handler.
    regexp = r'/api(?:/([^/]+))?'

    def get(self, endpoint):
        if endpoint:
            func = '_api_%s' % endpoint.upper()
            if hasattr(self, func):
                return getattr(self, func)()

# Path: pushmanager/core/db.py
# def UnsignedInteger():
# def init_db():
# def finalize_db():
# def execute_cb(query, callback_fn):
# def execute_transaction_cb(queries, callback_fn, condition=None):
# def prefix_insert_ignore(insert_ignore, compiler, **kw):
# def prefix_insert_ignore_sqlite(insert_ignore, compiler, **kw):
# class DatabaseError(Exception):
# class PushCheckList(Base):
# class PushPlans(Base):
# class PushPushContents(Base):
# class PushPushes(Base):
# class PushRemovals(Base):
# class PushRequests(Base):
# class InsertIgnore(Insert):


# Path: pushmanager/servlets/api.py
import json
import sqlalchemy as SA
from pushmanager.core import db
from pushmanager.core import util
from pushmanager.core.requesthandler import RequestHandler





class APIServlet(RequestHandler):

    # Regexp part of the URLSpec, to be used in
    # tornado.web.Application initialization with APIServlet handler.
    regexp = r'/api(?:/([^/]+))?'

    def get(self, endpoint):
        if endpoint:
            func = '_api_%s' % endpoint.upper()
            if hasattr(self, func):
                return getattr(self, func)()

        return self.redirect("https://github.com/Yelp/pushmanager/wiki/Pushmanager-API")