fork of hey-api/openapi-ts because I need some additional things
1import sdk from '@stackblitz/sdk';
2
3// https://api.npmjs.org/versions/@hey-api%2Fopenapi-ts/last-week
4
5export const embedProject = (projectId: string) => async (event: Event) => {
6 const container = document.createElement('div');
7
8 if (event.target) {
9 const node = event.target as HTMLElement;
10 node.replaceWith(container);
11 }
12
13 switch (projectId) {
14 case 'hey-api-client-axios-example':
15 return await sdk.embedProjectId(container, projectId, {
16 height: 700,
17 openFile:
18 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts,src/App.tsx',
19 view: 'editor',
20 });
21 case 'hey-api-client-fetch-example':
22 return await sdk.embedProjectId(container, projectId, {
23 height: 700,
24 openFile:
25 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts,src/App.tsx',
26 view: 'editor',
27 });
28 case 'hey-api-client-fetch-plugin-fastify-example':
29 return await sdk.embedProjectId(container, projectId, {
30 height: 700,
31 openFile:
32 'openapi-ts.config.ts,src/client/fastify.gen.ts,src/client/types.gen.ts,src/server.ts',
33 view: 'editor',
34 });
35 case 'hey-api-client-fetch-plugin-tanstack-react-query-example':
36 return await sdk.embedProjectId(container, projectId, {
37 height: 700,
38 openFile:
39 'openapi-ts.config.ts,src/client/@tanstack/react-query.gen.ts,src/client/types.gen.ts,src/App.tsx',
40 view: 'editor',
41 });
42 case 'hey-api-client-fetch-plugin-zod-example':
43 return await sdk.embedProjectId(container, projectId, {
44 height: 700,
45 openFile: 'openapi-ts.config.ts,src/client/zod.gen.ts,src/App.tsx',
46 view: 'editor',
47 });
48 case 'hey-api-example':
49 return await sdk.embedProjectId(container, projectId, {
50 height: 700,
51 openFile:
52 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts',
53 view: 'editor',
54 });
55 }
56};