Skip to content

Commit cfda6a3

Browse files
committed
chore: move response to body
1 parent c47a629 commit cfda6a3

14 files changed

Lines changed: 784 additions & 705 deletions

File tree

dev/inputs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const specsPath = path.join(__dirname, '..', 'specs');
55
export const inputs = {
66
circular: path.resolve(specsPath, '3.0.x', 'circular.yaml'),
77
full: path.resolve(specsPath, '3.1.x', 'full.yaml'),
8+
heyapi: 'hey-api/backend',
89
local: 'http://localhost:8000/openapi.json',
910
opencode: path.resolve(specsPath, '3.1.x', 'opencode.yaml'),
1011
petstore:

dev/playground.ts

Lines changed: 10 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { setupServer } from 'msw/node';
55
import { client } from './gen/typescript/client.gen';
66
// import { createOpencode } from '@opencode-ai/sdk';
77
import { createMswHandlers } from './gen/typescript/msw.gen';
8-
import { OpenCode } from './gen/typescript/sdk.gen';
8+
import { Sdk } from './gen/typescript/sdk.gen';
99
import spec from './opencode.json';
1010

1111
type MyPluginConfig = { readonly name: 'myplugin' };
@@ -26,68 +26,19 @@ const sourceHandlers = await fromOpenApi({
2626
basePath: 'https://api.example.com',
2727
});
2828
const handlers = createMswHandlers({
29-
baseUrl: 'https://api.example.com',
29+
baseUrl: 'https://api.heyapi.dev',
3030
});
3131

3232
const server = setupServer(
3333
// ...sourceHandlers,
34+
// handlers.pick.get({
35+
// body: 'Hi',
36+
// }),
3437
...handlers.all({
3538
pick: {
36-
// projectUpdate(info) {
39+
// get(info) {
3740
// console.log('Received request for projectUpdate with info:', info);
3841
// },
39-
projectUpdate: [
40-
undefined,
41-
// (info) => {
42-
// console.log('Received request for projectUpdate with info:', info);
43-
// },
44-
// {
45-
// result: {
46-
// id: '123',
47-
// name: 'Updated Project Name',
48-
// time: {
49-
// created: 1678900000000,
50-
// updated: 1678900000000,
51-
// },
52-
// worktree: 'main',
53-
// icon: {
54-
// url: 'https://example.com/icon.png',
55-
// color: 'blue',
56-
// },
57-
// vcs: 'git',
58-
// },
59-
// status: 200,
60-
// },
61-
{
62-
// baseUrl: 'https://api.example.com',
63-
},
64-
],
65-
// projectUpdate: {
66-
// result: {
67-
// id: '123',
68-
// name: 'Updated Project Name',
69-
// time: {
70-
// created: 1678900000000,
71-
// updated: 1678900000000,
72-
// },
73-
// worktree: 'main',
74-
// icon: {
75-
// url: 'https://example.com/icon.png',
76-
// color: 'blue',
77-
// },
78-
// vcs: 'git',
79-
// },
80-
// },
81-
},
82-
}),
83-
// handlers.pick.projectUpdate(),
84-
handlers.pick.globalEvent({
85-
result: {
86-
directory: 'main',
87-
payload: {
88-
properties: {},
89-
type: 'global.disposed',
90-
},
9142
},
9243
}),
9344
);
@@ -97,9 +48,9 @@ async function run() {
9748
// const { client, server } = await createOpencode();
9849
// console.log(client, server);
9950
client.setConfig({
100-
baseUrl: 'https://api.example.com',
51+
baseUrl: 'https://api.heyapi.dev/',
10152
});
102-
const sdk = new OpenCode({ client });
53+
const sdk = new Sdk({ client });
10354
// const published = await sdk.tui.publish({
10455
// body: {
10556
// properties: {
@@ -111,14 +62,8 @@ async function run() {
11162
// directory: 'main',
11263
// });
11364
// console.log('Published:', published.data, published.error);
114-
const project = await sdk.project.update({
115-
projectID: '123',
116-
directory: 'main',
117-
icon: {
118-
color: 'blue',
119-
url: 'https://example.com/icon.png',
120-
},
121-
name: 'Updated Project Name',
65+
const project = await sdk.get({
66+
// ...
12267
});
12368
console.log('Updated Project:', project.data, project.error);
12469
}

dev/typescript/presets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const presets = {
3838
{
3939
name: '@hey-api/sdk',
4040
operations: {
41-
containerName: 'OpenCode',
41+
containerName: 'Sdk',
4242
strategy: 'single',
4343
},
4444
paramsStructure: 'flat',

0 commit comments

Comments
 (0)