- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
[Components] Topdesk - new components #18844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import app from "../../topdesk.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "topdesk-get-incident", | ||
| name: "Get Incident", | ||
| description: "Returns an incident by ID. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/getIncidentById)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| incidentId: { | ||
| propDefinition: [ | ||
| app, | ||
| "incidentId", | ||
| ], | ||
| }, | ||
| }, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| incidentId, | ||
| } = this; | ||
| 
     | 
||
| const response = await app.getIncident({ | ||
| $, | ||
| incidentId, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", `Successfully retrieved incident with ID \`${response.id}\``); | ||
| 
     | 
||
| return response; | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import app from "../../topdesk.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "topdesk-get-incidents", | ||
| name: "Get Incidents", | ||
| description: "Returns a list of incidents. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/getIncidents)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| maxResults: { | ||
| type: "integer", | ||
| label: "Max Results", | ||
| description: "Maximum number of incidents to return. Leave empty to return all incidents.", | ||
| optional: true, | ||
| }, | ||
| sort: { | ||
| type: "string", | ||
| label: "Sort", | ||
| description: "The sort order of the returned incidents (e.g., `callDate:asc,creationDate:desc`)", | ||
| optional: true, | ||
| }, | ||
| query: { | ||
| type: "string", | ||
| label: "Query", | ||
| description: "A FIQL string to select which incidents should be returned. [See the documentation](https://developers.topdesk.com/tutorial.html#query)", | ||
| optional: true, | ||
| }, | ||
| fields: { | ||
| type: "string", | ||
| label: "Fields", | ||
| description: "A comma-separated list of which fields should be returned. By default all fields will be returned.", | ||
| optional: true, | ||
| }, | ||
| all: { | ||
| type: "boolean", | ||
| label: "All", | ||
| description: "When set to true, will return all incidents including partials and archived. Otherwise only firstLine and secondLine incidents are returned.", | ||
| optional: true, | ||
| default: false, | ||
| }, | ||
| }, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| maxResults, | ||
| sort, | ||
| query, | ||
| fields, | ||
| all, | ||
| } = this; | ||
| 
     | 
||
| const incidents = []; | ||
| const paginator = app.paginate({ | ||
| fn: app.listIncidents, | ||
| fnArgs: { | ||
| $, | ||
| params: { | ||
| sort, | ||
| query, | ||
| fields: Array.isArray(fields) && fields?.length | ||
| ? fields.join(",") | ||
| : typeof fields === "string" && fields.length | ||
| ? fields | ||
| : undefined, | ||
| all, | ||
| page_size: 100, | ||
| }, | ||
| }, | ||
| maxResults, | ||
| }); | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| for await (const incident of paginator) { | ||
| incidents.push(incident); | ||
| } | ||
| 
     | 
||
| $.export("$summary", `Successfully retrieved \`${incidents.length}\` incident(s)`); | ||
| 
     | 
||
| return incidents; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import app from "../../topdesk.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "topdesk-get-knowledge-item-statuses", | ||
| name: "Get Knowledge Item Statuses", | ||
| description: "Returns the list of possible Knowledge Item statuses. [See the documentation](https://developers.topdesk.com/explorer/?page=knowledge-base#/Searchlists/getStatuses)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| archived: { | ||
| type: "boolean", | ||
| label: "Archived", | ||
| description: "Whether to show archived entries. Leave unset for all entries, or specify true/false for only archived or only active entries, respectively.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| archived, | ||
| } = this; | ||
| 
     | 
||
| const response = await app.listKnowledgeItemStatuses({ | ||
| $, | ||
| params: { | ||
| archived, | ||
| }, | ||
| }); | ||
| 
     | 
||
| const statusCount = response.results?.length || 0; | ||
| $.export("$summary", `Successfully retrieved \`${statusCount}\` knowledge item status(es)`); | ||
| 
     | 
