@chneau/hyperaccounts 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -26
- package/index.d.ts +2541 -2541
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @chneau/hyperaccounts
|
|
2
2
|
|
|
3
|
-
A TypeScript client for the HyperAccounts REST API for Sage 50cloud, featuring
|
|
3
|
+
A TypeScript client for the HyperAccounts REST API for Sage 50cloud, featuring
|
|
4
|
+
type-safe requests and responses using Zod.
|
|
4
5
|
|
|
5
6
|
## Installation
|
|
6
7
|
|
|
@@ -22,14 +23,15 @@ Initialize the client with your HyperAccounts base URL and authentication token.
|
|
|
22
23
|
import { HyperAccountsClient } from "@chneau/hyperaccounts";
|
|
23
24
|
|
|
24
25
|
const client = new HyperAccountsClient({
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
baseURL: "https://your-hyperaccounts-api-url.com",
|
|
27
|
+
authToken: "YOUR_AUTH_TOKEN",
|
|
27
28
|
});
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
## Usage
|
|
31
32
|
|
|
32
|
-
All API methods return a Promise that resolves to a typed response validated by
|
|
33
|
+
All API methods return a Promise that resolves to a typed response validated by
|
|
34
|
+
Zod schemas.
|
|
33
35
|
|
|
34
36
|
### Check API Status
|
|
35
37
|
|
|
@@ -42,17 +44,17 @@ console.log(status);
|
|
|
42
44
|
|
|
43
45
|
```typescript
|
|
44
46
|
const customers = await client.searchCustomer([
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
{
|
|
48
|
+
field: "name",
|
|
49
|
+
type: "like",
|
|
50
|
+
value: "Acme%",
|
|
51
|
+
},
|
|
50
52
|
]);
|
|
51
53
|
|
|
52
54
|
if (customers.success && customers.results) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
customers.results.forEach((customer) => {
|
|
56
|
+
console.log(`Found customer: ${customer.name} (${customer.accountRef})`);
|
|
57
|
+
});
|
|
56
58
|
}
|
|
57
59
|
```
|
|
58
60
|
|
|
@@ -67,27 +69,30 @@ console.log(customer.response);
|
|
|
67
69
|
|
|
68
70
|
```typescript
|
|
69
71
|
const newOrder = await client.createSalesOrder({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
customerAccountRef: "ACME001",
|
|
73
|
+
orderDate: "2023-10-27",
|
|
74
|
+
invoiceItems: [
|
|
75
|
+
{
|
|
76
|
+
stockCode: "WIDGET-01",
|
|
77
|
+
quantity: 10,
|
|
78
|
+
unitPrice: 15.50,
|
|
79
|
+
description: "Premium Widget",
|
|
80
|
+
taxCode: 1,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
if (newOrder.success) {
|
|
84
|
-
|
|
86
|
+
console.log(`Order created successfully: ${newOrder.response}`);
|
|
85
87
|
}
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
## Features
|
|
89
91
|
|
|
90
92
|
- **Type-Safe**: Full TypeScript definitions for inputs and outputs.
|
|
91
|
-
- **Runtime Validation**: Uses [Zod](https://zod.dev) to validate API responses,
|
|
93
|
+
- **Runtime Validation**: Uses [Zod](https://zod.dev) to validate API responses,
|
|
94
|
+
ensuring your application handles data correctly.
|
|
92
95
|
- **Promise-Based**: Modern async/await API.
|
|
93
|
-
- **Comprehensive Coverage**: Supports a wide range of HyperAccounts endpoints
|
|
96
|
+
- **Comprehensive Coverage**: Supports a wide range of HyperAccounts endpoints
|
|
97
|
+
including Company Settings, Customers, Suppliers, Products, Stock, Sales
|
|
98
|
+
Orders, Purchase Orders, and more.
|