Skip to content

Commit 5d29324

Browse files
committed
updates
1 parent ec6633c commit 5d29324

File tree

7 files changed

+254
-10
lines changed

7 files changed

+254
-10
lines changed

components/frontapp/actions/create-draft-reply/create-draft-reply.mjs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export default {
99
type: "action",
1010
props: {
1111
frontApp,
12+
teamId: {
13+
propDefinition: [
14+
frontApp,
15+
"teamId",
16+
],
17+
},
1218
conversationId: {
1319
propDefinition: [
1420
frontApp,
@@ -38,7 +44,6 @@ export default {
3844
"teammateId",
3945
],
4046
label: "Author ID",
41-
optional: true,
4247
},
4348
to: {
4449
propDefinition: [
@@ -65,6 +70,33 @@ export default {
6570
"attachments",
6671
],
6772
},
73+
mode: {
74+
propDefinition: [
75+
frontApp,
76+
"mode",
77+
],
78+
},
79+
signatureId: {
80+
propDefinition: [
81+
frontApp,
82+
"signatureId",
83+
(c) => ({
84+
teamId: c.teamId,
85+
}),
86+
],
87+
},
88+
shouldAddDefaultSignature: {
89+
propDefinition: [
90+
frontApp,
91+
"shouldAddDefaultSignature",
92+
],
93+
},
94+
quoteBody: {
95+
propDefinition: [
96+
frontApp,
97+
"quoteBody",
98+
],
99+
},
68100
},
69101
async run({ $ }) {
70102
const response = await this.frontApp.createDraftReply({
@@ -78,6 +110,10 @@ export default {
78110
cc: this.cc,
79111
bcc: this.bcc,
80112
attachments: this.attachments,
113+
mode: this.mode,
114+
signature_id: this.signatureId,
115+
should_add_default_signature: this.shouldAddDefaultSignature,
116+
quote_body: this.quoteBody,
81117
},
82118
headers: utils.hasArrayItems(this.attachments) && {
83119
"Content-Type": "multipart/form-data",

components/frontapp/actions/create-draft/create-draft.mjs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export default {
99
type: "action",
1010
props: {
1111
frontApp,
12+
teamId: {
13+
propDefinition: [
14+
frontApp,
15+
"teamId",
16+
],
17+
},
1218
channelId: {
1319
propDefinition: [
1420
frontApp,
@@ -32,7 +38,6 @@ export default {
3238
"teammateId",
3339
],
3440
label: "Author ID",
35-
optional: true,
3641
},
3742
to: {
3843
propDefinition: [
@@ -59,6 +64,33 @@ export default {
5964
"attachments",
6065
],
6166
},
67+
mode: {
68+
propDefinition: [
69+
frontApp,
70+
"mode",
71+
],
72+
},
73+
signatureId: {
74+
propDefinition: [
75+
frontApp,
76+
"signatureId",
77+
(c) => ({
78+
teamId: c.teamId,
79+
}),
80+
],
81+
},
82+
shouldAddDefaultSignature: {
83+
propDefinition: [
84+
frontApp,
85+
"shouldAddDefaultSignature",
86+
],
87+
},
88+
quoteBody: {
89+
propDefinition: [
90+
frontApp,
91+
"quoteBody",
92+
],
93+
},
6294
},
6395
async run({ $ }) {
6496
const response = await this.frontApp.createDraft({
@@ -71,6 +103,10 @@ export default {
71103
cc: this.cc,
72104
bcc: this.bcc,
73105
attachments: this.attachments,
106+
mode: this.mode,
107+
signature_id: this.signatureId,
108+
should_add_default_signature: this.shouldAddDefaultSignature,
109+
quote_body: this.quoteBody,
74110
},
75111
headers: utils.hasArrayItems(this.attachments) && {
76112
"Content-Type": "multipart/form-data",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-list-comment-mentions",
5+
name: "List Comment Mentions",
6+
description: "List the teammates mentioned in a comment. [See the documentation](https://dev.frontapp.com/reference/list-comment-mentions)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
conversationId: {
12+
propDefinition: [
13+
frontApp,
14+
"conversationId",
15+
],
16+
},
17+
commentId: {
18+
propDefinition: [
19+
frontApp,
20+
"commentId",
21+
(c) => ({
22+
conversationId: c.conversationId,
23+
}),
24+
],
25+
},
26+
maxResults: {
27+
propDefinition: [
28+
frontApp,
29+
"maxResults",
30+
],
31+
},
32+
},
33+
async run({ $ }) {
34+
const items = this.frontApp.paginate({
35+
fn: this.frontApp.listCommentMentions,
36+
maxResults: this.maxResults,
37+
$,
38+
commentId: this.commentId,
39+
});
40+
41+
const results = [];
42+
for await (const item of items) {
43+
results.push(item);
44+
}
45+
$.export("$summary", `Successfully retrieved ${results?.length} mention${results?.length === 1
46+
? ""
47+
: "s"}`);
48+
return results;
49+
},
50+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-list-comments",
5+
name: "List Conversation Comments",
6+
description: "List the comments in a conversation. [See the documentation](https://dev.frontapp.com/reference/list-conversation-comments)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
conversationId: {
12+
propDefinition: [
13+
frontApp,
14+
"conversationId",
15+
],
16+
},
17+
maxResults: {
18+
propDefinition: [
19+
frontApp,
20+
"maxResults",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const items = this.frontApp.paginate({
26+
fn: this.frontApp.listComments,
27+
maxResults: this.maxResults,
28+
$,
29+
conversationId: this.conversationId,
30+
});
31+
32+
const results = [];
33+
for await (const item of items) {
34+
results.push(item);
35+
}
36+
37+
$.export("$summary", `Successfully retrieved ${results.length} comment${results.length === 1
38+
? ""
39+
: "s"}`);
40+
return results;
41+
},
42+
};

components/frontapp/actions/list-conversations/list-conversations.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export default {
1919
const items = this.frontApp.paginate({
2020
fn: this.frontApp.listConversations,
2121
maxResults: this.maxResults,
22-
args: {
23-
$,
24-
},
22+
$,
2523
});
2624

2725
const results = [];

components/frontapp/actions/list-teammates/list-teammates.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export default {
1919
const items = this.frontApp.paginate({
2020
fn: this.frontApp.listTeammates,
2121
maxResults: this.maxResults,
22-
args: {
23-
$,
24-
},
22+
$,
2523
});
2624

2725
const results = [];

components/frontapp/frontapp.app.mjs

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export default {
6868
listResourcesFn: this.listChannels,
6969
filter,
7070
mapper: ({
71-
id, address,
71+
id, name,
7272
}) => ({
73-
label: address,
73+
label: name,
7474
value: id,
7575
}),
7676
});
@@ -187,6 +187,68 @@ export default {
187187
});
188188
},
189189
},
190+
teamId: {
191+
type: "string",
192+
label: "Team ID",
193+
description: "ID of a team",
194+
async options({ prevContext }) {
195+
return this.paginateOptions({
196+
prevContext,
197+
listResourcesFn: this.listTeams,
198+
mapper: ({
199+
id, name,
200+
}) => ({
201+
label: name,
202+
value: id,
203+
}),
204+
});
205+
},
206+
},
207+
signatureId: {
208+
type: "string",
209+
label: "Signature ID",
210+
description: "ID of the signature to attach. If ommited, no signature is attached.",
211+
optional: true,
212+
async options({
213+
teamId, prevContext,
214+
}) {
215+
return this.paginateOptions({
216+
prevContext,
217+
listResourcesFn: this.listSignatures,
218+
mapper: ({
219+
id, name,
220+
}) => ({
221+
label: name,
222+
value: id,
223+
}),
224+
args: {
225+
teamId,
226+
},
227+
});
228+
},
229+
},
230+
mode: {
231+
type: "string",
232+
label: "Mode",
233+
description: "Mode of the draft to create. Can be 'private' (draft is visible to the author only) or 'shared' (draft is visible to all teammates with access to the conversation).",
234+
options: [
235+
"private",
236+
"shared",
237+
],
238+
optional: true,
239+
},
240+
shouldAddDefaultSignature: {
241+
type: "boolean",
242+
label: "Should Add Default Signature",
243+
description: "Whether or not Front should try to resolve a signature for the message. Is ignored if signature_id is included. Default `false`",
244+
optional: true,
245+
},
246+
quoteBody: {
247+
type: "string",
248+
label: "Quote Body",
249+
description: "Body for the quote that the message is referencing. Only available on email channels.",
250+
optional: true,
251+
},
190252
to: {
191253
type: "string[]",
192254
label: "To",
@@ -390,6 +452,28 @@ export default {
390452
...args,
391453
});
392454
},
455+
listTeams(args = {}) {
456+
return this.makeRequest({
457+
path: "/teams",
458+
...args,
459+
});
460+
},
461+
listSignatures({
462+
teamId, ...args
463+
}) {
464+
return this.makeRequest({
465+
path: `/teams/${teamId}/signatures`,
466+
...args,
467+
});
468+
},
469+
listCommentMentions({
470+
commentId, ...args
471+
}) {
472+
return this.makeRequest({
473+
path: `/comments/${commentId}/mentions`,
474+
...args,
475+
});
476+
},
393477
addComment({
394478
conversationId, ...args
395479
}) {

0 commit comments

Comments
 (0)