Skip to content

Commit 7c3a310

Browse files
authored
Trengo - new components (#19033)
* new components * versions * fix doc link
1 parent b526160 commit 7c3a310

File tree

25 files changed

+242
-20
lines changed

25 files changed

+242
-20
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import app from "../../trengo.app.mjs";
2+
3+
export default {
4+
key: "trengo-attach-label",
5+
name: "Attach Label",
6+
description: "Attach a label to a ticket. [See the documentation](https://developers.trengo.com/reference/apply-a-label)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
ticketId: {
17+
propDefinition: [
18+
app,
19+
"ticketId",
20+
],
21+
},
22+
labelId: {
23+
propDefinition: [
24+
app,
25+
"labelId",
26+
],
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.app.attachLabel({
31+
$,
32+
ticketId: this.ticketId,
33+
data: {
34+
label_id: this.labelId,
35+
},
36+
});
37+
$.export("$summary", `Successfully attached label with ID ${this.labelId} to ticket with ID ${this.ticketId}`);
38+
return response;
39+
},
40+
};

components/trengo/actions/create-contact/create-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-create-contact",
6-
version: "0.0.5",
6+
version: "0.0.6",
77
annotations: {
88
destructiveHint: false,
99
openWorldHint: true,

components/trengo/actions/find-contacts/find-contacts.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-find-contacts",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import app from "../../trengo.app.mjs";
2+
3+
export default {
4+
key: "trengo-get-label",
5+
name: "Get Label",
6+
description: "Get a label by ID. [See the documentation](https://developers.trengo.com/reference/get-a-label)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
app,
16+
labelId: {
17+
propDefinition: [
18+
app,
19+
"labelId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.app.getLabel({
25+
$,
26+
labelId: this.labelId,
27+
});
28+
$.export("$summary", `Successfully retrieved label with ID ${this.labelId}`);
29+
return response;
30+
},
31+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import app from "../../trengo.app.mjs";
2+
3+
export default {
4+
key: "trengo-get-message",
5+
name: "Get Message",
6+
description: "Get a message by ID. [See the documentation](https://developers.trengo.com/reference/fetch-a-message)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
app,
16+
ticketId: {
17+
propDefinition: [
18+
app,
19+
"ticketId",
20+
],
21+
},
22+
messageId: {
23+
propDefinition: [
24+
app,
25+
"messageId",
26+
(c) => ({
27+
ticketId: c.ticketId,
28+
}),
29+
],
30+
},
31+
},
32+
async run({ $ }) {
33+
const response = await this.app.getMessage({
34+
$,
35+
ticketId: this.ticketId,
36+
messageId: this.messageId,
37+
});
38+
$.export("$summary", `Successfully retrieved message with ID ${this.messageId}`);
39+
return response;
40+
},
41+
};

components/trengo/actions/list-articles/list-articles.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-list-articles",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../trengo.app.mjs";
3+
4+
export default {
5+
key: "trengo-list-labels",
6+
name: "List Labels",
7+
description: "List all labels. [See the documentation](https://developers.trengo.com/reference/list-all-labels)",
8+
version: "0.0.1",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
props: {
16+
app,
17+
maxResults: {
18+
type: "integer",
19+
label: "Max Results",
20+
description: "Maximum number of labels to return (if not specified, all results will be returned)",
21+
optional: true,
22+
},
23+
},
24+
async run({ $ }) {
25+
const labels = [];
26+
const resourcesStream = utils.getResourcesStream({
27+
resourceFn: this.app.listLabels,
28+
resourceFnArgs: {
29+
$,
30+
},
31+
});
32+
for await (const item of resourcesStream) {
33+
labels.push(item);
34+
if (this.maxResults && labels.length >= this.maxResults) {
35+
break;
36+
}
37+
}
38+
const length = labels.length;
39+
$.export("$summary", `Successfully retrieved ${length} label${length === 1
40+
? ""
41+
: "s"}`);
42+
return labels;
43+
},
44+
};

components/trengo/actions/list-messages/list-messages.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "trengo-list-messages",
66
name: "List Messages",
77
description: "List messages from a ticket. [See the documentation](https://developers.trengo.com/reference/list-all-messages)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/trengo/actions/list-tickets/list-tickets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "trengo-list-tickets",
66
name: "List Tickets",
77
description: "List tickets according to the specified criteria. [See the documentation](https://developers.trengo.com/reference/list-all-tickets)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-log-a-voice-call",
6-
version: "0.0.5",
6+
version: "0.0.6",
77
annotations: {
88
destructiveHint: false,
99
openWorldHint: true,

0 commit comments

Comments
 (0)