const getHubspotTripDesignerEmailByOwnerId = (ownerId: number) =>
F.pipe(
Effect.tryCatchPromise(
() => hubspotClient.crm.owners.ownersApi.getById(ownerId),
handleHubspotApiError
),
Effect.flatMap((owner) =>
owner.email
? Effect.succeed(owner.email)
: Effect.fail({
errorCode: 'hubspot-trip-designer-does-not-have-an-email',
} as const)
)
);
const getHubspotTripDesignerEmailByOwnerId = (ownerId: number) =>
F.pipe(
Effect.tryCatchPromise(
() => hubspotClient.crm.owners.ownersApi.getById(ownerId),
handleHubspotApiError
),
Effect.flatMap((owner) =>
owner.email
? Effect.succeed(owner.email)
: Effect.fail({
errorCode: 'hubspot-trip-designer-does-not-have-an-email',
} as const)
)
);