2022-05-07 21:07:55 +00:00
|
|
|
from app.classes.web.routes.api.index_handler import ApiIndexHandler
|
|
|
|
from app.classes.web.routes.api.not_found import ApiNotFoundHandler
|
2022-04-14 12:33:53 +00:00
|
|
|
from app.classes.web.routes.api.auth.invalidate_tokens import (
|
|
|
|
ApiAuthInvalidateTokensHandler,
|
|
|
|
)
|
|
|
|
from app.classes.web.routes.api.auth.login import ApiAuthLoginHandler
|
2022-05-07 21:07:55 +00:00
|
|
|
from app.classes.web.routes.api.roles.index import ApiRolesIndexHandler
|
|
|
|
from app.classes.web.routes.api.roles.role.index import ApiRolesRoleIndexHandler
|
|
|
|
from app.classes.web.routes.api.roles.role.servers import ApiRolesRoleServersHandler
|
|
|
|
from app.classes.web.routes.api.roles.role.users import ApiRolesRoleUsersHandler
|
2022-04-14 12:33:53 +00:00
|
|
|
from app.classes.web.routes.api.servers.index import ApiServersIndexHandler
|
|
|
|
from app.classes.web.routes.api.servers.server.action import (
|
|
|
|
ApiServersServerActionHandler,
|
|
|
|
)
|
|
|
|
from app.classes.web.routes.api.servers.server.index import ApiServersServerIndexHandler
|
|
|
|
from app.classes.web.routes.api.servers.server.logs import ApiServersServerLogsHandler
|
|
|
|
from app.classes.web.routes.api.servers.server.public import (
|
|
|
|
ApiServersServerPublicHandler,
|
|
|
|
)
|
|
|
|
from app.classes.web.routes.api.servers.server.stats import ApiServersServerStatsHandler
|
|
|
|
from app.classes.web.routes.api.servers.server.users import ApiServersServerUsersHandler
|
|
|
|
from app.classes.web.routes.api.users.index import ApiUsersIndexHandler
|
|
|
|
from app.classes.web.routes.api.users.user.index import ApiUsersUserIndexHandler
|
|
|
|
from app.classes.web.routes.api.users.user.pfp import ApiUsersUserPfpHandler
|
|
|
|
from app.classes.web.routes.api.users.user.public import ApiUsersUserPublicHandler
|
|
|
|
|
|
|
|
|
|
|
|
def api_handlers(handler_args):
|
|
|
|
return [
|
|
|
|
# Auth routes
|
2022-05-07 21:07:55 +00:00
|
|
|
(r"/api/v2/auth/login/?", ApiAuthLoginHandler, handler_args),
|
2022-04-14 12:33:53 +00:00
|
|
|
(
|
2022-05-07 21:07:55 +00:00
|
|
|
r"/api/v2/auth/invalidate_tokens/?",
|
2022-04-14 12:33:53 +00:00
|
|
|
ApiAuthInvalidateTokensHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
|
|
|
# User routes
|
2022-05-07 21:07:55 +00:00
|
|
|
(r"/api/v2/users/?", ApiUsersIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/users/([a-z0-9_]+)/?", ApiUsersUserIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/users/(@me)/?", ApiUsersUserIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/users/([a-z0-9_]+)/pfp/?", ApiUsersUserPfpHandler, handler_args),
|
|
|
|
(r"/api/v2/users/(@me)/pfp/?", ApiUsersUserPfpHandler, handler_args),
|
|
|
|
(
|
|
|
|
r"/api/v2/users/([a-z0-9_]+)/public/?",
|
|
|
|
ApiUsersUserPublicHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
|
|
|
(r"/api/v2/users/(@me)/public/?", ApiUsersUserPublicHandler, handler_args),
|
2022-04-14 12:33:53 +00:00
|
|
|
# Server routes
|
2022-05-07 21:07:55 +00:00
|
|
|
(r"/api/v2/servers/?", ApiServersIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/servers/([0-9]+)/?", ApiServersServerIndexHandler, handler_args),
|
|
|
|
(
|
|
|
|
r"/api/v2/servers/([0-9]+)/stats/?",
|
|
|
|
ApiServersServerStatsHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
2022-04-14 12:33:53 +00:00
|
|
|
(
|
2022-05-07 21:07:55 +00:00
|
|
|
r"/api/v2/servers/([0-9]+)/action/([a-z_]+)/?",
|
2022-04-14 12:33:53 +00:00
|
|
|
ApiServersServerActionHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
2022-05-07 21:07:55 +00:00
|
|
|
(r"/api/v2/servers/([0-9]+)/logs/?", ApiServersServerLogsHandler, handler_args),
|
2022-04-14 12:33:53 +00:00
|
|
|
(
|
2022-05-07 21:07:55 +00:00
|
|
|
r"/api/v2/servers/([0-9]+)/users/?",
|
|
|
|
ApiServersServerUsersHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
|
|
|
(
|
|
|
|
r"/api/v2/servers/([0-9]+)/public/?",
|
2022-04-14 12:33:53 +00:00
|
|
|
ApiServersServerPublicHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
2022-05-07 21:07:55 +00:00
|
|
|
(r"/api/v2/roles/?", ApiRolesIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/roles/([a-z0-9_]+)/?", ApiRolesRoleIndexHandler, handler_args),
|
|
|
|
(
|
|
|
|
r"/api/v2/roles/([a-z0-9_]+)/servers/?",
|
|
|
|
ApiRolesRoleServersHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
|
|
|
(
|
|
|
|
r"/api/v2/roles/([a-z0-9_]+)/users/?",
|
|
|
|
ApiRolesRoleUsersHandler,
|
|
|
|
handler_args,
|
|
|
|
),
|
|
|
|
(r"/api/v2/?", ApiIndexHandler, handler_args),
|
|
|
|
(r"/api/v2/(.*)", ApiNotFoundHandler, handler_args),
|
2022-04-14 12:33:53 +00:00
|
|
|
]
|