@instantkom/cli 3.129.2 → 3.130.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 +29 -0
- package/bin/run.js +0 -0
- package/dist/api-client.js +28 -5
- package/dist/command-helpers/download.d.ts +10 -0
- package/dist/command-helpers/download.js +10 -0
- package/dist/command-helpers/json.d.ts +4 -0
- package/dist/command-helpers/json.js +37 -0
- package/dist/commands/account/get.d.ts +14 -0
- package/dist/commands/account/get.js +14 -0
- package/dist/commands/account/update.d.ts +23 -0
- package/dist/commands/account/update.js +37 -0
- package/dist/commands/auth/login.js +0 -2
- package/dist/commands/auth/logout.js +0 -2
- package/dist/commands/auth/tokens/create.js +0 -2
- package/dist/commands/auth/tokens/list.js +0 -2
- package/dist/commands/auth/tokens/revoke.js +0 -2
- package/dist/commands/bots/env-vars/create.d.ts +1 -1
- package/dist/commands/bots/env-vars/create.js +18 -11
- package/dist/commands/bots/filters/create.d.ts +5 -5
- package/dist/commands/bots/filters/create.js +33 -18
- package/dist/commands/broadcast/delete.d.ts +20 -0
- package/dist/commands/broadcast/delete.js +18 -0
- package/dist/commands/broadcast/get.d.ts +20 -0
- package/dist/commands/broadcast/get.js +18 -0
- package/dist/commands/broadcast/list.d.ts +21 -0
- package/dist/commands/broadcast/list.js +39 -0
- package/dist/commands/broadcast/send.d.ts +20 -0
- package/dist/commands/broadcast/send.js +18 -0
- package/dist/commands/broadcast/status.d.ts +20 -0
- package/dist/commands/broadcast/status.js +31 -0
- package/dist/commands/broadcast/update.d.ts +30 -0
- package/dist/commands/broadcast/update.js +47 -0
- package/dist/commands/chats/get.d.ts +20 -0
- package/dist/commands/chats/get.js +18 -0
- package/dist/commands/chats/list.d.ts +22 -0
- package/dist/commands/chats/list.js +40 -0
- package/dist/commands/config/get.js +0 -2
- package/dist/commands/config/set.js +0 -2
- package/dist/commands/config/unset.js +0 -2
- package/dist/commands/contacts/custom-fields/delete-value.d.ts +24 -0
- package/dist/commands/contacts/custom-fields/delete-value.js +32 -0
- package/dist/commands/contacts/custom-fields/list.d.ts +20 -0
- package/dist/commands/contacts/custom-fields/list.js +24 -0
- package/dist/commands/contacts/custom-fields/set-value.d.ts +25 -0
- package/dist/commands/contacts/custom-fields/set-value.js +32 -0
- package/dist/commands/contacts/custom-fields/set.d.ts +23 -0
- package/dist/commands/contacts/custom-fields/set.js +42 -0
- package/dist/commands/contacts/tags/add.d.ts +24 -0
- package/dist/commands/contacts/tags/add.js +30 -0
- package/dist/commands/contacts/tags/list.d.ts +20 -0
- package/dist/commands/contacts/tags/list.js +24 -0
- package/dist/commands/contacts/tags/remove.d.ts +24 -0
- package/dist/commands/contacts/tags/remove.js +32 -0
- package/dist/commands/custom-fields/bulk-delete.d.ts +15 -0
- package/dist/commands/custom-fields/bulk-delete.js +24 -0
- package/dist/commands/custom-fields/create.d.ts +21 -0
- package/dist/commands/custom-fields/create.js +47 -0
- package/dist/commands/custom-fields/delete.d.ts +20 -0
- package/dist/commands/custom-fields/delete.js +18 -0
- package/dist/commands/custom-fields/get.d.ts +20 -0
- package/dist/commands/custom-fields/get.js +18 -0
- package/dist/commands/custom-fields/list.d.ts +14 -0
- package/dist/commands/custom-fields/list.js +14 -0
- package/dist/commands/custom-fields/reorder.d.ts +15 -0
- package/dist/commands/custom-fields/reorder.js +22 -0
- package/dist/commands/custom-fields/update.d.ts +27 -0
- package/dist/commands/custom-fields/update.js +52 -0
- package/dist/commands/doctor.d.ts +14 -0
- package/dist/commands/doctor.js +56 -0
- package/dist/commands/features.d.ts +14 -0
- package/dist/commands/features.js +19 -0
- package/dist/commands/messages/bulk-spam.d.ts +16 -0
- package/dist/commands/messages/bulk-spam.js +30 -0
- package/dist/commands/messages/create-ticket.d.ts +23 -0
- package/dist/commands/messages/create-ticket.js +28 -0
- package/dist/commands/messages/delete.d.ts +20 -0
- package/dist/commands/messages/delete.js +18 -0
- package/dist/commands/messages/get.d.ts +20 -0
- package/dist/commands/messages/get.js +18 -0
- package/dist/commands/messages/list.d.ts +22 -0
- package/dist/commands/messages/list.js +35 -0
- package/dist/commands/messages/reactions.d.ts +20 -0
- package/dist/commands/messages/reactions.js +18 -0
- package/dist/commands/messages/spam.d.ts +21 -0
- package/dist/commands/messages/spam.js +27 -0
- package/dist/commands/messages/unread-count.d.ts +14 -0
- package/dist/commands/messages/unread-count.js +14 -0
- package/dist/commands/messages/update.d.ts +27 -0
- package/dist/commands/messages/update.js +43 -0
- package/dist/commands/permissions.d.ts +14 -0
- package/dist/commands/permissions.js +14 -0
- package/dist/commands/segments/create.d.ts +21 -0
- package/dist/commands/segments/create.js +33 -0
- package/dist/commands/segments/delete.d.ts +20 -0
- package/dist/commands/segments/delete.js +18 -0
- package/dist/commands/segments/get.d.ts +20 -0
- package/dist/commands/segments/get.js +18 -0
- package/dist/commands/segments/list.d.ts +20 -0
- package/dist/commands/segments/list.js +34 -0
- package/dist/commands/segments/tags/add.d.ts +24 -0
- package/dist/commands/segments/tags/add.js +21 -0
- package/dist/commands/segments/tags/list.d.ts +20 -0
- package/dist/commands/segments/tags/list.js +18 -0
- package/dist/commands/segments/tags/remove.d.ts +24 -0
- package/dist/commands/segments/tags/remove.js +23 -0
- package/dist/commands/segments/update.d.ts +26 -0
- package/dist/commands/segments/update.js +34 -0
- package/dist/commands/tags/create.d.ts +19 -0
- package/dist/commands/tags/create.js +29 -0
- package/dist/commands/tags/delete.d.ts +20 -0
- package/dist/commands/tags/delete.js +16 -0
- package/dist/commands/tags/export.d.ts +15 -0
- package/dist/commands/tags/export.js +27 -0
- package/dist/commands/tags/get.d.ts +20 -0
- package/dist/commands/tags/get.js +16 -0
- package/dist/commands/tags/import.d.ts +16 -0
- package/dist/commands/tags/import.js +29 -0
- package/dist/commands/tags/list.d.ts +18 -0
- package/dist/commands/tags/list.js +27 -0
- package/dist/commands/tags/recipients/add.d.ts +21 -0
- package/dist/commands/tags/recipients/add.js +27 -0
- package/dist/commands/tags/recipients/remove.d.ts +21 -0
- package/dist/commands/tags/recipients/remove.js +27 -0
- package/dist/commands/tags/update.d.ts +25 -0
- package/dist/commands/tags/update.js +30 -0
- package/dist/commands/tags/validate-import.d.ts +15 -0
- package/dist/commands/tags/validate-import.js +21 -0
- package/dist/commands/team/create.d.ts +23 -0
- package/dist/commands/team/create.js +37 -0
- package/dist/commands/team/delete.d.ts +20 -0
- package/dist/commands/team/delete.js +18 -0
- package/dist/commands/team/list.d.ts +14 -0
- package/dist/commands/team/list.js +14 -0
- package/dist/commands/templates/create.d.ts +24 -0
- package/dist/commands/templates/create.js +63 -0
- package/dist/commands/templates/delete.d.ts +20 -0
- package/dist/commands/templates/delete.js +18 -0
- package/dist/commands/templates/export.d.ts +16 -0
- package/dist/commands/templates/export.js +29 -0
- package/dist/commands/templates/import.d.ts +17 -0
- package/dist/commands/templates/import.js +34 -0
- package/dist/commands/templates/update.d.ts +30 -0
- package/dist/commands/templates/update.js +61 -0
- package/dist/commands/templates/validate-import.d.ts +16 -0
- package/dist/commands/templates/validate-import.js +28 -0
- package/dist/commands/tickets/update.d.ts +2 -0
- package/dist/commands/tickets/update.js +14 -0
- package/dist/commands/webhooks/events.d.ts +14 -0
- package/dist/commands/webhooks/events.js +18 -0
- package/dist/commands/webhooks/logs.d.ts +14 -0
- package/dist/commands/webhooks/logs.js +11 -0
- package/dist/commands/webhooks/test.d.ts +17 -0
- package/dist/commands/webhooks/test.js +27 -0
- package/dist/commands/whoami.js +0 -2
- package/dist/crud/csv.js +2 -1
- package/dist/errors/api-error.d.ts +1 -1
- package/dist/errors/exit-codes.js +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +8888 -1922
- package/package.json +38 -5
|
@@ -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 ContactsTagsList extends BaseCommand {
|
|
5
|
+
static description = 'List tags assigned to a contact';
|
|
6
|
+
static args = {
|
|
7
|
+
contactId: Args.integer({
|
|
8
|
+
description: 'Contact ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
...BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(ContactsTagsList);
|
|
17
|
+
this.flags = flags;
|
|
18
|
+
const client = await createCliApiClient(flags);
|
|
19
|
+
const response = await client.get(`/v1/contacts/${args.contactId}/tags`);
|
|
20
|
+
if (!flags.quiet) {
|
|
21
|
+
this.log(this.toFormatted(response));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
2
|
+
export default class ContactsTagsRemove extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
contactId: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
tagId: 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,32 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base-command.js';
|
|
3
|
+
import { createCliApiClient } from '../../../send/api.js';
|
|
4
|
+
export default class ContactsTagsRemove extends BaseCommand {
|
|
5
|
+
static description = 'Remove a tag from a contact';
|
|
6
|
+
static args = {
|
|
7
|
+
contactId: Args.integer({
|
|
8
|
+
description: 'Contact ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
tagId: Args.integer({
|
|
12
|
+
description: 'Tag ID',
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
static flags = {
|
|
17
|
+
...BaseCommand.baseFlags,
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(ContactsTagsRemove);
|
|
21
|
+
this.flags = flags;
|
|
22
|
+
const client = await createCliApiClient(flags);
|
|
23
|
+
await client.delete(`/v1/contacts/${args.contactId}/tags/${args.tagId}`);
|
|
24
|
+
if (!flags.quiet) {
|
|
25
|
+
this.log(this.toFormatted({
|
|
26
|
+
removed: true,
|
|
27
|
+
contactId: args.contactId,
|
|
28
|
+
tagId: args.tagId,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsBulkDelete extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
ids: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { parseNumberList } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class CustomFieldsBulkDelete extends BaseCommand {
|
|
6
|
+
static description = 'Bulk delete custom fields';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
ids: Flags.string({
|
|
10
|
+
description: 'Comma-separated custom field IDs',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(CustomFieldsBulkDelete);
|
|
16
|
+
this.flags = flags;
|
|
17
|
+
const client = await createCliApiClient(flags);
|
|
18
|
+
const response = await client.post('/v1/custom-fields/bulk-delete', {
|
|
19
|
+
ids: parseNumberList(flags.ids, '--ids'),
|
|
20
|
+
});
|
|
21
|
+
if (!flags.quiet)
|
|
22
|
+
this.log(this.toFormatted(response));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
type: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
required: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
default: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
options: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, 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,47 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { parseStringList } from '../../command-helpers/json.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class CustomFieldsCreate extends BaseCommand {
|
|
7
|
+
static description = 'Create a custom field';
|
|
8
|
+
static flags = {
|
|
9
|
+
...BaseCommand.baseFlags,
|
|
10
|
+
name: Flags.string({ description: 'Field name', required: true }),
|
|
11
|
+
key: Flags.string({ description: 'Field key', required: true }),
|
|
12
|
+
type: Flags.string({
|
|
13
|
+
description: 'Field type',
|
|
14
|
+
options: [
|
|
15
|
+
'text',
|
|
16
|
+
'number',
|
|
17
|
+
'date',
|
|
18
|
+
'dropdown',
|
|
19
|
+
'checkbox',
|
|
20
|
+
'url',
|
|
21
|
+
'email',
|
|
22
|
+
'phone',
|
|
23
|
+
],
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
required: Flags.boolean({ description: 'Field is required' }),
|
|
27
|
+
default: Flags.string({ description: 'Default value' }),
|
|
28
|
+
options: Flags.string({ description: 'Comma-separated dropdown options' }),
|
|
29
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
const { flags } = await this.parse(CustomFieldsCreate);
|
|
33
|
+
this.flags = flags;
|
|
34
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
35
|
+
name: flags.name,
|
|
36
|
+
key: flags.key,
|
|
37
|
+
fieldType: flags.type,
|
|
38
|
+
isRequired: flags.required,
|
|
39
|
+
defaultValue: flags.default,
|
|
40
|
+
options: parseStringList(flags.options),
|
|
41
|
+
});
|
|
42
|
+
const client = await createCliApiClient(flags);
|
|
43
|
+
const response = await client.post('/v1/custom-fields', payload);
|
|
44
|
+
if (!flags.quiet)
|
|
45
|
+
this.log(this.toFormatted(response));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsDelete 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
|
+
'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 CustomFieldsDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete custom field';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'custom field ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
10
|
+
async run() {
|
|
11
|
+
const { args, flags } = await this.parse(CustomFieldsDelete);
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
const client = await createCliApiClient(flags);
|
|
14
|
+
await client.delete(`/v1/custom-fields/${args.id}`);
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted({ deleted: true, id: args.id }));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsGet 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
|
+
'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 CustomFieldsGet extends BaseCommand {
|
|
5
|
+
static description = 'Get custom field by ID';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'custom field ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
10
|
+
async run() {
|
|
11
|
+
const { args, flags } = await this.parse(CustomFieldsGet);
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
const client = await createCliApiClient(flags);
|
|
14
|
+
const response = await client.get(`/v1/custom-fields/${args.id}`);
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted(response));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsList 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,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
3
|
+
export default class CustomFieldsList extends BaseCommand {
|
|
4
|
+
static description = 'List custom fields';
|
|
5
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(CustomFieldsList);
|
|
8
|
+
this.flags = flags;
|
|
9
|
+
const client = await createCliApiClient(flags);
|
|
10
|
+
const response = await client.get('/v1/custom-fields');
|
|
11
|
+
if (!flags.quiet)
|
|
12
|
+
this.log(this.toFormatted(response));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsReorder extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
order: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { parseJsonValue } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class CustomFieldsReorder extends BaseCommand {
|
|
6
|
+
static description = 'Reorder custom fields';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
order: Flags.string({
|
|
10
|
+
description: 'Order JSON array payload',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(CustomFieldsReorder);
|
|
16
|
+
this.flags = flags;
|
|
17
|
+
const client = await createCliApiClient(flags);
|
|
18
|
+
const response = await client.put('/v1/custom-fields/reorder', parseJsonValue(flags.order, '--order'));
|
|
19
|
+
if (!flags.quiet)
|
|
20
|
+
this.log(this.toFormatted(response));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class CustomFieldsUpdate 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
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
required: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
status: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
default: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
options: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
};
|
|
26
|
+
run(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { parseStringList } from '../../command-helpers/json.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class CustomFieldsUpdate extends BaseCommand {
|
|
7
|
+
static description = 'Update a custom field';
|
|
8
|
+
static args = {
|
|
9
|
+
id: Args.integer({ description: 'Custom field ID', required: true }),
|
|
10
|
+
};
|
|
11
|
+
static flags = {
|
|
12
|
+
...BaseCommand.baseFlags,
|
|
13
|
+
name: Flags.string({ description: 'Field name' }),
|
|
14
|
+
type: Flags.string({
|
|
15
|
+
description: 'Field type',
|
|
16
|
+
options: [
|
|
17
|
+
'text',
|
|
18
|
+
'number',
|
|
19
|
+
'date',
|
|
20
|
+
'dropdown',
|
|
21
|
+
'checkbox',
|
|
22
|
+
'url',
|
|
23
|
+
'email',
|
|
24
|
+
'phone',
|
|
25
|
+
],
|
|
26
|
+
}),
|
|
27
|
+
required: Flags.boolean({
|
|
28
|
+
description: 'Field is required',
|
|
29
|
+
allowNo: true,
|
|
30
|
+
}),
|
|
31
|
+
status: Flags.boolean({ description: 'Field is active', allowNo: true }),
|
|
32
|
+
default: Flags.string({ description: 'Default value' }),
|
|
33
|
+
options: Flags.string({ description: 'Comma-separated dropdown options' }),
|
|
34
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
35
|
+
};
|
|
36
|
+
async run() {
|
|
37
|
+
const { args, flags } = await this.parse(CustomFieldsUpdate);
|
|
38
|
+
this.flags = flags;
|
|
39
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
40
|
+
name: flags.name,
|
|
41
|
+
fieldType: flags.type,
|
|
42
|
+
isRequired: flags.required,
|
|
43
|
+
status: flags.status,
|
|
44
|
+
defaultValue: flags.default,
|
|
45
|
+
options: parseStringList(flags.options),
|
|
46
|
+
});
|
|
47
|
+
const client = await createCliApiClient(flags);
|
|
48
|
+
const response = await client.put(`/v1/custom-fields/${args.id}`, payload);
|
|
49
|
+
if (!flags.quiet)
|
|
50
|
+
this.log(this.toFormatted(response));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
export default class Doctor 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,56 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
import { createCliApiClient } from '../send/api.js';
|
|
3
|
+
export default class Doctor extends BaseCommand {
|
|
4
|
+
static description = 'Run CLI/API connectivity diagnostics';
|
|
5
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(Doctor);
|
|
8
|
+
this.flags = flags;
|
|
9
|
+
const client = await createCliApiClient(flags);
|
|
10
|
+
const checks = [];
|
|
11
|
+
try {
|
|
12
|
+
checks.push({
|
|
13
|
+
check: 'whoami',
|
|
14
|
+
ok: true,
|
|
15
|
+
detail: await client.get('/v1/users/me'),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
checks.push({
|
|
20
|
+
check: 'whoami',
|
|
21
|
+
ok: false,
|
|
22
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
checks.push({
|
|
27
|
+
check: 'account',
|
|
28
|
+
ok: true,
|
|
29
|
+
detail: await client.get('/v1/account'),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
checks.push({
|
|
34
|
+
check: 'account',
|
|
35
|
+
ok: false,
|
|
36
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
checks.push({
|
|
41
|
+
check: 'channels',
|
|
42
|
+
ok: true,
|
|
43
|
+
detail: await client.get('/v1/channels', { limit: 1 }),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
checks.push({
|
|
48
|
+
check: 'channels',
|
|
49
|
+
ok: false,
|
|
50
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (!flags.quiet)
|
|
54
|
+
this.log(this.toFormatted({ apiUrl: client.getBaseUrl(), checks }));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
export default class Features 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,19 @@
|
|
|
1
|
+
import { BaseCommand } from '../base-command.js';
|
|
2
|
+
import { createCliApiClient } from '../send/api.js';
|
|
3
|
+
export default class Features extends BaseCommand {
|
|
4
|
+
static description = 'Show account plan and feature hints';
|
|
5
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(Features);
|
|
8
|
+
this.flags = flags;
|
|
9
|
+
const client = await createCliApiClient(flags);
|
|
10
|
+
const account = await client.get('/v1/account');
|
|
11
|
+
if (!flags.quiet)
|
|
12
|
+
this.log(this.toFormatted({
|
|
13
|
+
planId: account.planId,
|
|
14
|
+
userGroup: account.userGroup,
|
|
15
|
+
status: account.status,
|
|
16
|
+
note: 'Detailed feature limits are currently exposed through the app API, not the Public API.',
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class MessagesBulkSpam extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
ids: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
spam: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
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,30 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { parseNumberList } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class MessagesBulkSpam extends BaseCommand {
|
|
6
|
+
static description = 'Mark or unmark multiple messages as spam';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
ids: Flags.string({
|
|
10
|
+
description: 'Comma-separated message IDs',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
spam: Flags.boolean({
|
|
14
|
+
description: 'Mark messages as spam',
|
|
15
|
+
default: true,
|
|
16
|
+
allowNo: true,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(MessagesBulkSpam);
|
|
21
|
+
this.flags = flags;
|
|
22
|
+
const client = await createCliApiClient(flags);
|
|
23
|
+
const response = await client.put('/v1/messages/bulk/spam', {
|
|
24
|
+
messageIds: parseNumberList(flags.ids, '--ids'),
|
|
25
|
+
isSpam: flags.spam,
|
|
26
|
+
});
|
|
27
|
+
if (!flags.quiet)
|
|
28
|
+
this.log(this.toFormatted(response));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class MessagesCreateTicket 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
|
+
subject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
priority: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<void>;
|
|
23
|
+
}
|