@instantkom/cli 3.129.2 → 3.131.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/reply.d.ts +22 -0
- package/dist/commands/tickets/reply.js +36 -0
- package/dist/commands/tickets/update.d.ts +2 -0
- package/dist/commands/tickets/update.js +16 -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 +8672 -1602
- package/package.json +38 -5
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { readJsonFile } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TagsValidateImport extends BaseCommand {
|
|
6
|
+
static description = 'Validate tags import JSON';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
file: Flags.string({ description: 'JSON file path', required: true }),
|
|
10
|
+
};
|
|
11
|
+
async run() {
|
|
12
|
+
const { flags } = await this.parse(TagsValidateImport);
|
|
13
|
+
this.flags = flags;
|
|
14
|
+
const input = await readJsonFile(flags.file, '--file');
|
|
15
|
+
const tags = Array.isArray(input) ? input : input.tags;
|
|
16
|
+
const client = await createCliApiClient(flags);
|
|
17
|
+
const response = await client.post('/v1/tags/import/validate', { tags });
|
|
18
|
+
if (!flags.quiet)
|
|
19
|
+
this.log(this.toFormatted(response));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TeamCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
email: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'first-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'last-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
password: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
phone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
company: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
color: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
folder: import("@oclif/core/interfaces").OptionFlag<number | 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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 TeamCreate extends BaseCommand {
|
|
6
|
+
static description = 'Create a team member';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
email: Flags.string({ description: 'Email address', required: true }),
|
|
10
|
+
'first-name': Flags.string({ description: 'First name', required: true }),
|
|
11
|
+
'last-name': Flags.string({ description: 'Last name', required: true }),
|
|
12
|
+
password: Flags.string({ description: 'Initial password', required: true }),
|
|
13
|
+
phone: Flags.string({ description: 'Phone number' }),
|
|
14
|
+
company: Flags.string({ description: 'Company name' }),
|
|
15
|
+
color: Flags.string({ description: 'Color as HEX' }),
|
|
16
|
+
folder: Flags.integer({ description: 'Object folder ID' }),
|
|
17
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(TeamCreate);
|
|
21
|
+
this.flags = flags;
|
|
22
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
23
|
+
email: flags.email,
|
|
24
|
+
firstName: flags['first-name'],
|
|
25
|
+
lastName: flags['last-name'],
|
|
26
|
+
password: flags.password,
|
|
27
|
+
phone: flags.phone,
|
|
28
|
+
company: flags.company,
|
|
29
|
+
color: flags.color,
|
|
30
|
+
folderId: flags.folder,
|
|
31
|
+
});
|
|
32
|
+
const client = await createCliApiClient(flags);
|
|
33
|
+
const response = await client.post('/v1/team', payload);
|
|
34
|
+
if (!flags.quiet)
|
|
35
|
+
this.log(this.toFormatted(response));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TeamDelete 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 TeamDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete a team member';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'Team member ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
10
|
+
async run() {
|
|
11
|
+
const { args, flags } = await this.parse(TeamDelete);
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
const client = await createCliApiClient(flags);
|
|
14
|
+
await client.delete(`/v1/team/${args.id}`);
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted({ deleted: true, id: args.id }));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TeamList 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 TeamList extends BaseCommand {
|
|
4
|
+
static description = 'List team members';
|
|
5
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(TeamList);
|
|
8
|
+
this.flags = flags;
|
|
9
|
+
const client = await createCliApiClient(flags);
|
|
10
|
+
const response = await client.get('/v1/team');
|
|
11
|
+
if (!flags.quiet)
|
|
12
|
+
this.log(this.toFormatted(response));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
name: 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
|
+
message: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
color: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
status: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'whatsapp-language': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
buttons: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'header-footer': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
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,63 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { parseJsonValue } from '../../command-helpers/json.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class TemplatesCreate extends BaseCommand {
|
|
7
|
+
static description = 'Create a message template';
|
|
8
|
+
static flags = {
|
|
9
|
+
...BaseCommand.baseFlags,
|
|
10
|
+
channel: Flags.integer({ description: 'Channel ID', required: true }),
|
|
11
|
+
name: Flags.string({ description: 'Template name', required: true }),
|
|
12
|
+
type: Flags.string({
|
|
13
|
+
description: 'Template type',
|
|
14
|
+
options: [
|
|
15
|
+
'text',
|
|
16
|
+
'image',
|
|
17
|
+
'video',
|
|
18
|
+
'document',
|
|
19
|
+
'audio',
|
|
20
|
+
'location',
|
|
21
|
+
'contact',
|
|
22
|
+
'interactive',
|
|
23
|
+
],
|
|
24
|
+
default: 'text',
|
|
25
|
+
}),
|
|
26
|
+
message: Flags.string({ description: 'Template message', required: true }),
|
|
27
|
+
color: Flags.string({ description: 'Template color as HEX' }),
|
|
28
|
+
status: Flags.boolean({
|
|
29
|
+
description: 'Template is active',
|
|
30
|
+
default: true,
|
|
31
|
+
allowNo: true,
|
|
32
|
+
}),
|
|
33
|
+
'whatsapp-language': Flags.string({
|
|
34
|
+
description: 'WhatsApp template language',
|
|
35
|
+
}),
|
|
36
|
+
buttons: Flags.string({ description: 'Buttons JSON array/object' }),
|
|
37
|
+
'header-footer': Flags.string({ description: 'Header/footer JSON object' }),
|
|
38
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
const { flags } = await this.parse(TemplatesCreate);
|
|
42
|
+
this.flags = flags;
|
|
43
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
44
|
+
channelId: flags.channel,
|
|
45
|
+
name: flags.name,
|
|
46
|
+
type: flags.type,
|
|
47
|
+
message: flags.message,
|
|
48
|
+
color: flags.color,
|
|
49
|
+
status: flags.status,
|
|
50
|
+
whatsappLanguage: flags['whatsapp-language'],
|
|
51
|
+
buttons: flags.buttons
|
|
52
|
+
? parseJsonValue(flags.buttons, '--buttons')
|
|
53
|
+
: undefined,
|
|
54
|
+
headerFooter: flags['header-footer']
|
|
55
|
+
? parseJsonValue(flags['header-footer'], '--header-footer')
|
|
56
|
+
: undefined,
|
|
57
|
+
});
|
|
58
|
+
const client = await createCliApiClient(flags);
|
|
59
|
+
const response = await client.post('/v1/templates', payload);
|
|
60
|
+
if (!flags.quiet)
|
|
61
|
+
this.log(this.toFormatted(response));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesDelete 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 TemplatesDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete template';
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({ description: 'template ID', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
10
|
+
async run() {
|
|
11
|
+
const { args, flags } = await this.parse(TemplatesDelete);
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
const client = await createCliApiClient(flags);
|
|
14
|
+
await client.delete(`/v1/templates/${args.id}`);
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted({ deleted: true, id: args.id }));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesExport extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, 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,29 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { writeDownloadResult } from '../../command-helpers/download.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TemplatesExport extends BaseCommand {
|
|
6
|
+
static description = 'Export templates to a file';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
file: Flags.string({ description: 'Output file path', required: true }),
|
|
10
|
+
format: Flags.string({
|
|
11
|
+
description: 'Export format',
|
|
12
|
+
options: ['csv', 'json'],
|
|
13
|
+
default: 'json',
|
|
14
|
+
}),
|
|
15
|
+
channel: Flags.integer({ description: 'Filter by channel ID' }),
|
|
16
|
+
};
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(TemplatesExport);
|
|
19
|
+
this.flags = flags;
|
|
20
|
+
const client = await createCliApiClient(flags);
|
|
21
|
+
const result = await client.getBinary('/v1/templates/export/download', {
|
|
22
|
+
format: flags.format,
|
|
23
|
+
channelId: flags.channel,
|
|
24
|
+
});
|
|
25
|
+
const output = await writeDownloadResult(flags.file, result);
|
|
26
|
+
if (!flags.quiet)
|
|
27
|
+
this.log(this.toFormatted(output));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesImport extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'skip-duplicates': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
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,34 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { readJsonFile } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TemplatesImport extends BaseCommand {
|
|
6
|
+
static description = 'Import templates from JSON';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
file: Flags.string({ description: 'JSON file path', required: true }),
|
|
10
|
+
channel: Flags.integer({
|
|
11
|
+
description: 'Target channel ID',
|
|
12
|
+
required: true,
|
|
13
|
+
}),
|
|
14
|
+
'skip-duplicates': Flags.boolean({
|
|
15
|
+
description: 'Skip duplicate templates',
|
|
16
|
+
default: true,
|
|
17
|
+
allowNo: true,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
const { flags } = await this.parse(TemplatesImport);
|
|
22
|
+
this.flags = flags;
|
|
23
|
+
const input = await readJsonFile(flags.file, '--file');
|
|
24
|
+
const templates = Array.isArray(input) ? input : input.templates;
|
|
25
|
+
const client = await createCliApiClient(flags);
|
|
26
|
+
const response = await client.post('/v1/templates/import', {
|
|
27
|
+
templates,
|
|
28
|
+
channelId: flags.channel,
|
|
29
|
+
skipDuplicates: flags['skip-duplicates'],
|
|
30
|
+
});
|
|
31
|
+
if (!flags.quiet)
|
|
32
|
+
this.log(this.toFormatted(response));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesUpdate 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
|
+
message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
color: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
status: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
'remove-media': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
'whatsapp-language': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
buttons: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'header-footer': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
};
|
|
29
|
+
run(): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { parseJsonValue } from '../../command-helpers/json.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class TemplatesUpdate extends BaseCommand {
|
|
7
|
+
static description = 'Update a message template';
|
|
8
|
+
static args = {
|
|
9
|
+
id: Args.integer({ description: 'Template ID', required: true }),
|
|
10
|
+
};
|
|
11
|
+
static flags = {
|
|
12
|
+
...BaseCommand.baseFlags,
|
|
13
|
+
name: Flags.string({ description: 'Template name' }),
|
|
14
|
+
type: Flags.string({
|
|
15
|
+
description: 'Template type',
|
|
16
|
+
options: [
|
|
17
|
+
'text',
|
|
18
|
+
'image',
|
|
19
|
+
'video',
|
|
20
|
+
'document',
|
|
21
|
+
'audio',
|
|
22
|
+
'location',
|
|
23
|
+
'contact',
|
|
24
|
+
'interactive',
|
|
25
|
+
],
|
|
26
|
+
}),
|
|
27
|
+
message: Flags.string({ description: 'Template message' }),
|
|
28
|
+
color: Flags.string({ description: 'Template color as HEX' }),
|
|
29
|
+
status: Flags.boolean({ description: 'Template is active', allowNo: true }),
|
|
30
|
+
'remove-media': Flags.boolean({ description: 'Remove existing media' }),
|
|
31
|
+
'whatsapp-language': Flags.string({
|
|
32
|
+
description: 'WhatsApp template language',
|
|
33
|
+
}),
|
|
34
|
+
buttons: Flags.string({ description: 'Buttons JSON array/object' }),
|
|
35
|
+
'header-footer': Flags.string({ description: 'Header/footer JSON object' }),
|
|
36
|
+
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
37
|
+
};
|
|
38
|
+
async run() {
|
|
39
|
+
const { args, flags } = await this.parse(TemplatesUpdate);
|
|
40
|
+
this.flags = flags;
|
|
41
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
42
|
+
name: flags.name,
|
|
43
|
+
type: flags.type,
|
|
44
|
+
message: flags.message,
|
|
45
|
+
color: flags.color,
|
|
46
|
+
status: flags.status,
|
|
47
|
+
removeMedia: flags['remove-media'],
|
|
48
|
+
whatsappLanguage: flags['whatsapp-language'],
|
|
49
|
+
buttons: flags.buttons
|
|
50
|
+
? parseJsonValue(flags.buttons, '--buttons')
|
|
51
|
+
: undefined,
|
|
52
|
+
headerFooter: flags['header-footer']
|
|
53
|
+
? parseJsonValue(flags['header-footer'], '--header-footer')
|
|
54
|
+
: undefined,
|
|
55
|
+
});
|
|
56
|
+
const client = await createCliApiClient(flags);
|
|
57
|
+
const response = await client.put(`/v1/templates/${args.id}`, payload);
|
|
58
|
+
if (!flags.quiet)
|
|
59
|
+
this.log(this.toFormatted(response));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TemplatesValidateImport extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number, 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,28 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { readJsonFile } from '../../command-helpers/json.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class TemplatesValidateImport extends BaseCommand {
|
|
6
|
+
static description = 'Validate templates import JSON';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
file: Flags.string({ description: 'JSON file path', required: true }),
|
|
10
|
+
channel: Flags.integer({
|
|
11
|
+
description: 'Target channel ID',
|
|
12
|
+
required: true,
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(TemplatesValidateImport);
|
|
17
|
+
this.flags = flags;
|
|
18
|
+
const input = await readJsonFile(flags.file, '--file');
|
|
19
|
+
const templates = Array.isArray(input) ? input : input.templates;
|
|
20
|
+
const client = await createCliApiClient(flags);
|
|
21
|
+
const response = await client.post('/v1/templates/import/validate', {
|
|
22
|
+
templates,
|
|
23
|
+
channelId: flags.channel,
|
|
24
|
+
});
|
|
25
|
+
if (!flags.quiet)
|
|
26
|
+
this.log(this.toFormatted(response));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class TicketsReply 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
|
+
message: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
close: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
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,36 @@
|
|
|
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 TicketsReply extends BaseCommand {
|
|
5
|
+
static description = 'Send a real support reply on a ticket. Delivers the message to the ' +
|
|
6
|
+
'customer and records it in both the ticket history and the ' +
|
|
7
|
+
'Nachrichtenprotokoll. Provide raw body text only -- the ticket system ' +
|
|
8
|
+
'auto-prepends the personalised salutation and auto-appends the localised ' +
|
|
9
|
+
'footer for email-channel tickets. Adding your own greetings causes ' +
|
|
10
|
+
'duplicated headers/footers.';
|
|
11
|
+
static args = {
|
|
12
|
+
id: Args.integer({ description: 'Ticket ID', required: true }),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
...BaseCommand.baseFlags,
|
|
16
|
+
message: Flags.string({
|
|
17
|
+
description: 'Reply body (raw text, no salutation or sign-off)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
close: Flags.boolean({
|
|
21
|
+
description: 'Close the ticket after sending the reply',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { args, flags } = await this.parse(TicketsReply);
|
|
27
|
+
this.flags = flags;
|
|
28
|
+
const payload = { message: flags.message };
|
|
29
|
+
if (flags.close)
|
|
30
|
+
payload.close = true;
|
|
31
|
+
const client = await createCliApiClient(flags);
|
|
32
|
+
const reply = await client.post(`/v1/tickets/${args.id}/reply`, payload);
|
|
33
|
+
if (!flags.quiet)
|
|
34
|
+
this.log(this.toFormatted(reply));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -12,6 +12,8 @@ export default class TicketsUpdate extends BaseCommand {
|
|
|
12
12
|
subject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
13
|
priority: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
14
|
status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'assigned-to': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
notify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
17
|
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
19
|
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -13,6 +13,18 @@ export default class TicketsUpdate extends BaseCommand {
|
|
|
13
13
|
subject: Flags.string({ description: 'Ticket subject' }),
|
|
14
14
|
priority: Flags.string({ description: 'Ticket priority' }),
|
|
15
15
|
status: Flags.string({ description: 'Ticket status' }),
|
|
16
|
+
'assigned-to': Flags.integer({
|
|
17
|
+
description: 'User ID to assign the ticket to (use -1 or omit to leave unchanged)',
|
|
18
|
+
}),
|
|
19
|
+
notify: Flags.boolean({
|
|
20
|
+
description: 'Trigger the legacy notification chain for transitions that have one. ' +
|
|
21
|
+
'On --assigned-to change: fires TICKET_ASSIGN (assignee email plus ' +
|
|
22
|
+
'optional customer reply via tickets_assign_reply_sts). On --status closed ' +
|
|
23
|
+
'transition: fires TICKET_CLOSE (optional customer reply via ' +
|
|
24
|
+
'tickets_close_reply_sts). Defaults to true. Use --no-notify for silent updates.',
|
|
25
|
+
allowNo: true,
|
|
26
|
+
default: true,
|
|
27
|
+
}),
|
|
16
28
|
data: Flags.string({ description: 'Additional JSON object payload' }),
|
|
17
29
|
};
|
|
18
30
|
async run() {
|
|
@@ -22,6 +34,10 @@ export default class TicketsUpdate extends BaseCommand {
|
|
|
22
34
|
subject: flags.subject,
|
|
23
35
|
priority: flags.priority,
|
|
24
36
|
status: flags.status,
|
|
37
|
+
assignedTo: flags['assigned-to'],
|
|
38
|
+
// Only send `notify=false`; the API default is already true so we
|
|
39
|
+
// skip the field when the user did not opt out.
|
|
40
|
+
notify: flags.notify ? undefined : false,
|
|
25
41
|
});
|
|
26
42
|
const client = await createCliApiClient(flags);
|
|
27
43
|
const ticket = await client.put(`/v1/channels/${flags.channel}/tickets/${args.id}`, payload);
|