@agentuity/cli 1.0.22 → 1.0.23
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/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -0
- package/dist/auth.js.map +1 -1
- package/dist/cache/resource-region.d.ts +1 -1
- package/dist/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/cmd/ai/claude-code/install.d.ts.map +1 -1
- package/dist/cmd/ai/claude-code/install.js +0 -1
- package/dist/cmd/ai/claude-code/install.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +4 -2
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js +18 -4
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -1
- package/dist/cmd/cloud/email/create.d.ts +3 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -0
- package/dist/cmd/cloud/email/create.js +58 -0
- package/dist/cmd/cloud/email/create.js.map +1 -0
- package/dist/cmd/cloud/email/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/delete.js +47 -0
- package/dist/cmd/cloud/email/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.js +54 -0
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/index.js +14 -0
- package/dist/cmd/cloud/email/destination/index.js.map +1 -0
- package/dist/cmd/cloud/email/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/list.js +39 -0
- package/dist/cmd/cloud/email/destination/list.js.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts +9 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.js +9 -0
- package/dist/cmd/cloud/email/destination/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/destination/url.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/url.js +64 -0
- package/dist/cmd/cloud/email/destination/url.js.map +1 -0
- package/dist/cmd/cloud/email/get.d.ts +3 -0
- package/dist/cmd/cloud/email/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/get.js +43 -0
- package/dist/cmd/cloud/email/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.js +44 -0
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.js +12 -0
- package/dist/cmd/cloud/email/inbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.js +43 -0
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.js +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/index.d.ts +3 -0
- package/dist/cmd/cloud/email/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/index.js +28 -0
- package/dist/cmd/cloud/email/index.js.map +1 -0
- package/dist/cmd/cloud/email/list.d.ts +3 -0
- package/dist/cmd/cloud/email/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/list.js +37 -0
- package/dist/cmd/cloud/email/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.js +45 -0
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.js +12 -0
- package/dist/cmd/cloud/email/outbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.js +43 -0
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.js +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/send.d.ts +3 -0
- package/dist/cmd/cloud/email/send.d.ts.map +1 -0
- package/dist/cmd/cloud/email/send.js +77 -0
- package/dist/cmd/cloud/email/send.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +26 -0
- package/dist/cmd/cloud/email/util.d.ts.map +1 -0
- package/dist/cmd/cloud/email/util.js +57 -0
- package/dist/cmd/cloud/email/util.js.map +1 -0
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +8 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -1
- package/dist/cmd/cloud/region-lookup.js +44 -2
- package/dist/cmd/cloud/region-lookup.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts +7 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +46 -28
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js +5 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -1
- package/dist/cmd/cloud/schedule/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/create.js +72 -0
- package/dist/cmd/cloud/schedule/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delete.js +38 -0
- package/dist/cmd/cloud/schedule/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.js +78 -0
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.js +23 -0
- package/dist/cmd/cloud/schedule/delivery/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.js +67 -0
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.js +97 -0
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.js +41 -0
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.js +57 -0
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.js +26 -0
- package/dist/cmd/cloud/schedule/destination/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.js +58 -0
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/get.js +76 -0
- package/dist/cmd/cloud/schedule/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/index.js +35 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/list.js +60 -0
- package/dist/cmd/cloud/schedule/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.d.ts +3 -0
- package/dist/cmd/cloud/schedule/update.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +65 -0
- package/dist/cmd/cloud/schedule/update.js.map +1 -0
- package/dist/cmd/cloud/schedule/util.d.ts +11 -0
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/util.js +17 -0
- package/dist/cmd/cloud/schedule/util.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts +3 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -0
- package/dist/cmd/cloud/task/create.js +108 -0
- package/dist/cmd/cloud/task/create.js.map +1 -0
- package/dist/cmd/cloud/task/get.d.ts +3 -0
- package/dist/cmd/cloud/task/get.d.ts.map +1 -0
- package/dist/cmd/cloud/task/get.js +124 -0
- package/dist/cmd/cloud/task/get.js.map +1 -0
- package/dist/cmd/cloud/task/index.d.ts +3 -0
- package/dist/cmd/cloud/task/index.d.ts.map +1 -0
- package/dist/cmd/cloud/task/index.js +33 -0
- package/dist/cmd/cloud/task/index.js.map +1 -0
- package/dist/cmd/cloud/task/list.d.ts +3 -0
- package/dist/cmd/cloud/task/list.d.ts.map +1 -0
- package/dist/cmd/cloud/task/list.js +174 -0
- package/dist/cmd/cloud/task/list.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts +3 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -0
- package/dist/cmd/cloud/task/update.js +118 -0
- package/dist/cmd/cloud/task/update.js.map +1 -0
- package/dist/cmd/cloud/task/util.d.ts +18 -0
- package/dist/cmd/cloud/task/util.d.ts.map +1 -0
- package/dist/cmd/cloud/task/util.js +45 -0
- package/dist/cmd/cloud/task/util.js.map +1 -0
- package/dist/cmd/cloud/webhook/create.d.ts +3 -0
- package/dist/cmd/cloud/webhook/create.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/create.js +54 -0
- package/dist/cmd/cloud/webhook/create.js.map +1 -0
- package/dist/cmd/cloud/webhook/delete.d.ts +3 -0
- package/dist/cmd/cloud/webhook/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/delete.js +50 -0
- package/dist/cmd/cloud/webhook/delete.js.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts +3 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.js +123 -0
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts +3 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.js +212 -0
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -0
- package/dist/cmd/cloud/webhook/get.d.ts +3 -0
- package/dist/cmd/cloud/webhook/get.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/get.js +50 -0
- package/dist/cmd/cloud/webhook/get.js.map +1 -0
- package/dist/cmd/cloud/webhook/index.d.ts +3 -0
- package/dist/cmd/cloud/webhook/index.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/index.js +45 -0
- package/dist/cmd/cloud/webhook/index.js.map +1 -0
- package/dist/cmd/cloud/webhook/list.d.ts +3 -0
- package/dist/cmd/cloud/webhook/list.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/list.js +72 -0
- package/dist/cmd/cloud/webhook/list.js.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts +3 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.js +128 -0
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -0
- package/dist/cmd/cloud/webhook/util.d.ts +27 -0
- package/dist/cmd/cloud/webhook/util.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/util.js +20 -0
- package/dist/cmd/cloud/webhook/util.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +18 -3
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/auth.ts +7 -0
- package/src/cache/resource-region.ts +4 -1
- package/src/cmd/ai/claude-code/install.ts +0 -3
- package/src/cmd/build/vite/public-asset-path-plugin.ts +18 -4
- package/src/cmd/cloud/email/create.ts +70 -0
- package/src/cmd/cloud/email/delete.ts +53 -0
- package/src/cmd/cloud/email/destination/delete.ts +65 -0
- package/src/cmd/cloud/email/destination/index.ts +15 -0
- package/src/cmd/cloud/email/destination/list.ts +46 -0
- package/src/cmd/cloud/email/destination/schemas.ts +9 -0
- package/src/cmd/cloud/email/destination/url.ts +75 -0
- package/src/cmd/cloud/email/get.ts +52 -0
- package/src/cmd/cloud/email/inbound/get.ts +53 -0
- package/src/cmd/cloud/email/inbound/index.ts +13 -0
- package/src/cmd/cloud/email/inbound/list.ts +50 -0
- package/src/cmd/cloud/email/inbound/schemas.ts +11 -0
- package/src/cmd/cloud/email/index.ts +29 -0
- package/src/cmd/cloud/email/list.ts +44 -0
- package/src/cmd/cloud/email/outbound/get.ts +54 -0
- package/src/cmd/cloud/email/outbound/index.ts +13 -0
- package/src/cmd/cloud/email/outbound/list.ts +50 -0
- package/src/cmd/cloud/email/outbound/schemas.ts +15 -0
- package/src/cmd/cloud/email/send.ts +91 -0
- package/src/cmd/cloud/email/util.ts +89 -0
- package/src/cmd/cloud/index.ts +8 -0
- package/src/cmd/cloud/region-lookup.ts +58 -2
- package/src/cmd/cloud/sandbox/snapshot/build.ts +59 -55
- package/src/cmd/cloud/sandbox/snapshot/generate.ts +5 -1
- package/src/cmd/cloud/schedule/create.ts +83 -0
- package/src/cmd/cloud/schedule/delete.ts +43 -0
- package/src/cmd/cloud/schedule/delivery/get.ts +85 -0
- package/src/cmd/cloud/schedule/delivery/index.ts +24 -0
- package/src/cmd/cloud/schedule/delivery/list.ts +82 -0
- package/src/cmd/cloud/schedule/destination/create.ts +110 -0
- package/src/cmd/cloud/schedule/destination/delete.ts +46 -0
- package/src/cmd/cloud/schedule/destination/get.ts +66 -0
- package/src/cmd/cloud/schedule/destination/index.ts +27 -0
- package/src/cmd/cloud/schedule/destination/list.ts +72 -0
- package/src/cmd/cloud/schedule/get.ts +92 -0
- package/src/cmd/cloud/schedule/index.ts +36 -0
- package/src/cmd/cloud/schedule/list.ts +78 -0
- package/src/cmd/cloud/schedule/update.ts +74 -0
- package/src/cmd/cloud/schedule/util.ts +34 -0
- package/src/cmd/cloud/task/create.ts +124 -0
- package/src/cmd/cloud/task/get.ts +138 -0
- package/src/cmd/cloud/task/index.ts +34 -0
- package/src/cmd/cloud/task/list.ts +191 -0
- package/src/cmd/cloud/task/update.ts +123 -0
- package/src/cmd/cloud/task/util.ts +74 -0
- package/src/cmd/cloud/webhook/create.ts +66 -0
- package/src/cmd/cloud/webhook/delete.ts +57 -0
- package/src/cmd/cloud/webhook/deliveries.ts +149 -0
- package/src/cmd/cloud/webhook/destinations.ts +274 -0
- package/src/cmd/cloud/webhook/get.ts +59 -0
- package/src/cmd/cloud/webhook/index.ts +46 -0
- package/src/cmd/cloud/webhook/list.ts +82 -0
- package/src/cmd/cloud/webhook/receipts.ts +157 -0
- package/src/cmd/cloud/webhook/util.ts +35 -0
- package/src/types.ts +3 -1
- package/src/version-check.ts +22 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createWebhookAPIClient, getWebhookApiOptions } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { createWebhook, WebhookSchema } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const WebhookCreateResponseSchema = WebhookSchema.pick({ id: true, name: true, url: true, created_at: true });
|
|
9
|
+
|
|
10
|
+
export const createSubcommand = createCommand({
|
|
11
|
+
name: 'create',
|
|
12
|
+
description: 'Create a new webhook',
|
|
13
|
+
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
14
|
+
requires: { auth: true, org: true },
|
|
15
|
+
examples: [
|
|
16
|
+
{
|
|
17
|
+
command: getCommand('cloud webhook create --name my-webhook'),
|
|
18
|
+
description: 'Create a webhook named my-webhook',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
command: getCommand(
|
|
22
|
+
'cloud webhook create --name github-events --description "GitHub webhook"'
|
|
23
|
+
),
|
|
24
|
+
description: 'Create a webhook with a description',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
schema: {
|
|
28
|
+
args: z.object({}),
|
|
29
|
+
options: z.object({
|
|
30
|
+
name: z.string().describe('Webhook name'),
|
|
31
|
+
description: z.string().optional().describe('Webhook description'),
|
|
32
|
+
}),
|
|
33
|
+
response: WebhookCreateResponseSchema,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
async handler(ctx) {
|
|
37
|
+
const { opts, options } = ctx;
|
|
38
|
+
const client = await createWebhookAPIClient(ctx);
|
|
39
|
+
|
|
40
|
+
const webhook = await createWebhook(
|
|
41
|
+
client,
|
|
42
|
+
{
|
|
43
|
+
name: opts.name,
|
|
44
|
+
description: opts.description,
|
|
45
|
+
},
|
|
46
|
+
getWebhookApiOptions(ctx)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (!options.json) {
|
|
50
|
+
tui.success(`Created webhook: ${webhook.name}`);
|
|
51
|
+
console.log(` ID: ${webhook.id}`);
|
|
52
|
+
if (webhook.url) {
|
|
53
|
+
console.log(` URL: ${webhook.url}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
id: webhook.id,
|
|
59
|
+
name: webhook.name,
|
|
60
|
+
url: webhook.url,
|
|
61
|
+
created_at: webhook.created_at,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export default createSubcommand;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createWebhookAPIClient, getWebhookApiOptions } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { deleteWebhook } from '@agentuity/server';
|
|
7
|
+
import { ErrorCode } from '../../../errors';
|
|
8
|
+
|
|
9
|
+
const DeleteResponseSchema = z.object({
|
|
10
|
+
success: z.boolean(),
|
|
11
|
+
id: z.string(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const deleteSubcommand = createCommand({
|
|
15
|
+
name: 'delete',
|
|
16
|
+
aliases: ['rm'],
|
|
17
|
+
description: 'Delete a webhook by ID',
|
|
18
|
+
tags: ['mutating', 'deletes-resource', 'requires-auth'],
|
|
19
|
+
requires: { auth: true },
|
|
20
|
+
examples: [
|
|
21
|
+
{
|
|
22
|
+
command: getCommand('cloud webhook delete wh_abc123 --confirm'),
|
|
23
|
+
description: 'Delete a webhook (requires confirmation)',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
schema: {
|
|
27
|
+
args: z.object({
|
|
28
|
+
id: z.string().min(1).describe('Webhook ID'),
|
|
29
|
+
}),
|
|
30
|
+
options: z.object({
|
|
31
|
+
confirm: z.boolean().default(false).describe('Skip confirmation prompt'),
|
|
32
|
+
}),
|
|
33
|
+
response: DeleteResponseSchema,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
async handler(ctx) {
|
|
37
|
+
const { args, opts, options } = ctx;
|
|
38
|
+
|
|
39
|
+
if (!opts.confirm) {
|
|
40
|
+
tui.fatal('Use --confirm to confirm webhook deletion', ErrorCode.INVALID_ARGUMENT);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const client = await createWebhookAPIClient(ctx);
|
|
44
|
+
await deleteWebhook(client, args.id, getWebhookApiOptions(ctx));
|
|
45
|
+
|
|
46
|
+
if (!options.json) {
|
|
47
|
+
tui.success(`Deleted webhook: ${args.id}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
success: true,
|
|
52
|
+
id: args.id,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export default deleteSubcommand;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand, createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createWebhookAPIClient, getWebhookApiOptions } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import {
|
|
7
|
+
listWebhookDeliveries,
|
|
8
|
+
retryWebhookDelivery,
|
|
9
|
+
WebhookDeliverySchema,
|
|
10
|
+
type WebhookDelivery,
|
|
11
|
+
} from '@agentuity/server';
|
|
12
|
+
|
|
13
|
+
const DeliveriesListResponseSchema = z.object({
|
|
14
|
+
deliveries: z.array(
|
|
15
|
+
z.object({
|
|
16
|
+
id: z.string(),
|
|
17
|
+
date: z.string(),
|
|
18
|
+
status: z.string(),
|
|
19
|
+
retries: z.number(),
|
|
20
|
+
webhook_destination_id: z.string(),
|
|
21
|
+
})
|
|
22
|
+
),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const listDeliveriesSubcommand = createSubcommand({
|
|
26
|
+
name: 'list',
|
|
27
|
+
aliases: ['ls'],
|
|
28
|
+
description: 'List deliveries for a webhook',
|
|
29
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
30
|
+
requires: { auth: true },
|
|
31
|
+
examples: [
|
|
32
|
+
{
|
|
33
|
+
command: getCommand('cloud webhook deliveries list wh_abc123'),
|
|
34
|
+
description: 'List webhook deliveries',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
schema: {
|
|
38
|
+
args: z.object({
|
|
39
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
40
|
+
}),
|
|
41
|
+
options: z.object({
|
|
42
|
+
limit: z.coerce
|
|
43
|
+
.number()
|
|
44
|
+
.min(0)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Maximum number of deliveries to return'),
|
|
47
|
+
offset: z.coerce.number().min(0).optional().describe('Offset for pagination'),
|
|
48
|
+
}),
|
|
49
|
+
response: DeliveriesListResponseSchema,
|
|
50
|
+
},
|
|
51
|
+
idempotent: true,
|
|
52
|
+
|
|
53
|
+
async handler(ctx) {
|
|
54
|
+
const { args, opts, options } = ctx;
|
|
55
|
+
const client = await createWebhookAPIClient(ctx);
|
|
56
|
+
const result = await listWebhookDeliveries(
|
|
57
|
+
client,
|
|
58
|
+
args.webhook_id,
|
|
59
|
+
{
|
|
60
|
+
limit: opts.limit,
|
|
61
|
+
offset: opts.offset,
|
|
62
|
+
},
|
|
63
|
+
getWebhookApiOptions(ctx)
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (!options.json) {
|
|
67
|
+
if (result.deliveries.length === 0) {
|
|
68
|
+
tui.info('No deliveries found');
|
|
69
|
+
} else {
|
|
70
|
+
const tableData = result.deliveries.map((d: WebhookDelivery) => ({
|
|
71
|
+
ID: d.id,
|
|
72
|
+
Date: new Date(d.date).toLocaleString(),
|
|
73
|
+
Status: d.status,
|
|
74
|
+
Retries: d.retries,
|
|
75
|
+
'Destination ID': d.webhook_destination_id,
|
|
76
|
+
}));
|
|
77
|
+
tui.table(tableData, ['ID', 'Date', 'Status', 'Retries', 'Destination ID']);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
deliveries: result.deliveries.map((d: WebhookDelivery) => ({
|
|
83
|
+
id: d.id,
|
|
84
|
+
date: d.date,
|
|
85
|
+
status: d.status,
|
|
86
|
+
retries: d.retries,
|
|
87
|
+
webhook_destination_id: d.webhook_destination_id,
|
|
88
|
+
})),
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const retryDeliverySubcommand = createSubcommand({
|
|
94
|
+
name: 'retry',
|
|
95
|
+
description: 'Retry a failed webhook delivery',
|
|
96
|
+
tags: ['mutating', 'requires-auth'],
|
|
97
|
+
requires: { auth: true },
|
|
98
|
+
examples: [
|
|
99
|
+
{
|
|
100
|
+
command: getCommand('cloud webhook deliveries retry wh_abc123 whdv_def456'),
|
|
101
|
+
description: 'Retry a failed delivery',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
schema: {
|
|
105
|
+
args: z.object({
|
|
106
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
107
|
+
delivery_id: z.string().min(1).describe('Delivery ID'),
|
|
108
|
+
}),
|
|
109
|
+
response: WebhookDeliverySchema,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
async handler(ctx) {
|
|
113
|
+
const { args, options } = ctx;
|
|
114
|
+
const client = await createWebhookAPIClient(ctx);
|
|
115
|
+
const delivery = await retryWebhookDelivery(
|
|
116
|
+
client,
|
|
117
|
+
args.webhook_id,
|
|
118
|
+
args.delivery_id,
|
|
119
|
+
getWebhookApiOptions(ctx)
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (!options.json) {
|
|
123
|
+
tui.success(`Retried delivery: ${delivery.id}`);
|
|
124
|
+
console.log(` Status: ${delivery.status}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return delivery;
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const deliveriesSubcommand = createCommand({
|
|
132
|
+
name: 'deliveries',
|
|
133
|
+
description: 'Manage webhook deliveries',
|
|
134
|
+
tags: ['requires-auth'],
|
|
135
|
+
requires: { auth: true },
|
|
136
|
+
examples: [
|
|
137
|
+
{
|
|
138
|
+
command: getCommand('cloud webhook deliveries list wh_abc123'),
|
|
139
|
+
description: 'List deliveries',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
command: getCommand('cloud webhook deliveries retry wh_abc123 whdv_def456'),
|
|
143
|
+
description: 'Retry a failed delivery',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
subcommands: [listDeliveriesSubcommand, retryDeliverySubcommand],
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export default deliveriesSubcommand;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand, createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createWebhookAPIClient, getWebhookApiOptions } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { ErrorCode } from '../../../errors';
|
|
7
|
+
import {
|
|
8
|
+
createWebhookDestination,
|
|
9
|
+
listWebhookDestinations,
|
|
10
|
+
updateWebhookDestination,
|
|
11
|
+
deleteWebhookDestination,
|
|
12
|
+
WebhookDestinationSchema,
|
|
13
|
+
type WebhookDestination,
|
|
14
|
+
} from '@agentuity/server';
|
|
15
|
+
|
|
16
|
+
const DestinationsListResponseSchema = z.object({
|
|
17
|
+
destinations: z.array(
|
|
18
|
+
z.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
type: z.string(),
|
|
21
|
+
config: z.record(z.string(), z.unknown()),
|
|
22
|
+
created_at: z.string(),
|
|
23
|
+
})
|
|
24
|
+
),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const listDestinationsSubcommand = createSubcommand({
|
|
28
|
+
name: 'list',
|
|
29
|
+
aliases: ['ls'],
|
|
30
|
+
description: 'List destinations for a webhook',
|
|
31
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
32
|
+
requires: { auth: true },
|
|
33
|
+
examples: [
|
|
34
|
+
{
|
|
35
|
+
command: getCommand('cloud webhook destinations list wh_abc123'),
|
|
36
|
+
description: 'List webhook destinations',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
schema: {
|
|
40
|
+
args: z.object({
|
|
41
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
42
|
+
}),
|
|
43
|
+
response: DestinationsListResponseSchema,
|
|
44
|
+
},
|
|
45
|
+
idempotent: true,
|
|
46
|
+
|
|
47
|
+
async handler(ctx) {
|
|
48
|
+
const { args, options } = ctx;
|
|
49
|
+
const client = await createWebhookAPIClient(ctx);
|
|
50
|
+
const destinations = await listWebhookDestinations(
|
|
51
|
+
client,
|
|
52
|
+
args.webhook_id,
|
|
53
|
+
getWebhookApiOptions(ctx)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (!options.json) {
|
|
57
|
+
if (destinations.length === 0) {
|
|
58
|
+
tui.info('No destinations configured');
|
|
59
|
+
} else {
|
|
60
|
+
const tableData = destinations.map((d: WebhookDestination) => ({
|
|
61
|
+
ID: d.id,
|
|
62
|
+
Type: d.type,
|
|
63
|
+
Config: JSON.stringify(d.config),
|
|
64
|
+
Created: new Date(d.created_at).toLocaleString(),
|
|
65
|
+
}));
|
|
66
|
+
tui.table(tableData, ['ID', 'Type', 'Config', 'Created']);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
destinations: destinations.map((d: WebhookDestination) => ({
|
|
72
|
+
id: d.id,
|
|
73
|
+
type: d.type,
|
|
74
|
+
config: d.config,
|
|
75
|
+
created_at: d.created_at,
|
|
76
|
+
})),
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const createUrlDestinationSubcommand = createSubcommand({
|
|
82
|
+
name: 'url',
|
|
83
|
+
description: 'Create a URL destination for a webhook',
|
|
84
|
+
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
85
|
+
requires: { auth: true },
|
|
86
|
+
examples: [
|
|
87
|
+
{
|
|
88
|
+
command: getCommand(
|
|
89
|
+
'cloud webhook destinations create url wh_abc123 https://example.com/webhook'
|
|
90
|
+
),
|
|
91
|
+
description: 'Create a URL destination',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
schema: {
|
|
95
|
+
args: z.object({
|
|
96
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
97
|
+
url: z.string().min(1).describe('Destination URL'),
|
|
98
|
+
}),
|
|
99
|
+
response: WebhookDestinationSchema,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
async handler(ctx) {
|
|
103
|
+
const { args, options } = ctx;
|
|
104
|
+
const client = await createWebhookAPIClient(ctx);
|
|
105
|
+
|
|
106
|
+
const destination = await createWebhookDestination(
|
|
107
|
+
client,
|
|
108
|
+
args.webhook_id,
|
|
109
|
+
{
|
|
110
|
+
type: 'url',
|
|
111
|
+
config: { url: args.url },
|
|
112
|
+
},
|
|
113
|
+
getWebhookApiOptions(ctx)
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (!options.json) {
|
|
117
|
+
tui.success(`Created destination: ${destination.id}`);
|
|
118
|
+
console.log(` URL: ${args.url}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return destination;
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const createDestinationSubcommand = createCommand({
|
|
126
|
+
name: 'create',
|
|
127
|
+
description: 'Create a destination for a webhook',
|
|
128
|
+
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
129
|
+
requires: { auth: true },
|
|
130
|
+
examples: [
|
|
131
|
+
{
|
|
132
|
+
command: getCommand(
|
|
133
|
+
'cloud webhook destinations create url wh_abc123 --url https://example.com/webhook'
|
|
134
|
+
),
|
|
135
|
+
description: 'Create a URL destination',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
subcommands: [createUrlDestinationSubcommand],
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const updateDestinationSubcommand = createSubcommand({
|
|
142
|
+
name: 'update',
|
|
143
|
+
description: 'Update a webhook destination',
|
|
144
|
+
tags: ['mutating', 'requires-auth'],
|
|
145
|
+
requires: { auth: true },
|
|
146
|
+
examples: [
|
|
147
|
+
{
|
|
148
|
+
command: getCommand(
|
|
149
|
+
'cloud webhook destinations update wh_abc123 whds_def456 --url https://example.com/v2'
|
|
150
|
+
),
|
|
151
|
+
description: 'Update a destination URL',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
schema: {
|
|
155
|
+
args: z.object({
|
|
156
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
157
|
+
destination_id: z.string().min(1).describe('Destination ID'),
|
|
158
|
+
}),
|
|
159
|
+
options: z.object({
|
|
160
|
+
url: z.string().optional().describe('Updated destination URL'),
|
|
161
|
+
}),
|
|
162
|
+
response: WebhookDestinationSchema,
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
async handler(ctx) {
|
|
166
|
+
const { args, opts, options } = ctx;
|
|
167
|
+
const client = await createWebhookAPIClient(ctx);
|
|
168
|
+
|
|
169
|
+
const updateParams: { config?: Record<string, unknown> } = {};
|
|
170
|
+
|
|
171
|
+
if (opts.url) {
|
|
172
|
+
updateParams.config = { url: opts.url };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const destination = await updateWebhookDestination(
|
|
176
|
+
client,
|
|
177
|
+
args.webhook_id,
|
|
178
|
+
args.destination_id,
|
|
179
|
+
updateParams,
|
|
180
|
+
getWebhookApiOptions(ctx)
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
if (!options.json) {
|
|
184
|
+
tui.success(`Updated destination: ${destination.id}`);
|
|
185
|
+
console.log(` URL: ${JSON.stringify(destination.config)}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return destination;
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const DeleteDestinationResponseSchema = z.object({
|
|
193
|
+
success: z.boolean(),
|
|
194
|
+
webhook_id: z.string(),
|
|
195
|
+
destination_id: z.string(),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const deleteDestinationSubcommand = createSubcommand({
|
|
199
|
+
name: 'delete',
|
|
200
|
+
aliases: ['rm'],
|
|
201
|
+
description: 'Delete a destination from a webhook',
|
|
202
|
+
tags: ['mutating', 'deletes-resource', 'requires-auth'],
|
|
203
|
+
requires: { auth: true },
|
|
204
|
+
examples: [
|
|
205
|
+
{
|
|
206
|
+
command: getCommand('cloud webhook destinations delete wh_abc123 whds_def456 --confirm'),
|
|
207
|
+
description: 'Delete a destination',
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
schema: {
|
|
211
|
+
args: z.object({
|
|
212
|
+
webhook_id: z.string().min(1).describe('Webhook ID'),
|
|
213
|
+
destination_id: z.string().min(1).describe('Destination ID'),
|
|
214
|
+
}),
|
|
215
|
+
options: z.object({
|
|
216
|
+
confirm: z.boolean().default(false).describe('Skip confirmation prompt'),
|
|
217
|
+
}),
|
|
218
|
+
response: DeleteDestinationResponseSchema,
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
async handler(ctx) {
|
|
222
|
+
const { args, opts, options } = ctx;
|
|
223
|
+
|
|
224
|
+
if (!opts.confirm) {
|
|
225
|
+
tui.fatal('Use --confirm to confirm destination deletion', ErrorCode.INVALID_ARGUMENT);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const client = await createWebhookAPIClient(ctx);
|
|
229
|
+
await deleteWebhookDestination(
|
|
230
|
+
client,
|
|
231
|
+
args.webhook_id,
|
|
232
|
+
args.destination_id,
|
|
233
|
+
getWebhookApiOptions(ctx)
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
if (!options.json) {
|
|
237
|
+
tui.success(`Deleted destination: ${args.destination_id}`);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
success: true,
|
|
242
|
+
webhook_id: args.webhook_id,
|
|
243
|
+
destination_id: args.destination_id,
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
export const destinationsSubcommand = createCommand({
|
|
249
|
+
name: 'destinations',
|
|
250
|
+
aliases: ['dest'],
|
|
251
|
+
description: 'Manage webhook destinations',
|
|
252
|
+
tags: ['requires-auth'],
|
|
253
|
+
requires: { auth: true },
|
|
254
|
+
examples: [
|
|
255
|
+
{
|
|
256
|
+
command: getCommand('cloud webhook destinations list wh_abc123'),
|
|
257
|
+
description: 'List destinations',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
command: getCommand(
|
|
261
|
+
'cloud webhook destinations create url wh_abc123 --url https://example.com/webhook'
|
|
262
|
+
),
|
|
263
|
+
description: 'Create a URL destination',
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
subcommands: [
|
|
267
|
+
listDestinationsSubcommand,
|
|
268
|
+
createDestinationSubcommand,
|
|
269
|
+
updateDestinationSubcommand,
|
|
270
|
+
deleteDestinationSubcommand,
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
export default destinationsSubcommand;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createWebhookAPIClient, getWebhookApiOptions } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { getWebhook, WebhookSchema } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
export const getSubcommand = createCommand({
|
|
9
|
+
name: 'get',
|
|
10
|
+
description: 'Get webhook details',
|
|
11
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
12
|
+
requires: { auth: true },
|
|
13
|
+
examples: [
|
|
14
|
+
{
|
|
15
|
+
command: getCommand('cloud webhook get wh_abc123'),
|
|
16
|
+
description: 'Get webhook details',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
schema: {
|
|
20
|
+
args: z.object({
|
|
21
|
+
id: z.string().min(1).describe('Webhook ID'),
|
|
22
|
+
}),
|
|
23
|
+
response: WebhookSchema,
|
|
24
|
+
},
|
|
25
|
+
idempotent: true,
|
|
26
|
+
|
|
27
|
+
async handler(ctx) {
|
|
28
|
+
const { args, options } = ctx;
|
|
29
|
+
const client = await createWebhookAPIClient(ctx);
|
|
30
|
+
const apiOptions = getWebhookApiOptions(ctx);
|
|
31
|
+
|
|
32
|
+
const webhook = await getWebhook(client, args.id, apiOptions);
|
|
33
|
+
|
|
34
|
+
if (!options.json) {
|
|
35
|
+
const details: Record<string, unknown> = {
|
|
36
|
+
Name: webhook.name,
|
|
37
|
+
ID: webhook.id,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (webhook.description) {
|
|
41
|
+
details.Description = webhook.description;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (webhook.url) {
|
|
45
|
+
details.URL = webhook.url;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
details['Created By'] = webhook.created_by;
|
|
49
|
+
details.Created = new Date(webhook.created_at).toISOString();
|
|
50
|
+
details.Updated = new Date(webhook.updated_at).toISOString();
|
|
51
|
+
|
|
52
|
+
tui.table([details], undefined, { layout: 'vertical' });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return webhook;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
|
+
import { listSubcommand } from './list';
|
|
3
|
+
import { createSubcommand } from './create';
|
|
4
|
+
import { getSubcommand } from './get';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { destinationsSubcommand } from './destinations';
|
|
7
|
+
import { receiptsSubcommand } from './receipts';
|
|
8
|
+
import { deliveriesSubcommand } from './deliveries';
|
|
9
|
+
import { getCommand } from '../../../command-prefix';
|
|
10
|
+
|
|
11
|
+
export const command = createCommand({
|
|
12
|
+
name: 'webhook',
|
|
13
|
+
aliases: ['webhooks'],
|
|
14
|
+
description: 'Manage webhooks for receiving external HTTP callbacks',
|
|
15
|
+
tags: ['requires-auth'],
|
|
16
|
+
examples: [
|
|
17
|
+
{
|
|
18
|
+
command: getCommand('cloud webhook list'),
|
|
19
|
+
description: 'List all webhooks',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
command: getCommand('cloud webhook create --name my-webhook'),
|
|
23
|
+
description: 'Create a webhook',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
command: getCommand('cloud webhook get wh_abc123'),
|
|
27
|
+
description: 'Get webhook details',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
command: getCommand('cloud webhook destinations list wh_abc123'),
|
|
31
|
+
description: 'List webhook destinations',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
subcommands: [
|
|
35
|
+
listSubcommand,
|
|
36
|
+
createSubcommand,
|
|
37
|
+
getSubcommand,
|
|
38
|
+
deleteSubcommand,
|
|
39
|
+
destinationsSubcommand,
|
|
40
|
+
receiptsSubcommand,
|
|
41
|
+
deliveriesSubcommand,
|
|
42
|
+
],
|
|
43
|
+
requires: { auth: true },
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export default command;
|