@muhammedaksam/logo-objects-node
v1.1.8
Published
TypeScript client SDK and tools for Logo Objects REST Service API
Maintainers
Readme
Logo Objects REST API Client Node.js SDK
A comprehensive TypeScript client SDK for the Logo Objects REST Service API. This project provides type-safe API clients and comprehensive test suites.
Features
- 🚀 TypeScript Client SDK - Type-safe API clients with full IntelliSense support
- 🧪 Test Suites - Comprehensive test coverage with Jest
- ⚡ Performance Optimized - Built-in retry logic, caching, and error handling
Installation
Install the SDK using your preferred package manager:
pnpm add @muhammedaksam/logo-objects-nodeOr with npm:
npm install @muhammedaksam/logo-objects-nodeOr with yarn:
yarn add @muhammedaksam/logo-objects-nodeQuick Start
Basic Usage
import { LogoApiClient } from '@muhammedaksam/logo-objects-node';
// Initialize the client
const client = new LogoApiClient({
baseURL: 'http://localhost:32001/api/v1',
apiKey: 'your-api-key',
});
// Get employees
const employees = await client.employees.getAll({
limit: 10,
fields: 'CODE,NAME,E_MAIL',
});
// Get contacts
const contacts = await client.contacts.getAll({
q: "NAME like 'John*'",
limit: 20,
});
// Get sales orders
const salesOrders = await client.salesOrders.getByClientCode('CUST001');
// Get projects
const activeProjects = await client.projects.getActive();
// Create a new opportunity
const newOpportunity = await client.opportunities.create({
CODE: 'OPP001',
DESCRIPTION: 'New sales opportunity',
CLIENTREF: 123,
ESTVALUE: 50000,
});Advanced Usage with Query Options
// Complex query with filtering and sorting
const filteredEmployees = await client.employees.getAll({
q: "NAME like 'John*' and ACTIVE eq 1",
sort: 'NAME,DATE_CREATED desc',
expandLevel: 'full',
withCount: true,
limit: 25,
});
// Get employees with related data
const employeesWithDetails = await client.employees.getAll({
expand: 'CONTACTS,ADDRESSES',
fields: 'CODE,NAME,CONTACTS.EMAIL,ADDRESSES.CITY',
});Available Scripts
Development
pnpm run dev # Run development server
pnpm run build:watch # Build in watch modeTesting
pnpm run test # Run tests
pnpm run test:watch # Run tests in watch mode
pnpm run test:coverage # Run tests with coverage
pnpm run test:quick # Quick validation test
pnpm run test:clients # Comprehensive client test
pnpm run test:validate # Run both validation testsCode Quality
pnpm run lint # Run ESLint
pnpm run lint:fix # Fix ESLint issuesUtilities
pnpm run clean # Clean build artifactsSupported APIs
This client supports all Logo Objects REST Service APIs
Additional Features
- Advanced filtering and search capabilities
- Pagination and sorting options
- Field selection and data expansion
- Real-time data synchronization
- Comprehensive error handling
Each client provides specialized methods for common operations:
- CRUD operations (Create, Read, Update, Delete)
- Search and filtering by various criteria
- And much more...
Configuration
Client Configuration
const client = new LogoApiClient({
baseURL: 'http://localhost:32001/api/v1',
apiKey: 'your-api-key',
timeout: 30000, // Request timeout in ms
retries: 3, // Number of retry attempts
retryDelay: 1000, // Delay between retries in ms
});Error Handling
The client provides comprehensive error handling:
try {
const employee = await client.employees.getById(999);
} catch (error) {
if (error instanceof ApiError) {
console.log('API Error:', error.message);
console.log('Status:', error.status);
console.log('Code:', error.code);
} else {
console.log('Network Error:', error.message);
}
}Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development
This project uses pnpm for package management.
Prerequisites
- Node.js 20 or higher
- pnpm 8.0.0 or higher
Install pnpm globally if you haven't already:
npm install -g pnpmInstall Dependencies
pnpm installBuild the Project
pnpm run buildDevelopment Setup
- Install dependencies:
pnpm install - Run tests:
pnpm test - Start development server:
pnpm run dev
License
This project is licensed under the MIT License - see the LICENSE file for details.
