This is a TypeScript wrapper for the Parasut API, designed to help developers integrate Parasut functionality into their projects easily. The package allows you to interact with various Parasut endpoints, such as authentication, customers, invoices, items, and more.
- Authentication: Easily authenticate with the Parasut API using your credentials.
- Customers: Fetch customer data and create new customer.
- Invoices: Create and retrieve invoices, update their details.
- Items: Manage items in your Parasut account.
- Update Invoice: Update existing invoices with new data.
You can install this package via npm or yarn.
npm install parasut-apiyarn add parasut-apiTo authenticate with the Parasut API, you can use the following code:
import { authenticate } from 'parasut-api';
const credentials = {
username: 'your-username',
password: 'your-password',
};
const token = await authenticate(credentials);
console.log(token);To fetch a list of customers from the Parasut API:
import { getCustomers } from 'parasut-api';
const customers = await getCustomers();
console.log(customers);
To create a new customer:
import { createCustomer } from 'parasut-api';
const newCustomer = await createCustomer({
name: 'New Customer',
email: 'customer@example.com',
phone: '1234567890',
address: 'Customer Address',
city: 'City Name',
country: 'Country Name',
});
console.log(newCustomer);To create a new invoice:
import { createInvoice } from 'parasut-api';
const invoice = await createInvoice({
customer_id: 'customer-id',
items: [
{
item_id: 'item-id',
quantity: 1,
price: 100,
},
],
});
console.log(invoice);To update an existing invoice:
import { updateInvoice } from 'parasut-api';
const updatedInvoice = await updateInvoice('invoice-id', {
status: 'paid',
});
console.log(updatedInvoice);This package supports the following API endpoints:
Authentication: POST /auth
Customers: GET /customers, POST /customers
Invoices: POST /invoices, GET /invoices, PUT /invoices/{id}
Items: GET /items, POST /items
Update Invoice: PUT /invoices/{id}This package is open-source and available under the MIT License.