From f3b1aa327f99252f799b18275114a2c33a13e37a Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 17 Feb 2026 14:44:13 -0800 Subject: [PATCH] feat(pipedrive): added sort order to endpoints that support it --- apps/docs/content/docs/en/tools/pipedrive.mdx | 1 + apps/sim/app/api/tools/pipedrive/get-files/route.ts | 4 +++- apps/sim/blocks/blocks/pipedrive.ts | 11 +++++++++++ apps/sim/tools/pipedrive/get_files.ts | 7 +++++++ apps/sim/tools/pipedrive/types.ts | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/docs/content/docs/en/tools/pipedrive.mdx b/apps/docs/content/docs/en/tools/pipedrive.mdx index f25abe6e9..40ad2d1b4 100644 --- a/apps/docs/content/docs/en/tools/pipedrive.mdx +++ b/apps/docs/content/docs/en/tools/pipedrive.mdx @@ -151,6 +151,7 @@ Retrieve files from Pipedrive with optional filters | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | +| `sort` | string | No | Sort files by field \(supported: "id", "update_time"\) | | `limit` | string | No | Number of results to return \(e.g., "50", default: 100, max: 100\) | | `start` | string | No | Pagination start offset \(0-based index of the first item to return\) | | `downloadFiles` | boolean | No | Download file contents into file outputs | diff --git a/apps/sim/app/api/tools/pipedrive/get-files/route.ts b/apps/sim/app/api/tools/pipedrive/get-files/route.ts index aab219d94..67a46bbf0 100644 --- a/apps/sim/app/api/tools/pipedrive/get-files/route.ts +++ b/apps/sim/app/api/tools/pipedrive/get-files/route.ts @@ -33,6 +33,7 @@ interface PipedriveApiResponse { const PipedriveGetFilesSchema = z.object({ accessToken: z.string().min(1, 'Access token is required'), + sort: z.string().optional().nullable(), limit: z.string().optional().nullable(), start: z.string().optional().nullable(), downloadFiles: z.boolean().optional().default(false), @@ -58,11 +59,12 @@ export async function POST(request: NextRequest) { const body = await request.json() const validatedData = PipedriveGetFilesSchema.parse(body) - const { accessToken, limit, start, downloadFiles } = validatedData + const { accessToken, sort, limit, start, downloadFiles } = validatedData const baseUrl = 'https://api.pipedrive.com/v1/files' const queryParams = new URLSearchParams() + if (sort) queryParams.append('sort', sort) if (limit) queryParams.append('limit', limit) if (start) queryParams.append('start', start) diff --git a/apps/sim/blocks/blocks/pipedrive.ts b/apps/sim/blocks/blocks/pipedrive.ts index 614986089..4f2e61e2d 100644 --- a/apps/sim/blocks/blocks/pipedrive.ts +++ b/apps/sim/blocks/blocks/pipedrive.ts @@ -215,6 +215,17 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n placeholder: 'New deal title ', condition: { field: 'operation', value: ['update_deal'] }, }, + { + id: 'sort', + title: 'Sort By', + type: 'dropdown', + options: [ + { label: 'ID', id: 'id' }, + { label: 'Update Time', id: 'update_time' }, + ], + value: () => 'id', + condition: { field: 'operation', value: ['get_files'] }, + }, { id: 'limit', title: 'Limit', diff --git a/apps/sim/tools/pipedrive/get_files.ts b/apps/sim/tools/pipedrive/get_files.ts index 13d4af26e..7d964fcd0 100644 --- a/apps/sim/tools/pipedrive/get_files.ts +++ b/apps/sim/tools/pipedrive/get_files.ts @@ -16,6 +16,12 @@ export const pipedriveGetFilesTool: ToolConfig ({ accessToken: params.accessToken, + sort: params.sort, limit: params.limit, start: params.start, downloadFiles: params.downloadFiles, diff --git a/apps/sim/tools/pipedrive/types.ts b/apps/sim/tools/pipedrive/types.ts index 4fb5d58f7..4c1e76af9 100644 --- a/apps/sim/tools/pipedrive/types.ts +++ b/apps/sim/tools/pipedrive/types.ts @@ -443,6 +443,7 @@ export interface PipedriveUpdateDealResponse extends ToolResponse { // GET Files export interface PipedriveGetFilesParams { accessToken: string + sort?: string limit?: string start?: string downloadFiles?: boolean