Skip to content

Commit e66baec

Browse files
authored
Merging pull request #18096
* remove automatic pagination, add page prop * pnpm-lock.yaml
1 parent 3abc3ae commit e66baec

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

components/zendesk/actions/search-tickets/search-tickets.mjs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Search Tickets",
66
description: "Searches for tickets using Zendesk's search API. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#search-tickets).",
77
type: "action",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
props: {
1010
app,
1111
query: {
@@ -37,6 +37,13 @@ export default {
3737
"customSubdomain",
3838
],
3939
},
40+
page: {
41+
type: "integer",
42+
label: "Page",
43+
description: "The page number to retrieve. Default is 1.",
44+
default: 1,
45+
optional: true,
46+
},
4047
},
4148
async run({ $: step }) {
4249
const {
@@ -47,28 +54,20 @@ export default {
4754
customSubdomain,
4855
} = this;
4956

50-
const results = this.app.paginate({
51-
fn: this.app.searchTickets,
52-
args: {
53-
step,
54-
customSubdomain,
55-
params: {
56-
query,
57-
sort_by: sortBy,
58-
sort_order: sortOrder,
59-
},
57+
const results = await this.app.searchTickets({
58+
step,
59+
customSubdomain,
60+
params: {
61+
query,
62+
sort_by: sortBy,
63+
sort_order: sortOrder,
64+
per_page: limit,
65+
page: this.page,
6066
},
61-
resourceKey: "results",
62-
max: limit,
6367
});
6468

65-
const tickets = [];
66-
for await (const ticket of results) {
67-
tickets.push(ticket);
68-
}
69-
70-
step.export("$summary", `Successfully found ${tickets.length} tickets matching the search query`);
69+
step.export("$summary", "Successfully retrieved tickets matching the search query");
7170

72-
return tickets;
71+
return results;
7372
},
7473
};

components/zendesk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zendesk",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"description": "Pipedream Zendesk Components",
55
"main": "zendesk.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)