@instantkom/cli 3.129.2
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 +34 -0
- package/bin/run.js +3 -0
- package/dist/api-client.d.ts +55 -0
- package/dist/api-client.js +199 -0
- package/dist/auth/device-flow-client.d.ts +22 -0
- package/dist/auth/device-flow-client.js +70 -0
- package/dist/auth/token-resolver.d.ts +31 -0
- package/dist/auth/token-resolver.js +48 -0
- package/dist/auth/token-store.d.ts +13 -0
- package/dist/auth/token-store.js +39 -0
- package/dist/base-command.d.ts +18 -0
- package/dist/base-command.js +84 -0
- package/dist/commands/ai/reply.d.ts +18 -0
- package/dist/commands/ai/reply.js +46 -0
- package/dist/commands/auth/login.d.ts +15 -0
- package/dist/commands/auth/login.js +37 -0
- package/dist/commands/auth/logout.d.ts +14 -0
- package/dist/commands/auth/logout.js +17 -0
- package/dist/commands/auth/tokens/create.d.ts +17 -0
- package/dist/commands/auth/tokens/create.js +62 -0
- package/dist/commands/auth/tokens/list.d.ts +14 -0
- package/dist/commands/auth/tokens/list.js +41 -0
- package/dist/commands/auth/tokens/revoke.d.ts +20 -0
- package/dist/commands/auth/tokens/revoke.js +41 -0
- package/dist/commands/autocomplete/script.d.ts +11 -0
- package/dist/commands/autocomplete/script.js +90 -0
- package/dist/commands/autocomplete.d.ts +13 -0
- package/dist/commands/autocomplete.js +95 -0
- package/dist/commands/bots/create.d.ts +22 -0
- package/dist/commands/bots/create.js +39 -0
- package/dist/commands/bots/delete.d.ts +20 -0
- package/dist/commands/bots/delete.js +19 -0
- package/dist/commands/bots/env-vars/bots.d.ts +20 -0
- package/dist/commands/bots/env-vars/bots.js +18 -0
- package/dist/commands/bots/env-vars/create.d.ts +18 -0
- package/dist/commands/bots/env-vars/create.js +28 -0
- package/dist/commands/bots/env-vars/delete.d.ts +20 -0
- package/dist/commands/bots/env-vars/delete.js +19 -0
- package/dist/commands/bots/env-vars/get.d.ts +20 -0
- package/dist/commands/bots/env-vars/get.js +19 -0
- package/dist/commands/bots/env-vars/list.d.ts +18 -0
- package/dist/commands/bots/env-vars/list.js +28 -0
- package/dist/commands/bots/env-vars/update.d.ts +23 -0
- package/dist/commands/bots/env-vars/update.js +29 -0
- package/dist/commands/bots/env-vars/values/delete.d.ts +20 -0
- package/dist/commands/bots/env-vars/values/delete.js +18 -0
- package/dist/commands/bots/env-vars/values/update.d.ts +23 -0
- package/dist/commands/bots/env-vars/values/update.js +28 -0
- package/dist/commands/bots/env-vars/values.d.ts +24 -0
- package/dist/commands/bots/env-vars/values.js +30 -0
- package/dist/commands/bots/filters/create.d.ts +28 -0
- package/dist/commands/bots/filters/create.js +38 -0
- package/dist/commands/bots/filters/delete.d.ts +24 -0
- package/dist/commands/bots/filters/delete.js +19 -0
- package/dist/commands/bots/filters/get.d.ts +24 -0
- package/dist/commands/bots/filters/get.js +19 -0
- package/dist/commands/bots/filters/list.d.ts +24 -0
- package/dist/commands/bots/filters/list.js +30 -0
- package/dist/commands/bots/filters/update.d.ts +32 -0
- package/dist/commands/bots/filters/update.js +39 -0
- package/dist/commands/bots/get.d.ts +20 -0
- package/dist/commands/bots/get.js +19 -0
- package/dist/commands/bots/list.d.ts +21 -0
- package/dist/commands/bots/list.js +34 -0
- package/dist/commands/bots/matches.d.ts +23 -0
- package/dist/commands/bots/matches.js +28 -0
- package/dist/commands/bots/tags/add.d.ts +24 -0
- package/dist/commands/bots/tags/add.js +19 -0
- package/dist/commands/bots/tags/list.d.ts +20 -0
- package/dist/commands/bots/tags/list.js +18 -0
- package/dist/commands/bots/tags/remove.d.ts +24 -0
- package/dist/commands/bots/tags/remove.js +19 -0
- package/dist/commands/bots/update.d.ts +27 -0
- package/dist/commands/bots/update.js +36 -0
- package/dist/commands/broadcast/create.d.ts +25 -0
- package/dist/commands/broadcast/create.js +117 -0
- package/dist/commands/channels/create.d.ts +19 -0
- package/dist/commands/channels/create.js +43 -0
- package/dist/commands/channels/get.d.ts +20 -0
- package/dist/commands/channels/get.js +25 -0
- package/dist/commands/channels/kpis.d.ts +21 -0
- package/dist/commands/channels/kpis.js +29 -0
- package/dist/commands/channels/list.d.ts +19 -0
- package/dist/commands/channels/list.js +43 -0
- package/dist/commands/channels/update.d.ts +24 -0
- package/dist/commands/channels/update.js +43 -0
- package/dist/commands/chats/reply.d.ts +21 -0
- package/dist/commands/chats/reply.js +28 -0
- package/dist/commands/config/get.d.ts +17 -0
- package/dist/commands/config/get.js +29 -0
- package/dist/commands/config/set.d.ts +18 -0
- package/dist/commands/config/set.js +30 -0
- package/dist/commands/config/unset.d.ts +17 -0
- package/dist/commands/config/unset.js +25 -0
- package/dist/commands/contacts/create.d.ts +18 -0
- package/dist/commands/contacts/create.js +39 -0
- package/dist/commands/contacts/delete.d.ts +20 -0
- package/dist/commands/contacts/delete.js +25 -0
- package/dist/commands/contacts/export.d.ts +19 -0
- package/dist/commands/contacts/export.js +50 -0
- package/dist/commands/contacts/get.d.ts +20 -0
- package/dist/commands/contacts/get.js +25 -0
- package/dist/commands/contacts/import.d.ts +16 -0
- package/dist/commands/contacts/import.js +62 -0
- package/dist/commands/contacts/list.d.ts +25 -0
- package/dist/commands/contacts/list.js +71 -0
- package/dist/commands/contacts/update.d.ts +23 -0
- package/dist/commands/contacts/update.js +39 -0
- package/dist/commands/exports/create.d.ts +23 -0
- package/dist/commands/exports/create.js +69 -0
- package/dist/commands/exports/delete.d.ts +20 -0
- package/dist/commands/exports/delete.js +25 -0
- package/dist/commands/exports/download.d.ts +21 -0
- package/dist/commands/exports/download.js +37 -0
- package/dist/commands/exports/get.d.ts +20 -0
- package/dist/commands/exports/get.js +25 -0
- package/dist/commands/exports/list.d.ts +18 -0
- package/dist/commands/exports/list.js +39 -0
- package/dist/commands/flow/edges/create.d.ts +25 -0
- package/dist/commands/flow/edges/create.js +32 -0
- package/dist/commands/flow/edges/delete.d.ts +24 -0
- package/dist/commands/flow/edges/delete.js +19 -0
- package/dist/commands/flow/edges/get.d.ts +24 -0
- package/dist/commands/flow/edges/get.js +19 -0
- package/dist/commands/flow/edges/list.d.ts +20 -0
- package/dist/commands/flow/edges/list.js +18 -0
- package/dist/commands/flow/edges/update.d.ts +29 -0
- package/dist/commands/flow/edges/update.js +33 -0
- package/dist/commands/flow/nodes/create.d.ts +25 -0
- package/dist/commands/flow/nodes/create.js +32 -0
- package/dist/commands/flow/nodes/delete.d.ts +24 -0
- package/dist/commands/flow/nodes/delete.js +19 -0
- package/dist/commands/flow/nodes/get.d.ts +24 -0
- package/dist/commands/flow/nodes/get.js +19 -0
- package/dist/commands/flow/nodes/list.d.ts +20 -0
- package/dist/commands/flow/nodes/list.js +18 -0
- package/dist/commands/flow/nodes/update.d.ts +29 -0
- package/dist/commands/flow/nodes/update.js +33 -0
- package/dist/commands/flows/create.d.ts +20 -0
- package/dist/commands/flows/create.js +32 -0
- package/dist/commands/flows/delete.d.ts +20 -0
- package/dist/commands/flows/delete.js +19 -0
- package/dist/commands/flows/get.d.ts +20 -0
- package/dist/commands/flows/get.js +19 -0
- package/dist/commands/flows/list.d.ts +19 -0
- package/dist/commands/flows/list.js +30 -0
- package/dist/commands/flows/update.d.ts +25 -0
- package/dist/commands/flows/update.js +33 -0
- package/dist/commands/send.d.ts +23 -0
- package/dist/commands/send.js +129 -0
- package/dist/commands/status.d.ts +23 -0
- package/dist/commands/status.js +81 -0
- package/dist/commands/tail.d.ts +15 -0
- package/dist/commands/tail.js +36 -0
- package/dist/commands/templates/get.d.ts +20 -0
- package/dist/commands/templates/get.js +24 -0
- package/dist/commands/templates/list.d.ts +18 -0
- package/dist/commands/templates/list.js +37 -0
- package/dist/commands/templates/render.d.ts +21 -0
- package/dist/commands/templates/render.js +30 -0
- package/dist/commands/ticket/messages/create.d.ts +22 -0
- package/dist/commands/ticket/messages/create.js +26 -0
- package/dist/commands/ticket/messages/delete.d.ts +24 -0
- package/dist/commands/ticket/messages/delete.js +20 -0
- package/dist/commands/ticket/messages/get.d.ts +24 -0
- package/dist/commands/ticket/messages/get.js +19 -0
- package/dist/commands/ticket/messages/list.d.ts +20 -0
- package/dist/commands/ticket/messages/list.js +18 -0
- package/dist/commands/tickets/create.d.ts +22 -0
- package/dist/commands/tickets/create.js +34 -0
- package/dist/commands/tickets/delete.d.ts +21 -0
- package/dist/commands/tickets/delete.js +21 -0
- package/dist/commands/tickets/get.d.ts +21 -0
- package/dist/commands/tickets/get.js +21 -0
- package/dist/commands/tickets/list.d.ts +17 -0
- package/dist/commands/tickets/list.js +24 -0
- package/dist/commands/tickets/update.d.ts +25 -0
- package/dist/commands/tickets/update.js +31 -0
- package/dist/commands/webhooks/add.d.ts +16 -0
- package/dist/commands/webhooks/add.js +38 -0
- package/dist/commands/webhooks/list.d.ts +14 -0
- package/dist/commands/webhooks/list.js +18 -0
- package/dist/commands/webhooks/remove.d.ts +17 -0
- package/dist/commands/webhooks/remove.js +24 -0
- package/dist/commands/whoami.d.ts +15 -0
- package/dist/commands/whoami.js +40 -0
- package/dist/config/config-file.d.ts +36 -0
- package/dist/config/config-file.js +111 -0
- package/dist/config/config-path.d.ts +8 -0
- package/dist/config/config-path.js +25 -0
- package/dist/crud/csv.d.ts +6 -0
- package/dist/crud/csv.js +89 -0
- package/dist/crud/data.d.ts +4 -0
- package/dist/crud/data.js +38 -0
- package/dist/crud/request.d.ts +14 -0
- package/dist/crud/request.js +26 -0
- package/dist/errors/api-error.d.ts +6 -0
- package/dist/errors/api-error.js +10 -0
- package/dist/errors/exit-codes.d.ts +12 -0
- package/dist/errors/exit-codes.js +24 -0
- package/dist/errors/redact-token.d.ts +10 -0
- package/dist/errors/redact-token.js +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/output/formatter.d.ts +15 -0
- package/dist/output/formatter.js +57 -0
- package/dist/output/text-format.d.ts +13 -0
- package/dist/output/text-format.js +67 -0
- package/dist/send/api.d.ts +3 -0
- package/dist/send/api.js +21 -0
- package/dist/send/fallback.d.ts +5 -0
- package/dist/send/fallback.js +38 -0
- package/dist/send/media.d.ts +2 -0
- package/dist/send/media.js +41 -0
- package/dist/send/payload.d.ts +23 -0
- package/dist/send/payload.js +22 -0
- package/dist/send/recipient-resolver.d.ts +13 -0
- package/dist/send/recipient-resolver.js +28 -0
- package/dist/send/schedule.d.ts +1 -0
- package/dist/send/schedule.js +19 -0
- package/dist/tail/sse.d.ts +24 -0
- package/dist/tail/sse.js +139 -0
- package/dist/templates/render-template.d.ts +14 -0
- package/dist/templates/render-template.js +46 -0
- package/npm-shrinkwrap.json +11444 -0
- package/oclif.manifest.json +9286 -0
- package/package.json +157 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../../crud/data.js';
|
|
4
|
+
import { createCliApiClient } from '../../../send/api.js';
|
|
5
|
+
export default class TicketMessagesCreate extends BaseCommand {
|
|
6
|
+
static description = 'Create a ticket message';
|
|
7
|
+
static args = {
|
|
8
|
+
ticketId: Args.integer({ description: 'Ticket ID', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
...BaseCommand.baseFlags,
|
|
12
|
+
message: Flags.string({ description: 'Message text', required: true }),
|
|
13
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(TicketMessagesCreate);
|
|
17
|
+
this.flags = flags;
|
|
18
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
19
|
+
message: flags.message,
|
|
20
|
+
});
|
|
21
|
+
const client = await createCliApiClient(flags);
|
|
22
|
+
const message = await client.post(`/v1/tickets/${args.ticketId}/messages`, payload);
|
|
23
|
+
if (!flags.quiet)
|
|
24
|
+
this.log(this.toFormatted(message));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
2
|
+
export default class TicketMessagesDelete extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
ticketId: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
messageId: import("@oclif/core/interfaces").Arg<number, {
|
|
10
|
+
max?: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
static flags: {
|
|
15
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../../send/api.js';
|
|
4
|
+
export default class TicketMessagesDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete a ticket message';
|
|
6
|
+
static args = {
|
|
7
|
+
ticketId: Args.integer({ description: 'Ticket ID', required: true }),
|
|
8
|
+
messageId: Args.integer({ description: 'Message ID', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(TicketMessagesDelete);
|
|
13
|
+
this.flags = flags;
|
|
14
|
+
const client = await createCliApiClient(flags);
|
|
15
|
+
const result = await client.delete(`/v1/tickets/${args.ticketId}/messages/${args.messageId}`);
|
|
16
|
+
if (!flags.quiet) {
|
|
17
|
+
this.log(this.toFormatted(result ?? { deleted: true, ticketId: args.ticketId, messageId: args.messageId }));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
2
|
+
export default class TicketMessagesGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
ticketId: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
messageId: import("@oclif/core/interfaces").Arg<number, {
|
|
10
|
+
max?: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
static flags: {
|
|
15
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../../send/api.js';
|
|
4
|
+
export default class TicketMessagesGet extends BaseCommand {
|
|
5
|
+
static description = 'Get a ticket message';
|
|
6
|
+
static args = {
|
|
7
|
+
ticketId: Args.integer({ description: 'Ticket ID', required: true }),
|
|
8
|
+
messageId: Args.integer({ description: 'Message ID', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(TicketMessagesGet);
|
|
13
|
+
this.flags = flags;
|
|
14
|
+
const client = await createCliApiClient(flags);
|
|
15
|
+
const message = await client.get(`/v1/tickets/${args.ticketId}/messages/${args.messageId}`);
|
|
16
|
+
if (!flags.quiet)
|
|
17
|
+
this.log(this.toFormatted(message));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
2
|
+
export default class TicketMessagesList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
ticketId: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../../send/api.js';
|
|
4
|
+
export default class TicketMessagesList extends BaseCommand {
|
|
5
|
+
static description = 'List ticket messages';
|
|
6
|
+
static args = {
|
|
7
|
+
ticketId: Args.integer({ description: 'Ticket ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
10
|
+
async run() {
|
|
11
|
+
const { args, flags } = await this.parse(TicketMessagesList);
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
const client = await createCliApiClient(flags);
|
|
14
|
+
const messages = await client.get(`/v1/tickets/${args.ticketId}/messages`);
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted(messages));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
subject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
recipient: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
priority: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TicketsCreate extends BaseCommand {
|
|
6
|
+
static description = 'Create a ticket';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
10
|
+
subject: Flags.string({ description: 'Ticket subject', required: true }),
|
|
11
|
+
recipient: Flags.integer({ description: 'Existing recipient ID' }),
|
|
12
|
+
email: Flags.string({ description: 'Customer email' }),
|
|
13
|
+
name: Flags.string({ description: 'Customer name' }),
|
|
14
|
+
priority: Flags.string({ description: 'Ticket priority' }),
|
|
15
|
+
source: Flags.string({ description: 'Ticket source' }),
|
|
16
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags } = await this.parse(TicketsCreate);
|
|
20
|
+
this.flags = flags;
|
|
21
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
22
|
+
subject: flags.subject,
|
|
23
|
+
recipientId: flags.recipient,
|
|
24
|
+
email: flags.email,
|
|
25
|
+
name: flags.name,
|
|
26
|
+
priority: flags.priority,
|
|
27
|
+
source: flags.source,
|
|
28
|
+
});
|
|
29
|
+
const client = await createCliApiClient(flags);
|
|
30
|
+
const ticket = await client.post(`/v1/channels/${flags.channel}/tickets`, payload);
|
|
31
|
+
if (!flags.quiet)
|
|
32
|
+
this.log(this.toFormatted(ticket));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsDelete extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
4
|
+
export default class TicketsDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete a ticket';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'Ticket ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = {
|
|
10
|
+
...BaseCommand.baseFlags,
|
|
11
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(TicketsDelete);
|
|
15
|
+
this.flags = flags;
|
|
16
|
+
const client = await createCliApiClient(flags);
|
|
17
|
+
const result = await client.delete(`/v1/channels/${flags.channel}/tickets/${args.id}`);
|
|
18
|
+
if (!flags.quiet)
|
|
19
|
+
this.log(this.toFormatted(result ?? { deleted: true, id: args.id }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
4
|
+
export default class TicketsGet extends BaseCommand {
|
|
5
|
+
static description = 'Get a ticket by ID';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'Ticket ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = {
|
|
10
|
+
...BaseCommand.baseFlags,
|
|
11
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(TicketsGet);
|
|
15
|
+
this.flags = flags;
|
|
16
|
+
const client = await createCliApiClient(flags);
|
|
17
|
+
const ticket = await client.get(`/v1/channels/${flags.channel}/tickets/${args.id}`);
|
|
18
|
+
if (!flags.quiet)
|
|
19
|
+
this.log(this.toFormatted(ticket));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { cleanQuery } from '../../crud/data.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TicketsList extends BaseCommand {
|
|
6
|
+
static description = 'List tickets for a channel';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
10
|
+
limit: Flags.integer({ description: 'Maximum tickets to return', default: 500 }),
|
|
11
|
+
offset: Flags.integer({ description: 'Number of tickets to skip', default: 0 }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(TicketsList);
|
|
15
|
+
this.flags = flags;
|
|
16
|
+
const client = await createCliApiClient(flags);
|
|
17
|
+
const tickets = await client.get(`/v1/channels/${flags.channel}/tickets`, cleanQuery({
|
|
18
|
+
limit: flags.limit,
|
|
19
|
+
offset: flags.offset,
|
|
20
|
+
}));
|
|
21
|
+
if (!flags.quiet)
|
|
22
|
+
this.log(this.toFormatted(tickets));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsUpdate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
subject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
priority: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
run(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TicketsUpdate extends BaseCommand {
|
|
6
|
+
static description = 'Update a ticket';
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({ description: 'Ticket ID', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
...BaseCommand.baseFlags,
|
|
12
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
13
|
+
subject: Flags.string({ description: 'Ticket subject' }),
|
|
14
|
+
priority: Flags.string({ description: 'Ticket priority' }),
|
|
15
|
+
status: Flags.string({ description: 'Ticket status' }),
|
|
16
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { args, flags } = await this.parse(TicketsUpdate);
|
|
20
|
+
this.flags = flags;
|
|
21
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
22
|
+
subject: flags.subject,
|
|
23
|
+
priority: flags.priority,
|
|
24
|
+
status: flags.status,
|
|
25
|
+
});
|
|
26
|
+
const client = await createCliApiClient(flags);
|
|
27
|
+
const ticket = await client.put(`/v1/channels/${flags.channel}/tickets/${args.id}`, payload);
|
|
28
|
+
if (!flags.quiet)
|
|
29
|
+
this.log(this.toFormatted(ticket));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksAdd extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
event: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
url: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { createResource } from '../../crud/request.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
const WEBHOOK_EVENTS = [
|
|
6
|
+
'new_contact',
|
|
7
|
+
'new_message',
|
|
8
|
+
'broadcast_sent',
|
|
9
|
+
'contact_updated',
|
|
10
|
+
'contact_opted_out',
|
|
11
|
+
];
|
|
12
|
+
export default class WebhooksAdd extends BaseCommand {
|
|
13
|
+
static description = 'Add a webhook subscription';
|
|
14
|
+
static flags = {
|
|
15
|
+
...BaseCommand.baseFlags,
|
|
16
|
+
event: Flags.string({
|
|
17
|
+
description: 'Webhook event to subscribe to',
|
|
18
|
+
options: WEBHOOK_EVENTS,
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
url: Flags.string({
|
|
22
|
+
description: 'HTTPS target URL that receives webhook POSTs',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(WebhooksAdd);
|
|
28
|
+
this.flags = flags;
|
|
29
|
+
const client = await createCliApiClient(flags);
|
|
30
|
+
const subscription = await createResource(client, '/v1/webhooks/subscribe', {
|
|
31
|
+
event: flags.event,
|
|
32
|
+
target_url: flags.url,
|
|
33
|
+
});
|
|
34
|
+
if (!flags.quiet) {
|
|
35
|
+
this.log(this.toFormatted(subscription));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
import { listResource } from '../../crud/request.js';
|
|
3
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
4
|
+
export default class WebhooksList extends BaseCommand {
|
|
5
|
+
static description = 'List webhook subscriptions';
|
|
6
|
+
static flags = {
|
|
7
|
+
...BaseCommand.baseFlags,
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(WebhooksList);
|
|
11
|
+
this.flags = flags;
|
|
12
|
+
const client = await createCliApiClient(flags);
|
|
13
|
+
const subscriptions = await listResource(client, '/v1/webhooks/subscriptions');
|
|
14
|
+
if (!flags.quiet) {
|
|
15
|
+
this.log(this.toFormatted(subscriptions));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksRemove extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
4
|
+
export default class WebhooksRemove extends BaseCommand {
|
|
5
|
+
static description = 'Remove a webhook subscription';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({
|
|
8
|
+
description: 'Webhook subscription ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
...BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(WebhooksRemove);
|
|
17
|
+
this.flags = flags;
|
|
18
|
+
const client = await createCliApiClient(flags);
|
|
19
|
+
const result = await client.delete(`/v1/webhooks/subscribe/${encodeURIComponent(args.id)}`);
|
|
20
|
+
if (!flags.quiet) {
|
|
21
|
+
this.log(this.toFormatted({ ...result, id: args.id }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
export default class Whoami extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
static args: {};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
import { EXIT_CODES } from '../errors/exit-codes.js';
|
|
3
|
+
import { ApiError } from '../errors/api-error.js';
|
|
4
|
+
import { resolveToken } from '../auth/token-resolver.js';
|
|
5
|
+
import { ApiClient } from '../api-client.js';
|
|
6
|
+
export default class Whoami extends BaseCommand {
|
|
7
|
+
static description = 'Show the current authenticated user profile';
|
|
8
|
+
static flags = {
|
|
9
|
+
...BaseCommand.baseFlags,
|
|
10
|
+
};
|
|
11
|
+
static args = {};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(Whoami);
|
|
14
|
+
this.flags = flags;
|
|
15
|
+
const token = await resolveToken({
|
|
16
|
+
flag: flags['api-key'],
|
|
17
|
+
env: process.env.IKM_API_KEY,
|
|
18
|
+
profile: flags.profile ?? 'default',
|
|
19
|
+
});
|
|
20
|
+
if (!token) {
|
|
21
|
+
throw new ApiError('unauthorized', 'Not logged in. Run: ikm auth login');
|
|
22
|
+
}
|
|
23
|
+
const apiUrl = flags['api-url'] ?? process.env.IKM_API_URL ?? 'https://api.instantkom.app';
|
|
24
|
+
const client = new ApiClient({
|
|
25
|
+
id: flags.profile ?? 'default',
|
|
26
|
+
name: 'ikm-cli',
|
|
27
|
+
apiUrl,
|
|
28
|
+
apiKey: token,
|
|
29
|
+
scope: 'customer',
|
|
30
|
+
});
|
|
31
|
+
const me = await client.get('/v1/users/me');
|
|
32
|
+
const output = {
|
|
33
|
+
email: me.email,
|
|
34
|
+
scope: me.scope ?? 'full',
|
|
35
|
+
channel_count: me.channel_count ?? 0,
|
|
36
|
+
};
|
|
37
|
+
this.log(this.toFormatted(output));
|
|
38
|
+
this.exit(EXIT_CODES.OK);
|
|
39
|
+
}
|
|
40
|
+
}
|