repzo
v1.0.254
Published
Repzo TypeScript SDK
Readme
📚 Repzo TypeScript SDK
A comprehensive TypeScript SDK for the Repzo API platform with automatically generated documentation from OpenAPI specifications.
🚀 Features
- Full TypeScript Support: Complete type definitions for all APIs
- Comprehensive Documentation: Auto-generated from 86+ OpenAPI specifications
- Interactive Docs: Beautiful HTML documentation with ReDoc
- Multiple Formats: Markdown and HTML documentation
- Type Safety: IntelliSense support and compile-time checking
- Always Up-to-Date: Documentation automatically syncs with API changes
📦 Installation
npm install repzo🔧 Quick Start
import Repzo from "repzo";
// Basic initialization
const repzo = new Repzo("my-repzo-api-key");
// With options (staging environment, custom timeout, retry logic)
const repzoWithOptions = new Repzo("my-repzo-api-key", {
env: "staging", // 'production', 'staging', or 'local'
timeout: 60000, // Request timeout in milliseconds
retryAttempts: 3, // Number of retry attempts (default: 3)
headers: {
"Custom-Header": "value",
},
});
// Find clients
let clients = repzo.client.find({ search: "Mecca" });
// Example usage with type safety
const params: Service.Client.Find.Params = {
page: 1,
per_page: 25,
active: true,
};
// Your API implementation hereRetry Logic
The SDK includes automatic retry logic for failed requests:
- Default Behavior: Automatically retries failed requests up to 3 times
- Exponential Backoff: Uses exponential backoff strategy (2^attempt seconds)
- 401 Protection: Never retries on 401 (Unauthorized) errors
- Configurable: Set custom retry attempts via
retryAttemptsoption
// Default: 3 retry attempts
const repzo = new Repzo("api-key");
// Custom: 5 retry attempts
const repzoCustom = new Repzo("api-key", { retryAttempts: 5 });
// Disable retries: 1 attempt only
const repzoNoRetry = new Repzo("api-key", { retryAttempts: 1 });📖 Documentation
This SDK provides three levels of documentation:
1. 🏠 Documentation Hub
Open Interactive Documentation
A beautiful web interface showcasing all 86+ APIs with:
- Interactive API explorer
- Search functionality
- Try-it-out capabilities
- Mobile-responsive design
2. 📚 Complete API Reference
View Complete API Documentation
Single comprehensive document containing:
- All endpoints in one place
- Complete request/response schemas
- Authentication details
- Error handling information
3. 📝 Individual API Docs
Each API has dedicated documentation:
- API Reference - Detailed Markdown documentation
- TypeScript Examples - Practical code examples
Available APIs (86+ endpoints)
| Category | APIs | Description | | ----------------- | -------------------------------- | ---------------------- | | Core Business | Client, Product, Brand, Category | Core business entities | | Inventory | Inventory, Warehouse, Transfer | Inventory management | | Sales | Invoice, Sales Order, Payments | Sales operations | | Assets | Asset, Asset Parts, Workorders | Asset management | | Feedback | Activity Feedback V1/V2, Forms | Customer feedback | | Media | Media, Media Storage | File management | | Admin | Teams, Reps, Settings | Administration | | Integration | Webhooks, Logs, Commands | System integration |
🛠️ Development
Generate Documentation
# Generate all documentation (Markdown + HTML)
npm run docs:build
# Generate only Markdown docs
npm run docs:python
# Generate only HTML docs
npm run docs:generate
# Serve documentation locally
npm run docs:serve
# Then open http://localhost:8080Documentation Scripts
| Script | Description |
| --------------- | ------------------------------- |
| docs:build | Generate complete documentation |
| docs:clean | Remove generated documentation |
| docs:rebuild | Clean and rebuild all docs |
| docs:serve | Serve docs locally on port 8080 |
| docs:validate | Validate documentation files |
📂 Documentation Structure
docs/
├── README.md # Main documentation
├── api/ # Markdown documentation
│ ├── index.md # API index
│ ├── {api-name}.md # API reference
│ └── {api-name}-examples.md # TypeScript examples
└── generated/ # Interactive HTML docs
├── index.html # Documentation hub
├── {api-name}.html # Individual API docs
└── repzo-api-complete.html # Complete API reference💡 Key Benefits for NPM Users
🎯 For Developers
- IntelliSense Support: Full autocomplete in your IDE
- Type Safety: Catch errors at compile time
- Practical Examples: Ready-to-use TypeScript code
- Interactive Testing: Try APIs directly in documentation
📚 For Teams
- Always Current: Docs auto-update with API changes
- Multiple Formats: Choose Markdown or interactive HTML
- Comprehensive Coverage: 86+ APIs fully documented
- Search & Navigation: Find what you need quickly
🚀 For Projects
- Faster Integration: Clear examples and schemas
- Better Reliability: Type checking prevents runtime errors
- Professional Docs: Beautiful, searchable documentation
- Offline Access: Documentation included in NPM package
🔍 Example Usage
Type-Safe API Calls
import { Service } from "repzo";
// Full type safety for parameters
const clientParams: Service.Client.Find.Params = {
page: 1,
per_page: 25,
search: "coffee shop",
active: true,
tags: ["retail", "food-service"],
};
// Type-safe response handling
const handleResponse = (result: Service.Client.Find.Result) => {
console.log(`Found ${result.paging.total} clients`);
result.data.forEach((client) => {
console.log(`${client.name} - ${client.formatted_address}`);
});
};Error Handling with Types
try {
const result = await apiCall();
if (result.success) {
// TypeScript knows the exact shape of result.data
console.log("Data:", result.data);
}
} catch (error) {
// Handle API errors appropriately
console.error("API Error:", error);
}🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Update OpenAPI specs in
src/oas/if needed - Generate documentation:
npm run docs:build - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📜 License
This project is licensed under the ISC License - see the LICENSE file for details.
🆘 Support
- GitHub Issues: Report bugs or request features
- Documentation: Browse complete API docs
- Examples: View TypeScript examples
📊 Stats
- 86+ API Endpoints: Comprehensive coverage
- 100% TypeScript: Full type safety
- Auto-Generated: Always up-to-date documentation
- Multiple Formats: Markdown + Interactive HTML
- Zero Config: Documentation included in NPM package
Made with ❤️ by the Repzo Team
Comprehensive documentation automatically generated from OpenAPI 3.0 specifications
