{"_id":"@apiroc/unified-calendar-api-node-sdk","_rev":"2-232a4ac95f4c0b573422a22416f46e53","name":"@apiroc/unified-calendar-api-node-sdk","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@apiroc/unified-calendar-api-node-sdk","version":"2.0.0","keywords":["calendar","apiroc","onecal","unified-calendar-api","google calendar api","microsoft calendar api","icloud calendar api","apple calendar api","sdk","typescript","nodejs"],"license":"MIT","_id":"@apiroc/unified-calendar-api-node-sdk@2.0.0","maintainers":[{"name":"kleo-xhindoli-onecal","email":"kleo@onecal.io"}],"homepage":"https://github.com/OneCal/unified-calendar-api-node-sdk#readme","bugs":{"url":"https://github.com/OneCal/unified-calendar-api-node-sdk/issues"},"dist":{"shasum":"66fc38059c29822ecd53dda9afeb1975c3420bca","tarball":"https://registry.npmjs.org/@apiroc/unified-calendar-api-node-sdk/-/unified-calendar-api-node-sdk-2.0.0.tgz","fileCount":15,"integrity":"sha512-owT8KE8ZRgOBfoUK8O+UsoEiKvYXrYgALoNGm0xAWFGnGleoUGYPTwAEwP/E4wYFfxkmcftYAACbQrN9H0LThw==","signatures":[{"sig":"MEUCIQCn1p1WeXpjNErhPlN7V5XWEFx5bKTYKH9isT2lvh6O2QIgMLTn023UqneOjvH/To7PD1E3W+KLCpMslKqLI2Qe7Vw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":216445},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16"},"exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"},"./oauth":{"types":{"import":"./dist/oauth/index.d.ts","require":"./dist/oauth/index.d.cts"},"import":"./dist/oauth/index.js","require":"./dist/oauth/index.cjs"}},"gitHead":"624df4718b3d0774196439fd6c99b9533edd6530","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.ts\"","example":"tsx examples/quickstart.ts","test:ui":"vitest --ui","typecheck":"tsc --noEmit && tsc -p tests/tsconfig.json","release:rc":"npm version prerelease --preid=rc && git push --follow-tags","test:watch":"vitest","release:beta":"npm version prerelease --preid=beta && git push --follow-tags","release:alpha":"npm version prerelease --preid=alpha && git push --follow-tags","release:major":"npm version major && git push --follow-tags","release:minor":"npm version minor && git push --follow-tags","release:patch":"npm version patch && git push --follow-tags","test:coverage":"vitest --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"kleo-xhindoli-onecal","email":"kleo@onecal.io"},"overrides":{"rollup":"^4.59.0","flatted":"^3.4.2","minimatch":"^9.0.7"},"repository":{"url":"git+https://github.com/OneCal/unified-calendar-api-node-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"Official Node.js SDK for Apiroc Unified Calendar API - A type-safe client for managing calendars, events, and integrations across Google, Microsoft, iCloud and other providers","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.25.76","axios":"^1.15.2","winston":"^3.19.0"},"typesVersions":{"*":{"oauth":["./dist/oauth/index.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.5.1","dotenv":"^17.2.3","eslint":"^8.57.1","vitest":"^4.1.10","prettier":"^3.8.0","@vitest/ui":"^4.1.10","typescript":"^5.9.3","@types/node":"^20.19.30","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/unified-calendar-api-node-sdk_2.0.0_1785938613237_0.6666141460926487","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@apiroc/unified-calendar-api-node-sdk","version":"2.0.1","description":"Official Node.js SDK for Apiroc Unified Calendar API - A type-safe client for managing calendars, events, and integrations across Google, Microsoft, iCloud and other providers","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"},"./oauth":{"types":{"import":"./dist/oauth/index.d.ts","require":"./dist/oauth/index.d.cts"},"import":"./dist/oauth/index.js","require":"./dist/oauth/index.cjs"}},"typesVersions":{"*":{"oauth":["./dist/oauth/index.d.ts"]}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","test:ui":"vitest --ui","test:coverage":"vitest --coverage","lint":"eslint src --ext .ts","format":"prettier --write \"src/**/*.ts\"","typecheck":"tsc --noEmit && tsc -p tests/tsconfig.json","release:patch":"npm version patch && git push --follow-tags","release:minor":"npm version minor && git push --follow-tags","release:major":"npm version major && git push --follow-tags","release:alpha":"npm version prerelease --preid=alpha && git push --follow-tags","release:beta":"npm version prerelease --preid=beta && git push --follow-tags","release:rc":"npm version prerelease --preid=rc && git push --follow-tags","prepublishOnly":"npm run build","example":"tsx examples/quickstart.ts"},"engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/OneCal/unified-calendar-api-node-sdk.git"},"bugs":{"url":"https://github.com/OneCal/unified-calendar-api-node-sdk/issues"},"homepage":"https://github.com/OneCal/unified-calendar-api-node-sdk#readme","license":"MIT","keywords":["calendar","apiroc","onecal","unified-calendar-api","google calendar api","microsoft calendar api","icloud calendar api","apple calendar api","sdk","typescript","nodejs"],"dependencies":{"axios":"^1.15.2","winston":"^3.19.0","zod":"^3.25.76"},"devDependencies":{"@types/node":"^20.19.30","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0","@vitest/ui":"^4.1.10","dotenv":"^17.2.3","eslint":"^8.57.1","prettier":"^3.8.0","tsup":"^8.5.1","tsx":"^4.21.0","typescript":"^5.9.3","vitest":"^4.1.10"},"overrides":{"flatted":"^3.4.2","minimatch":"^9.0.7","rollup":"^4.59.0"},"_id":"@apiroc/unified-calendar-api-node-sdk@2.0.1","gitHead":"d3dc59e839436acbde89926570085a6d7e4b8882","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-T8TsJIvw88ZYZslxzM57e69hg1Hk2C4nAnHlEbnJoVRFgPVUZWFJ+dMYz0p/KkAwQGkcRWbRD82QbLCI0wg6fg==","shasum":"a69c1701bd6dbdcf5ccbdcda36906e67c66d3300","tarball":"https://registry.npmjs.org/@apiroc/unified-calendar-api-node-sdk/-/unified-calendar-api-node-sdk-2.0.1.tgz","fileCount":15,"unpackedSize":216445,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD1a9vqv6U9RSrA/WJopypkE4wBDFJnbZBo7yAQ4+/4WAIhAM0CnEnydxzMEIn8VJ4oxhjZM+boZ5q0lpuXcugBq6Vb"}]},"_npmUser":{"name":"kleo-xhindoli-onecal","email":"kleo@onecal.io"},"directories":{},"maintainers":[{"name":"kleo-xhindoli-onecal","email":"kleo@onecal.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unified-calendar-api-node-sdk_2.0.1_1785938800238_0.41960880036604453"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T14:03:32.994Z","modified":"2026-08-05T14:06:40.584Z","2.0.0":"2026-08-05T14:03:33.396Z","2.0.1":"2026-08-05T14:06:40.369Z"},"bugs":{"url":"https://github.com/OneCal/unified-calendar-api-node-sdk/issues"},"license":"MIT","homepage":"https://github.com/OneCal/unified-calendar-api-node-sdk#readme","keywords":["calendar","apiroc","onecal","unified-calendar-api","google calendar api","microsoft calendar api","icloud calendar api","apple calendar api","sdk","typescript","nodejs"],"repository":{"type":"git","url":"git+https://github.com/OneCal/unified-calendar-api-node-sdk.git"},"description":"Official Node.js SDK for Apiroc Unified Calendar API - A type-safe client for managing calendars, events, and integrations across Google, Microsoft, iCloud and other providers","maintainers":[{"name":"kleo-xhindoli-onecal","email":"kleo@onecal.io"}],"readme":"# Apiroc Unified Calendar API - Node.js SDK\n\nOfficial Node.js/TypeScript SDK for the [Apiroc Unified Calendar API](https://docs.apiroc.com). Manage calendars, events, and integrations across Google Calendar, Microsoft Outlook, and other providers with a single, unified interface.\n\n## Features\n\n✨ **Unified Interface** - Work with multiple calendar providers through one consistent API  \n🔒 **Type-Safe** - Full TypeScript support with comprehensive type definitions  \n📦 **Modern** - ESM and CommonJS support  \n🚀 **Simple** - Intuitive, promise-based API  \n📚 **Well-Documented** - Extensive documentation and examples  \n🧪 **Tested** - Comprehensive test coverage\n\n## Installation\n\n```bash\nnpm install @apiroc/unified-calendar-api-node-sdk\n```\n\nOr using yarn:\n\n```bash\nyarn add @apiroc/unified-calendar-api-node-sdk\n```\n\nOr using pnpm:\n\n```bash\npnpm add @apiroc/unified-calendar-api-node-sdk\n```\n\n## Quick Start\n\n```typescript\nimport { UnifiedCalendarApi } from '@apiroc/unified-calendar-api-node-sdk';\n\n// Initialize the client\nconst client = new UnifiedCalendarApi({\n  apiKey: 'your-api-key-here',\n});\n\n// List calendars\nconst calendars = await client.calendars.list('endUserAccountId');\n\n// Create an event\nconst event = await client.events.create('endUserAccountId', 'calendarId', {\n  title: 'Team Meeting',\n  start: {\n    dateTime: '2026-01-20T10:00:00Z',\n    timeZone: 'UTC',\n  },\n  end: {\n    dateTime: '2026-01-20T11:00:00Z',\n    timeZone: 'UTC',\n  },\n  attendees: [{ email: 'team@example.com', name: 'Team Member' }],\n});\n\nconsole.log(`Created event: ${event.title}`);\n```\n\n## Configuration\n\n```typescript\nconst client = new UnifiedCalendarApi({\n  apiKey: 'your-api-key', // Required: Your Unified Calendar API key\n  unifiedApiBaseUrl: 'https://api.apiroc.com', // Optional: API base URL\n  timeout: 30000, // Optional: Request timeout in ms\n  debug: false, // Optional: Enable debug logging\n});\n```\n\n## API Reference\n\n### End User Accounts\n\nManage end user accounts that connect to calendar providers.\n\n```typescript\n// List all end user accounts\nconst accounts = await client.endUserAccounts.list({\n  limit: 20,\n  search: 'user@example.com',\n  statusFilter: 'active',\n});\n\n// Get a specific account\nconst account = await client.endUserAccounts.get('accountId');\n\n// Create a new account\nconst newAccount = await client.endUserAccounts.upsert({\n  email: 'user@example.com',\n  refreshToken: 'refresh-token',\n  providerType: ProviderType.GOOGLE,\n  externalId: 'user-123',\n});\n\n// Get account credentials (automatically refreshes if expired)\nconst credentials = await client.endUserAccounts.getCredentials('accountId');\n\n// Delete an account\nawait client.endUserAccounts.delete('accountId');\n```\n\n### Calendars\n\nManage calendars for end user accounts.\n\n```typescript\n// List calendars\nconst calendars = await client.calendars.list('endUserAccountId', {\n  pageSize: 20,\n});\n\n// Get a specific calendar\nconst calendar = await client.calendars.get('endUserAccountId', 'calendarId');\n\n// Create a calendar\nconst newCalendar = await client.calendars.create('endUserAccountId', {\n  name: 'My Calendar',\n  hexColor: '#FF5733',\n  timeZone: 'America/New_York',\n});\n\n// Update a calendar\nconst updated = await client.calendars.update(\n  'endUserAccountId',\n  'calendarId',\n  {\n    name: 'Updated Calendar Name',\n  }\n);\n\n// Delete a calendar\nawait client.calendars.delete('endUserAccountId', 'calendarId');\n```\n\n### Events\n\nCreate, read, update, and delete calendar events.\n\n```typescript\n// List events\nconst events = await client.events.list('endUserAccountId', 'calendarId', {\n  startDateTime: new Date('2026-01-01'),\n  endDateTime: new Date('2026-12-31'),\n  search: 'meeting',\n  orderBy: EventOrderBy.START_TIME,\n  pageSize: 50,\n});\n\n// Get a specific event\nconst event = await client.events.get(\n  'endUserAccountId',\n  'calendarId',\n  'eventId'\n);\n\n// Create an event\nconst newEvent = await client.events.create('endUserAccountId', 'calendarId', {\n  title: 'Product Launch',\n  description: 'Launch event for new product',\n  start: {\n    dateTime: '2026-02-15T14:00:00Z',\n    timeZone: 'UTC',\n  },\n  end: {\n    dateTime: '2026-02-15T16:00:00Z',\n    timeZone: 'UTC',\n  },\n  location: '123 Main St, San Francisco, CA',\n  attendees: [\n    { email: 'alice@example.com', name: 'Alice' },\n    { email: 'bob@example.com', name: 'Bob' },\n  ],\n  reminders: {\n    useDefault: false,\n    overrides: [\n      { method: 'email', minutes: 24 * 60 }, // 1 day before\n      { method: 'popup', minutes: 30 }, // 30 minutes before\n    ],\n  },\n});\n\n// Update an event\nconst updated = await client.events.update(\n  'endUserAccountId',\n  'calendarId',\n  'eventId',\n  {\n    title: 'Updated Event Title',\n    location: 'New Location',\n  }\n);\n\n// Delete an event\nawait client.events.delete('endUserAccountId', 'calendarId', 'eventId');\n\n// Get recurring event occurrences\nconst occurrences = await client.events.getOccurrences(\n  'endUserAccountId',\n  'calendarId',\n  'recurringEventId',\n  {\n    startDateTime: new Date('2026-01-01'),\n    endDateTime: new Date('2026-03-31'),\n  }\n);\n\n// RSVP to an event\nawait client.events.rsvp('endUserAccountId', 'calendarId', 'eventId', {\n  responseStatus: 'accepted',\n});\n```\n\n### Free/Busy\n\nQuery free/busy availability across calendars.\n\n```typescript\nconst freeBusy = await client.freeBusy.get('endUserAccountId', {\n  startDateTime: new Date(),\n  endDateTime: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // Next 7 days\n  timeZone: 'America/New_York',\n  calendarIds: ['calendar1', 'calendar2'],\n});\n\n// Response is an array of FreeBusySlot objects\nconsole.log('Free/Busy results:', freeBusy);\n// Example: [{ calendarId: 'calendar1', busySlots: [{ start: {...}, end: {...} }] }]\n```\n\n### Calendar Subscriptions\n\nSubscribe to calendar event notifications via webhooks.\n\n```typescript\n// List subscriptions\nconst subscriptions =\n  await client.calendarSubscriptions.list('endUserAccountId');\n\n// Create a subscription for calendar events\nconst subscription = await client.calendarSubscriptions.create(\n  'endUserAccountId',\n  {\n    webhookUrl: 'https://your-app.com/webhooks',\n    calendarId: 'calendarId',\n    subscriptionType: 'event', // 'event' for calendar events, 'calendar' for calendar changes\n    rateLimit: 100, // Optional: requests per second limit\n  }\n);\n// Returns: { webhookSubscriptionId: string, endpointSecret: string }\n\n// Create a subscription for calendar list changes\nconst calendarSub = await client.calendarSubscriptions.create(\n  'endUserAccountId',\n  {\n    webhookUrl: 'https://your-app.com/webhooks/calendars',\n    subscriptionType: 'calendar',\n  }\n);\n\n// Delete a subscription\nawait client.calendarSubscriptions.delete('endUserAccountId', 'subscriptionId');\n```\n\n### OAuth\n\nGenerate OAuth authorization URLs for connecting user calendars.\n\n```typescript\nimport { getOAuthUrl } from '@apiroc/unified-calendar-api-node-sdk/oauth';\n\n// Get OAuth URL for Google\nconst googleUrl = getOAuthUrl('your-app-id', 'GOOGLE', {\n  redirectUrl: 'https://your-app.com/callback',\n  externalId: 'user-123',\n  loginHint: 'user@example.com',\n  unifiedApiBaseUrl: 'https://api.apiroc.com', // Optional: defaults to production\n});\n\n// Get OAuth URL for Microsoft\nconst microsoftUrl = getOAuthUrl('your-app-id', 'MICROSOFT', {\n  redirectUrl: 'https://your-app.com/callback',\n  externalId: 'user-456',\n});\n\n// Redirect user to the OAuth URL\n// After authorization, they'll be redirected back to your redirectUrl\n```\n\n## Error Handling\n\nThe SDK provides specific error types for different scenarios:\n\n```typescript\nimport {\n  UnifiedCalendarApiError,\n  APIRequestError,\n  AuthenticationError,\n  AuthorizationError,\n  NotFoundError,\n  RateLimitError,\n} from '@apiroc/unified-calendar-api-node-sdk';\n\ntry {\n  const event = await client.events.get('accountId', 'calendarId', 'eventId');\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    console.error('Invalid API key');\n  } else if (error instanceof NotFoundError) {\n    console.error('Event not found');\n  } else if (error instanceof RateLimitError) {\n    console.error(`Rate limited. Retry after ${error.retryAfter} seconds`);\n  } else if (error instanceof APIRequestError) {\n    console.error(`API error: ${error.message} (${error.status})`);\n  } else {\n    console.error('Unexpected error:', error);\n  }\n}\n```\n\n## TypeScript Support\n\nThis SDK is written in TypeScript and provides comprehensive type definitions:\n\n```typescript\nimport type {\n  Calendar,\n  Event,\n  EndUserAccount,\n  CreateEventInput,\n  ListEventsParams,\n  EventOrderBy,\n  ProviderType,\n} from '@apiroc/unified-calendar-api-node-sdk';\n```\n\n## Examples\n\nSee the [`examples/`](./examples/) directory for more usage examples:\n\n- [`quickstart.ts`](./examples/quickstart.ts) - Complete quick start guide\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the SDK\nnpm run build\n\n# Run tests\nnpm test\n\n# Run linter\nnpm run lint\n\n# Format code\nnpm run format\n\n# Type check\nnpm run typecheck\n\n# Watch mode (for development)\nnpm run dev\n```\n\n## Support\n\n- 📧 Email: contact@apiroc.com\n- 📚 Documentation: https://docs.apiroc.com\n\n## Links\n\n- [Apiroc Unified API Website](https://www.apiroc.com)\n- [API Documentation](https://docs.apiroc.com)\n- [NPM Package](https://www.npmjs.com/package/@apiroc/unified-calendar-api-node-sdk)\n- [GitHub Repository](https://github.com/OneCal/unified-calendar-api-node-sdk)\n","readmeFilename":"README.md"}