Skip to content

Commit 2b5895b

Browse files
authored
fix: pipedrive contacts list (#287)
1 parent 6acbd4a commit 2b5895b

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vesselapi/integrations",
3-
"version": "1.0.59",
3+
"version": "1.0.60",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/pipedrive/client.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ const makeClient = () => {
7272
module: PipedriveModule,
7373
schema: z.ZodSchema,
7474
): requestFunctionType<ListObjectInput, ListOutput<TOutput>> =>
75-
request(({ start, limit = PIPEDRIVE_MAX_PAGE_SIZE }: ListObjectInput) => ({
75+
request(({ start, limit }: ListObjectInput) => ({
7676
url: `/${API_VERSION}/${module}`,
7777
method: 'GET',
78-
query: shake({
79-
start,
80-
limit,
81-
}),
78+
query: {
79+
start: `${start ?? 0}`,
80+
limit: `${limit ?? PIPEDRIVE_MAX_PAGE_SIZE}`,
81+
},
8282
schema: listResponseSchema(schema),
8383
}));
8484

@@ -126,8 +126,8 @@ const makeClient = () => {
126126
query: {
127127
term: `id:${ids.join(',')}`,
128128
exact_match: `${1}`,
129-
start: `${start}`,
130-
limit: `${limit}`,
129+
start: `${start ?? 0}`,
130+
limit: `${limit ?? PIPEDRIVE_MAX_PAGE_SIZE}`,
131131
},
132132
schema: searchResponseSchema(schema),
133133
}),
@@ -140,18 +140,20 @@ const makeClient = () => {
140140
request(
141141
({
142142
term,
143+
fields,
143144
exact_match,
144145
start,
145146
limit = PIPEDRIVE_MAX_PAGE_SIZE,
146147
}: SearchObjectInput) => ({
147148
url: `/${API_VERSION}/${module}/search`,
148149
method: 'GET',
149-
query: {
150+
query: shake({
150151
term: term,
152+
fields: fields?.join(','),
151153
exact_match: `${exact_match}`,
152-
start: `${start}`,
153-
limit: `${limit}`,
154-
},
154+
start: `${start ?? 0}`,
155+
limit: `${limit ?? PIPEDRIVE_MAX_PAGE_SIZE}`,
156+
}),
155157
schema: searchResponseSchema(schema),
156158
}),
157159
);

src/platforms/pipedrive/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const API_VERSION = 'v1';
22
export const BASE_URL = `https://api.pipedrive.com`;
3-
export const PIPEDRIVE_MAX_PAGE_SIZE = 500;
3+
export const PIPEDRIVE_MAX_PAGE_SIZE = 100;
44
export const PIPEDRIVE_MODULES = [
55
'persons',
66
'users',

src/platforms/pipedrive/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type BatchReadObjectInput = {
1717
} & ListObjectInput;
1818
export type SearchObjectInput = {
1919
term: string;
20+
fields?: string[];
2021
exact_match: 0 | 1;
2122
} & ListObjectInput;
2223
export type FindOutput<T> = {

0 commit comments

Comments
 (0)