def create_gateway_routes(config: GatewayConfig, client: Any) -> list[BaseRoute]:
r"""创建网关内部的健康检查、消息发送与组织信息路由。"""
async def health(_: Request) -> Response:
return JSONResponse({"status": "ok"})
async def ready(_: Request) -> Response:
return JSONResponse({"status": "ok"})
return [
Route("/healthz", health, methods=["GET"]),
Route("/readyz", ready, methods=["GET"]),
Route("/messages/send", _internal(config, _send_message(client)), methods=["POST"]),
Route("/messages/card", _internal(config, _send_card(client)), methods=["POST"]),
Route("/org/users", _internal(config, _list_users(client)), methods=["GET"]),
Route("/org/users/{user_id}", _internal(config, _get_user(client)), methods=["GET"]),
Route("/org/departments", _internal(config, _list_departments(client)), methods=["GET"]),
Route("/org/departments/{department_id}", _internal(config, _get_department(client)), methods=["GET"]),
Route("/org/resolve", _internal(config, _resolve_users(client)), methods=["POST"]),
]