link-stack/packages/bridge-ui/lib/routing.ts
2024-11-25 09:31:25 +01:00

25 lines
782 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { ServiceParams } from "./service";
import { getService } from "./utils";
export const getBot = async (
_req: NextRequest,
params: ServiceParams,
): Promise<NextResponse> => (await getService(params))?.getBot(params);
export const sendMessage = async (
req: NextRequest,
params: ServiceParams,
): Promise<NextResponse> =>
(await getService(params))?.sendMessage(req, params);
export const receiveMessage = async (
req: NextRequest,
params: ServiceParams,
): Promise<NextResponse> =>
(await getService(params))?.receiveMessage(req, params);
export const handleWebhook = async (
req: NextRequest,
params: ServiceParams,
): Promise<NextResponse> => (await getService(params))?.handleWebhook(req);