@opencode-ai/client 0.0.0-next-14944
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/contract.d.ts +1 -0
- package/dist/contract.js +1 -0
- package/dist/effect/api/api.d.ts +814 -0
- package/dist/effect/api/api.js +0 -0
- package/dist/effect/api.d.ts +6 -0
- package/dist/effect/api.js +0 -0
- package/dist/effect/generated/client-error.d.ts +7 -0
- package/dist/effect/generated/client-error.js +5 -0
- package/dist/effect/generated/client.d.ts +6112 -0
- package/dist/effect/generated/client.js +376 -0
- package/dist/effect/generated/index.d.ts +2 -0
- package/dist/effect/generated/index.js +2 -0
- package/dist/effect/index.d.ts +30 -0
- package/dist/effect/index.js +26 -0
- package/dist/effect/service.d.ts +28 -0
- package/dist/effect/service.js +113 -0
- package/dist/promise/api.d.ts +21 -0
- package/dist/promise/api.js +0 -0
- package/dist/promise/generated/client-error.d.ts +6 -0
- package/dist/promise/generated/client-error.js +8 -0
- package/dist/promise/generated/client.d.ts +1298 -0
- package/dist/promise/generated/client.js +970 -0
- package/dist/promise/generated/index.d.ts +3 -0
- package/dist/promise/generated/index.js +3 -0
- package/dist/promise/generated/types.d.ts +8306 -0
- package/dist/promise/generated/types.js +21 -0
- package/dist/promise/index.d.ts +4 -0
- package/dist/promise/index.js +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,970 @@
|
|
|
1
|
+
import { ClientError } from "./client-error";
|
|
2
|
+
export function make(options) {
|
|
3
|
+
const fetch = options.fetch ?? globalThis.fetch;
|
|
4
|
+
const prepare = (descriptor, requestOptions) => {
|
|
5
|
+
const url = new URL(descriptor.path, options.baseUrl);
|
|
6
|
+
for (const [key, value] of Object.entries(descriptor.query ?? {}))
|
|
7
|
+
appendQuery(url.searchParams, key, value);
|
|
8
|
+
const headers = new Headers(options.headers);
|
|
9
|
+
for (const [key, value] of Object.entries(descriptor.headers ?? {})) {
|
|
10
|
+
if (value !== undefined && value !== null)
|
|
11
|
+
headers.set(key, String(value));
|
|
12
|
+
}
|
|
13
|
+
for (const [key, value] of new Headers(requestOptions?.headers))
|
|
14
|
+
headers.set(key, value);
|
|
15
|
+
if (descriptor.body !== undefined && !headers.has("content-type"))
|
|
16
|
+
headers.set("content-type", "application/json");
|
|
17
|
+
return {
|
|
18
|
+
url,
|
|
19
|
+
init: {
|
|
20
|
+
method: descriptor.method,
|
|
21
|
+
signal: requestOptions?.signal,
|
|
22
|
+
headers,
|
|
23
|
+
body: descriptor.body === undefined ? undefined : JSON.stringify(descriptor.body),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const execute = async (descriptor, requestOptions) => {
|
|
28
|
+
try {
|
|
29
|
+
const prepared = prepare(descriptor, requestOptions);
|
|
30
|
+
return await fetch(prepared.url, prepared.init);
|
|
31
|
+
}
|
|
32
|
+
catch (cause) {
|
|
33
|
+
throw new ClientError("Transport", { cause });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const responseError = async (response, descriptor) => {
|
|
37
|
+
if (descriptor.declaredStatuses.includes(response.status))
|
|
38
|
+
throw await json(response);
|
|
39
|
+
try {
|
|
40
|
+
await response.body?.cancel();
|
|
41
|
+
}
|
|
42
|
+
catch { }
|
|
43
|
+
throw new ClientError("UnexpectedStatus", { cause: { status: response.status } });
|
|
44
|
+
};
|
|
45
|
+
const request = async (descriptor, requestOptions) => {
|
|
46
|
+
const response = await execute(descriptor, requestOptions);
|
|
47
|
+
if (response.status !== descriptor.successStatus)
|
|
48
|
+
return responseError(response, descriptor);
|
|
49
|
+
if (descriptor.binary)
|
|
50
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
51
|
+
if (descriptor.empty) {
|
|
52
|
+
try {
|
|
53
|
+
await response.body?.cancel();
|
|
54
|
+
}
|
|
55
|
+
catch { }
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return (await json(response));
|
|
59
|
+
};
|
|
60
|
+
const sse = (descriptor, requestOptions) => ({
|
|
61
|
+
async *[Symbol.asyncIterator]() {
|
|
62
|
+
const response = await execute(descriptor, requestOptions);
|
|
63
|
+
if (response.status !== descriptor.successStatus)
|
|
64
|
+
await responseError(response, descriptor);
|
|
65
|
+
if (!isContentType(response, "text/event-stream")) {
|
|
66
|
+
try {
|
|
67
|
+
await response.body?.cancel();
|
|
68
|
+
}
|
|
69
|
+
catch { }
|
|
70
|
+
throw new ClientError("UnsupportedContentType");
|
|
71
|
+
}
|
|
72
|
+
if (response.body === null)
|
|
73
|
+
throw new ClientError("MalformedResponse");
|
|
74
|
+
const reader = response.body.getReader();
|
|
75
|
+
const decoder = new TextDecoder();
|
|
76
|
+
let buffer = "";
|
|
77
|
+
try {
|
|
78
|
+
while (true) {
|
|
79
|
+
let next;
|
|
80
|
+
try {
|
|
81
|
+
next = await reader.read();
|
|
82
|
+
}
|
|
83
|
+
catch (cause) {
|
|
84
|
+
throw new ClientError("Transport", { cause });
|
|
85
|
+
}
|
|
86
|
+
buffer += decoder.decode(next.value, { stream: !next.done });
|
|
87
|
+
if (buffer.length > 1_048_576)
|
|
88
|
+
throw new ClientError("MalformedResponse");
|
|
89
|
+
const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
|
|
90
|
+
if (trailingCarriageReturn)
|
|
91
|
+
buffer = buffer.slice(0, -1);
|
|
92
|
+
buffer = buffer.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
|
|
93
|
+
if (trailingCarriageReturn)
|
|
94
|
+
buffer += "\r";
|
|
95
|
+
if (next.done && buffer !== "")
|
|
96
|
+
buffer += "\n\n";
|
|
97
|
+
let boundary = buffer.indexOf("\n\n");
|
|
98
|
+
while (boundary >= 0) {
|
|
99
|
+
const block = buffer.slice(0, boundary);
|
|
100
|
+
buffer = buffer.slice(boundary + 2);
|
|
101
|
+
const data = block
|
|
102
|
+
.split("\n")
|
|
103
|
+
.flatMap((line) => (line.startsWith("data:") ? [line.slice(5).trimStart()] : []))
|
|
104
|
+
.join("\n");
|
|
105
|
+
if (data !== "") {
|
|
106
|
+
try {
|
|
107
|
+
yield JSON.parse(data);
|
|
108
|
+
}
|
|
109
|
+
catch (cause) {
|
|
110
|
+
throw new ClientError("MalformedResponse", { cause });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
boundary = buffer.indexOf("\n\n");
|
|
114
|
+
}
|
|
115
|
+
if (next.done)
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
try {
|
|
121
|
+
await reader.cancel();
|
|
122
|
+
}
|
|
123
|
+
catch { }
|
|
124
|
+
reader.releaseLock();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
health: {
|
|
130
|
+
get: (requestOptions) => request({ method: "GET", path: `/api/health`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
|
|
131
|
+
},
|
|
132
|
+
location: {
|
|
133
|
+
get: (input, requestOptions) => request({
|
|
134
|
+
method: "GET",
|
|
135
|
+
path: `/api/location`,
|
|
136
|
+
query: { location: input?.["location"] },
|
|
137
|
+
successStatus: 200,
|
|
138
|
+
declaredStatuses: [401, 400],
|
|
139
|
+
empty: false,
|
|
140
|
+
}, requestOptions),
|
|
141
|
+
},
|
|
142
|
+
agent: {
|
|
143
|
+
list: (input, requestOptions) => request({
|
|
144
|
+
method: "GET",
|
|
145
|
+
path: `/api/agent`,
|
|
146
|
+
query: { location: input?.["location"] },
|
|
147
|
+
successStatus: 200,
|
|
148
|
+
declaredStatuses: [401, 400],
|
|
149
|
+
empty: false,
|
|
150
|
+
}, requestOptions),
|
|
151
|
+
},
|
|
152
|
+
plugin: {
|
|
153
|
+
list: (input, requestOptions) => request({
|
|
154
|
+
method: "GET",
|
|
155
|
+
path: `/api/plugin`,
|
|
156
|
+
query: { location: input?.["location"] },
|
|
157
|
+
successStatus: 200,
|
|
158
|
+
declaredStatuses: [401, 400],
|
|
159
|
+
empty: false,
|
|
160
|
+
}, requestOptions),
|
|
161
|
+
},
|
|
162
|
+
session: {
|
|
163
|
+
list: (input, requestOptions) => request({
|
|
164
|
+
method: "GET",
|
|
165
|
+
path: `/api/session`,
|
|
166
|
+
query: {
|
|
167
|
+
workspace: input?.["workspace"],
|
|
168
|
+
limit: input?.["limit"],
|
|
169
|
+
order: input?.["order"],
|
|
170
|
+
search: input?.["search"],
|
|
171
|
+
parentID: input?.["parentID"],
|
|
172
|
+
directory: input?.["directory"],
|
|
173
|
+
project: input?.["project"],
|
|
174
|
+
subpath: input?.["subpath"],
|
|
175
|
+
cursor: input?.["cursor"],
|
|
176
|
+
},
|
|
177
|
+
successStatus: 200,
|
|
178
|
+
declaredStatuses: [400, 401],
|
|
179
|
+
empty: false,
|
|
180
|
+
}, requestOptions),
|
|
181
|
+
create: (input, requestOptions) => request({
|
|
182
|
+
method: "POST",
|
|
183
|
+
path: `/api/session`,
|
|
184
|
+
body: {
|
|
185
|
+
id: input?.["id"],
|
|
186
|
+
agent: input?.["agent"],
|
|
187
|
+
model: input?.["model"],
|
|
188
|
+
location: input?.["location"],
|
|
189
|
+
},
|
|
190
|
+
successStatus: 200,
|
|
191
|
+
declaredStatuses: [401, 400],
|
|
192
|
+
empty: false,
|
|
193
|
+
}, requestOptions).then((value) => value.data),
|
|
194
|
+
active: (requestOptions) => request({
|
|
195
|
+
method: "GET",
|
|
196
|
+
path: `/api/session/active`,
|
|
197
|
+
successStatus: 200,
|
|
198
|
+
declaredStatuses: [401, 400],
|
|
199
|
+
empty: false,
|
|
200
|
+
}, requestOptions),
|
|
201
|
+
get: (input, requestOptions) => request({
|
|
202
|
+
method: "GET",
|
|
203
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}`,
|
|
204
|
+
successStatus: 200,
|
|
205
|
+
declaredStatuses: [404, 400, 401],
|
|
206
|
+
empty: false,
|
|
207
|
+
}, requestOptions).then((value) => value.data),
|
|
208
|
+
fork: (input, requestOptions) => request({
|
|
209
|
+
method: "POST",
|
|
210
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/fork`,
|
|
211
|
+
body: { messageID: input["messageID"] },
|
|
212
|
+
successStatus: 200,
|
|
213
|
+
declaredStatuses: [404, 400, 401],
|
|
214
|
+
empty: false,
|
|
215
|
+
}, requestOptions).then((value) => value.data),
|
|
216
|
+
switchAgent: (input, requestOptions) => request({
|
|
217
|
+
method: "POST",
|
|
218
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/agent`,
|
|
219
|
+
body: { agent: input["agent"] },
|
|
220
|
+
successStatus: 204,
|
|
221
|
+
declaredStatuses: [404, 400, 401],
|
|
222
|
+
empty: true,
|
|
223
|
+
}, requestOptions),
|
|
224
|
+
switchModel: (input, requestOptions) => request({
|
|
225
|
+
method: "POST",
|
|
226
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/model`,
|
|
227
|
+
body: { model: input["model"] },
|
|
228
|
+
successStatus: 204,
|
|
229
|
+
declaredStatuses: [404, 400, 401],
|
|
230
|
+
empty: true,
|
|
231
|
+
}, requestOptions),
|
|
232
|
+
rename: (input, requestOptions) => request({
|
|
233
|
+
method: "POST",
|
|
234
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/rename`,
|
|
235
|
+
body: { title: input["title"] },
|
|
236
|
+
successStatus: 204,
|
|
237
|
+
declaredStatuses: [404, 400, 401],
|
|
238
|
+
empty: true,
|
|
239
|
+
}, requestOptions),
|
|
240
|
+
prompt: (input, requestOptions) => request({
|
|
241
|
+
method: "POST",
|
|
242
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/prompt`,
|
|
243
|
+
body: { id: input["id"], prompt: input["prompt"], delivery: input["delivery"], resume: input["resume"] },
|
|
244
|
+
successStatus: 200,
|
|
245
|
+
declaredStatuses: [409, 404, 400, 401],
|
|
246
|
+
empty: false,
|
|
247
|
+
}, requestOptions).then((value) => value.data),
|
|
248
|
+
command: (input, requestOptions) => request({
|
|
249
|
+
method: "POST",
|
|
250
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/command`,
|
|
251
|
+
body: {
|
|
252
|
+
id: input["id"],
|
|
253
|
+
command: input["command"],
|
|
254
|
+
arguments: input["arguments"],
|
|
255
|
+
agent: input["agent"],
|
|
256
|
+
model: input["model"],
|
|
257
|
+
files: input["files"],
|
|
258
|
+
agents: input["agents"],
|
|
259
|
+
delivery: input["delivery"],
|
|
260
|
+
resume: input["resume"],
|
|
261
|
+
},
|
|
262
|
+
successStatus: 200,
|
|
263
|
+
declaredStatuses: [409, 404, 500, 400, 401],
|
|
264
|
+
empty: false,
|
|
265
|
+
}, requestOptions).then((value) => value.data),
|
|
266
|
+
skill: (input, requestOptions) => request({
|
|
267
|
+
method: "POST",
|
|
268
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/skill`,
|
|
269
|
+
body: { id: input["id"], skill: input["skill"], resume: input["resume"] },
|
|
270
|
+
successStatus: 204,
|
|
271
|
+
declaredStatuses: [404, 400, 401],
|
|
272
|
+
empty: true,
|
|
273
|
+
}, requestOptions),
|
|
274
|
+
synthetic: (input, requestOptions) => request({
|
|
275
|
+
method: "POST",
|
|
276
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/synthetic`,
|
|
277
|
+
body: { text: input["text"], description: input["description"], metadata: input["metadata"] },
|
|
278
|
+
successStatus: 204,
|
|
279
|
+
declaredStatuses: [404, 400, 401],
|
|
280
|
+
empty: true,
|
|
281
|
+
}, requestOptions),
|
|
282
|
+
shell: (input, requestOptions) => request({
|
|
283
|
+
method: "POST",
|
|
284
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/shell`,
|
|
285
|
+
body: { id: input["id"], command: input["command"] },
|
|
286
|
+
successStatus: 204,
|
|
287
|
+
declaredStatuses: [404, 400, 401],
|
|
288
|
+
empty: true,
|
|
289
|
+
}, requestOptions),
|
|
290
|
+
compact: (input, requestOptions) => request({
|
|
291
|
+
method: "POST",
|
|
292
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/compact`,
|
|
293
|
+
successStatus: 204,
|
|
294
|
+
declaredStatuses: [404, 409, 503, 500, 400, 401],
|
|
295
|
+
empty: true,
|
|
296
|
+
}, requestOptions),
|
|
297
|
+
wait: (input, requestOptions) => request({
|
|
298
|
+
method: "POST",
|
|
299
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/wait`,
|
|
300
|
+
successStatus: 204,
|
|
301
|
+
declaredStatuses: [404, 503, 400, 401],
|
|
302
|
+
empty: true,
|
|
303
|
+
}, requestOptions),
|
|
304
|
+
revertStage: (input, requestOptions) => request({
|
|
305
|
+
method: "POST",
|
|
306
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/stage`,
|
|
307
|
+
body: { messageID: input["messageID"], files: input["files"] },
|
|
308
|
+
successStatus: 200,
|
|
309
|
+
declaredStatuses: [404, 409, 500, 400, 401],
|
|
310
|
+
empty: false,
|
|
311
|
+
}, requestOptions).then((value) => value.data),
|
|
312
|
+
revertClear: (input, requestOptions) => request({
|
|
313
|
+
method: "POST",
|
|
314
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/clear`,
|
|
315
|
+
successStatus: 204,
|
|
316
|
+
declaredStatuses: [404, 409, 500, 400, 401],
|
|
317
|
+
empty: true,
|
|
318
|
+
}, requestOptions),
|
|
319
|
+
revertCommit: (input, requestOptions) => request({
|
|
320
|
+
method: "POST",
|
|
321
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/commit`,
|
|
322
|
+
successStatus: 204,
|
|
323
|
+
declaredStatuses: [404, 409, 400, 401],
|
|
324
|
+
empty: true,
|
|
325
|
+
}, requestOptions),
|
|
326
|
+
context: (input, requestOptions) => request({
|
|
327
|
+
method: "GET",
|
|
328
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/context`,
|
|
329
|
+
successStatus: 200,
|
|
330
|
+
declaredStatuses: [404, 500, 400, 401],
|
|
331
|
+
empty: false,
|
|
332
|
+
}, requestOptions).then((value) => value.data),
|
|
333
|
+
listContextEntries: (input, requestOptions) => request({
|
|
334
|
+
method: "GET",
|
|
335
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/context-entry`,
|
|
336
|
+
successStatus: 200,
|
|
337
|
+
declaredStatuses: [404, 400, 401],
|
|
338
|
+
empty: false,
|
|
339
|
+
}, requestOptions).then((value) => value.data),
|
|
340
|
+
putContextEntry: (input, requestOptions) => request({
|
|
341
|
+
method: "PUT",
|
|
342
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/context-entry/${encodeURIComponent(input.key)}`,
|
|
343
|
+
body: { value: input["value"] },
|
|
344
|
+
successStatus: 204,
|
|
345
|
+
declaredStatuses: [404, 400, 401],
|
|
346
|
+
empty: true,
|
|
347
|
+
}, requestOptions),
|
|
348
|
+
removeContextEntry: (input, requestOptions) => request({
|
|
349
|
+
method: "DELETE",
|
|
350
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/context-entry/${encodeURIComponent(input.key)}`,
|
|
351
|
+
successStatus: 204,
|
|
352
|
+
declaredStatuses: [404, 400, 401],
|
|
353
|
+
empty: true,
|
|
354
|
+
}, requestOptions),
|
|
355
|
+
log: (input, requestOptions) => sse({
|
|
356
|
+
method: "GET",
|
|
357
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/log`,
|
|
358
|
+
query: { after: input["after"], follow: input["follow"] },
|
|
359
|
+
successStatus: 200,
|
|
360
|
+
declaredStatuses: [404, 400, 401],
|
|
361
|
+
empty: false,
|
|
362
|
+
}, requestOptions),
|
|
363
|
+
interrupt: (input, requestOptions) => request({
|
|
364
|
+
method: "POST",
|
|
365
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/interrupt`,
|
|
366
|
+
successStatus: 204,
|
|
367
|
+
declaredStatuses: [404, 400, 401],
|
|
368
|
+
empty: true,
|
|
369
|
+
}, requestOptions),
|
|
370
|
+
background: (input, requestOptions) => request({
|
|
371
|
+
method: "POST",
|
|
372
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/background`,
|
|
373
|
+
successStatus: 204,
|
|
374
|
+
declaredStatuses: [404, 400, 401],
|
|
375
|
+
empty: true,
|
|
376
|
+
}, requestOptions),
|
|
377
|
+
message: (input, requestOptions) => request({
|
|
378
|
+
method: "GET",
|
|
379
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/message/${encodeURIComponent(input.messageID)}`,
|
|
380
|
+
successStatus: 200,
|
|
381
|
+
declaredStatuses: [404, 400, 401],
|
|
382
|
+
empty: false,
|
|
383
|
+
}, requestOptions).then((value) => value.data),
|
|
384
|
+
},
|
|
385
|
+
message: {
|
|
386
|
+
list: (input, requestOptions) => request({
|
|
387
|
+
method: "GET",
|
|
388
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/message`,
|
|
389
|
+
query: { limit: input["limit"], order: input["order"], cursor: input["cursor"] },
|
|
390
|
+
successStatus: 200,
|
|
391
|
+
declaredStatuses: [400, 404, 500, 401],
|
|
392
|
+
empty: false,
|
|
393
|
+
}, requestOptions),
|
|
394
|
+
},
|
|
395
|
+
model: {
|
|
396
|
+
list: (input, requestOptions) => request({
|
|
397
|
+
method: "GET",
|
|
398
|
+
path: `/api/model`,
|
|
399
|
+
query: { location: input?.["location"] },
|
|
400
|
+
successStatus: 200,
|
|
401
|
+
declaredStatuses: [503, 401, 400],
|
|
402
|
+
empty: false,
|
|
403
|
+
}, requestOptions),
|
|
404
|
+
default: (input, requestOptions) => request({
|
|
405
|
+
method: "GET",
|
|
406
|
+
path: `/api/model/default`,
|
|
407
|
+
query: { location: input?.["location"] },
|
|
408
|
+
successStatus: 200,
|
|
409
|
+
declaredStatuses: [503, 401, 400],
|
|
410
|
+
empty: false,
|
|
411
|
+
}, requestOptions),
|
|
412
|
+
},
|
|
413
|
+
generate: {
|
|
414
|
+
text: (input, requestOptions) => request({
|
|
415
|
+
method: "POST",
|
|
416
|
+
path: `/api/generate`,
|
|
417
|
+
query: { location: input["location"] },
|
|
418
|
+
body: { prompt: input["prompt"], model: input["model"] },
|
|
419
|
+
successStatus: 200,
|
|
420
|
+
declaredStatuses: [400, 503, 401],
|
|
421
|
+
empty: false,
|
|
422
|
+
}, requestOptions).then((value) => value.data),
|
|
423
|
+
},
|
|
424
|
+
provider: {
|
|
425
|
+
list: (input, requestOptions) => request({
|
|
426
|
+
method: "GET",
|
|
427
|
+
path: `/api/provider`,
|
|
428
|
+
query: { location: input?.["location"] },
|
|
429
|
+
successStatus: 200,
|
|
430
|
+
declaredStatuses: [503, 401, 400],
|
|
431
|
+
empty: false,
|
|
432
|
+
}, requestOptions),
|
|
433
|
+
get: (input, requestOptions) => request({
|
|
434
|
+
method: "GET",
|
|
435
|
+
path: `/api/provider/${encodeURIComponent(input.providerID)}`,
|
|
436
|
+
query: { location: input["location"] },
|
|
437
|
+
successStatus: 200,
|
|
438
|
+
declaredStatuses: [404, 503, 401, 400],
|
|
439
|
+
empty: false,
|
|
440
|
+
}, requestOptions),
|
|
441
|
+
},
|
|
442
|
+
integration: {
|
|
443
|
+
list: (input, requestOptions) => request({
|
|
444
|
+
method: "GET",
|
|
445
|
+
path: `/api/integration`,
|
|
446
|
+
query: { location: input?.["location"] },
|
|
447
|
+
successStatus: 200,
|
|
448
|
+
declaredStatuses: [401, 400],
|
|
449
|
+
empty: false,
|
|
450
|
+
}, requestOptions),
|
|
451
|
+
get: (input, requestOptions) => request({
|
|
452
|
+
method: "GET",
|
|
453
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}`,
|
|
454
|
+
query: { location: input["location"] },
|
|
455
|
+
successStatus: 200,
|
|
456
|
+
declaredStatuses: [401, 400],
|
|
457
|
+
empty: false,
|
|
458
|
+
}, requestOptions),
|
|
459
|
+
connectKey: (input, requestOptions) => request({
|
|
460
|
+
method: "POST",
|
|
461
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/key`,
|
|
462
|
+
query: { location: input["location"] },
|
|
463
|
+
body: { key: input["key"], label: input["label"] },
|
|
464
|
+
successStatus: 204,
|
|
465
|
+
declaredStatuses: [400, 401],
|
|
466
|
+
empty: true,
|
|
467
|
+
}, requestOptions),
|
|
468
|
+
connectOauth: (input, requestOptions) => request({
|
|
469
|
+
method: "POST",
|
|
470
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth`,
|
|
471
|
+
query: { location: input["location"] },
|
|
472
|
+
body: { methodID: input["methodID"], inputs: input["inputs"], label: input["label"] },
|
|
473
|
+
successStatus: 200,
|
|
474
|
+
declaredStatuses: [400, 401],
|
|
475
|
+
empty: false,
|
|
476
|
+
}, requestOptions),
|
|
477
|
+
attemptStatus: (input, requestOptions) => request({
|
|
478
|
+
method: "GET",
|
|
479
|
+
path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}`,
|
|
480
|
+
query: { location: input["location"] },
|
|
481
|
+
successStatus: 200,
|
|
482
|
+
declaredStatuses: [401, 400],
|
|
483
|
+
empty: false,
|
|
484
|
+
}, requestOptions),
|
|
485
|
+
attemptComplete: (input, requestOptions) => request({
|
|
486
|
+
method: "POST",
|
|
487
|
+
path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}/complete`,
|
|
488
|
+
query: { location: input["location"] },
|
|
489
|
+
body: { code: input["code"] },
|
|
490
|
+
successStatus: 204,
|
|
491
|
+
declaredStatuses: [400, 401],
|
|
492
|
+
empty: true,
|
|
493
|
+
}, requestOptions),
|
|
494
|
+
attemptCancel: (input, requestOptions) => request({
|
|
495
|
+
method: "DELETE",
|
|
496
|
+
path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}`,
|
|
497
|
+
query: { location: input["location"] },
|
|
498
|
+
successStatus: 204,
|
|
499
|
+
declaredStatuses: [401, 400],
|
|
500
|
+
empty: true,
|
|
501
|
+
}, requestOptions),
|
|
502
|
+
},
|
|
503
|
+
"server.mcp": {
|
|
504
|
+
list: (input, requestOptions) => request({
|
|
505
|
+
method: "GET",
|
|
506
|
+
path: `/api/mcp`,
|
|
507
|
+
query: { location: input?.["location"] },
|
|
508
|
+
successStatus: 200,
|
|
509
|
+
declaredStatuses: [401, 400],
|
|
510
|
+
empty: false,
|
|
511
|
+
}, requestOptions),
|
|
512
|
+
},
|
|
513
|
+
credential: {
|
|
514
|
+
update: (input, requestOptions) => request({
|
|
515
|
+
method: "PATCH",
|
|
516
|
+
path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
|
|
517
|
+
query: { location: input["location"] },
|
|
518
|
+
body: { label: input["label"] },
|
|
519
|
+
successStatus: 204,
|
|
520
|
+
declaredStatuses: [401, 400],
|
|
521
|
+
empty: true,
|
|
522
|
+
}, requestOptions),
|
|
523
|
+
remove: (input, requestOptions) => request({
|
|
524
|
+
method: "DELETE",
|
|
525
|
+
path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
|
|
526
|
+
query: { location: input["location"] },
|
|
527
|
+
successStatus: 204,
|
|
528
|
+
declaredStatuses: [401, 400],
|
|
529
|
+
empty: true,
|
|
530
|
+
}, requestOptions),
|
|
531
|
+
},
|
|
532
|
+
project: {
|
|
533
|
+
current: (input, requestOptions) => request({
|
|
534
|
+
method: "GET",
|
|
535
|
+
path: `/api/project/current`,
|
|
536
|
+
query: { location: input?.["location"] },
|
|
537
|
+
successStatus: 200,
|
|
538
|
+
declaredStatuses: [401, 400],
|
|
539
|
+
empty: false,
|
|
540
|
+
}, requestOptions),
|
|
541
|
+
directories: (input, requestOptions) => request({
|
|
542
|
+
method: "GET",
|
|
543
|
+
path: `/api/project/${encodeURIComponent(input.projectID)}/directories`,
|
|
544
|
+
query: { location: input["location"] },
|
|
545
|
+
successStatus: 200,
|
|
546
|
+
declaredStatuses: [401, 400],
|
|
547
|
+
empty: false,
|
|
548
|
+
}, requestOptions),
|
|
549
|
+
},
|
|
550
|
+
form: {
|
|
551
|
+
listRequests: (input, requestOptions) => request({
|
|
552
|
+
method: "GET",
|
|
553
|
+
path: `/api/form/request`,
|
|
554
|
+
query: { location: input?.["location"] },
|
|
555
|
+
successStatus: 200,
|
|
556
|
+
declaredStatuses: [401, 400],
|
|
557
|
+
empty: false,
|
|
558
|
+
}, requestOptions),
|
|
559
|
+
list: (input, requestOptions) => request({
|
|
560
|
+
method: "GET",
|
|
561
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form`,
|
|
562
|
+
successStatus: 200,
|
|
563
|
+
declaredStatuses: [404, 400, 401],
|
|
564
|
+
empty: false,
|
|
565
|
+
}, requestOptions).then((value) => value.data),
|
|
566
|
+
create: (input, requestOptions) => request({
|
|
567
|
+
method: "POST",
|
|
568
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form`,
|
|
569
|
+
body: {
|
|
570
|
+
id: input["id"],
|
|
571
|
+
title: input["title"],
|
|
572
|
+
metadata: input["metadata"],
|
|
573
|
+
mode: input["mode"],
|
|
574
|
+
fields: input["fields"],
|
|
575
|
+
url: input["url"],
|
|
576
|
+
},
|
|
577
|
+
successStatus: 200,
|
|
578
|
+
declaredStatuses: [404, 409, 400, 401],
|
|
579
|
+
empty: false,
|
|
580
|
+
}, requestOptions).then((value) => value.data),
|
|
581
|
+
get: (input, requestOptions) => request({
|
|
582
|
+
method: "GET",
|
|
583
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}`,
|
|
584
|
+
successStatus: 200,
|
|
585
|
+
declaredStatuses: [404, 400, 401],
|
|
586
|
+
empty: false,
|
|
587
|
+
}, requestOptions).then((value) => value.data),
|
|
588
|
+
state: (input, requestOptions) => request({
|
|
589
|
+
method: "GET",
|
|
590
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}/state`,
|
|
591
|
+
successStatus: 200,
|
|
592
|
+
declaredStatuses: [404, 400, 401],
|
|
593
|
+
empty: false,
|
|
594
|
+
}, requestOptions).then((value) => value.data),
|
|
595
|
+
reply: (input, requestOptions) => request({
|
|
596
|
+
method: "POST",
|
|
597
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}/reply`,
|
|
598
|
+
body: { answer: input["answer"] },
|
|
599
|
+
successStatus: 204,
|
|
600
|
+
declaredStatuses: [404, 409, 400, 401],
|
|
601
|
+
empty: true,
|
|
602
|
+
}, requestOptions),
|
|
603
|
+
cancel: (input, requestOptions) => request({
|
|
604
|
+
method: "POST",
|
|
605
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}/cancel`,
|
|
606
|
+
successStatus: 204,
|
|
607
|
+
declaredStatuses: [404, 409, 400, 401],
|
|
608
|
+
empty: true,
|
|
609
|
+
}, requestOptions),
|
|
610
|
+
},
|
|
611
|
+
permission: {
|
|
612
|
+
listRequests: (input, requestOptions) => request({
|
|
613
|
+
method: "GET",
|
|
614
|
+
path: `/api/permission/request`,
|
|
615
|
+
query: { location: input?.["location"] },
|
|
616
|
+
successStatus: 200,
|
|
617
|
+
declaredStatuses: [401, 400],
|
|
618
|
+
empty: false,
|
|
619
|
+
}, requestOptions),
|
|
620
|
+
listSaved: (input, requestOptions) => request({
|
|
621
|
+
method: "GET",
|
|
622
|
+
path: `/api/permission/saved`,
|
|
623
|
+
query: { projectID: input?.["projectID"] },
|
|
624
|
+
successStatus: 200,
|
|
625
|
+
declaredStatuses: [401, 400],
|
|
626
|
+
empty: false,
|
|
627
|
+
}, requestOptions).then((value) => value.data),
|
|
628
|
+
removeSaved: (input, requestOptions) => request({
|
|
629
|
+
method: "DELETE",
|
|
630
|
+
path: `/api/permission/saved/${encodeURIComponent(input.id)}`,
|
|
631
|
+
successStatus: 204,
|
|
632
|
+
declaredStatuses: [401, 400],
|
|
633
|
+
empty: true,
|
|
634
|
+
}, requestOptions),
|
|
635
|
+
create: (input, requestOptions) => request({
|
|
636
|
+
method: "POST",
|
|
637
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
|
|
638
|
+
body: {
|
|
639
|
+
id: input["id"],
|
|
640
|
+
action: input["action"],
|
|
641
|
+
resources: input["resources"],
|
|
642
|
+
save: input["save"],
|
|
643
|
+
metadata: input["metadata"],
|
|
644
|
+
source: input["source"],
|
|
645
|
+
agent: input["agent"],
|
|
646
|
+
},
|
|
647
|
+
successStatus: 200,
|
|
648
|
+
declaredStatuses: [404, 400, 401],
|
|
649
|
+
empty: false,
|
|
650
|
+
}, requestOptions).then((value) => value.data),
|
|
651
|
+
list: (input, requestOptions) => request({
|
|
652
|
+
method: "GET",
|
|
653
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
|
|
654
|
+
successStatus: 200,
|
|
655
|
+
declaredStatuses: [404, 400, 401],
|
|
656
|
+
empty: false,
|
|
657
|
+
}, requestOptions).then((value) => value.data),
|
|
658
|
+
get: (input, requestOptions) => request({
|
|
659
|
+
method: "GET",
|
|
660
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}`,
|
|
661
|
+
successStatus: 200,
|
|
662
|
+
declaredStatuses: [404, 400, 401],
|
|
663
|
+
empty: false,
|
|
664
|
+
}, requestOptions).then((value) => value.data),
|
|
665
|
+
reply: (input, requestOptions) => request({
|
|
666
|
+
method: "POST",
|
|
667
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}/reply`,
|
|
668
|
+
body: { reply: input["reply"], message: input["message"] },
|
|
669
|
+
successStatus: 204,
|
|
670
|
+
declaredStatuses: [404, 400, 401],
|
|
671
|
+
empty: true,
|
|
672
|
+
}, requestOptions),
|
|
673
|
+
},
|
|
674
|
+
file: {
|
|
675
|
+
read: (input, requestOptions) => request({
|
|
676
|
+
method: "GET",
|
|
677
|
+
path: `/api/fs/read/${encodePath(input.path)}`,
|
|
678
|
+
query: { location: input["location"] },
|
|
679
|
+
successStatus: 200,
|
|
680
|
+
declaredStatuses: [401, 400],
|
|
681
|
+
empty: false,
|
|
682
|
+
binary: true,
|
|
683
|
+
}, requestOptions),
|
|
684
|
+
list: (input, requestOptions) => request({
|
|
685
|
+
method: "GET",
|
|
686
|
+
path: `/api/fs/list`,
|
|
687
|
+
query: { location: input?.["location"], path: input?.["path"] },
|
|
688
|
+
successStatus: 200,
|
|
689
|
+
declaredStatuses: [401, 400],
|
|
690
|
+
empty: false,
|
|
691
|
+
}, requestOptions),
|
|
692
|
+
find: (input, requestOptions) => request({
|
|
693
|
+
method: "GET",
|
|
694
|
+
path: `/api/fs/find`,
|
|
695
|
+
query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
|
|
696
|
+
successStatus: 200,
|
|
697
|
+
declaredStatuses: [401, 400],
|
|
698
|
+
empty: false,
|
|
699
|
+
}, requestOptions),
|
|
700
|
+
},
|
|
701
|
+
command: {
|
|
702
|
+
list: (input, requestOptions) => request({
|
|
703
|
+
method: "GET",
|
|
704
|
+
path: `/api/command`,
|
|
705
|
+
query: { location: input?.["location"] },
|
|
706
|
+
successStatus: 200,
|
|
707
|
+
declaredStatuses: [401, 400],
|
|
708
|
+
empty: false,
|
|
709
|
+
}, requestOptions),
|
|
710
|
+
},
|
|
711
|
+
skill: {
|
|
712
|
+
list: (input, requestOptions) => request({
|
|
713
|
+
method: "GET",
|
|
714
|
+
path: `/api/skill`,
|
|
715
|
+
query: { location: input?.["location"] },
|
|
716
|
+
successStatus: 200,
|
|
717
|
+
declaredStatuses: [401, 400],
|
|
718
|
+
empty: false,
|
|
719
|
+
}, requestOptions),
|
|
720
|
+
},
|
|
721
|
+
event: {
|
|
722
|
+
subscribe: (requestOptions) => sse({ method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
|
|
723
|
+
changes: (requestOptions) => sse({ method: "GET", path: `/api/event/changes`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
|
|
724
|
+
},
|
|
725
|
+
pty: {
|
|
726
|
+
list: (input, requestOptions) => request({
|
|
727
|
+
method: "GET",
|
|
728
|
+
path: `/api/pty`,
|
|
729
|
+
query: { location: input?.["location"] },
|
|
730
|
+
successStatus: 200,
|
|
731
|
+
declaredStatuses: [401, 400],
|
|
732
|
+
empty: false,
|
|
733
|
+
}, requestOptions),
|
|
734
|
+
create: (input, requestOptions) => request({
|
|
735
|
+
method: "POST",
|
|
736
|
+
path: `/api/pty`,
|
|
737
|
+
query: { location: input?.["location"] },
|
|
738
|
+
body: {
|
|
739
|
+
command: input?.["command"],
|
|
740
|
+
args: input?.["args"],
|
|
741
|
+
cwd: input?.["cwd"],
|
|
742
|
+
title: input?.["title"],
|
|
743
|
+
env: input?.["env"],
|
|
744
|
+
},
|
|
745
|
+
successStatus: 200,
|
|
746
|
+
declaredStatuses: [401, 400],
|
|
747
|
+
empty: false,
|
|
748
|
+
}, requestOptions),
|
|
749
|
+
get: (input, requestOptions) => request({
|
|
750
|
+
method: "GET",
|
|
751
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
752
|
+
query: { location: input["location"] },
|
|
753
|
+
successStatus: 200,
|
|
754
|
+
declaredStatuses: [404, 401, 400],
|
|
755
|
+
empty: false,
|
|
756
|
+
}, requestOptions),
|
|
757
|
+
update: (input, requestOptions) => request({
|
|
758
|
+
method: "PUT",
|
|
759
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
760
|
+
query: { location: input["location"] },
|
|
761
|
+
body: { title: input["title"], size: input["size"] },
|
|
762
|
+
successStatus: 200,
|
|
763
|
+
declaredStatuses: [404, 401, 400],
|
|
764
|
+
empty: false,
|
|
765
|
+
}, requestOptions),
|
|
766
|
+
remove: (input, requestOptions) => request({
|
|
767
|
+
method: "DELETE",
|
|
768
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
769
|
+
query: { location: input["location"] },
|
|
770
|
+
successStatus: 204,
|
|
771
|
+
declaredStatuses: [404, 401, 400],
|
|
772
|
+
empty: true,
|
|
773
|
+
}, requestOptions),
|
|
774
|
+
},
|
|
775
|
+
shell: {
|
|
776
|
+
list: (input, requestOptions) => request({
|
|
777
|
+
method: "GET",
|
|
778
|
+
path: `/api/shell`,
|
|
779
|
+
query: { location: input?.["location"] },
|
|
780
|
+
successStatus: 200,
|
|
781
|
+
declaredStatuses: [401, 400],
|
|
782
|
+
empty: false,
|
|
783
|
+
}, requestOptions),
|
|
784
|
+
create: (input, requestOptions) => request({
|
|
785
|
+
method: "POST",
|
|
786
|
+
path: `/api/shell`,
|
|
787
|
+
query: { location: input["location"] },
|
|
788
|
+
body: {
|
|
789
|
+
command: input["command"],
|
|
790
|
+
cwd: input["cwd"],
|
|
791
|
+
timeout: input["timeout"],
|
|
792
|
+
metadata: input["metadata"],
|
|
793
|
+
},
|
|
794
|
+
successStatus: 200,
|
|
795
|
+
declaredStatuses: [401, 400],
|
|
796
|
+
empty: false,
|
|
797
|
+
}, requestOptions),
|
|
798
|
+
get: (input, requestOptions) => request({
|
|
799
|
+
method: "GET",
|
|
800
|
+
path: `/api/shell/${encodeURIComponent(input.id)}`,
|
|
801
|
+
query: { location: input["location"] },
|
|
802
|
+
successStatus: 200,
|
|
803
|
+
declaredStatuses: [404, 401, 400],
|
|
804
|
+
empty: false,
|
|
805
|
+
}, requestOptions),
|
|
806
|
+
output: (input, requestOptions) => request({
|
|
807
|
+
method: "GET",
|
|
808
|
+
path: `/api/shell/${encodeURIComponent(input.id)}/output`,
|
|
809
|
+
query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
|
|
810
|
+
successStatus: 200,
|
|
811
|
+
declaredStatuses: [404, 401, 400],
|
|
812
|
+
empty: false,
|
|
813
|
+
}, requestOptions),
|
|
814
|
+
remove: (input, requestOptions) => request({
|
|
815
|
+
method: "DELETE",
|
|
816
|
+
path: `/api/shell/${encodeURIComponent(input.id)}`,
|
|
817
|
+
query: { location: input["location"] },
|
|
818
|
+
successStatus: 204,
|
|
819
|
+
declaredStatuses: [404, 401, 400],
|
|
820
|
+
empty: true,
|
|
821
|
+
}, requestOptions),
|
|
822
|
+
},
|
|
823
|
+
question: {
|
|
824
|
+
listRequests: (input, requestOptions) => request({
|
|
825
|
+
method: "GET",
|
|
826
|
+
path: `/api/question/request`,
|
|
827
|
+
query: { location: input?.["location"] },
|
|
828
|
+
successStatus: 200,
|
|
829
|
+
declaredStatuses: [401, 400],
|
|
830
|
+
empty: false,
|
|
831
|
+
}, requestOptions),
|
|
832
|
+
list: (input, requestOptions) => request({
|
|
833
|
+
method: "GET",
|
|
834
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/question`,
|
|
835
|
+
successStatus: 200,
|
|
836
|
+
declaredStatuses: [404, 400, 401],
|
|
837
|
+
empty: false,
|
|
838
|
+
}, requestOptions).then((value) => value.data),
|
|
839
|
+
reply: (input, requestOptions) => request({
|
|
840
|
+
method: "POST",
|
|
841
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/question/${encodeURIComponent(input.requestID)}/reply`,
|
|
842
|
+
body: { answers: input["answers"] },
|
|
843
|
+
successStatus: 204,
|
|
844
|
+
declaredStatuses: [404, 400, 401],
|
|
845
|
+
empty: true,
|
|
846
|
+
}, requestOptions),
|
|
847
|
+
reject: (input, requestOptions) => request({
|
|
848
|
+
method: "POST",
|
|
849
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/question/${encodeURIComponent(input.requestID)}/reject`,
|
|
850
|
+
successStatus: 204,
|
|
851
|
+
declaredStatuses: [404, 400, 401],
|
|
852
|
+
empty: true,
|
|
853
|
+
}, requestOptions),
|
|
854
|
+
},
|
|
855
|
+
reference: {
|
|
856
|
+
list: (input, requestOptions) => request({
|
|
857
|
+
method: "GET",
|
|
858
|
+
path: `/api/reference`,
|
|
859
|
+
query: { location: input?.["location"] },
|
|
860
|
+
successStatus: 200,
|
|
861
|
+
declaredStatuses: [401, 400],
|
|
862
|
+
empty: false,
|
|
863
|
+
}, requestOptions),
|
|
864
|
+
},
|
|
865
|
+
projectCopy: {
|
|
866
|
+
create: (input, requestOptions) => request({
|
|
867
|
+
method: "POST",
|
|
868
|
+
path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy`,
|
|
869
|
+
query: { location: input["location"] },
|
|
870
|
+
body: { strategy: input["strategy"], directory: input["directory"], name: input["name"] },
|
|
871
|
+
successStatus: 200,
|
|
872
|
+
declaredStatuses: [400, 401],
|
|
873
|
+
empty: false,
|
|
874
|
+
}, requestOptions),
|
|
875
|
+
remove: (input, requestOptions) => request({
|
|
876
|
+
method: "DELETE",
|
|
877
|
+
path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy`,
|
|
878
|
+
query: { location: input["location"] },
|
|
879
|
+
body: { directory: input["directory"], force: input["force"] },
|
|
880
|
+
successStatus: 204,
|
|
881
|
+
declaredStatuses: [400, 401],
|
|
882
|
+
empty: true,
|
|
883
|
+
}, requestOptions),
|
|
884
|
+
refresh: (input, requestOptions) => request({
|
|
885
|
+
method: "POST",
|
|
886
|
+
path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy/refresh`,
|
|
887
|
+
query: { location: input["location"] },
|
|
888
|
+
successStatus: 204,
|
|
889
|
+
declaredStatuses: [400, 401],
|
|
890
|
+
empty: true,
|
|
891
|
+
}, requestOptions),
|
|
892
|
+
},
|
|
893
|
+
vcs: {
|
|
894
|
+
status: (input, requestOptions) => request({
|
|
895
|
+
method: "GET",
|
|
896
|
+
path: `/api/vcs/status`,
|
|
897
|
+
query: { location: input?.["location"] },
|
|
898
|
+
successStatus: 200,
|
|
899
|
+
declaredStatuses: [401, 400],
|
|
900
|
+
empty: false,
|
|
901
|
+
}, requestOptions),
|
|
902
|
+
diff: (input, requestOptions) => request({
|
|
903
|
+
method: "GET",
|
|
904
|
+
path: `/api/vcs/diff`,
|
|
905
|
+
query: { location: input["location"], mode: input["mode"], context: input["context"] },
|
|
906
|
+
successStatus: 200,
|
|
907
|
+
declaredStatuses: [401, 400],
|
|
908
|
+
empty: false,
|
|
909
|
+
}, requestOptions),
|
|
910
|
+
},
|
|
911
|
+
debug: {
|
|
912
|
+
location: (requestOptions) => request({
|
|
913
|
+
method: "GET",
|
|
914
|
+
path: `/api/debug/location`,
|
|
915
|
+
successStatus: 200,
|
|
916
|
+
declaredStatuses: [401, 400],
|
|
917
|
+
empty: false,
|
|
918
|
+
}, requestOptions),
|
|
919
|
+
},
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
function encodePath(value) {
|
|
923
|
+
return value.split("/").map(encodeURIComponent).join("/");
|
|
924
|
+
}
|
|
925
|
+
function appendQuery(params, key, value) {
|
|
926
|
+
if (value === undefined)
|
|
927
|
+
return;
|
|
928
|
+
if (value === null) {
|
|
929
|
+
params.append(key, "null");
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
if (Array.isArray(value)) {
|
|
933
|
+
for (const item of value)
|
|
934
|
+
appendQuery(params, key, item);
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
if (typeof value === "object") {
|
|
938
|
+
for (const [child, item] of Object.entries(value))
|
|
939
|
+
appendQuery(params, `${key}[${child}]`, item);
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
params.append(key, String(value));
|
|
943
|
+
}
|
|
944
|
+
async function json(response) {
|
|
945
|
+
if (!isContentType(response, "application/json") && !response.headers.get("content-type")?.includes("+json")) {
|
|
946
|
+
try {
|
|
947
|
+
await response.body?.cancel();
|
|
948
|
+
}
|
|
949
|
+
catch { }
|
|
950
|
+
throw new ClientError("UnsupportedContentType");
|
|
951
|
+
}
|
|
952
|
+
let text;
|
|
953
|
+
try {
|
|
954
|
+
text = await response.text();
|
|
955
|
+
}
|
|
956
|
+
catch (cause) {
|
|
957
|
+
throw new ClientError("Transport", { cause });
|
|
958
|
+
}
|
|
959
|
+
if (text === "")
|
|
960
|
+
throw new ClientError("MalformedResponse");
|
|
961
|
+
try {
|
|
962
|
+
return JSON.parse(text);
|
|
963
|
+
}
|
|
964
|
+
catch (cause) {
|
|
965
|
+
throw new ClientError("MalformedResponse", { cause });
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
function isContentType(response, expected) {
|
|
969
|
+
return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
|
|
970
|
+
}
|