Skip to content

Commit e061bd2

Browse files
authored
Helpscout API Key - new components (#19384)
* new components * pnpm-lock.yaml * remove verdice_as_a_service dist * update
1 parent d053b82 commit e061bd2

File tree

8 files changed

+687
-167
lines changed

8 files changed

+687
-167
lines changed

components/fashn/fashn.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import helpscout from "../../help_scout_api_keys.app.mjs";
2+
3+
export default {
4+
key: "help_scout_api_keys-get-article",
5+
name: "Get Article",
6+
description: "Retrieve a single article by ID or number. [See the documentation](https://developer.helpscout.com/docs-api/articles/get/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
helpscout,
16+
collectionId: {
17+
propDefinition: [
18+
helpscout,
19+
"collectionId",
20+
],
21+
},
22+
categoryId: {
23+
propDefinition: [
24+
helpscout,
25+
"categoryId",
26+
({ collectionId }) => ({
27+
collectionId,
28+
}),
29+
],
30+
optional: true,
31+
},
32+
articleId: {
33+
propDefinition: [
34+
helpscout,
35+
"articleId",
36+
({
37+
collectionId, categoryId,
38+
}) => ({
39+
collectionId,
40+
categoryId,
41+
}),
42+
],
43+
},
44+
},
45+
async run({ $ }) {
46+
const response = await this.helpscout.getArticle({
47+
$,
48+
articleId: this.articleId,
49+
});
50+
$.export("$summary", `Retrieved article ${this.articleId}`);
51+
return response;
52+
},
53+
};
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import helpscout from "../../help_scout_api_keys.app.mjs";
2+
3+
export default {
4+
key: "help_scout_api_keys-list-articles",
5+
name: "List Articles",
6+
description: "Retrieve a list of articles by collection or category. [See the documentation](https://developer.helpscout.com/docs-api/articles/list/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
helpscout,
16+
collectionId: {
17+
propDefinition: [
18+
helpscout,
19+
"collectionId",
20+
],
21+
},
22+
categoryId: {
23+
propDefinition: [
24+
helpscout,
25+
"categoryId",
26+
({ collectionId }) => ({
27+
collectionId,
28+
}),
29+
],
30+
optional: true,
31+
},
32+
status: {
33+
propDefinition: [
34+
helpscout,
35+
"status",
36+
],
37+
},
38+
sort: {
39+
type: "string",
40+
label: "Sort",
41+
description: "The field to sort the articles by",
42+
options: [
43+
"number",
44+
"status",
45+
"name",
46+
"popularity",
47+
"createdAt",
48+
"updatedAt",
49+
],
50+
optional: true,
51+
},
52+
order: {
53+
type: "string",
54+
label: "Order",
55+
description: "The order to sort the articles by",
56+
options: [
57+
"asc",
58+
"desc",
59+
],
60+
optional: true,
61+
},
62+
page: {
63+
propDefinition: [
64+
helpscout,
65+
"page",
66+
],
67+
},
68+
pageSize: {
69+
type: "integer",
70+
label: "Page Size",
71+
description: "The number of articles to retrieve per page",
72+
optional: true,
73+
default: 100,
74+
max: 100,
75+
},
76+
},
77+
async run({ $ }) {
78+
const params = {
79+
status: this.status,
80+
sort: this.sort,
81+
order: this.order,
82+
page: this.page,
83+
pageSize: this.pageSize,
84+
};
85+
const response = this.categoryId
86+
? await this.helpscout.listArticlesByCategory({
87+
$,
88+
categoryId: this.categoryId,
89+
params,
90+
})
91+
: await this.helpscout.listArticlesByCollection({
92+
$,
93+
collectionId: this.collectionId,
94+
params,
95+
});
96+
$.export("$summary", `Retrieved ${response.articles.items.length} article${response.articles.items.length === 1
97+
? ""
98+
: "s"}.`);
99+
return response;
100+
},
101+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import helpscout from "../../help_scout_api_keys.app.mjs";
2+
3+
export default {
4+
key: "help_scout_api_keys-search-articles",
5+
name: "Search Articles",
6+
description: "Search for articles by keyword. [See the documentation](https://developer.helpscout.com/docs-api/articles/search/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
helpscout,
16+
query: {
17+
type: "string",
18+
label: "Query",
19+
description: "The keyword to search for",
20+
},
21+
collectionId: {
22+
propDefinition: [
23+
helpscout,
24+
"collectionId",
25+
],
26+
optional: true,
27+
},
28+
siteId: {
29+
propDefinition: [
30+
helpscout,
31+
"siteId",
32+
],
33+
optional: true,
34+
},
35+
status: {
36+
propDefinition: [
37+
helpscout,
38+
"status",
39+
],
40+
},
41+
visibility: {
42+
type: "string",
43+
label: "Visibility",
44+
description: "The visibility of the articles to search for",
45+
options: [
46+
"all",
47+
"public",
48+
"private",
49+
],
50+
optional: true,
51+
},
52+
page: {
53+
propDefinition: [
54+
helpscout,
55+
"page",
56+
],
57+
},
58+
},
59+
async run({ $ }) {
60+
const response = await this.helpscout.searchArticles({
61+
$,
62+
params: {
63+
query: this.query,
64+
collectionId: this.collectionId,
65+
siteId: this.siteId,
66+
status: this.status,
67+
visibility: this.visibility,
68+
page: this.page,
69+
},
70+
});
71+
$.export("$summary", `Found ${response.articles.items.length} article${response.articles.items.length === 1
72+
? ""
73+
: "s"}.`);
74+
return response;
75+
},
76+
};

0 commit comments

Comments
 (0)