link-stack/packages/bridge-ui/lib/routing.ts

26 lines
782 B
TypeScript
Raw Permalink Normal View History

2024-04-30 11:39:16 +02:00
import { NextRequest, NextResponse } from "next/server";
import { ServiceParams } from "./service";
import { getService } from "./utils";
export const getBot = async (
_req: NextRequest,
params: ServiceParams,
2024-11-25 09:31:25 +01:00
): Promise<NextResponse> => (await getService(params))?.getBot(params);
2024-04-30 11:39:16 +02:00
export const sendMessage = async (
req: NextRequest,
params: ServiceParams,
2024-11-25 09:31:25 +01:00
): Promise<NextResponse> =>
(await getService(params))?.sendMessage(req, params);
2024-04-30 11:39:16 +02:00
2024-05-15 10:27:14 +02:00
export const receiveMessage = async (
req: NextRequest,
params: ServiceParams,
2024-11-25 09:31:25 +01:00
): Promise<NextResponse> =>
(await getService(params))?.receiveMessage(req, params);
2024-05-15 10:27:14 +02:00
2024-04-30 11:39:16 +02:00
export const handleWebhook = async (
req: NextRequest,
params: ServiceParams,
2024-11-25 09:31:25 +01:00
): Promise<NextResponse> => (await getService(params))?.handleWebhook(req);