Skip to content

Commit 7b00a45

Browse files
Add manage conversation actions for
1 parent 4480d00 commit 7b00a45

4 files changed

Lines changed: 118 additions & 5 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"ai-agent"
4444
],
4545
"dependencies": {
46-
"@linkedapi/node": "^2.1.1",
46+
"@linkedapi/node": "^2.1.3",
4747
"@oclif/core": "^4.2.10"
4848
},
4949
"devDependencies": {

src/commands/message/manage.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { Args } from '@oclif/core';
2+
3+
import { BaseCommand } from '@base-command';
4+
import { formatVoidOutput } from '@core/output/formatter';
5+
import { runVoidWorkflow } from '@core/workflow/workflow-runner';
6+
7+
export default class MessageManage extends BaseCommand {
8+
static override description = 'Archive, star, or mute a conversation thread';
9+
10+
static override args = {
11+
'thread-id': Args.string({
12+
description: 'Conversation thread identifier',
13+
required: true,
14+
}),
15+
operation: Args.string({
16+
description: 'One of archive, unarchive, star, unstar, mute, unmute',
17+
required: true,
18+
options: ['archive', 'unarchive', 'star', 'unstar', 'mute', 'unmute'],
19+
}),
20+
};
21+
22+
static override flags = {
23+
...BaseCommand.baseFlags,
24+
};
25+
26+
static override examples = [
27+
'<%= config.bin %> message manage 2-abc123... archive',
28+
'<%= config.bin %> message manage 2-abc123... unmute',
29+
];
30+
31+
public async run(): Promise<void> {
32+
const { args, flags } = await this.parse(MessageManage);
33+
34+
const client = await this.buildAuthenticatedClient();
35+
36+
try {
37+
const result = await runVoidWorkflow(
38+
client.manageConversation,
39+
{
40+
threadId: args['thread-id'],
41+
operation: args.operation,
42+
},
43+
{
44+
isQuiet: flags.quiet,
45+
},
46+
);
47+
48+
formatVoidOutput({
49+
errors: result.errors,
50+
isJson: flags.json,
51+
isQuiet: flags.quiet,
52+
successMessage: `Conversation "${args.operation}" applied.`,
53+
});
54+
} catch (error) {
55+
this.handleError(error);
56+
}
57+
}
58+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { Args } from '@oclif/core';
2+
3+
import { BaseCommand } from '@base-command';
4+
import { formatVoidOutput } from '@core/output/formatter';
5+
import { runVoidWorkflow } from '@core/workflow/workflow-runner';
6+
7+
export default class NavigatorMessageManage extends BaseCommand {
8+
static override description = 'Archive or unarchive a Sales Navigator conversation thread';
9+
10+
static override args = {
11+
'thread-id': Args.string({
12+
description: 'Conversation thread identifier',
13+
required: true,
14+
}),
15+
operation: Args.string({
16+
description: 'One of archive, unarchive',
17+
required: true,
18+
options: ['archive', 'unarchive'],
19+
}),
20+
};
21+
22+
static override flags = {
23+
...BaseCommand.baseFlags,
24+
};
25+
26+
static override examples = ['<%= config.bin %> navigator message manage 2-abc123... archive'];
27+
28+
public async run(): Promise<void> {
29+
const { args, flags } = await this.parse(NavigatorMessageManage);
30+
31+
const client = await this.buildAuthenticatedClient();
32+
33+
try {
34+
const result = await runVoidWorkflow(
35+
client.nvManageConversation,
36+
{
37+
threadId: args['thread-id'],
38+
operation: args.operation,
39+
},
40+
{
41+
isQuiet: flags.quiet,
42+
},
43+
);
44+
45+
formatVoidOutput({
46+
errors: result.errors,
47+
isJson: flags.json,
48+
isQuiet: flags.quiet,
49+
successMessage: `Sales Navigator conversation "${args.operation}" applied.`,
50+
});
51+
} catch (error) {
52+
this.handleError(error);
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)