Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
55 changes: 55 additions & 0 deletions components/zoho_desk/actions/get-article/get-article.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import zohoDesk from "../../zoho_desk.app.mjs";

export default {
key: "zoho_desk-get-article",
name: "Get Article",
description: "Retrieves the details of a knowledge base article. [See the docs here](https://desk.zoho.com/portal/APIDocument.do#KnowledgeBase_Getarticle)",
type: "action",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
zohoDesk,
orgId: {
propDefinition: [
zohoDesk,
"orgId",
],
},
portalId: {
propDefinition: [
zohoDesk,
"portalId",
({ orgId }) => ({
orgId,
}),
],
},
articleId: {
propDefinition: [
zohoDesk,
"articleId",
],
},
},
async run({ $ }) {
const {
portalId,
articleId,
} = this;

const article = await this.zohoDesk.getKnowledgeBaseArticle({
articleId,
params: {
portalId,
},
});

$.export("$summary", `Fetched article ${article.title || articleId}.`);

return article;
},
};
97 changes: 97 additions & 0 deletions components/zoho_desk/actions/list-articles/list-articles.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import zohoDesk from "../../zoho_desk.app.mjs";

export default {
key: "zoho_desk-list-articles",
name: "List Articles",
description: "Lists knowledge base articles for a help center. [See the docs here](https://desk.zoho.com/portal/APIDocument.do#KnowledgeBase#KnowledgeBase_Listarticles)",
type: "action",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
zohoDesk,
orgId: {
propDefinition: [
zohoDesk,
"orgId",
],
},
portalId: {
propDefinition: [
zohoDesk,
"portalId",
({ orgId }) => ({
orgId,
}),
],
},
categoryId: {
type: "string",
label: "Category ID",
description: "Filter by the ID(s) of the categories the articles belong to. Use comma-separated IDs to include multiple categories.",
optional: true,
},
sortBy: {
type: "string",
label: "Sort By",
description: "Sort articles by the specified attribute.",
optional: true,
options: [
"createdTime",
"modifiedTime",
"likeCount",
"viewCount",
"unlikeCount",
],
default: "createdTime",
},
tag: {
type: "string",
label: "Tag",
description: "Filter articles by a tag.",
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of articles to return. Leave blank to return all available results.",
optional: true,
},
},
async run({ $ }) {
const {
portalId,
categoryId,
sortBy,
tag,
maxResults,
} = this;

const params = {
portalId,
categoryId,
sortBy,
tag,
};

const articles = [];
const stream = this.zohoDesk.listKnowledgeBaseArticlesStream({
params,
});
for await (const article of stream) {
articles.push(article);
if (maxResults && articles.length >= maxResults) {
break;
}
}

$.export("$summary", `Retrieved ${articles.length} article${articles.length === 1
? ""
: "s"}.`);

return articles;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import zohoDesk from "../../zoho_desk.app.mjs";

export default {
key: "zoho_desk-list-help-centers",
name: "List Help Centers",
description: "Lists the help centers configured in an organization. [See the docs here](https://desk.zoho.com/portal/APIDocument.do#HelpCenters_Listhelpcenters)",
type: "action",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
zohoDesk,
orgId: {
propDefinition: [
zohoDesk,
"orgId",
],
},
},
async run({ $ }) {
const { orgId } = this;

const { data: helpCenters = [] } =
await this.zohoDesk.listHelpCenters({
params: {
orgId,
},
});

$.export("$summary", `Retrieved ${helpCenters.length} help center${helpCenters.length === 1
? ""
: "s"}.`);

return helpCenters;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import zohoDesk from "../../zoho_desk.app.mjs";

export default {
key: "zoho_desk-list-root-categories",
name: "List Root Categories",
description: "Lists root knowledge base categories for a help center. [See the docs here](https://desk.zoho.com/portal/APIDocument.do#KnowledgeBase_Listallrootcategoriesofthehelpcenter)",
type: "action",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
zohoDesk,
orgId: {
propDefinition: [
zohoDesk,
"orgId",
],
},
portalId: {
propDefinition: [
zohoDesk,
"portalId",
({ orgId }) => ({
orgId,
}),
],
},
sortBy: {
type: "string",
label: "Sort By",
description: "Sort the categories by the specified attribute.",
optional: true,
options: [
"name",
"order",
],
},
searchValue: {
type: "string",
label: "Search Value",
description: "Filter categories whose names match the provided value.",
optional: true,
},
visibility: {
type: "string",
label: "Visibility",
description: "Filter categories by visibility (e.g. ALL_USERS).",
optional: true,
},
departmentId: {
type: "string",
label: "Department ID",
description: "Filter categories associated with the specified department.",
optional: true,
},
hasArticles: {
type: "boolean",
label: "Has Articles",
description: "Return only categories that contain articles when set to `true`.",
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of categories to return. Leave blank to return all available results.",
optional: true,
},
},
async run({ $ }) {
const {
portalId,
sortBy,
searchValue,
visibility,
departmentId,
hasArticles,
maxResults,
} = this;

const params = {
portalId,
sortBy,
searchValue,
visibility,
departmentId,
hasArticles,
};

const categories = [];
const stream = this.zohoDesk.listKnowledgeBaseRootCategoriesStream({
params,
});
for await (const category of stream) {
categories.push(category);
if (maxResults && categories.length >= maxResults) {
break;
}
}

$.export("$summary", `Retrieved ${categories.length} root categor${categories.length === 1
? "y"
: "ies"}.`);

return categories;
},
};
Loading
Loading