@entrolytics/api-client
v2.2.1
Published
TypeScript API client for Entrolytics - First-party growth analytics for the edge
Downloads
132
Maintainers
Readme
⚠️ DEPRECATED
This package is deprecated in favor of @entrolytics/trpc-client.
The new tRPC client provides:
- ✅ Full end-to-end type safety
- ✅ Auto-completion for all API methods
- ✅ Automatic request batching
- ✅ Better error handling
- ✅ Same functionality, better DX
Migration Guide
Installation
# Remove old client
npm uninstall @entrolytics/api-client
# Install new client
npm install @entrolytics/trpc-clientUsage Changes
Before (REST Client):
import { EntrolyticsClient } from "@entrolytics/api-client";
const client = new EntrolyticsClient({
apiUrl: "https://api.entrolytics.click",
apiKey: "your-key",
});
const websites = await client.websites.list();After (tRPC Client):
import { createClient } from "@entrolytics/trpc-client";
const client = createClient({
apiUrl: "https://api.entrolytics.click",
apiKey: "your-key",
});
const websites = await client.websites.list.query();Key Differences
- Query/Mutation Pattern: tRPC uses
.query()for reads and.mutate()for writes - Type Safety: All types are automatically inferred from the backend
- Error Handling: Errors are typed and more predictable
API Mapping
| Old Method | New Method |
| ----------------------------------- | ----------------------------------------- |
| client.websites.list() | client.websites.list.query() |
| client.websites.create(data) | client.websites.create.mutate(data) |
| client.analytics.overview(params) | client.analytics.overview.query(params) |
| client.events.list(params) | client.events.list.query(params) |
See the full tRPC client documentation for complete migration details.
@entrolytics/api-client (Legacy)
REST API client for Entrolytics (no longer maintained).
For new projects, use @entrolytics/trpc-client instead.
