@factorialco/api-client 1.0.1 → 1.0.3
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 +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ See the [Factorial API versioning docs](https://apidoc.factorialhr.com/docs/api-
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
npm install @factorialco/api-client
|
|
20
|
+
npm install @factorialco/api-client@2026-04-01
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Quick start
|
|
@@ -29,7 +29,7 @@ const client = new FactorialClient({
|
|
|
29
29
|
apiKey: process.env.FACTORIAL_API_KEY,
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const { data, meta } = await client.employees.employees.list();
|
|
32
|
+
const { data: { data: { data, meta } = {}, error } = {}, error } = await client.employees.employees.list();
|
|
33
33
|
console.log(`${meta.total} employees total`);
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -70,7 +70,7 @@ Every resource exposes the standard methods available in the API:
|
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
// List (single page, up to 100 items)
|
|
73
|
-
const { data, meta } = await client.employees.employees.list({
|
|
73
|
+
const { data: { data, meta } = {}, error } = await client.employees.employees.list({
|
|
74
74
|
query: { only_active: true },
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -95,18 +95,18 @@ await client.timeoff.leaves.delete({ path: { id: 99 } });
|
|
|
95
95
|
|
|
96
96
|
// Named actions
|
|
97
97
|
await client.timeoff.leaves.approve({ body: { id: 99 } });
|
|
98
|
-
await client.attendance.shifts.clockIn({ body: { employee_id: 1 } });
|
|
98
|
+
await client.attendance.shifts.clockIn({ body: { employee_id: 1, , now: new Date().toISOString().slice(0, 19) } });
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
## Pagination
|
|
102
102
|
|
|
103
103
|
The Factorial API uses **cursor-based pagination**. All list endpoints return
|
|
104
|
-
`{ data, meta }` where `meta` contains `has_next_page`, `end_cursor`, and `total`.
|
|
104
|
+
`{ data: { data, meta } = {}, error }` where `meta` contains `has_next_page`, `end_cursor`, and `total`.
|
|
105
105
|
|
|
106
106
|
### Single page
|
|
107
107
|
|
|
108
108
|
```ts
|
|
109
|
-
const { data, meta } = await client.employees.employees.list({ query: { limit: 50 } });
|
|
109
|
+
const { data: { data, meta } = {}, error } = await client.employees.employees.list({ query: { limit: 50 } });
|
|
110
110
|
|
|
111
111
|
// Fetch next page manually
|
|
112
112
|
if (meta.has_next_page) {
|