@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.
Files changed (160) hide show
  1. package/README.md +29 -0
  2. package/bin/run.js +0 -0
  3. package/dist/api-client.js +28 -5
  4. package/dist/command-helpers/download.d.ts +10 -0
  5. package/dist/command-helpers/download.js +10 -0
  6. package/dist/command-helpers/json.d.ts +4 -0
  7. package/dist/command-helpers/json.js +37 -0
  8. package/dist/commands/account/get.d.ts +14 -0
  9. package/dist/commands/account/get.js +14 -0
  10. package/dist/commands/account/update.d.ts +23 -0
  11. package/dist/commands/account/update.js +37 -0
  12. package/dist/commands/auth/login.js +0 -2
  13. package/dist/commands/auth/logout.js +0 -2
  14. package/dist/commands/auth/tokens/create.js +0 -2
  15. package/dist/commands/auth/tokens/list.js +0 -2
  16. package/dist/commands/auth/tokens/revoke.js +0 -2
  17. package/dist/commands/bots/env-vars/create.d.ts +1 -1
  18. package/dist/commands/bots/env-vars/create.js +18 -11
  19. package/dist/commands/bots/filters/create.d.ts +5 -5
  20. package/dist/commands/bots/filters/create.js +33 -18
  21. package/dist/commands/broadcast/delete.d.ts +20 -0
  22. package/dist/commands/broadcast/delete.js +18 -0
  23. package/dist/commands/broadcast/get.d.ts +20 -0
  24. package/dist/commands/broadcast/get.js +18 -0
  25. package/dist/commands/broadcast/list.d.ts +21 -0
  26. package/dist/commands/broadcast/list.js +39 -0
  27. package/dist/commands/broadcast/send.d.ts +20 -0
  28. package/dist/commands/broadcast/send.js +18 -0
  29. package/dist/commands/broadcast/status.d.ts +20 -0
  30. package/dist/commands/broadcast/status.js +31 -0
  31. package/dist/commands/broadcast/update.d.ts +30 -0
  32. package/dist/commands/broadcast/update.js +47 -0
  33. package/dist/commands/chats/get.d.ts +20 -0
  34. package/dist/commands/chats/get.js +18 -0
  35. package/dist/commands/chats/list.d.ts +22 -0
  36. package/dist/commands/chats/list.js +40 -0
  37. package/dist/commands/config/get.js +0 -2
  38. package/dist/commands/config/set.js +0 -2
  39. package/dist/commands/config/unset.js +0 -2
  40. package/dist/commands/contacts/custom-fields/delete-value.d.ts +24 -0
  41. package/dist/commands/contacts/custom-fields/delete-value.js +32 -0
  42. package/dist/commands/contacts/custom-fields/list.d.ts +20 -0
  43. package/dist/commands/contacts/custom-fields/list.js +24 -0
  44. package/dist/commands/contacts/custom-fields/set-value.d.ts +25 -0
  45. package/dist/commands/contacts/custom-fields/set-value.js +32 -0
  46. package/dist/commands/contacts/custom-fields/set.d.ts +23 -0
  47. package/dist/commands/contacts/custom-fields/set.js +42 -0
  48. package/dist/commands/contacts/tags/add.d.ts +24 -0
  49. package/dist/commands/contacts/tags/add.js +30 -0
  50. package/dist/commands/contacts/tags/list.d.ts +20 -0
  51. package/dist/commands/contacts/tags/list.js +24 -0
  52. package/dist/commands/contacts/tags/remove.d.ts +24 -0
  53. package/dist/commands/contacts/tags/remove.js +32 -0
  54. package/dist/commands/custom-fields/bulk-delete.d.ts +15 -0
  55. package/dist/commands/custom-fields/bulk-delete.js +24 -0
  56. package/dist/commands/custom-fields/create.d.ts +21 -0
  57. package/dist/commands/custom-fields/create.js +47 -0
  58. package/dist/commands/custom-fields/delete.d.ts +20 -0
  59. package/dist/commands/custom-fields/delete.js +18 -0
  60. package/dist/commands/custom-fields/get.d.ts +20 -0
  61. package/dist/commands/custom-fields/get.js +18 -0
  62. package/dist/commands/custom-fields/list.d.ts +14 -0
  63. package/dist/commands/custom-fields/list.js +14 -0
  64. package/dist/commands/custom-fields/reorder.d.ts +15 -0
  65. package/dist/commands/custom-fields/reorder.js +22 -0
  66. package/dist/commands/custom-fields/update.d.ts +27 -0
  67. package/dist/commands/custom-fields/update.js +52 -0
  68. package/dist/commands/doctor.d.ts +14 -0
  69. package/dist/commands/doctor.js +56 -0
  70. package/dist/commands/features.d.ts +14 -0
  71. package/dist/commands/features.js +19 -0
  72. package/dist/commands/messages/bulk-spam.d.ts +16 -0
  73. package/dist/commands/messages/bulk-spam.js +30 -0
  74. package/dist/commands/messages/create-ticket.d.ts +23 -0
  75. package/dist/commands/messages/create-ticket.js +28 -0
  76. package/dist/commands/messages/delete.d.ts +20 -0
  77. package/dist/commands/messages/delete.js +18 -0
  78. package/dist/commands/messages/get.d.ts +20 -0
  79. package/dist/commands/messages/get.js +18 -0
  80. package/dist/commands/messages/list.d.ts +22 -0
  81. package/dist/commands/messages/list.js +35 -0
  82. package/dist/commands/messages/reactions.d.ts +20 -0
  83. package/dist/commands/messages/reactions.js +18 -0
  84. package/dist/commands/messages/spam.d.ts +21 -0
  85. package/dist/commands/messages/spam.js +27 -0
  86. package/dist/commands/messages/unread-count.d.ts +14 -0
  87. package/dist/commands/messages/unread-count.js +14 -0
  88. package/dist/commands/messages/update.d.ts +27 -0
  89. package/dist/commands/messages/update.js +43 -0
  90. package/dist/commands/permissions.d.ts +14 -0
  91. package/dist/commands/permissions.js +14 -0
  92. package/dist/commands/segments/create.d.ts +21 -0
  93. package/dist/commands/segments/create.js +33 -0
  94. package/dist/commands/segments/delete.d.ts +20 -0
  95. package/dist/commands/segments/delete.js +18 -0
  96. package/dist/commands/segments/get.d.ts +20 -0
  97. package/dist/commands/segments/get.js +18 -0
  98. package/dist/commands/segments/list.d.ts +20 -0
  99. package/dist/commands/segments/list.js +34 -0
  100. package/dist/commands/segments/tags/add.d.ts +24 -0
  101. package/dist/commands/segments/tags/add.js +21 -0
  102. package/dist/commands/segments/tags/list.d.ts +20 -0
  103. package/dist/commands/segments/tags/list.js +18 -0
  104. package/dist/commands/segments/tags/remove.d.ts +24 -0
  105. package/dist/commands/segments/tags/remove.js +23 -0
  106. package/dist/commands/segments/update.d.ts +26 -0
  107. package/dist/commands/segments/update.js +34 -0
  108. package/dist/commands/tags/create.d.ts +19 -0
  109. package/dist/commands/tags/create.js +29 -0
  110. package/dist/commands/tags/delete.d.ts +20 -0
  111. package/dist/commands/tags/delete.js +16 -0
  112. package/dist/commands/tags/export.d.ts +15 -0
  113. package/dist/commands/tags/export.js +27 -0
  114. package/dist/commands/tags/get.d.ts +20 -0
  115. package/dist/commands/tags/get.js +16 -0
  116. package/dist/commands/tags/import.d.ts +16 -0
  117. package/dist/commands/tags/import.js +29 -0
  118. package/dist/commands/tags/list.d.ts +18 -0
  119. package/dist/commands/tags/list.js +27 -0
  120. package/dist/commands/tags/recipients/add.d.ts +21 -0
  121. package/dist/commands/tags/recipients/add.js +27 -0
  122. package/dist/commands/tags/recipients/remove.d.ts +21 -0
  123. package/dist/commands/tags/recipients/remove.js +27 -0
  124. package/dist/commands/tags/update.d.ts +25 -0
  125. package/dist/commands/tags/update.js +30 -0
  126. package/dist/commands/tags/validate-import.d.ts +15 -0
  127. package/dist/commands/tags/validate-import.js +21 -0
  128. package/dist/commands/team/create.d.ts +23 -0
  129. package/dist/commands/team/create.js +37 -0
  130. package/dist/commands/team/delete.d.ts +20 -0
  131. package/dist/commands/team/delete.js +18 -0
  132. package/dist/commands/team/list.d.ts +14 -0
  133. package/dist/commands/team/list.js +14 -0
  134. package/dist/commands/templates/create.d.ts +24 -0
  135. package/dist/commands/templates/create.js +63 -0
  136. package/dist/commands/templates/delete.d.ts +20 -0
  137. package/dist/commands/templates/delete.js +18 -0
  138. package/dist/commands/templates/export.d.ts +16 -0
  139. package/dist/commands/templates/export.js +29 -0
  140. package/dist/commands/templates/import.d.ts +17 -0
  141. package/dist/commands/templates/import.js +34 -0
  142. package/dist/commands/templates/update.d.ts +30 -0
  143. package/dist/commands/templates/update.js +61 -0
  144. package/dist/commands/templates/validate-import.d.ts +16 -0
  145. package/dist/commands/templates/validate-import.js +28 -0
  146. package/dist/commands/tickets/update.d.ts +2 -0
  147. package/dist/commands/tickets/update.js +14 -0
  148. package/dist/commands/webhooks/events.d.ts +14 -0
  149. package/dist/commands/webhooks/events.js +18 -0
  150. package/dist/commands/webhooks/logs.d.ts +14 -0
  151. package/dist/commands/webhooks/logs.js +11 -0
  152. package/dist/commands/webhooks/test.d.ts +17 -0
  153. package/dist/commands/webhooks/test.js +27 -0
  154. package/dist/commands/whoami.js +0 -2
  155. package/dist/crud/csv.js +2 -1
  156. package/dist/errors/api-error.d.ts +1 -1
  157. package/dist/errors/exit-codes.js +1 -0
  158. package/npm-shrinkwrap.json +2 -2
  159. package/oclif.manifest.json +8888 -1922
  160. package/package.json +38 -5
