This library provides a comprehensive set of functions to interact with the Bexio API. It includes methods for all available endpoints, including authentication, error handling, and type safety.
# Using pnpm (recommended)
pnpm add bexio
# Using npm
npm install bexio
# Using yarn
yarn add bexio
- Full TypeScript support with included type definitions
- Comprehensive coverage of Bexio API endpoints
- Promise-based API
- Error handling with detailed responses
- Support for all CRUD operations where applicable
You can find a list of all implements functions in the wiki
You can find a list of all missing functions here: Missing Functions.
If you need a function implemented, please fill out an issue.
import Bexio from "bexio";
// Initialize with your API token
const bexio = new Bexio("YOUR_API_TOKEN");
// Example: Fetch a contact
bexio.contacts.show(1)
.then(contact => console.log(contact))
.catch(error => console.error(error));
// Example: Create a new invoice
const invoice = await bexio.invoices.create({
// invoice details
});
The library provides access to the following Bexio resources:
- List contacts
- Create contact
- Show contact details
- Update contact
- Delete contact
- List projects
- Create project
- Show project details
- Update project
- Delete project
- List invoices
- Create invoice
- Show invoice details
- Update invoice
- Delete invoice
- Generate PDF
- List items
- Create item
- Show item details
- Update item
- Delete item
- Business Activities
- Contact Relations
- Contact Groups
- Project Statuses
- Project Types
- Bills
- Payments
- Timetracking
- Users
The library requires an API token from Bexio. To obtain an API token:
- Log in to your Bexio account
- Navigate to Settings > Developer
- Create a new API token
The library provides comprehensive error handling for all API requests. If an error occurs, it will be thrown as a JavaScript Error object with the following properties:
code
: The HTTP status codemessage
: The error messagedata
: The response data
Example:
try {
await bexio.contacts.show(999);
} catch (error) {
console.error(`Status: ${error.code}`);
console.error(`Message: ${error.message}`);
}
All interfaces and types are exported and can be imported directly:
import { ContactsStatic } from "bexio";
const contact: ContactsStatic.ContactCreate = {
// TypeScript will provide type hints here
};
To contribute to this library:
- Fork the repository
- Install dependencies:
pnpm install
- Make your changes
- Run tests:
pnpm test
- Build:
pnpm build
The library uses Jest for testing. Run tests with:
pnpm test
Coverage reports are automatically generated and can be found in the coverage
directory.
- Supports Node.js >= 10.0
- TypeScript support included
- Full API documentation available at docs.bexio.com
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin feature/my-new-feature
- Submit a pull request
If you find a bug or would like to request a new feature, please open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.