@factorialco/api-client 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/api-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Official TypeScript SDK for the Factorial API",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",