Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions components/help_scout_api_keys/actions/get-article/get-article.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import helpscout from "../../help_scout_api_keys.app.mjs";

export default {
key: "help_scout_api_keys-get-article",
name: "Get Article",
description: "Retrieve a single article by ID or number. [See the documentation](https://developer.helpscout.com/docs-api/articles/get/)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
helpscout,
collectionId: {
propDefinition: [
helpscout,
"collectionId",
],
},
categoryId: {
propDefinition: [
helpscout,
"categoryId",
({ collectionId }) => ({
collectionId,
}),
],
optional: true,
},
articleId: {
propDefinition: [
helpscout,
"articleId",
({
collectionId, categoryId,
}) => ({
collectionId,
categoryId,
}),
],
},
},
async run({ $ }) {
const response = await this.helpscout.getArticle({
$,
articleId: this.articleId,
});
$.export("$summary", `Retrieved article ${this.articleId}`);
return response;
},
};
101 changes: 101 additions & 0 deletions components/help_scout_api_keys/actions/list-articles/list-articles.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import helpscout from "../../help_scout_api_keys.app.mjs";

export default {
key: "help_scout_api_keys-list-articles",
name: "List Articles",
description: "Retrieve a list of articles by collection or category. [See the documentation](https://developer.helpscout.com/docs-api/articles/list/)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
helpscout,
collectionId: {
propDefinition: [
helpscout,
"collectionId",
],
},
categoryId: {
propDefinition: [
helpscout,
"categoryId",
({ collectionId }) => ({
collectionId,
}),
],
optional: true,
},
status: {
propDefinition: [
helpscout,
"status",
],
},
sort: {
type: "string",
label: "Sort",
description: "The field to sort the articles by",
options: [
"number",
"status",
"name",
"popularity",
"createdAt",
"updatedAt",
],
optional: true,
},
order: {
type: "string",
label: "Order",
description: "The order to sort the articles by",
options: [
"asc",
"desc",
],
optional: true,
},
page: {
propDefinition: [
helpscout,
"page",
],
},
pageSize: {
type: "integer",
label: "Page Size",
description: "The number of articles to retrieve per page",
optional: true,
default: 100,
max: 100,
},
},
async run({ $ }) {
const params = {
status: this.status,
sort: this.sort,
order: this.order,
page: this.page,
pageSize: this.pageSize,
};
const response = this.categoryId
? await this.helpscout.listArticlesByCategory({
$,
categoryId: this.categoryId,
params,
})
: await this.helpscout.listArticlesByCollection({
$,
collectionId: this.collectionId,
params,
});
$.export("$summary", `Retrieved ${response.articles.items.length} article${response.articles.items.length === 1
? ""
: "s"}.`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import helpscout from "../../help_scout_api_keys.app.mjs";

export default {
key: "help_scout_api_keys-search-articles",
name: "Search Articles",
description: "Search for articles by keyword. [See the documentation](https://developer.helpscout.com/docs-api/articles/search/)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
helpscout,
query: {
type: "string",
label: "Query",
description: "The keyword to search for",
},
collectionId: {
propDefinition: [
helpscout,
"collectionId",
],
optional: true,
},
siteId: {
propDefinition: [
helpscout,
"siteId",
],
optional: true,
},
status: {
propDefinition: [
helpscout,
"status",
],
},
visibility: {
type: "string",
label: "Visibility",
description: "The visibility of the articles to search for",
options: [
"all",
"public",
"private",
],
optional: true,
},
page: {
propDefinition: [
helpscout,
"page",
],
},
},
async run({ $ }) {
const response = await this.helpscout.searchArticles({
$,
params: {
query: this.query,
collectionId: this.collectionId,
siteId: this.siteId,
status: this.status,
visibility: this.visibility,
page: this.page,
},
});
$.export("$summary", `Found ${response.articles.items.length} article${response.articles.items.length === 1
? ""
: "s"}.`);
return response;
},
};
Loading
Loading