Skip to content

Commit 6cb582c

Browse files
authored
fix: hubpost association batch reads (#253)
1 parent b23673f commit 6cb582c

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
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.38",
3+
"version": "1.0.39",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/hubspot/client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
HubspotAssociationLabelInput,
2525
HubspotAssociationLabelOutput,
2626
hubspotAssociationLabelOutputSchema,
27+
hubspotAssociationListResponseSchema,
2728
HubspotCall,
2829
HubspotCallCreate,
2930
hubspotCallSchema,
@@ -400,12 +401,10 @@ const makeClient = () => {
400401
({ fromType, toType, inputs }: HubspotAssociationBatchRead) => ({
401402
url: `/crm/v4/associations/${fromType}/${toType}/batch/read`,
402403
method: 'POST',
403-
schema: listResponseSchema(hubspotPropertySchema),
404-
json: [
405-
shake({
406-
inputs,
407-
}),
408-
],
404+
schema: hubspotAssociationListResponseSchema,
405+
json: shake({
406+
inputs,
407+
}),
409408
}),
410409
),
411410
create: request(

src/platforms/hubspot/schemas.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,46 @@ export const hubspotAssociationResponseSchema = z.object({
612612
export type HubspotAssociationResponse = z.infer<
613613
typeof hubspotAssociationResponseSchema
614614
>;
615+
export const hubspotAssociationListResponseSchema = z.object({
616+
results: z.array(
617+
z.object({
618+
from: z.object({
619+
id: hubspotIdSchema,
620+
}),
621+
to: z.array(
622+
z.object({
623+
toObjectId: hubspotIdSchema,
624+
associationSpec: z.object({
625+
associationCategory: z.string(),
626+
associationTypeId: hubspotIdSchema,
627+
}),
628+
}),
629+
),
630+
paging: z
631+
.object({
632+
next: z
633+
.object({
634+
link: z.string().nullable(),
635+
after: z.string().nullable(),
636+
})
637+
.partial()
638+
.nullable(),
639+
prev: z
640+
.object({
641+
before: z.string().nullable(),
642+
link: z.string().nullable(),
643+
})
644+
.partial()
645+
.nullable(),
646+
})
647+
.partial()
648+
.nullable(),
649+
}),
650+
),
651+
});
652+
export type HubspotAssociationListResponse = z.infer<
653+
typeof hubspotAssociationListResponseSchema
654+
>;
615655

616656
export const hubspotAssociationDeleteSchema = z.object({
617657
fromId: hubspotIdSchema,

0 commit comments

Comments
 (0)