//#region src/sync/pipedrive-client.ts
async function pipedriveGet(instanceUrl, token, path) {
	const url = `${instanceUrl.replace(/\/$/, "")}/api/v1${path}?limit=500&api_token=${token}`;
	const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
	if (!res.ok) throw new Error(`Pipedrive API error: ${res.status} ${res.statusText}`);
	return (await res.json()).data ?? [];
}
async function fetchPipedrivePersons(instanceUrl, token) {
	return pipedriveGet(instanceUrl, token, "/persons");
}
async function fetchPipedriveActivities(instanceUrl, token) {
	return pipedriveGet(instanceUrl, token, "/activities");
}
//#endregion
export { fetchPipedriveActivities, fetchPipedrivePersons };

//# sourceMappingURL=pipedrive-client-CdGKpH9b.js.map