43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { createTRPCRouter, adminProcedure } from "../trpc.js";
|
|
import {
|
|
CreateWebhookInputSchema,
|
|
createWebhook,
|
|
deleteWebhook,
|
|
getWebhookById,
|
|
listWebhooks,
|
|
testWebhook,
|
|
UpdateWebhookProcedureInputSchema,
|
|
updateWebhook,
|
|
WebhookIdInputSchema,
|
|
} from "./webhook-procedure-support.js";
|
|
|
|
export const webhookRouter = createTRPCRouter({
|
|
/** List all webhooks. */
|
|
list: adminProcedure.query(({ ctx }) => listWebhooks(ctx)),
|
|
|
|
/** Get a single webhook by ID. */
|
|
getById: adminProcedure
|
|
.input(WebhookIdInputSchema)
|
|
.query(({ ctx, input }) => getWebhookById(ctx, input)),
|
|
|
|
/** Create a new webhook. */
|
|
create: adminProcedure
|
|
.input(CreateWebhookInputSchema)
|
|
.mutation(({ ctx, input }) => createWebhook(ctx, input)),
|
|
|
|
/** Update an existing webhook. */
|
|
update: adminProcedure
|
|
.input(UpdateWebhookProcedureInputSchema)
|
|
.mutation(({ ctx, input }) => updateWebhook(ctx, input)),
|
|
|
|
/** Delete a webhook. */
|
|
delete: adminProcedure
|
|
.input(WebhookIdInputSchema)
|
|
.mutation(({ ctx, input }) => deleteWebhook(ctx, input)),
|
|
|
|
/** Send a test payload to a webhook URL. */
|
|
test: adminProcedure
|
|
.input(WebhookIdInputSchema)
|
|
.mutation(({ ctx, input }) => testWebhook(ctx, input)),
|
|
});
|