@calljacob/leaddocket-typescript
v1.0.3
Published
A strongly-typed API client library for Lead Docket, automatically generated from the official OpenAPI schema.
Maintainers
Readme
Lead Docket TypeScript API Client
A strongly-typed, auto-generated TypeScript API client library for the Lead Docket API.
This library provides full TypeScript definitions, autocomplete, and a native fetch implementation for all 114 Lead Docket API endpoints.
Installation
npm install leaddocket-typescriptor
yarn add leaddocket-typescriptor
pnpm add leaddocket-typescriptUsage
You can use the exported client instance to configure your credentials and base URL globally.
import { client, ContactsService, LeadsService } from 'leaddocket-typescript';
// 1. Configure the client
client.setConfig({
baseUrl: 'https://{example}.leaddocket.com', // Replace {example} with your organization's subdomain
headers: {
Authorization: 'Bearer YOUR_API_TOKEN',
},
});
// 2. Call an endpoint using one of the generated services
async function fetchLeads() {
try {
const { data, error } = await LeadsService.leadsGetByStatus({
statusId: 123,
});
if (error) {
console.error('Failed to fetch leads:', error);
return;
}
console.log('Leads:', data);
} catch (err) {
console.error('Network Error:', err);
}
}
fetchLeads();Features
- Fully Typed: Generated directly from the official OpenAPI v3 schema.
- Zero Dependencies: Built on the native web
fetchAPI. Works in Node.js 18+, browsers, Edge runtime, Next.js, and Cloudflare Workers. - Comprehensive: Covers all 114 endpoints across Leads, Contacts, Opportunities, External Calls, Settlements, and more.
Development
To build the project locally:
npm install
npm run buildTo run tests and linting:
npm run test
npm run lintLicense
MIT
