2
0

⚗️ Implement chat API

This commit is contained in:
Baptiste Arnaud
2022-11-29 10:02:40 +01:00
parent 49ba434350
commit bf0d0c2475
122 changed files with 5075 additions and 292 deletions

View File

@ -0,0 +1,15 @@
import { generateOpenApiDocument } from 'trpc-openapi'
import { writeFileSync } from 'fs'
import { appRouter } from './routers/v1/_app'
const openApiDocument = generateOpenApiDocument(appRouter, {
title: 'Chat API',
version: '1.0.0',
baseUrl: 'https://typebot.io/api/v1',
docsUrl: 'https://docs.typebot.io/api',
})
writeFileSync(
'./openapi/chat/_spec_.json',
JSON.stringify(openApiDocument, null, 2)
)

View File

@ -0,0 +1,8 @@
import { chatRouter } from '@/features/chat/api'
import { router } from '../../trpc'
export const appRouter = router({
chat: chatRouter,
})
export type AppRouter = typeof appRouter

View File

@ -0,0 +1,13 @@
import { initTRPC } from '@trpc/server'
import { OpenApiMeta } from 'trpc-openapi'
import superjson from 'superjson'
const t = initTRPC.meta<OpenApiMeta>().create({
transformer: superjson,
})
export const middleware = t.middleware
export const router = t.router
export const publicProcedure = t.procedure