@iamweird/planfix-api-client
v1.5.3
Published
Type-safe API client for Planfix CRM REST API, generated with orval + Zod
Downloads
10
Maintainers
Readme
planfix-api-client
Type-safe Zod schemas for the Planfix CRM REST API, generated with orval v8.
What's Inside
Zod validation schemas for all 99 Planfix REST API endpoints, organized by tag:
| Module | Description |
|--------|-------------|
| contact | Contacts & companies |
| task | Tasks |
| checklist | Checklists |
| comments | Comments |
| data-tags | Data tags & entries |
| file | Files |
| project | Projects |
| employee | Employees |
| directory | Directories |
| process | Processes |
| report | Reports |
| object | Objects |
| custom-fields | Custom fields |
| custom-fields-task | Task custom fields |
| custom-fields-contact | Contact custom fields |
| custom-fields-project | Project custom fields |
| custom-fields-employee | Employee custom fields |
| system | System settings |
| monitoring | API availability |
Setup
npm installUsage
import { GetContactByIdResponse, GetTaskListBody } from 'planfix-api-client';
// Validate an API response
const result = GetContactByIdResponse.parse(apiResponse);
// Create a validated request body
const body = GetTaskListBody.parse({
offset: 0,
pageSize: 50,
});Import specific modules
import { GetTaskByIdResponse, PostTaskBody } from 'planfix-api-client/generated/task/task.js';
import { PingResponse } from 'planfix-api-client/generated/monitoring/monitoring.js';Infer TypeScript types
import { z } from 'zod';
import { GetContactByIdResponse } from 'planfix-api-client';
type Contact = z.infer<typeof GetContactByIdResponse>;Regenerate
To regenerate schemas from an updated swagger.json:
npm run generateBuild
npm run buildOutput goes to dist/.
