@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,50 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { writeFile } from 'node:fs/promises';
|
|
3
|
+
import { BaseCommand } from '../../base-command.js';
|
|
4
|
+
import { cleanQuery } from '../../crud/data.js';
|
|
5
|
+
import { serializeCsv } from '../../crud/csv.js';
|
|
6
|
+
import { listResource } from '../../crud/request.js';
|
|
7
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
8
|
+
export default class ContactsExport extends BaseCommand {
|
|
9
|
+
static description = 'Export contacts to CSV';
|
|
10
|
+
static flags = {
|
|
11
|
+
...BaseCommand.baseFlags,
|
|
12
|
+
file: Flags.string({
|
|
13
|
+
description: 'CSV output file path',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
channel: Flags.integer({
|
|
17
|
+
description: 'Filter by channel ID',
|
|
18
|
+
}),
|
|
19
|
+
search: Flags.string({
|
|
20
|
+
description: 'Search by name or identifier',
|
|
21
|
+
}),
|
|
22
|
+
page: Flags.integer({
|
|
23
|
+
description: 'Page number',
|
|
24
|
+
default: 1,
|
|
25
|
+
}),
|
|
26
|
+
limit: Flags.integer({
|
|
27
|
+
description: 'Items per page',
|
|
28
|
+
default: 100,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
const { flags } = await this.parse(ContactsExport);
|
|
33
|
+
this.flags = flags;
|
|
34
|
+
const client = await createCliApiClient(flags);
|
|
35
|
+
const response = await listResource(client, '/v1/contacts', cleanQuery({
|
|
36
|
+
channelId: flags.channel,
|
|
37
|
+
search: flags.search,
|
|
38
|
+
page: flags.page,
|
|
39
|
+
limit: flags.limit,
|
|
40
|
+
}));
|
|
41
|
+
const contacts = Array.isArray(response) ? response : response.data ?? [];
|
|
42
|
+
await writeFile(flags.file, serializeCsv(contacts), 'utf8');
|
|
43
|
+
if (!flags.quiet) {
|
|
44
|
+
this.log(this.toFormatted({
|
|
45
|
+
exported: contacts.length,
|
|
46
|
+
file: flags.file,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ContactsGet 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,25 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { getResource } from '../../crud/request.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class ContactsGet extends BaseCommand {
|
|
6
|
+
static description = 'Get a contact by ID';
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({
|
|
9
|
+
description: 'Contact ID',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
...BaseCommand.baseFlags,
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(ContactsGet);
|
|
18
|
+
this.flags = flags;
|
|
19
|
+
const client = await createCliApiClient(flags);
|
|
20
|
+
const contact = await getResource(client, '/v1/contacts', args.id);
|
|
21
|
+
if (!flags.quiet) {
|
|
22
|
+
this.log(this.toFormatted(contact));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ContactsImport 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,62 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { BaseCommand } from '../../base-command.js';
|
|
4
|
+
import { ApiError } from '../../errors/api-error.js';
|
|
5
|
+
import { parseCsv } from '../../crud/csv.js';
|
|
6
|
+
import { createResource } from '../../crud/request.js';
|
|
7
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
8
|
+
export default class ContactsImport extends BaseCommand {
|
|
9
|
+
static description = 'Import contacts from CSV';
|
|
10
|
+
static flags = {
|
|
11
|
+
...BaseCommand.baseFlags,
|
|
12
|
+
file: Flags.string({
|
|
13
|
+
description: 'CSV file path',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
channel: Flags.integer({
|
|
17
|
+
description: 'Channel ID',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { flags } = await this.parse(ContactsImport);
|
|
23
|
+
this.flags = flags;
|
|
24
|
+
const csv = await readFile(flags.file, 'utf8');
|
|
25
|
+
const rows = parseCsv(csv);
|
|
26
|
+
const client = await createCliApiClient(flags);
|
|
27
|
+
const failures = [];
|
|
28
|
+
let created = 0;
|
|
29
|
+
for (const row of rows) {
|
|
30
|
+
const identifier = row.values.identifier || row.values.to;
|
|
31
|
+
if (!identifier) {
|
|
32
|
+
failures.push({ rowNumber: row.rowNumber, message: 'Missing identifier or to column' });
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const { to: _to, ...values } = row.values;
|
|
37
|
+
await createResource(client, '/v1/contacts', {
|
|
38
|
+
...values,
|
|
39
|
+
channelId: flags.channel,
|
|
40
|
+
identifier,
|
|
41
|
+
});
|
|
42
|
+
created += 1;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
failures.push({
|
|
46
|
+
rowNumber: row.rowNumber,
|
|
47
|
+
message: error instanceof Error ? error.message : String(error),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (created === 0 && failures.length > 0) {
|
|
52
|
+
throw new ApiError('user_error', `No contacts imported: ${failures[0]?.message ?? 'unknown error'}`);
|
|
53
|
+
}
|
|
54
|
+
if (!flags.quiet) {
|
|
55
|
+
this.log(this.toFormatted({
|
|
56
|
+
created,
|
|
57
|
+
failed: failures.length,
|
|
58
|
+
failures,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ContactsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
channel: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'optin-status': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
blocked: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
segment: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
tags: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'tag-match': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
spam: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'trust-level': 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,71 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { cleanQuery } from '../../crud/data.js';
|
|
4
|
+
import { listResource } from '../../crud/request.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class ContactsList extends BaseCommand {
|
|
7
|
+
static description = 'List contacts';
|
|
8
|
+
static flags = {
|
|
9
|
+
...BaseCommand.baseFlags,
|
|
10
|
+
channel: Flags.integer({
|
|
11
|
+
description: 'Filter by channel ID',
|
|
12
|
+
}),
|
|
13
|
+
search: Flags.string({
|
|
14
|
+
description: 'Search by name or identifier',
|
|
15
|
+
}),
|
|
16
|
+
page: Flags.integer({
|
|
17
|
+
description: 'Page number',
|
|
18
|
+
default: 1,
|
|
19
|
+
}),
|
|
20
|
+
limit: Flags.integer({
|
|
21
|
+
description: 'Items per page',
|
|
22
|
+
default: 20,
|
|
23
|
+
}),
|
|
24
|
+
'optin-status': Flags.integer({
|
|
25
|
+
description: 'Filter by opt-in status',
|
|
26
|
+
options: ['0', '1'],
|
|
27
|
+
}),
|
|
28
|
+
blocked: Flags.integer({
|
|
29
|
+
description: 'Filter by blocked status: 1 blocked, 0 not blocked',
|
|
30
|
+
options: ['0', '1'],
|
|
31
|
+
}),
|
|
32
|
+
segment: Flags.integer({
|
|
33
|
+
description: 'Filter by segment ID',
|
|
34
|
+
}),
|
|
35
|
+
tags: Flags.string({
|
|
36
|
+
description: 'Comma-separated tag IDs',
|
|
37
|
+
}),
|
|
38
|
+
'tag-match': Flags.string({
|
|
39
|
+
description: 'Tag match mode',
|
|
40
|
+
options: ['any', 'all'],
|
|
41
|
+
}),
|
|
42
|
+
spam: Flags.string({
|
|
43
|
+
description: 'Filter by spam status',
|
|
44
|
+
options: ['true', 'false'],
|
|
45
|
+
}),
|
|
46
|
+
'trust-level': Flags.string({
|
|
47
|
+
description: 'Comma-separated trust levels',
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
async run() {
|
|
51
|
+
const { flags } = await this.parse(ContactsList);
|
|
52
|
+
this.flags = flags;
|
|
53
|
+
const client = await createCliApiClient(flags);
|
|
54
|
+
const contacts = await listResource(client, '/v1/contacts', cleanQuery({
|
|
55
|
+
channelId: flags.channel,
|
|
56
|
+
search: flags.search,
|
|
57
|
+
page: flags.page,
|
|
58
|
+
limit: flags.limit,
|
|
59
|
+
optinStatus: flags['optin-status'],
|
|
60
|
+
isBlocked: flags.blocked,
|
|
61
|
+
segmentId: flags.segment,
|
|
62
|
+
tagIds: flags.tags,
|
|
63
|
+
tagMatchMode: flags['tag-match'],
|
|
64
|
+
spam: flags.spam,
|
|
65
|
+
trustLevel: flags['trust-level'],
|
|
66
|
+
}));
|
|
67
|
+
if (!flags.quiet) {
|
|
68
|
+
this.log(this.toFormatted(contacts));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ContactsUpdate 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
|
+
identifier: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
name: 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
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
4
|
+
import { updateResource } from '../../crud/request.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class ContactsUpdate extends BaseCommand {
|
|
7
|
+
static description = 'Update a contact';
|
|
8
|
+
static args = {
|
|
9
|
+
id: Args.integer({
|
|
10
|
+
description: 'Contact ID',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
...BaseCommand.baseFlags,
|
|
16
|
+
identifier: Flags.string({
|
|
17
|
+
description: 'Unique contact identifier',
|
|
18
|
+
}),
|
|
19
|
+
name: Flags.string({
|
|
20
|
+
description: 'Contact name',
|
|
21
|
+
}),
|
|
22
|
+
data: Flags.string({
|
|
23
|
+
description: 'Additional JSON object payload',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { args, flags } = await this.parse(ContactsUpdate);
|
|
28
|
+
this.flags = flags;
|
|
29
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
30
|
+
identifier: flags.identifier,
|
|
31
|
+
name: flags.name,
|
|
32
|
+
});
|
|
33
|
+
const client = await createCliApiClient(flags);
|
|
34
|
+
const contact = await updateResource(client, '/v1/contacts', args.id, payload);
|
|
35
|
+
if (!flags.quiet) {
|
|
36
|
+
this.log(this.toFormatted(contact));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ExportsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
sources: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
channels: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
filters: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
color: 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
|
+
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,69 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { ApiError } from '../../errors/api-error.js';
|
|
4
|
+
import { mergeData, parseDataFlag } from '../../crud/data.js';
|
|
5
|
+
import { createResource } from '../../crud/request.js';
|
|
6
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
7
|
+
export default class ExportsCreate extends BaseCommand {
|
|
8
|
+
static description = 'Create an export';
|
|
9
|
+
static flags = {
|
|
10
|
+
...BaseCommand.baseFlags,
|
|
11
|
+
name: Flags.string({
|
|
12
|
+
description: 'Export name',
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
sources: Flags.string({
|
|
16
|
+
description: 'Data sources to export',
|
|
17
|
+
}),
|
|
18
|
+
type: Flags.string({
|
|
19
|
+
description: 'Alias for --sources',
|
|
20
|
+
}),
|
|
21
|
+
target: Flags.string({
|
|
22
|
+
description: 'Export target/format',
|
|
23
|
+
}),
|
|
24
|
+
format: Flags.string({
|
|
25
|
+
description: 'Alias for --target',
|
|
26
|
+
}),
|
|
27
|
+
channels: Flags.string({
|
|
28
|
+
description: 'Comma-separated channel IDs',
|
|
29
|
+
}),
|
|
30
|
+
fields: Flags.string({
|
|
31
|
+
description: 'Comma-separated fields',
|
|
32
|
+
}),
|
|
33
|
+
filters: Flags.string({
|
|
34
|
+
description: 'Filter criteria',
|
|
35
|
+
}),
|
|
36
|
+
color: Flags.string({
|
|
37
|
+
description: 'Export color as HEX',
|
|
38
|
+
}),
|
|
39
|
+
data: Flags.string({
|
|
40
|
+
description: 'Additional JSON object payload',
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
async run() {
|
|
44
|
+
const { flags } = await this.parse(ExportsCreate);
|
|
45
|
+
this.flags = flags;
|
|
46
|
+
const sources = flags.sources ?? flags.type;
|
|
47
|
+
const target = flags.target ?? flags.format;
|
|
48
|
+
if (!sources) {
|
|
49
|
+
throw new ApiError('user_error', 'Either --sources or --type is required');
|
|
50
|
+
}
|
|
51
|
+
if (!target) {
|
|
52
|
+
throw new ApiError('user_error', 'Either --target or --format is required');
|
|
53
|
+
}
|
|
54
|
+
const payload = mergeData(parseDataFlag(flags.data), {
|
|
55
|
+
name: flags.name,
|
|
56
|
+
sources,
|
|
57
|
+
target,
|
|
58
|
+
channels: flags.channels,
|
|
59
|
+
fields: flags.fields,
|
|
60
|
+
filters: flags.filters,
|
|
61
|
+
color: flags.color,
|
|
62
|
+
});
|
|
63
|
+
const client = await createCliApiClient(flags);
|
|
64
|
+
const exportConfig = await createResource(client, '/v1/exports', payload);
|
|
65
|
+
if (!flags.quiet) {
|
|
66
|
+
this.log(this.toFormatted(exportConfig));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ExportsDelete 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,25 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { deleteResource } from '../../crud/request.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class ExportsDelete extends BaseCommand {
|
|
6
|
+
static description = 'Delete an export';
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({
|
|
9
|
+
description: 'Export ID',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
...BaseCommand.baseFlags,
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(ExportsDelete);
|
|
18
|
+
this.flags = flags;
|
|
19
|
+
const client = await createCliApiClient(flags);
|
|
20
|
+
await deleteResource(client, '/v1/exports', args.id);
|
|
21
|
+
if (!flags.quiet) {
|
|
22
|
+
this.log(this.toFormatted({ deleted: true, id: args.id }));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ExportsDownload 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
|
+
file: 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,37 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { writeFile } from 'node:fs/promises';
|
|
3
|
+
import { BaseCommand } from '../../base-command.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class ExportsDownload extends BaseCommand {
|
|
6
|
+
static description = 'Download an export file';
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({
|
|
9
|
+
description: 'Export ID',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
...BaseCommand.baseFlags,
|
|
15
|
+
file: Flags.string({
|
|
16
|
+
description: 'Output file path',
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(ExportsDownload);
|
|
21
|
+
this.flags = flags;
|
|
22
|
+
const client = await createCliApiClient(flags);
|
|
23
|
+
const result = await client.getBinary(`/v1/exports/${args.id}/download`);
|
|
24
|
+
if (flags.file) {
|
|
25
|
+
await writeFile(flags.file, result.buffer);
|
|
26
|
+
}
|
|
27
|
+
if (!flags.quiet) {
|
|
28
|
+
this.log(this.toFormatted({
|
|
29
|
+
id: args.id,
|
|
30
|
+
bytes: result.buffer.byteLength,
|
|
31
|
+
contentType: result.contentType,
|
|
32
|
+
contentDisposition: result.contentDisposition,
|
|
33
|
+
file: flags.file,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ExportsGet 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,25 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { getResource } from '../../crud/request.js';
|
|
4
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
5
|
+
export default class ExportsGet extends BaseCommand {
|
|
6
|
+
static description = 'Get an export by ID';
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({
|
|
9
|
+
description: 'Export ID',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
...BaseCommand.baseFlags,
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(ExportsGet);
|
|
18
|
+
this.flags = flags;
|
|
19
|
+
const client = await createCliApiClient(flags);
|
|
20
|
+
const exportConfig = await getResource(client, '/v1/exports', args.id);
|
|
21
|
+
if (!flags.quiet) {
|
|
22
|
+
this.log(this.toFormatted(exportConfig));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class ExportsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
page: 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
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { cleanQuery } from '../../crud/data.js';
|
|
4
|
+
import { listResource } from '../../crud/request.js';
|
|
5
|
+
import { createCliApiClient } from '../../send/api.js';
|
|
6
|
+
export default class ExportsList extends BaseCommand {
|
|
7
|
+
static description = 'List exports';
|
|
8
|
+
static flags = {
|
|
9
|
+
...BaseCommand.baseFlags,
|
|
10
|
+
page: Flags.integer({
|
|
11
|
+
description: 'Page number',
|
|
12
|
+
default: 1,
|
|
13
|
+
}),
|
|
14
|
+
limit: Flags.integer({
|
|
15
|
+
description: 'Items per page',
|
|
16
|
+
default: 50,
|
|
17
|
+
}),
|
|
18
|
+
source: Flags.string({
|
|
19
|
+
description: 'Filter by data source',
|
|
20
|
+
}),
|
|
21
|
+
target: Flags.string({
|
|
22
|
+
description: 'Filter by export target/format',
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { flags } = await this.parse(ExportsList);
|
|
27
|
+
this.flags = flags;
|
|
28
|
+
const client = await createCliApiClient(flags);
|
|
29
|
+
const exports = await listResource(client, '/v1/exports', cleanQuery({
|
|
30
|
+
page: flags.page,
|
|
31
|
+
limit: flags.limit,
|
|
32
|
+
source: flags.source,
|
|
33
|
+
target: flags.target,
|
|
34
|
+
}));
|
|
35
|
+
if (!flags.quiet) {
|
|
36
|
+
this.log(this.toFormatted(exports));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|