@devpad/api 1.0.1 → 2.0.0
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 +2 -2
- package/dist/api-client.d.ts +216 -83
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +222 -99
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/request.d.ts +9 -1
- package/dist/request.d.ts.map +1 -1
- package/dist/request.js +29 -14
- package/dist/result.d.ts +8 -40
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +9 -42
- package/dist/tools.d.ts +5 -5
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +238 -189
- package/package.json +3 -2
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { save_config_request, save_tags_request, upsert_goal, upsert_milestone, upsert_project, upsert_todo } from "@devpad/schema";
|
|
1
2
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
+
function unwrap(result) {
|
|
4
|
+
if (!result.ok)
|
|
5
|
+
throw new Error(result.error?.message ?? "Unknown error");
|
|
6
|
+
return result.value;
|
|
7
|
+
}
|
|
3
8
|
// Filter schemas that aren't in @devpad/schema yet
|
|
4
9
|
export const project_filters = z.object({
|
|
5
10
|
private: z.boolean().optional().describe("Include private projects (default: true)"),
|
|
@@ -39,43 +44,26 @@ export const tools = {
|
|
|
39
44
|
name: "devpad_projects_list",
|
|
40
45
|
description: "List all projects (or only public ones)",
|
|
41
46
|
inputSchema: project_filters,
|
|
42
|
-
execute: async (client, input) =>
|
|
43
|
-
const result = await client.projects.list(input);
|
|
44
|
-
if (result.error)
|
|
45
|
-
throw new Error(result.error.message);
|
|
46
|
-
return result.projects;
|
|
47
|
-
},
|
|
47
|
+
execute: async (client, input) => unwrap(await client.projects.list(input)),
|
|
48
48
|
},
|
|
49
49
|
devpad_projects_get: {
|
|
50
50
|
name: "devpad_projects_get",
|
|
51
51
|
description: "Get project by ID or name",
|
|
52
52
|
inputSchema: project_by_id_or_name,
|
|
53
|
-
execute: async (client, input) =>
|
|
54
|
-
const result = input.id ? await client.projects.getById(input.id) : await client.projects.getByName(input.name);
|
|
55
|
-
if (result.error)
|
|
56
|
-
throw new Error(result.error.message);
|
|
57
|
-
return result.project;
|
|
58
|
-
},
|
|
53
|
+
execute: async (client, input) => unwrap(input.id ? await client.projects.getById(input.id) : await client.projects.getByName(input.name)),
|
|
59
54
|
},
|
|
60
55
|
devpad_projects_upsert: {
|
|
61
56
|
name: "devpad_projects_upsert",
|
|
62
57
|
description: "Create or update a project (set deleted=true to delete)",
|
|
63
58
|
inputSchema: upsert_project,
|
|
64
|
-
execute: async (client, input) =>
|
|
65
|
-
const result = await client.projects.upsert(input);
|
|
66
|
-
if (result.error)
|
|
67
|
-
throw new Error(result.error.message);
|
|
68
|
-
return result.project;
|
|
69
|
-
},
|
|
59
|
+
execute: async (client, input) => unwrap(await client.projects.upsert(input)),
|
|
70
60
|
},
|
|
71
61
|
devpad_projects_config_save: {
|
|
72
62
|
name: "devpad_projects_config_save",
|
|
73
63
|
description: "Save project configuration",
|
|
74
64
|
inputSchema: save_config_request,
|
|
75
65
|
execute: async (client, input) => {
|
|
76
|
-
|
|
77
|
-
if (result.error)
|
|
78
|
-
throw new Error(result.error.message);
|
|
66
|
+
unwrap(await client.projects.config.save(input));
|
|
79
67
|
return { success: true };
|
|
80
68
|
},
|
|
81
69
|
},
|
|
@@ -84,43 +72,26 @@ export const tools = {
|
|
|
84
72
|
name: "devpad_tasks_list",
|
|
85
73
|
description: "List tasks, optionally filtered by project or tag",
|
|
86
74
|
inputSchema: task_filters,
|
|
87
|
-
execute: async (client, input) =>
|
|
88
|
-
const result = await client.tasks.list(input);
|
|
89
|
-
if (result.error)
|
|
90
|
-
throw new Error(result.error.message);
|
|
91
|
-
return result.tasks;
|
|
92
|
-
},
|
|
75
|
+
execute: async (client, input) => unwrap(await client.tasks.list(input)),
|
|
93
76
|
},
|
|
94
77
|
devpad_tasks_get: {
|
|
95
78
|
name: "devpad_tasks_get",
|
|
96
79
|
description: "Get task by ID",
|
|
97
80
|
inputSchema: task_by_id,
|
|
98
|
-
execute: async (client, input) =>
|
|
99
|
-
const result = await client.tasks.find(input.id);
|
|
100
|
-
if (result.error)
|
|
101
|
-
throw new Error(result.error.message);
|
|
102
|
-
return result.task;
|
|
103
|
-
},
|
|
81
|
+
execute: async (client, input) => unwrap(await client.tasks.find(input.id)),
|
|
104
82
|
},
|
|
105
83
|
devpad_tasks_upsert: {
|
|
106
84
|
name: "devpad_tasks_upsert",
|
|
107
85
|
description: "Create or update a task (set deleted=true to delete)",
|
|
108
86
|
inputSchema: upsert_todo,
|
|
109
|
-
execute: async (client, input) =>
|
|
110
|
-
const result = await client.tasks.upsert(input);
|
|
111
|
-
if (result.error)
|
|
112
|
-
throw new Error(result.error.message);
|
|
113
|
-
return result.task;
|
|
114
|
-
},
|
|
87
|
+
execute: async (client, input) => unwrap(await client.tasks.upsert(input)),
|
|
115
88
|
},
|
|
116
89
|
devpad_tasks_save_tags: {
|
|
117
90
|
name: "devpad_tasks_save_tags",
|
|
118
91
|
description: "Save tags for tasks",
|
|
119
92
|
inputSchema: save_tags_request,
|
|
120
93
|
execute: async (client, input) => {
|
|
121
|
-
|
|
122
|
-
if (result.error)
|
|
123
|
-
throw new Error(result.error.message);
|
|
94
|
+
unwrap(await client.tasks.saveTags(input));
|
|
124
95
|
return { success: true };
|
|
125
96
|
},
|
|
126
97
|
},
|
|
@@ -129,127 +100,82 @@ export const tools = {
|
|
|
129
100
|
name: "devpad_milestones_list",
|
|
130
101
|
description: "List milestones for authenticated user or by project",
|
|
131
102
|
inputSchema: milestone_filters,
|
|
132
|
-
execute: async (client, input) =>
|
|
133
|
-
const result = input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list();
|
|
134
|
-
if (result.error)
|
|
135
|
-
throw new Error(result.error.message);
|
|
136
|
-
return result.milestones;
|
|
137
|
-
},
|
|
103
|
+
execute: async (client, input) => unwrap(input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list()),
|
|
138
104
|
},
|
|
139
105
|
devpad_milestones_get: {
|
|
140
106
|
name: "devpad_milestones_get",
|
|
141
107
|
description: "Get milestone by ID",
|
|
142
108
|
inputSchema: milestone_by_id,
|
|
143
|
-
execute: async (client, input) =>
|
|
144
|
-
const result = await client.milestones.find(input.id);
|
|
145
|
-
if (result.error)
|
|
146
|
-
throw new Error(result.error.message);
|
|
147
|
-
return result.milestone;
|
|
148
|
-
},
|
|
109
|
+
execute: async (client, input) => unwrap(await client.milestones.find(input.id)),
|
|
149
110
|
},
|
|
150
111
|
devpad_milestones_upsert: {
|
|
151
112
|
name: "devpad_milestones_upsert",
|
|
152
113
|
description: "Create or update a milestone",
|
|
153
114
|
inputSchema: upsert_milestone,
|
|
154
|
-
execute: async (client, input) =>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
if (result.error)
|
|
170
|
-
throw new Error(result.error.message);
|
|
171
|
-
return result.milestone;
|
|
172
|
-
},
|
|
115
|
+
execute: async (client, input) => unwrap(input.id
|
|
116
|
+
? await client.milestones.update(input.id, {
|
|
117
|
+
name: input.name,
|
|
118
|
+
description: input.description,
|
|
119
|
+
target_time: input.target_time,
|
|
120
|
+
target_version: input.target_version,
|
|
121
|
+
})
|
|
122
|
+
: await client.milestones.create({
|
|
123
|
+
project_id: input.project_id,
|
|
124
|
+
name: input.name,
|
|
125
|
+
description: input.description,
|
|
126
|
+
target_time: input.target_time,
|
|
127
|
+
target_version: input.target_version,
|
|
128
|
+
})),
|
|
173
129
|
},
|
|
174
130
|
// Goals
|
|
175
131
|
devpad_goals_list: {
|
|
176
132
|
name: "devpad_goals_list",
|
|
177
133
|
description: "List goals for authenticated user",
|
|
178
134
|
inputSchema: z.object({}),
|
|
179
|
-
execute: async (client) =>
|
|
180
|
-
const result = await client.goals.list();
|
|
181
|
-
if (result.error)
|
|
182
|
-
throw new Error(result.error.message);
|
|
183
|
-
return result.goals;
|
|
184
|
-
},
|
|
135
|
+
execute: async (client) => unwrap(await client.goals.list()),
|
|
185
136
|
},
|
|
186
137
|
devpad_goals_get: {
|
|
187
138
|
name: "devpad_goals_get",
|
|
188
139
|
description: "Get goal by ID",
|
|
189
140
|
inputSchema: goal_by_id,
|
|
190
|
-
execute: async (client, input) =>
|
|
191
|
-
const result = await client.goals.find(input.id);
|
|
192
|
-
if (result.error)
|
|
193
|
-
throw new Error(result.error.message);
|
|
194
|
-
return result.goal;
|
|
195
|
-
},
|
|
141
|
+
execute: async (client, input) => unwrap(await client.goals.find(input.id)),
|
|
196
142
|
},
|
|
197
143
|
devpad_goals_upsert: {
|
|
198
144
|
name: "devpad_goals_upsert",
|
|
199
145
|
description: "Create or update a goal",
|
|
200
146
|
inputSchema: upsert_goal,
|
|
201
|
-
execute: async (client, input) =>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
if (result.error)
|
|
215
|
-
throw new Error(result.error.message);
|
|
216
|
-
return result.goal;
|
|
217
|
-
},
|
|
147
|
+
execute: async (client, input) => unwrap(input.id
|
|
148
|
+
? await client.goals.update(input.id, {
|
|
149
|
+
name: input.name,
|
|
150
|
+
description: input.description,
|
|
151
|
+
target_time: input.target_time,
|
|
152
|
+
})
|
|
153
|
+
: await client.goals.create({
|
|
154
|
+
milestone_id: input.milestone_id,
|
|
155
|
+
name: input.name,
|
|
156
|
+
description: input.description,
|
|
157
|
+
target_time: input.target_time,
|
|
158
|
+
})),
|
|
218
159
|
},
|
|
219
160
|
// Tags
|
|
220
161
|
devpad_tags_list: {
|
|
221
162
|
name: "devpad_tags_list",
|
|
222
163
|
description: "List tags for authenticated user",
|
|
223
164
|
inputSchema: z.object({}),
|
|
224
|
-
execute: async (client) =>
|
|
225
|
-
const result = await client.tags.list();
|
|
226
|
-
if (result.error)
|
|
227
|
-
throw new Error(result.error.message);
|
|
228
|
-
return result.tags;
|
|
229
|
-
},
|
|
165
|
+
execute: async (client) => unwrap(await client.tags.list()),
|
|
230
166
|
},
|
|
231
167
|
// GitHub integration
|
|
232
168
|
devpad_github_repos: {
|
|
233
169
|
name: "devpad_github_repos",
|
|
234
170
|
description: "List GitHub repositories for authenticated user",
|
|
235
171
|
inputSchema: z.object({}),
|
|
236
|
-
execute: async (client) =>
|
|
237
|
-
const result = await client.github.repos();
|
|
238
|
-
if (result.error)
|
|
239
|
-
throw new Error(result.error.message);
|
|
240
|
-
return result.repos;
|
|
241
|
-
},
|
|
172
|
+
execute: async (client) => unwrap(await client.github.repos()),
|
|
242
173
|
},
|
|
243
174
|
devpad_github_branches: {
|
|
244
175
|
name: "devpad_github_branches",
|
|
245
176
|
description: "List branches for a GitHub repository",
|
|
246
177
|
inputSchema: github_branches,
|
|
247
|
-
execute: async (client, input) =>
|
|
248
|
-
const result = await client.github.branches(input.owner, input.repo);
|
|
249
|
-
if (result.error)
|
|
250
|
-
throw new Error(result.error.message);
|
|
251
|
-
return result.branches;
|
|
252
|
-
},
|
|
178
|
+
execute: async (client, input) => unwrap(await client.github.branches(input.owner, input.repo)),
|
|
253
179
|
},
|
|
254
180
|
// Additional project operations
|
|
255
181
|
devpad_projects_delete: {
|
|
@@ -259,15 +185,10 @@ export const tools = {
|
|
|
259
185
|
id: z.string().describe("Project ID"),
|
|
260
186
|
}),
|
|
261
187
|
execute: async (client, input) => {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (getResult.error)
|
|
265
|
-
throw new Error(getResult.error.message);
|
|
266
|
-
if (!getResult.project)
|
|
188
|
+
const project = unwrap(await client.projects.find(input.id));
|
|
189
|
+
if (!project)
|
|
267
190
|
throw new Error(`Project ${input.id} not found`);
|
|
268
|
-
|
|
269
|
-
if (result.error)
|
|
270
|
-
throw new Error(result.error.message);
|
|
191
|
+
unwrap(await client.projects.deleteProject(project));
|
|
271
192
|
return { success: true };
|
|
272
193
|
},
|
|
273
194
|
},
|
|
@@ -277,12 +198,7 @@ export const tools = {
|
|
|
277
198
|
inputSchema: z.object({
|
|
278
199
|
project_id: z.string().describe("Project ID"),
|
|
279
200
|
}),
|
|
280
|
-
execute: async (client, input) =>
|
|
281
|
-
const result = await client.projects.history(input.project_id);
|
|
282
|
-
if (result.error)
|
|
283
|
-
throw new Error(result.error.message);
|
|
284
|
-
return result.history;
|
|
285
|
-
},
|
|
201
|
+
execute: async (client, input) => unwrap(await client.projects.history(input.project_id)),
|
|
286
202
|
},
|
|
287
203
|
devpad_projects_specification: {
|
|
288
204
|
name: "devpad_projects_specification",
|
|
@@ -290,12 +206,7 @@ export const tools = {
|
|
|
290
206
|
inputSchema: z.object({
|
|
291
207
|
project_id: z.string().describe("Project ID"),
|
|
292
208
|
}),
|
|
293
|
-
execute: async (client, input) =>
|
|
294
|
-
const result = await client.projects.specification(input.project_id);
|
|
295
|
-
if (result.error)
|
|
296
|
-
throw new Error(result.error.message);
|
|
297
|
-
return result.specification;
|
|
298
|
-
},
|
|
209
|
+
execute: async (client, input) => unwrap(await client.projects.specification(input.project_id)),
|
|
299
210
|
},
|
|
300
211
|
devpad_projects_config_load: {
|
|
301
212
|
name: "devpad_projects_config_load",
|
|
@@ -303,12 +214,7 @@ export const tools = {
|
|
|
303
214
|
inputSchema: z.object({
|
|
304
215
|
project_id: z.string().describe("Project ID"),
|
|
305
216
|
}),
|
|
306
|
-
execute: async (client, input) =>
|
|
307
|
-
const result = await client.projects.config.load(input.project_id);
|
|
308
|
-
if (result.error)
|
|
309
|
-
throw new Error(result.error.message);
|
|
310
|
-
return result.config;
|
|
311
|
-
},
|
|
217
|
+
execute: async (client, input) => unwrap(await client.projects.config.load(input.project_id)),
|
|
312
218
|
},
|
|
313
219
|
// Additional milestone operations
|
|
314
220
|
devpad_milestones_delete: {
|
|
@@ -317,12 +223,7 @@ export const tools = {
|
|
|
317
223
|
inputSchema: z.object({
|
|
318
224
|
id: z.string().describe("Milestone ID"),
|
|
319
225
|
}),
|
|
320
|
-
execute: async (client, input) =>
|
|
321
|
-
const result = await client.milestones.delete(input.id);
|
|
322
|
-
if (result.error)
|
|
323
|
-
throw new Error(result.error.message);
|
|
324
|
-
return result.result;
|
|
325
|
-
},
|
|
226
|
+
execute: async (client, input) => unwrap(await client.milestones.delete(input.id)),
|
|
326
227
|
},
|
|
327
228
|
devpad_milestones_goals: {
|
|
328
229
|
name: "devpad_milestones_goals",
|
|
@@ -330,12 +231,7 @@ export const tools = {
|
|
|
330
231
|
inputSchema: z.object({
|
|
331
232
|
id: z.string().describe("Milestone ID"),
|
|
332
233
|
}),
|
|
333
|
-
execute: async (client, input) =>
|
|
334
|
-
const result = await client.milestones.goals(input.id);
|
|
335
|
-
if (result.error)
|
|
336
|
-
throw new Error(result.error.message);
|
|
337
|
-
return result.goals;
|
|
338
|
-
},
|
|
234
|
+
execute: async (client, input) => unwrap(await client.milestones.goals(input.id)),
|
|
339
235
|
},
|
|
340
236
|
// Additional goal operations
|
|
341
237
|
devpad_goals_delete: {
|
|
@@ -344,12 +240,7 @@ export const tools = {
|
|
|
344
240
|
inputSchema: z.object({
|
|
345
241
|
id: z.string().describe("Goal ID"),
|
|
346
242
|
}),
|
|
347
|
-
execute: async (client, input) =>
|
|
348
|
-
const result = await client.goals.delete(input.id);
|
|
349
|
-
if (result.error)
|
|
350
|
-
throw new Error(result.error.message);
|
|
351
|
-
return result.result;
|
|
352
|
-
},
|
|
243
|
+
execute: async (client, input) => unwrap(await client.goals.delete(input.id)),
|
|
353
244
|
},
|
|
354
245
|
// Additional task operations
|
|
355
246
|
devpad_tasks_delete: {
|
|
@@ -359,15 +250,10 @@ export const tools = {
|
|
|
359
250
|
id: z.string().describe("Task ID"),
|
|
360
251
|
}),
|
|
361
252
|
execute: async (client, input) => {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (getResult.error)
|
|
365
|
-
throw new Error(getResult.error.message);
|
|
366
|
-
if (!getResult.task)
|
|
253
|
+
const task = unwrap(await client.tasks.find(input.id));
|
|
254
|
+
if (!task)
|
|
367
255
|
throw new Error(`Task ${input.id} not found`);
|
|
368
|
-
|
|
369
|
-
if (result.error)
|
|
370
|
-
throw new Error(result.error.message);
|
|
256
|
+
unwrap(await client.tasks.deleteTask(task));
|
|
371
257
|
return { success: true };
|
|
372
258
|
},
|
|
373
259
|
},
|
|
@@ -377,24 +263,14 @@ export const tools = {
|
|
|
377
263
|
inputSchema: z.object({
|
|
378
264
|
task_id: z.string().describe("Task ID"),
|
|
379
265
|
}),
|
|
380
|
-
execute: async (client, input) =>
|
|
381
|
-
const result = await client.tasks.history.get(input.task_id);
|
|
382
|
-
if (result.error)
|
|
383
|
-
throw new Error(result.error.message);
|
|
384
|
-
return result.history;
|
|
385
|
-
},
|
|
266
|
+
execute: async (client, input) => unwrap(await client.tasks.history.get(input.task_id)),
|
|
386
267
|
},
|
|
387
268
|
// User operations
|
|
388
269
|
devpad_user_history: {
|
|
389
270
|
name: "devpad_user_history",
|
|
390
271
|
description: "Get user activity history",
|
|
391
272
|
inputSchema: z.object({}),
|
|
392
|
-
execute: async (client) =>
|
|
393
|
-
const result = await client.user.history();
|
|
394
|
-
if (result.error)
|
|
395
|
-
throw new Error(result.error.message);
|
|
396
|
-
return result.history;
|
|
397
|
-
},
|
|
273
|
+
execute: async (client) => unwrap(await client.user.history()),
|
|
398
274
|
},
|
|
399
275
|
devpad_user_preferences: {
|
|
400
276
|
name: "devpad_user_preferences",
|
|
@@ -403,11 +279,184 @@ export const tools = {
|
|
|
403
279
|
id: z.string().describe("User ID"),
|
|
404
280
|
task_view: z.enum(["list", "grid"]).describe("Task view preference"),
|
|
405
281
|
}),
|
|
282
|
+
execute: async (client, input) => unwrap(await client.user.preferences(input)),
|
|
283
|
+
},
|
|
284
|
+
devpad_blog_posts_list: {
|
|
285
|
+
name: "devpad_blog_posts_list",
|
|
286
|
+
description: "List blog posts with optional filters",
|
|
287
|
+
inputSchema: z.object({
|
|
288
|
+
category: z.string().optional().describe("Filter by category"),
|
|
289
|
+
tag: z.string().optional().describe("Filter by tag"),
|
|
290
|
+
project: z.string().optional().describe("Filter by project ID"),
|
|
291
|
+
status: z.enum(["draft", "published"]).optional().describe("Filter by status"),
|
|
292
|
+
archived: z.boolean().optional().describe("Filter by archived state"),
|
|
293
|
+
limit: z.number().optional().describe("Max posts to return"),
|
|
294
|
+
offset: z.number().optional().describe("Offset for pagination"),
|
|
295
|
+
sort: z.string().optional().describe("Sort order"),
|
|
296
|
+
}),
|
|
297
|
+
execute: async (client, input) => unwrap(await client.blog.posts.list(input)),
|
|
298
|
+
},
|
|
299
|
+
devpad_blog_posts_get: {
|
|
300
|
+
name: "devpad_blog_posts_get",
|
|
301
|
+
description: "Get a blog post by slug",
|
|
302
|
+
inputSchema: z.object({
|
|
303
|
+
slug: z.string().describe("Post slug"),
|
|
304
|
+
}),
|
|
305
|
+
execute: async (client, input) => unwrap(await client.blog.posts.getBySlug(input.slug)),
|
|
306
|
+
},
|
|
307
|
+
devpad_blog_posts_create: {
|
|
308
|
+
name: "devpad_blog_posts_create",
|
|
309
|
+
description: "Create a new blog post",
|
|
310
|
+
inputSchema: z.object({
|
|
311
|
+
title: z.string().describe("Post title"),
|
|
312
|
+
content: z.string().describe("Post content"),
|
|
313
|
+
format: z.enum(["markdown", "html"]).describe("Content format"),
|
|
314
|
+
slug: z.string().optional().describe("Custom slug"),
|
|
315
|
+
category: z.string().optional().describe("Category name"),
|
|
316
|
+
tags: z.array(z.string()).optional().describe("Tag names"),
|
|
317
|
+
description: z.string().optional().describe("Post description"),
|
|
318
|
+
publish_at: z.string().optional().describe("Scheduled publish date (ISO string)"),
|
|
319
|
+
project_ids: z.array(z.string()).optional().describe("Associated project IDs"),
|
|
320
|
+
archived: z.boolean().optional().describe("Whether post is archived"),
|
|
321
|
+
}),
|
|
322
|
+
execute: async (client, input) => unwrap(await client.blog.posts.create(input)),
|
|
323
|
+
},
|
|
324
|
+
devpad_blog_posts_update: {
|
|
325
|
+
name: "devpad_blog_posts_update",
|
|
326
|
+
description: "Update a blog post by UUID",
|
|
327
|
+
inputSchema: z.object({
|
|
328
|
+
uuid: z.string().describe("Post UUID"),
|
|
329
|
+
title: z.string().optional().describe("Post title"),
|
|
330
|
+
content: z.string().optional().describe("Post content"),
|
|
331
|
+
format: z.enum(["markdown", "html"]).optional().describe("Content format"),
|
|
332
|
+
slug: z.string().optional().describe("Custom slug"),
|
|
333
|
+
category: z.string().optional().describe("Category name"),
|
|
334
|
+
tags: z.array(z.string()).optional().describe("Tag names"),
|
|
335
|
+
description: z.string().optional().describe("Post description"),
|
|
336
|
+
publish_at: z.string().optional().describe("Scheduled publish date (ISO string)"),
|
|
337
|
+
project_ids: z.array(z.string()).optional().describe("Associated project IDs"),
|
|
338
|
+
archived: z.boolean().optional().describe("Whether post is archived"),
|
|
339
|
+
}),
|
|
340
|
+
execute: async (client, input) => {
|
|
341
|
+
const { uuid, ...data } = input;
|
|
342
|
+
return unwrap(await client.blog.posts.update(uuid, data));
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
devpad_blog_posts_delete: {
|
|
346
|
+
name: "devpad_blog_posts_delete",
|
|
347
|
+
description: "Delete a blog post by UUID",
|
|
348
|
+
inputSchema: z.object({
|
|
349
|
+
uuid: z.string().describe("Post UUID"),
|
|
350
|
+
}),
|
|
351
|
+
execute: async (client, input) => unwrap(await client.blog.posts.delete(input.uuid)),
|
|
352
|
+
},
|
|
353
|
+
devpad_blog_tags_list: {
|
|
354
|
+
name: "devpad_blog_tags_list",
|
|
355
|
+
description: "List all blog tags with post counts",
|
|
356
|
+
inputSchema: z.object({}),
|
|
357
|
+
execute: async (client) => unwrap(await client.blog.tags.list()),
|
|
358
|
+
},
|
|
359
|
+
devpad_blog_categories_tree: {
|
|
360
|
+
name: "devpad_blog_categories_tree",
|
|
361
|
+
description: "Get the blog category tree",
|
|
362
|
+
inputSchema: z.object({}),
|
|
363
|
+
execute: async (client) => unwrap(await client.blog.categories.tree()),
|
|
364
|
+
},
|
|
365
|
+
devpad_blog_categories_create: {
|
|
366
|
+
name: "devpad_blog_categories_create",
|
|
367
|
+
description: "Create a blog category",
|
|
368
|
+
inputSchema: z.object({
|
|
369
|
+
name: z.string().describe("Category name"),
|
|
370
|
+
parent: z.string().optional().describe("Parent category name"),
|
|
371
|
+
}),
|
|
372
|
+
execute: async (client, input) => unwrap(await client.blog.categories.create(input)),
|
|
373
|
+
},
|
|
374
|
+
devpad_blog_tokens_list: {
|
|
375
|
+
name: "devpad_blog_tokens_list",
|
|
376
|
+
description: "List blog access tokens",
|
|
377
|
+
inputSchema: z.object({}),
|
|
378
|
+
execute: async (client) => unwrap(await client.blog.tokens.list()),
|
|
379
|
+
},
|
|
380
|
+
devpad_blog_tokens_create: {
|
|
381
|
+
name: "devpad_blog_tokens_create",
|
|
382
|
+
description: "Create a blog access token",
|
|
383
|
+
inputSchema: z.object({
|
|
384
|
+
name: z.string().describe("Token name"),
|
|
385
|
+
note: z.string().optional().describe("Optional note"),
|
|
386
|
+
}),
|
|
387
|
+
execute: async (client, input) => unwrap(await client.blog.tokens.create(input)),
|
|
388
|
+
},
|
|
389
|
+
devpad_media_profiles_list: {
|
|
390
|
+
name: "devpad_media_profiles_list",
|
|
391
|
+
description: "List media profiles",
|
|
392
|
+
inputSchema: z.object({}),
|
|
393
|
+
execute: async (client) => unwrap(await client.media.profiles.list()),
|
|
394
|
+
},
|
|
395
|
+
devpad_media_profiles_create: {
|
|
396
|
+
name: "devpad_media_profiles_create",
|
|
397
|
+
description: "Create a media profile",
|
|
398
|
+
inputSchema: z.object({
|
|
399
|
+
name: z.string().describe("Profile name"),
|
|
400
|
+
slug: z.string().describe("Profile slug"),
|
|
401
|
+
}),
|
|
402
|
+
execute: async (client, input) => unwrap(await client.media.profiles.create(input)),
|
|
403
|
+
},
|
|
404
|
+
devpad_media_profiles_get: {
|
|
405
|
+
name: "devpad_media_profiles_get",
|
|
406
|
+
description: "Get a media profile by ID",
|
|
407
|
+
inputSchema: z.object({
|
|
408
|
+
id: z.string().describe("Profile ID"),
|
|
409
|
+
}),
|
|
410
|
+
execute: async (client, input) => unwrap(await client.media.profiles.get(input.id)),
|
|
411
|
+
},
|
|
412
|
+
devpad_media_profiles_update: {
|
|
413
|
+
name: "devpad_media_profiles_update",
|
|
414
|
+
description: "Update a media profile by ID",
|
|
415
|
+
inputSchema: z.object({
|
|
416
|
+
id: z.string().describe("Profile ID"),
|
|
417
|
+
name: z.string().optional().describe("Profile name"),
|
|
418
|
+
slug: z.string().optional().describe("Profile slug"),
|
|
419
|
+
}),
|
|
420
|
+
execute: async (client, input) => {
|
|
421
|
+
const { id, ...data } = input;
|
|
422
|
+
return unwrap(await client.media.profiles.update(id, data));
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
devpad_media_profiles_delete: {
|
|
426
|
+
name: "devpad_media_profiles_delete",
|
|
427
|
+
description: "Delete a media profile by ID",
|
|
428
|
+
inputSchema: z.object({
|
|
429
|
+
id: z.string().describe("Profile ID"),
|
|
430
|
+
}),
|
|
431
|
+
execute: async (client, input) => unwrap(await client.media.profiles.delete(input.id)),
|
|
432
|
+
},
|
|
433
|
+
devpad_media_connections_list: {
|
|
434
|
+
name: "devpad_media_connections_list",
|
|
435
|
+
description: "List connections for a media profile",
|
|
436
|
+
inputSchema: z.object({
|
|
437
|
+
profile_id: z.string().describe("Profile ID"),
|
|
438
|
+
}),
|
|
439
|
+
execute: async (client, input) => unwrap(await client.media.connections.list(input.profile_id)),
|
|
440
|
+
},
|
|
441
|
+
devpad_media_connections_refresh: {
|
|
442
|
+
name: "devpad_media_connections_refresh",
|
|
443
|
+
description: "Refresh a media connection",
|
|
444
|
+
inputSchema: z.object({
|
|
445
|
+
account_id: z.string().describe("Account/connection ID"),
|
|
446
|
+
}),
|
|
447
|
+
execute: async (client, input) => unwrap(await client.media.connections.refresh(input.account_id)),
|
|
448
|
+
},
|
|
449
|
+
devpad_media_timeline_get: {
|
|
450
|
+
name: "devpad_media_timeline_get",
|
|
451
|
+
description: "Get media timeline for a user",
|
|
452
|
+
inputSchema: z.object({
|
|
453
|
+
user_id: z.string().describe("User ID"),
|
|
454
|
+
from: z.string().optional().describe("Start date (ISO string)"),
|
|
455
|
+
to: z.string().optional().describe("End date (ISO string)"),
|
|
456
|
+
}),
|
|
406
457
|
execute: async (client, input) => {
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
throw new Error(result.error.message);
|
|
410
|
-
return result.result;
|
|
458
|
+
const { user_id, ...params } = input;
|
|
459
|
+
return unwrap(await client.media.timeline.get(user_id, params));
|
|
411
460
|
},
|
|
412
461
|
},
|
|
413
462
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devpad/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "f0rbit",
|
|
6
6
|
"url": "https://github.com/f0rbit"
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"clean": "rm -rf dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@devpad/schema": "
|
|
26
|
+
"@devpad/schema": "^2.0.0",
|
|
27
|
+
"@f0rbit/corpus": "^0.3.5",
|
|
27
28
|
"zod": "^3.22.4"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|