Minimax Client
A TypeScript client library for the Minimax accounting API (https://moj.minimax.rs/RS/API/).
⚠️ IMPORTANT: This library is still in active development and not intended for production use. Breaking changes may occur between versions.
Features
- TypeScript-based with full type definitions
- Node.js backend usage (not browser)
- Axios for HTTP client
- Handle authentication and sessions internally
- English for library interface, preserve original API error messages
- Handle concurrency with RowVersion
Installation
npm install minimax-client
Or with yarn:
yarn add minimax-client
Usage
import { MinimaxClient } from 'minimax-client';
// Initializes the client and authenticates
const client = new MinimaxClient({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
username: 'your-username',
password: 'your-password',
});
// Use the API
const invoices = await client.invoices.getAll();
Development
Setup
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
Available Scripts
npm run clean
- Clean the dist directorynpm run build
- Build the projectnpm run build:dev
- Build the project in watch modenpm run test
- Run testsnpm run lint
- Run lintingnpm run lint:fix
- Fix linting issuesnpm run format
- Format code with Prettiernpm run format:check
- Check formatting without making changes
API Resources
The client provides access to the following Minimax API resources:
- Invoices
- Customers
- Journals
- (More resources coming soon)
Error Handling
try {
const result = await client.invoices.getById('invalid-id');
} catch (error) {
if (error.isMinimaxError) {
// Handle Minimax API error
console.error(`API Error: ${error.message}`);
console.error(`Status: ${error.status}`);
} else {
// Handle network or other errors
console.error('Unexpected error:', error);
}
}
Documentation
For more detailed information about the Minimax API and how to use this client, please refer to:
License
MIT