نمونه SDK
بررسی Shiki و دکمه کپی روی بلوکهای کد.
این صفحه برای تست رندر بلوک کد، هایلایت نحو Shiki و دکمه کپی است.
نصب
bun add @leadara/sdkراهاندازی TypeScript
import { Leadara } from "@leadara/sdk";
const client = new Leadara({
apiKey: process.env.LEADARA_API_KEY!,
endpoint: "https://api.leadara.com",
});
export async function trackSignup(userId: string, email: string) {
await client.track({
event: "signup",
userId,
properties: {
email,
source: "docs-sample",
timestamp: new Date().toISOString(),
},
});
}ساختار پاسخ JSON
{
"ok": true,
"eventId": "evt_01HV3M2B4YF9Z",
"profile": {
"id": "usr_42",
"email": "ali@example.com",
"segments": ["new-users", "fa-locale"]
}
}