@@ -5,7 +5,7 @@ import { setupServer } from 'msw/node';
55import { client } from './gen/typescript/client.gen' ;
66// import { createOpencode } from '@opencode-ai/sdk';
77import { createMswHandlers } from './gen/typescript/msw.gen' ;
8- import { OpenCode } from './gen/typescript/sdk.gen' ;
8+ import { Sdk } from './gen/typescript/sdk.gen' ;
99import spec from './opencode.json' ;
1010
1111type MyPluginConfig = { readonly name : 'myplugin' } ;
@@ -26,68 +26,19 @@ const sourceHandlers = await fromOpenApi({
2626 basePath : 'https://api.example.com' ,
2727} ) ;
2828const handlers = createMswHandlers ( {
29- baseUrl : 'https://api.example.com ' ,
29+ baseUrl : 'https://api.heyapi.dev ' ,
3030} ) ;
3131
3232const 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}
0 commit comments