repzo 1.0.141 → 1.0.142
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/docs/README.md +16 -315
- package/docs/api/activity-ai-sales-order-examples.md +63 -112
- package/docs/api/activity-ai-sales-order.md +15 -215
- package/docs/api/activity-feedback-examples.md +82 -136
- package/docs/api/activity-feedback-v2-examples.md +86 -138
- package/docs/api/activity-feedback-v2.md +19 -263
- package/docs/api/activity-feedback.md +19 -263
- package/docs/api/activity-storecheck-examples.md +62 -101
- package/docs/api/activity-storecheck.md +13 -186
- package/docs/api/adjust-account-examples.md +50 -78
- package/docs/api/adjust-account.md +12 -117
- package/docs/api/adjust-inventory-examples.md +50 -78
- package/docs/api/adjust-inventory.md +16 -121
- package/docs/api/approval-request-examples.md +58 -97
- package/docs/api/approval-request.md +26 -189
- package/docs/api/approvals-examples.md +58 -97
- package/docs/api/approvals.md +26 -189
- package/docs/api/asset-examples.md +53 -95
- package/docs/api/asset-part-examples.md +62 -101
- package/docs/api/asset-part-receival-examples.md +62 -101
- package/docs/api/asset-part-receival.md +13 -186
- package/docs/api/asset-part-transfer-examples.md +63 -112
- package/docs/api/asset-part-transfer.md +15 -215
- package/docs/api/asset-part-type-examples.md +62 -101
- package/docs/api/asset-part-type.md +13 -186
- package/docs/api/asset-part-unit-examples.md +62 -101
- package/docs/api/asset-part-unit.md +13 -186
- package/docs/api/asset-part.md +13 -186
- package/docs/api/asset-type-examples.md +58 -97
- package/docs/api/asset-type.md +26 -189
- package/docs/api/asset-unit-examples.md +80 -147
- package/docs/api/asset-unit.md +19 -306
- package/docs/api/asset.md +26 -189
- package/docs/api/banks-examples.md +53 -95
- package/docs/api/banks.md +26 -189
- package/docs/api/bankslists-examples.md +58 -97
- package/docs/api/bankslists.md +26 -189
- package/docs/api/brand-examples.md +58 -97
- package/docs/api/brand.md +18 -181
- package/docs/api/category-examples.md +58 -97
- package/docs/api/category.md +18 -181
- package/docs/api/checks-examples.md +45 -76
- package/docs/api/checks.md +12 -117
- package/docs/api/client-channel-examples.md +62 -101
- package/docs/api/client-channel.md +20 -207
- package/docs/api/client-contact-examples.md +62 -101
- package/docs/api/client-contact.md +25 -233
- package/docs/api/client-examples.md +53 -95
- package/docs/api/client-location-examples.md +71 -126
- package/docs/api/client-location.md +19 -275
- package/docs/api/client.md +18 -181
- package/docs/api/contract-examples.md +58 -97
- package/docs/api/contract-installment-examples.md +84 -148
- package/docs/api/contract-installment.md +21 -303
- package/docs/api/contract.md +26 -189
- package/docs/api/custom-list-examples.md +58 -97
- package/docs/api/custom-list-item-examples.md +58 -97
- package/docs/api/custom-list-item.md +26 -189
- package/docs/api/custom-list.md +26 -189
- package/docs/api/custom-status-examples.md +58 -97
- package/docs/api/custom-status.md +26 -189
- package/docs/api/day-examples.md +45 -76
- package/docs/api/day.md +12 -117
- package/docs/api/feedback-options-examples.md +90 -153
- package/docs/api/feedback-options.md +23 -307
- package/docs/api/fullinvoices-examples.md +51 -83
- package/docs/api/fullinvoices.md +22 -162
- package/docs/api/index.md +99 -705
- package/docs/api/integration-action-log-examples.md +62 -101
- package/docs/api/integration-action-log.md +13 -186
- package/docs/api/integration-app-examples.md +51 -83
- package/docs/api/integration-app.md +16 -156
- package/docs/api/integration-command-log-examples.md +62 -101
- package/docs/api/integration-command-log.md +13 -186
- package/docs/api/inventory-adjustment-reason-examples.md +58 -97
- package/docs/api/inventory-adjustment-reason.md +26 -189
- package/docs/api/inventory-examples.md +35 -45
- package/docs/api/inventory.md +8 -53
- package/docs/api/mail-unsubscribe-examples.md +69 -124
- package/docs/api/mail-unsubscribe.md +13 -251
- package/docs/api/measureunit-examples.md +58 -97
- package/docs/api/measureunit-family-examples.md +58 -97
- package/docs/api/measureunit-family.md +18 -188
- package/docs/api/measureunit.md +20 -190
- package/docs/api/media-examples.md +53 -95
- package/docs/api/media-storage-examples.md +58 -97
- package/docs/api/media-storage.md +18 -181
- package/docs/api/media.md +18 -181
- package/docs/api/msl-examples.md +53 -95
- package/docs/api/msl-products-examples.md +58 -97
- package/docs/api/msl-products.md +26 -189
- package/docs/api/msl.md +26 -189
- package/docs/api/ocr-invoice-job-examples.md +74 -132
- package/docs/api/ocr-invoice-job-group-examples.md +73 -121
- package/docs/api/ocr-invoice-job-group.md +15 -215
- package/docs/api/ocr-invoice-job-page-examples.md +63 -112
- package/docs/api/ocr-invoice-job-page.md +15 -215
- package/docs/api/ocr-invoice-job-template-examples.md +62 -101
- package/docs/api/ocr-invoice-job-template.md +13 -186
- package/docs/api/ocr-invoice-job.md +19 -253
- package/docs/api/patch-action-examples.md +63 -112
- package/docs/api/patch-action.md +15 -215
- package/docs/api/payment-terms-examples.md +58 -97
- package/docs/api/payment-terms.md +28 -198
- package/docs/api/payments-examples.md +51 -83
- package/docs/api/payments.md +22 -162
- package/docs/api/pricelist-examples.md +58 -97
- package/docs/api/pricelist-item-examples.md +58 -97
- package/docs/api/pricelist-item.md +24 -208
- package/docs/api/pricelist.md +18 -181
- package/docs/api/product-examples.md +58 -97
- package/docs/api/product-group-examples.md +58 -97
- package/docs/api/product-group.md +18 -181
- package/docs/api/product-modifiers-group-examples.md +70 -125
- package/docs/api/product-modifiers-group.md +19 -275
- package/docs/api/product.md +20 -190
- package/docs/api/proforma-examples.md +51 -83
- package/docs/api/proforma.md +22 -162
- package/docs/api/quick-convert-to-pdf-examples.md +30 -41
- package/docs/api/quick-convert-to-pdf.md +6 -56
- package/docs/api/receiving-material-examples.md +51 -83
- package/docs/api/receiving-material.md +16 -156
- package/docs/api/refund-examples.md +46 -81
- package/docs/api/refund.md +16 -156
- package/docs/api/rep-balance-summary-examples.md +36 -46
- package/docs/api/rep-balance-summary.md +6 -53
- package/docs/api/rep-examples.md +53 -95
- package/docs/api/rep.md +18 -181
- package/docs/api/return-asset-part-unit-examples.md +62 -101
- package/docs/api/return-asset-part-unit.md +13 -186
- package/docs/api/return-reason-examples.md +58 -97
- package/docs/api/return-reason.md +18 -181
- package/docs/api/route-examples.md +53 -95
- package/docs/api/route.md +18 -181
- package/docs/api/safe-invoice-serial-counter-examples.md +72 -127
- package/docs/api/safe-invoice-serial-counter.md +17 -266
- package/docs/api/settings-examples.md +47 -70
- package/docs/api/settings.md +18 -123
- package/docs/api/settlement-examples.md +50 -78
- package/docs/api/settlement.md +12 -117
- package/docs/api/speciality-examples.md +70 -125
- package/docs/api/speciality.md +17 -266
- package/docs/api/store-asset-part-unit-examples.md +62 -101
- package/docs/api/store-asset-part-unit.md +13 -186
- package/docs/api/storecheck-template-examples.md +58 -97
- package/docs/api/storecheck-template.md +18 -181
- package/docs/api/subcategory-examples.md +58 -97
- package/docs/api/subcategory.md +18 -181
- package/docs/api/supplier-examples.md +58 -97
- package/docs/api/supplier.md +26 -189
- package/docs/api/svix-integration-examples.md +62 -101
- package/docs/api/svix-integration.md +13 -186
- package/docs/api/tag-examples.md +53 -95
- package/docs/api/tag.md +18 -181
- package/docs/api/tax-examples.md +53 -95
- package/docs/api/tax.md +18 -181
- package/docs/api/team-examples.md +53 -95
- package/docs/api/team.md +18 -181
- package/docs/api/transfer-examples.md +51 -83
- package/docs/api/transfer.md +16 -156
- package/docs/api/update-integration-meta-examples.md +63 -112
- package/docs/api/update-integration-meta.md +15 -215
- package/docs/api/variant-examples.md +58 -97
- package/docs/api/variant.md +20 -183
- package/docs/api/visit-examples.md +46 -81
- package/docs/api/visit.md +22 -162
- package/docs/api/warehouse-examples.md +58 -97
- package/docs/api/warehouse.md +18 -181
- package/docs/api/workorder-category-examples.md +76 -141
- package/docs/api/workorder-category.md +19 -305
- package/docs/api/workorder-examples.md +58 -97
- package/docs/api/workorder-portal-examples.md +75 -132
- package/docs/api/workorder-portal-link-examples.md +70 -145
- package/docs/api/workorder-portal-link.md +23 -336
- package/docs/api/workorder-portal.md +19 -271
- package/docs/api/workorder-request-examples.md +58 -97
- package/docs/api/workorder-request.md +26 -189
- package/docs/api/workorder.md +26 -189
- package/docs/generated/index.html +1 -1
- package/docs/generated/repzo-api-complete.yaml +2585 -2585
- package/lib/index.d.ts +180 -0
- package/lib/index.js +90 -0
- package/lib/types/index.d.ts +13393 -14636
- package/package.json +2 -3
- package/src/types/index.ts +14 -1
|
@@ -11,66 +11,59 @@ npm install repzo
|
|
|
11
11
|
## Basic Setup
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Service } from
|
|
14
|
+
import { Service } from "repzo";
|
|
15
15
|
|
|
16
16
|
// Initialize with your API key
|
|
17
|
-
const apiKey =
|
|
18
|
-
const baseURL =
|
|
17
|
+
const apiKey = "your-api-key";
|
|
18
|
+
const baseURL = "https://api.repzo.me/v1";
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## API Usage Examples
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
23
|
### Get all activity feedback
|
|
26
24
|
|
|
27
|
-
|
|
28
25
|
Retrieve a list of all activity feedback with optional filtering and pagination
|
|
29
26
|
|
|
30
|
-
|
|
31
27
|
```typescript
|
|
32
|
-
|
|
33
28
|
// GET /activity-feedback
|
|
34
29
|
|
|
35
30
|
const params = {
|
|
36
|
-
|
|
37
31
|
page: 1, // Page number for pagination
|
|
38
32
|
|
|
39
33
|
per_page: 1, // Number of items per page
|
|
40
34
|
|
|
41
|
-
sort:
|
|
35
|
+
sort: "example-value", // Sort field
|
|
42
36
|
|
|
43
37
|
company_namespace: null, // Company namespace for filtering
|
|
44
38
|
|
|
45
|
-
activity_type:
|
|
39
|
+
activity_type: "example-value", // Filter by activity type
|
|
46
40
|
|
|
47
|
-
rep:
|
|
41
|
+
rep: "example-value", // Filter by representative ID
|
|
48
42
|
|
|
49
|
-
client:
|
|
43
|
+
client: "example-value", // Filter by client ID
|
|
50
44
|
|
|
51
45
|
rating: 1, // Filter by rating
|
|
52
46
|
|
|
53
47
|
_id: null, // Filter by ID
|
|
54
|
-
|
|
55
48
|
};
|
|
56
49
|
|
|
57
|
-
const result = await fetch(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
const result = await fetch(
|
|
51
|
+
`${baseURL}/activity-feedback?${new URLSearchParams(params)}`,
|
|
52
|
+
{
|
|
53
|
+
method: "GET",
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: `Bearer ${apiKey}`,
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
},
|
|
62
58
|
}
|
|
63
|
-
|
|
59
|
+
);
|
|
64
60
|
|
|
65
61
|
const data = await result.json();
|
|
66
62
|
console.log(data);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
63
|
```
|
|
71
64
|
|
|
72
|
-
|
|
73
65
|
**Expected Response:**
|
|
66
|
+
|
|
74
67
|
```json
|
|
75
68
|
{
|
|
76
69
|
"success": true,
|
|
@@ -80,18 +73,13 @@ console.log(data);
|
|
|
80
73
|
}
|
|
81
74
|
```
|
|
82
75
|
|
|
83
|
-
|
|
84
76
|
---
|
|
85
77
|
|
|
86
|
-
|
|
87
78
|
### Create new activity feedback
|
|
88
79
|
|
|
89
|
-
|
|
90
80
|
Create a new activity feedback entry
|
|
91
81
|
|
|
92
|
-
|
|
93
82
|
```typescript
|
|
94
|
-
|
|
95
83
|
// POST /activity-feedback
|
|
96
84
|
|
|
97
85
|
const requestBody = {
|
|
@@ -100,61 +88,48 @@ const requestBody = {
|
|
|
100
88
|
};
|
|
101
89
|
|
|
102
90
|
const result = await fetch(`${baseURL}/activity-feedback`, {
|
|
103
|
-
method:
|
|
91
|
+
method: "POST",
|
|
104
92
|
headers: {
|
|
105
|
-
|
|
106
|
-
|
|
93
|
+
Authorization: `Bearer ${apiKey}`,
|
|
94
|
+
"Content-Type": "application/json",
|
|
107
95
|
},
|
|
108
|
-
body: JSON.stringify(requestBody)
|
|
96
|
+
body: JSON.stringify(requestBody),
|
|
109
97
|
});
|
|
110
98
|
|
|
111
99
|
const data = await result.json();
|
|
112
100
|
console.log(data);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
101
|
```
|
|
117
102
|
|
|
118
|
-
|
|
119
|
-
|
|
120
103
|
---
|
|
121
104
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
105
|
### Get activity feedback by ID
|
|
126
106
|
|
|
127
|
-
|
|
128
107
|
Retrieve a specific activity feedback by its ID
|
|
129
108
|
|
|
130
|
-
|
|
131
109
|
```typescript
|
|
132
|
-
|
|
133
110
|
// GET /activity-feedback/{id}
|
|
134
111
|
|
|
135
112
|
const params = {
|
|
136
|
-
|
|
137
|
-
id: 'example-value', // Activity feedback ID
|
|
138
|
-
|
|
113
|
+
id: "example-value", // Activity feedback ID
|
|
139
114
|
};
|
|
140
115
|
|
|
141
|
-
const result = await fetch(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
116
|
+
const result = await fetch(
|
|
117
|
+
`${baseURL}/activity-feedback/{id}?${new URLSearchParams(params)}`,
|
|
118
|
+
{
|
|
119
|
+
method: "GET",
|
|
120
|
+
headers: {
|
|
121
|
+
Authorization: `Bearer ${apiKey}`,
|
|
122
|
+
"Content-Type": "application/json",
|
|
123
|
+
},
|
|
146
124
|
}
|
|
147
|
-
|
|
125
|
+
);
|
|
148
126
|
|
|
149
127
|
const data = await result.json();
|
|
150
128
|
console.log(data);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
129
|
```
|
|
155
130
|
|
|
156
|
-
|
|
157
131
|
**Expected Response:**
|
|
132
|
+
|
|
158
133
|
```json
|
|
159
134
|
{
|
|
160
135
|
"success": true,
|
|
@@ -164,47 +139,37 @@ console.log(data);
|
|
|
164
139
|
}
|
|
165
140
|
```
|
|
166
141
|
|
|
167
|
-
|
|
168
142
|
---
|
|
169
143
|
|
|
170
|
-
|
|
171
144
|
### Update activity feedback
|
|
172
145
|
|
|
173
|
-
|
|
174
146
|
Update an existing activity feedback
|
|
175
147
|
|
|
176
|
-
|
|
177
148
|
```typescript
|
|
178
|
-
|
|
179
149
|
// PATCH /activity-feedback/{id}
|
|
180
150
|
|
|
181
|
-
const id =
|
|
182
|
-
const updatePath =
|
|
183
|
-
|
|
184
|
-
|
|
151
|
+
const id = "your-resource-id";
|
|
152
|
+
const updatePath = "/activity-feedback/{id}".replace("{id}", id);
|
|
185
153
|
|
|
186
154
|
const updateData = {
|
|
187
155
|
// Add your update properties here
|
|
188
156
|
};
|
|
189
157
|
|
|
190
158
|
const result = await fetch(`${baseURL}${updatePath}`, {
|
|
191
|
-
method:
|
|
159
|
+
method: "PATCH",
|
|
192
160
|
headers: {
|
|
193
|
-
|
|
194
|
-
|
|
161
|
+
Authorization: `Bearer ${apiKey}`,
|
|
162
|
+
"Content-Type": "application/json",
|
|
195
163
|
},
|
|
196
|
-
body: JSON.stringify(updateData)
|
|
164
|
+
body: JSON.stringify(updateData),
|
|
197
165
|
});
|
|
198
166
|
|
|
199
167
|
const data = await result.json();
|
|
200
168
|
console.log(data);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
169
|
```
|
|
205
170
|
|
|
206
|
-
|
|
207
171
|
**Expected Response:**
|
|
172
|
+
|
|
208
173
|
```json
|
|
209
174
|
{
|
|
210
175
|
"success": true,
|
|
@@ -214,39 +179,32 @@ console.log(data);
|
|
|
214
179
|
}
|
|
215
180
|
```
|
|
216
181
|
|
|
217
|
-
|
|
218
182
|
---
|
|
219
183
|
|
|
220
|
-
|
|
221
184
|
### Delete activity feedback
|
|
222
185
|
|
|
223
|
-
|
|
224
186
|
Delete an activity feedback by ID
|
|
225
187
|
|
|
226
|
-
|
|
227
188
|
```typescript
|
|
228
|
-
|
|
229
189
|
// DELETE /activity-feedback/{id}
|
|
230
190
|
|
|
231
|
-
const id =
|
|
232
|
-
const deletePath =
|
|
191
|
+
const id = "your-resource-id";
|
|
192
|
+
const deletePath = "/activity-feedback/{id}".replace("{id}", id);
|
|
233
193
|
|
|
234
194
|
const result = await fetch(`${baseURL}${deletePath}`, {
|
|
235
|
-
method:
|
|
195
|
+
method: "DELETE",
|
|
236
196
|
headers: {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
197
|
+
Authorization: `Bearer ${apiKey}`,
|
|
198
|
+
"Content-Type": "application/json",
|
|
199
|
+
},
|
|
240
200
|
});
|
|
241
201
|
|
|
242
202
|
const data = await result.json();
|
|
243
203
|
console.log(data);
|
|
244
|
-
|
|
245
|
-
|
|
246
204
|
```
|
|
247
205
|
|
|
248
|
-
|
|
249
206
|
**Expected Response:**
|
|
207
|
+
|
|
250
208
|
```json
|
|
251
209
|
{
|
|
252
210
|
"success": true,
|
|
@@ -256,51 +214,42 @@ console.log(data);
|
|
|
256
214
|
}
|
|
257
215
|
```
|
|
258
216
|
|
|
259
|
-
|
|
260
217
|
---
|
|
261
218
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
219
|
### Get feedback analytics
|
|
266
220
|
|
|
267
|
-
|
|
268
221
|
Get analytics and statistics for activity feedback
|
|
269
222
|
|
|
270
|
-
|
|
271
223
|
```typescript
|
|
272
|
-
|
|
273
224
|
// GET /activity-feedback/analytics
|
|
274
225
|
|
|
275
226
|
const params = {
|
|
227
|
+
date_from: "example-value", // Start date for analytics
|
|
276
228
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
date_to: 'example-value', // End date for analytics
|
|
280
|
-
|
|
281
|
-
activity_type: 'example-value', // Filter by activity type
|
|
229
|
+
date_to: "example-value", // End date for analytics
|
|
282
230
|
|
|
283
|
-
|
|
231
|
+
activity_type: "example-value", // Filter by activity type
|
|
284
232
|
|
|
233
|
+
rep: "example-value", // Filter by representative ID
|
|
285
234
|
};
|
|
286
235
|
|
|
287
|
-
const result = await fetch(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
236
|
+
const result = await fetch(
|
|
237
|
+
`${baseURL}/activity-feedback/analytics?${new URLSearchParams(params)}`,
|
|
238
|
+
{
|
|
239
|
+
method: "GET",
|
|
240
|
+
headers: {
|
|
241
|
+
Authorization: `Bearer ${apiKey}`,
|
|
242
|
+
"Content-Type": "application/json",
|
|
243
|
+
},
|
|
292
244
|
}
|
|
293
|
-
|
|
245
|
+
);
|
|
294
246
|
|
|
295
247
|
const data = await result.json();
|
|
296
248
|
console.log(data);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
249
|
```
|
|
301
250
|
|
|
302
|
-
|
|
303
251
|
**Expected Response:**
|
|
252
|
+
|
|
304
253
|
```json
|
|
305
254
|
{
|
|
306
255
|
"success": true,
|
|
@@ -310,27 +259,21 @@ console.log(data);
|
|
|
310
259
|
}
|
|
311
260
|
```
|
|
312
261
|
|
|
313
|
-
|
|
314
262
|
---
|
|
315
263
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
264
|
## Using with Repzo SDK Service Types
|
|
320
265
|
|
|
321
266
|
The Repzo SDK provides TypeScript interfaces for type safety:
|
|
322
267
|
|
|
323
268
|
```typescript
|
|
324
|
-
import { Service } from
|
|
269
|
+
import { Service } from "repzo";
|
|
325
270
|
|
|
326
271
|
// Example using SDK types
|
|
327
272
|
|
|
328
|
-
|
|
329
273
|
async function example() {
|
|
330
274
|
// Use the Service.Activityfeedback types for better type safety
|
|
331
275
|
// This provides intellisense and compile-time type checking
|
|
332
276
|
}
|
|
333
|
-
|
|
334
277
|
```
|
|
335
278
|
|
|
336
279
|
## Error Handling
|
|
@@ -338,11 +281,11 @@ async function example() {
|
|
|
338
281
|
```typescript
|
|
339
282
|
try {
|
|
340
283
|
const result = await fetch(`${baseURL}/endpoint`, {
|
|
341
|
-
method:
|
|
284
|
+
method: "GET",
|
|
342
285
|
headers: {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
286
|
+
Authorization: `Bearer ${apiKey}`,
|
|
287
|
+
"Content-Type": "application/json",
|
|
288
|
+
},
|
|
346
289
|
});
|
|
347
290
|
|
|
348
291
|
if (!result.ok) {
|
|
@@ -350,14 +293,14 @@ try {
|
|
|
350
293
|
}
|
|
351
294
|
|
|
352
295
|
const data = await result.json();
|
|
353
|
-
|
|
296
|
+
|
|
354
297
|
if (!data.success) {
|
|
355
|
-
throw new Error(data.error ||
|
|
298
|
+
throw new Error(data.error || "API request failed");
|
|
356
299
|
}
|
|
357
|
-
|
|
300
|
+
|
|
358
301
|
return data.data;
|
|
359
302
|
} catch (error) {
|
|
360
|
-
console.error(
|
|
303
|
+
console.error("API request failed:", error);
|
|
361
304
|
throw error;
|
|
362
305
|
}
|
|
363
306
|
```
|
|
@@ -373,18 +316,21 @@ const params = {
|
|
|
373
316
|
// other filters...
|
|
374
317
|
};
|
|
375
318
|
|
|
376
|
-
const result = await fetch(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
319
|
+
const result = await fetch(
|
|
320
|
+
`${baseURL}/endpoint?${new URLSearchParams(params)}`,
|
|
321
|
+
{
|
|
322
|
+
method: "GET",
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: `Bearer ${apiKey}`,
|
|
325
|
+
"Content-Type": "application/json",
|
|
326
|
+
},
|
|
381
327
|
}
|
|
382
|
-
|
|
328
|
+
);
|
|
383
329
|
|
|
384
330
|
const data = await result.json();
|
|
385
331
|
|
|
386
332
|
// Access pagination info
|
|
387
|
-
console.log(
|
|
388
|
-
console.log(
|
|
389
|
-
console.log(
|
|
390
|
-
```
|
|
333
|
+
console.log("Total items:", data.paging.total);
|
|
334
|
+
console.log("Current page:", data.paging.page);
|
|
335
|
+
console.log("Total pages:", data.paging.pages);
|
|
336
|
+
```
|