||
| return response; | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| import app from "../../topdesk.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "topdesk-get-knowledge-items", | ||
| name: "Get Knowledge Items", | ||
| description: "Returns a list of Knowledge Items. [See the documentation](https://developers.topdesk.com/explorer/?page=knowledge-base#/Knowledge%20Items/getKnowledgeItems)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| maxResults: { | ||
| type: "integer", | ||
| label: "Max Results", | ||
| description: "Maximum number of knowledge items to return. Leave empty to return all items.", | ||
| optional: true, | ||
| }, | ||
| fields: { | ||
| type: "string[]", | ||
| label: "Fields", | ||
| description: "Additional fields to include in the response. ID and number are always included.", | ||
| optional: true, | ||
| options: [ | ||
| "parent", | ||
| "visibility", | ||
| "urls", | ||
| "news", | ||
| "manager", | ||
| "status", | ||
| "standardSolution", | ||
| "externalLink", | ||
| "language", | ||
| "title", | ||
| "description", | ||
| "content", | ||
| "commentsForOperators", | ||
| "keywords", | ||
| "creator", | ||
| "modifier", | ||
| "creationDate", | ||
| "modificationDate", | ||
| "translation.creator", | ||
| "translation.modifier", | ||
| "translation.creationDate", | ||
| "translation.modificationDate", | ||
| "availableTranslations", | ||
| ], | ||
| }, | ||
| query: { | ||
| type: "string", | ||
| label: "Query", | ||
| description: `A FIQL query to filter the response. Use semicolons to combine multiple conditions. | ||
| 
     | 
||
| **Available filter fields:** | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest linking to the associated documentation page instead of listing all the filters here. It would keep the description more concise while also providing the information and guaranteeing it will be up-to-date.  | 
||
| - \`parent.id\`, \`parent.number\` | ||
| - \`visibility.sspVisibility\`, \`visibility.sspVisibleFrom\`, \`visibility.sspVisibleUntil\` | ||
| - \`visibility.sspVisibilityFilteredOnBranches\`, \`visibility.operatorVisibilityFilteredOnBranches\` | ||
| - \`visibility.publicKnowledgeItem\`, \`visibility.branches.id\`, \`visibility.branches.name\` | ||
| - \`manager.id\`, \`manager.name\` | ||
| - \`status.id\`, \`status.name\` | ||
| - \`standardSolution.id\`, \`standardSolution.name\` | ||
| - \`externalLink.id\`, \`externalLink.type\`, \`externalLink.date\` | ||
| - \`archived\`, \`news\` | ||
| 
     | 
||
| **Operators:** | ||
| - \`==\` (equals), \`!=\` (not equals) | ||
| - \`=gt=\` (greater than), \`=ge=\` (greater than or equal) | ||
| - \`=lt=\` (less than), \`=le=\` (less than or equal) | ||
| - \`=in=\` (in list), \`=out=\` (not in list) | ||
| 
     | 
||
| **Example:** \`parent.id==3fa85f64-5717-4562-b3fc-2c963f66afa6;externalLink.id=in=(oneTool,otherTool)\` | ||
| 
     | 
||
| [See the documentation](https://developers.topdesk.com/explorer/?page=knowledge-base#/Knowledge%20Items/getKnowledgeItems) for more information.`, | ||
| optional: true, | ||
| }, | ||
| language: { | ||
| type: "string", | ||
| label: "Language", | ||
| description: "The language of the Knowledge Item content, in BCP 47 format (e.g., `en`)", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| maxResults, | ||
| fields, | ||
| query, | ||
| language, | ||
| } = this; | ||
| 
     | 
||
| const items = []; | ||
| const paginator = app.paginate({ | ||
| fn: app.listKnowledgeItems, | ||
| fnArgs: { | ||
| $, | ||
| params: { | ||
| fields: Array.isArray(fields) && fields?.length | ||
| ? fields.join(",") | ||
| : typeof fields === "string" && fields.length | ||
| ? fields | ||
| : undefined, | ||
| query, | ||
| language, | ||
| page_size: 100, | ||
| }, | ||
| }, | ||
| maxResults, | ||
| dataField: "item", | ||
| }); | ||
| 
     | 
||
| for await (const item of paginator) { | ||
| items.push(item); | ||
| } | ||
| 
     | 
||
| $.export("$summary", `Successfully retrieved \`${items.length}\` knowledge item(s)`); | ||
| 
     | 
||
| return items; | ||
| }, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Confirm the ‘all’ filter name
Is all a valid query flag for GET /incidents? If the API expects different flags (e.g., archived/partials), adjust accordingly.
🌐 Web query:
💡 Result:
Short answer:
Sources:
Remove invalid 'all' parameter — TOPdesk API doesn't support it
The TOPdesk incidents API has no single
allflag. To include archived incidents, usearchived=true. For partial incidents, filter bystatus=partialor use FIQL queries. Refactor this parameter to use the correct API-supported parameters instead.🤖 Prompt for AI Agents