@@ -0,0 +1,20 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class BroadcastSend 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 BroadcastSend extends BaseCommand {
5
+ static description = 'Send a broadcast immediately';
6
+ static args = {
7
+ id: Args.integer({ description: 'Broadcast ID', required: true }),
8
+ };
9
+ static flags = { ...BaseCommand.baseFlags };
10
+ async run() {
11
+ const { args, flags } = await this.parse(BroadcastSend);
12
+ this.flags = flags;
13
+ const client = await createCliApiClient(flags);
14
+ const response = await client.post(`/v1/broadcasts/${args.id}/send`, {});
15
+ if (!flags.quiet)
16
+ this.log(this.toFormatted(response));
17
+ }
18
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class BroadcastStatus 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,31 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
3
+ import { createCliApiClient } from '../../send/api.js';
4
+ export default class BroadcastStatus extends BaseCommand {
5
+ static description = 'Show broadcast send status';
6
+ static args = {
7
+ id: Args.integer({
8
+ description: 'Broadcast ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static flags = {
13
+ ...BaseCommand.baseFlags,
14
+ };
15
+ async run() {
16
+ const { args, flags } = await this.parse(BroadcastStatus);
17
+ this.flags = flags;
18
+ const client = await createCliApiClient(flags);
19
+ const broadcast = await client.get(`/v1/broadcasts/${args.id}`);
20
+ const output = {
21
+ id: broadcast.id,
22
+ status: broadcast.sendStatus ?? broadcast.status,
23
+ sentAt: broadcast.sentAt,
24
+ scheduledAt: broadcast.scheduledAt,
25
+ recipients: broadcast.recipientCount,
26
+ };
27
+ if (!flags.quiet) {
28
+ this.log(this.toFormatted(output));
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,30 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class BroadcastUpdate 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
+ text: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'send-status': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'scheduled-at': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ approved: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ locked: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ test: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ 'template-id': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'remove-media': import("@oclif/core/interfaces").BooleanFlag<boolean>;
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,47 @@
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 BroadcastUpdate extends BaseCommand {
7
+ static description = 'Update a broadcast';
8
+ static args = {
9
+ id: Args.integer({ description: 'Broadcast ID', required: true }),
10
+ };
11
+ static flags = {
12
+ ...BaseCommand.baseFlags,
13
+ text: Flags.string({ description: 'Broadcast message text' }),
14
+ 'send-status': Flags.string({ description: 'Send status' }),
15
+ 'scheduled-at': Flags.integer({
16
+ description: 'Unix timestamp for scheduled send',
17
+ }),
18
+ approved: Flags.boolean({ description: 'Mark as approved' }),
19
+ locked: Flags.boolean({ description: 'Mark as locked' }),
20
+ test: Flags.boolean({ description: 'Mark as test broadcast' }),
21
+ 'template-id': Flags.integer({ description: 'Template ID' }),
22
+ 'remove-media': Flags.boolean({ description: 'Remove existing media' }),
23
+ 'header-footer': Flags.string({ description: 'Header/footer JSON array' }),
24
+ data: Flags.string({ description: 'Additional JSON object payload' }),
25
+ };
26
+ async run() {
27
+ const { args, flags } = await this.parse(BroadcastUpdate);
28
+ this.flags = flags;
29
+ const payload = mergeData(parseDataFlag(flags.data), {
30
+ message: flags.text,
31
+ sendStatus: flags['send-status'],
32
+ scheduledAt: flags['scheduled-at'],
33
+ approved: flags.approved,
34
+ locked: flags.locked,
35
+ test: flags.test,
36
+ templateId: flags['template-id'],
37
+ removeMedia: flags['remove-media'],
38
+ headerFooter: flags['header-footer']
39
+ ? parseJsonValue(flags['header-footer'], '--header-footer')
40
+ : undefined,
41
+ });
42
+ const client = await createCliApiClient(flags);
43
+ const response = await client.put(`/v1/broadcasts/${args.id}`, 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 ChatsGet 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 ChatsGet extends BaseCommand {
5
+ static description = 'Get chat by ID';
6
+ static args = {
7
+ id: Args.integer({ description: 'chat ID', required: true }),
8
+ };
9
+ static flags = { ...BaseCommand.baseFlags };
10
+ async run() {
11
+ const { args, flags } = await this.parse(ChatsGet);
12
+ this.flags = flags;
13
+ const client = await createCliApiClient(flags);
14
+ const response = await client.get(`/v1/chats/${args.id}`);
15
+ if (!flags.quiet)
16
+ this.log(this.toFormatted(response));
17
+ }
18
+ }
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class ChatsList 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
+ channel: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ channels: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'unread-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ 'include-archived': 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,40 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
3
+ import { cleanQuery } from '../../crud/data.js';
4
+ import { createCliApiClient } from '../../send/api.js';
5
+ export default class ChatsList extends BaseCommand {
6
+ static description = 'List chats';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ page: Flags.integer({ description: 'Page number', default: 1 }),
10
+ limit: Flags.integer({ description: 'Items per page', default: 20 }),
11
+ channel: Flags.integer({ description: 'Filter by channel ID' }),
12
+ channels: Flags.string({ description: 'Comma-separated channel IDs' }),
13
+ search: Flags.string({ description: 'Search chats' }),
14
+ status: Flags.string({
15
+ description: 'Chat status',
16
+ options: ['all', 'unread', 'read', 'archived'],
17
+ }),
18
+ 'unread-only': Flags.boolean({ description: 'Only unread chats' }),
19
+ 'include-archived': Flags.boolean({
20
+ description: 'Include archived chats',
21
+ }),
22
+ };
23
+ async run() {
24
+ const { flags } = await this.parse(ChatsList);
25
+ this.flags = flags;
26
+ const client = await createCliApiClient(flags);
27
+ const response = await client.get('/v1/chats', cleanQuery({
28
+ page: flags.page,
29
+ limit: flags.limit,
30
+ channelId: flags.channel,
31
+ channelIds: flags.channels,
32
+ search: flags.search,
33
+ status: flags.status,
34
+ unreadOnly: flags['unread-only'],
35
+ includeArchived: flags['include-archived'],
36
+ }));
37
+ if (!flags.quiet)
38
+ this.log(this.toFormatted(response));
39
+ }
40
+ }
@@ -1,6 +1,5 @@
1
1
  import { Args } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base-command.js';
3
- import { EXIT_CODES } from '../../errors/exit-codes.js';
4
3
  import { ApiError } from '../../errors/api-error.js';
5
4
  import { ConfigFile } from '../../config/config-file.js';
6
5
  export default class ConfigGet extends BaseCommand {
@@ -24,6 +23,5 @@ export default class ConfigGet extends BaseCommand {
24
23
  throw new ApiError('user_error', `Key '${args.key}' not found in profile '${profile}'.`);
25
24
  }
26
25
  this.log(String(block[args.key]));
27
- this.exit(EXIT_CODES.OK);
28
26
  }
29
27
  }
@@ -1,6 +1,5 @@
1
1
  import { Args } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base-command.js';
3
- import { EXIT_CODES } from '../../errors/exit-codes.js';
4
3
  import { ConfigFile } from '../../config/config-file.js';
5
4
  export default class ConfigSet extends BaseCommand {
6
5
  static description = 'Set a configuration value for the current profile';
@@ -25,6 +24,5 @@ export default class ConfigSet extends BaseCommand {
25
24
  // ConfigFile.write() will throw ApiError for secret-shaped keys per D-38
26
25
  cf.write(profile, args.key, args.value);
27
26
  this.log(`Set ${args.key} in profile '${profile}'.`);
28
- this.exit(EXIT_CODES.OK);
29
27
  }
30
28
  }
@@ -1,6 +1,5 @@
1
1
  import { Args } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base-command.js';
3
- import { EXIT_CODES } from '../../errors/exit-codes.js';
4
3
  import { ConfigFile } from '../../config/config-file.js';
5
4
  export default class ConfigUnset extends BaseCommand {
6
5
  static description = 'Remove a configuration key from the current profile';
@@ -20,6 +19,5 @@ export default class ConfigUnset extends BaseCommand {
20
19
  const cf = new ConfigFile();
21
20
  cf.unset(profile, args.key);
22
21
  this.log(`Unset ${args.key} from profile '${profile}'.`);
23
- this.exit(EXIT_CODES.OK);
24
22
  }
25
23
  }
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsCustomFieldsDeleteValue 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
+ fieldId: 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 ContactsCustomFieldsDeleteValue extends BaseCommand {
5
+ static description = 'Delete one custom field value from a contact';
6
+ static args = {
7
+ contactId: Args.integer({
8
+ description: 'Contact ID',
9
+ required: true,
10
+ }),
11
+ fieldId: Args.integer({
12
+ description: 'Custom field ID',
13
+ required: true,
14
+ }),
15
+ };
16
+ static flags = {
17
+ ...BaseCommand.baseFlags,
18
+ };
19
+ async run() {
20
+ const { args, flags } = await this.parse(ContactsCustomFieldsDeleteValue);
21
+ this.flags = flags;
22
+ const client = await createCliApiClient(flags);
23
+ await client.delete(`/v1/contacts/${args.contactId}/custom-fields/${args.fieldId}`);
24
+ if (!flags.quiet) {
25
+ this.log(this.toFormatted({
26
+ deleted: true,
27
+ contactId: args.contactId,
28
+ fieldId: args.fieldId,
29
+ }));
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsCustomFieldsList 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
+ };
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,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 ContactsCustomFieldsList extends BaseCommand {
5
+ static description = 'List custom field values for 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(ContactsCustomFieldsList);
17
+ this.flags = flags;
18
+ const client = await createCliApiClient(flags);
19
+ const response = await client.get(`/v1/contacts/${args.contactId}/custom-fields`);
20
+ if (!flags.quiet) {
21
+ this.log(this.toFormatted(response));
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,25 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsCustomFieldsSetValue 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
+ fieldId: import("@oclif/core/interfaces").Arg<number, {
10
+ max?: number;
11
+ min?: number;
12
+ }>;
13
+ };
14
+ static flags: {
15
+ value: import("@oclif/core/interfaces").OptionFlag<string, 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,32 @@
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 ContactsCustomFieldsSetValue extends BaseCommand {
5
+ static description = 'Set one custom field value for a contact';
6
+ static args = {
7
+ contactId: Args.integer({
8
+ description: 'Contact ID',
9
+ required: true,
10
+ }),
11
+ fieldId: Args.integer({
12
+ description: 'Custom field ID',
13
+ required: true,
14
+ }),
15
+ };
16
+ static flags = {
17
+ ...BaseCommand.baseFlags,
18
+ value: Flags.string({
19
+ description: 'Custom field value',
20
+ required: true,
21
+ }),
22
+ };
23
+ async run() {
24
+ const { args, flags } = await this.parse(ContactsCustomFieldsSetValue);
25
+ this.flags = flags;
26
+ const client = await createCliApiClient(flags);
27
+ const response = await client.put(`/v1/contacts/${args.contactId}/custom-fields/${args.fieldId}`, { value: flags.value });
28
+ if (!flags.quiet) {
29
+ this.log(this.toFormatted(response));
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsCustomFieldsSet 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
+ };
10
+ static flags: {
11
+ values: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ file: 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,42 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base-command.js';
3
+ import { parseJsonValue, readJsonFile } from '../../../command-helpers/json.js';
4
+ import { mergeData, parseDataFlag } from '../../../crud/data.js';
5
+ import { createCliApiClient } from '../../../send/api.js';
6
+ export default class ContactsCustomFieldsSet extends BaseCommand {
7
+ static description = 'Set multiple custom field values for a contact';
8
+ static args = {
9
+ contactId: Args.integer({
10
+ description: 'Contact ID',
11
+ required: true,
12
+ }),
13
+ };
14
+ static flags = {
15
+ ...BaseCommand.baseFlags,
16
+ values: Flags.string({
17
+ description: 'JSON object with field keys as property names',
18
+ }),
19
+ file: Flags.string({
20
+ description: 'Path to a JSON file with field keys as property names',
21
+ }),
22
+ data: Flags.string({
23
+ description: 'Additional JSON object payload',
24
+ }),
25
+ };
26
+ async run() {
27
+ const { args, flags } = await this.parse(ContactsCustomFieldsSet);
28
+ this.flags = flags;
29
+ const fileValues = flags.file
30
+ ? await readJsonFile(flags.file, '--file')
31
+ : {};
32
+ const values = mergeData(fileValues, flags.values
33
+ ? parseJsonValue(flags.values, '--values')
34
+ : {});
35
+ const payload = mergeData(parseDataFlag(flags.data), { values });
36
+ const client = await createCliApiClient(flags);
37
+ const response = await client.put(`/v1/contacts/${args.contactId}/custom-fields`, payload);
38
+ if (!flags.quiet) {
39
+ this.log(this.toFormatted(response));
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsTagsAdd 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,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base-command.js';
3
+ import { createCliApiClient } from '../../../send/api.js';
4
+ export default class ContactsTagsAdd extends BaseCommand {
5
+ static description = 'Assign a tag to 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(ContactsTagsAdd);
21
+ this.flags = flags;
22
+ const client = await createCliApiClient(flags);
23
+ const response = await client.post(`/v1/contacts/${args.contactId}/tags`, {
24
+ tagId: args.tagId,
25
+ });
26
+ if (!flags.quiet) {
27
+ this.log(this.toFormatted(response));
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseCommand } from '../../../base-command.js';
2
+ export default class ContactsTagsList 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
+ };
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
+ }