repzo 1.0.141 → 1.0.143
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 +3 -4
- package/src/types/index.ts +14 -1
|
@@ -11,68 +11,61 @@ 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 v2
|
|
26
24
|
|
|
27
|
-
|
|
28
25
|
Retrieve a list of all activity feedback v2 with optional filtering and pagination
|
|
29
26
|
|
|
30
|
-
|
|
31
27
|
```typescript
|
|
32
|
-
|
|
33
28
|
// GET /activity-feedback-v2
|
|
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
|
overall_satisfaction: 1, // Filter by overall satisfaction rating
|
|
52
46
|
|
|
53
|
-
template_id:
|
|
47
|
+
template_id: "example-value", // Filter by feedback template ID
|
|
54
48
|
|
|
55
49
|
_id: null, // Filter by ID
|
|
56
|
-
|
|
57
50
|
};
|
|
58
51
|
|
|
59
|
-
const result = await fetch(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
const result = await fetch(
|
|
53
|
+
`${baseURL}/activity-feedback-v2?${new URLSearchParams(params)}`,
|
|
54
|
+
{
|
|
55
|
+
method: "GET",
|
|
56
|
+
headers: {
|
|
57
|
+
Authorization: `Bearer ${apiKey}`,
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
},
|
|
64
60
|
}
|
|
65
|
-
|
|
61
|
+
);
|
|
66
62
|
|
|
67
63
|
const data = await result.json();
|
|
68
64
|
console.log(data);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
65
|
```
|
|
73
66
|
|
|
74
|
-
|
|
75
67
|
**Expected Response:**
|
|
68
|
+
|
|
76
69
|
```json
|
|
77
70
|
{
|
|
78
71
|
"success": true,
|
|
@@ -82,18 +75,13 @@ console.log(data);
|
|
|
82
75
|
}
|
|
83
76
|
```
|
|
84
77
|
|
|
85
|
-
|
|
86
78
|
---
|
|
87
79
|
|
|
88
|
-
|
|
89
80
|
### Create new activity feedback v2
|
|
90
81
|
|
|
91
|
-
|
|
92
82
|
Create a new activity feedback v2 entry
|
|
93
83
|
|
|
94
|
-
|
|
95
84
|
```typescript
|
|
96
|
-
|
|
97
85
|
// POST /activity-feedback-v2
|
|
98
86
|
|
|
99
87
|
const requestBody = {
|
|
@@ -102,61 +90,48 @@ const requestBody = {
|
|
|
102
90
|
};
|
|
103
91
|
|
|
104
92
|
const result = await fetch(`${baseURL}/activity-feedback-v2`, {
|
|
105
|
-
method:
|
|
93
|
+
method: "POST",
|
|
106
94
|
headers: {
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
Authorization: `Bearer ${apiKey}`,
|
|
96
|
+
"Content-Type": "application/json",
|
|
109
97
|
},
|
|
110
|
-
body: JSON.stringify(requestBody)
|
|
98
|
+
body: JSON.stringify(requestBody),
|
|
111
99
|
});
|
|
112
100
|
|
|
113
101
|
const data = await result.json();
|
|
114
102
|
console.log(data);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
103
|
```
|
|
119
104
|
|
|
120
|
-
|
|
121
|
-
|
|
122
105
|
---
|
|
123
106
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
107
|
### Get activity feedback v2 by ID
|
|
128
108
|
|
|
129
|
-
|
|
130
109
|
Retrieve a specific activity feedback v2 by its ID
|
|
131
110
|
|
|
132
|
-
|
|
133
111
|
```typescript
|
|
134
|
-
|
|
135
112
|
// GET /activity-feedback-v2/{id}
|
|
136
113
|
|
|
137
114
|
const params = {
|
|
138
|
-
|
|
139
|
-
id: 'example-value', // Activity feedback v2 ID
|
|
140
|
-
|
|
115
|
+
id: "example-value", // Activity feedback v2 ID
|
|
141
116
|
};
|
|
142
117
|
|
|
143
|
-
const result = await fetch(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
118
|
+
const result = await fetch(
|
|
119
|
+
`${baseURL}/activity-feedback-v2/{id}?${new URLSearchParams(params)}`,
|
|
120
|
+
{
|
|
121
|
+
method: "GET",
|
|
122
|
+
headers: {
|
|
123
|
+
Authorization: `Bearer ${apiKey}`,
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
},
|
|
148
126
|
}
|
|
149
|
-
|
|
127
|
+
);
|
|
150
128
|
|
|
151
129
|
const data = await result.json();
|
|
152
130
|
console.log(data);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
131
|
```
|
|
157
132
|
|
|
158
|
-
|
|
159
133
|
**Expected Response:**
|
|
134
|
+
|
|
160
135
|
```json
|
|
161
136
|
{
|
|
162
137
|
"success": true,
|
|
@@ -166,47 +141,37 @@ console.log(data);
|
|
|
166
141
|
}
|
|
167
142
|
```
|
|
168
143
|
|
|
169
|
-
|
|
170
144
|
---
|
|
171
145
|
|
|
172
|
-
|
|
173
146
|
### Update activity feedback v2
|
|
174
147
|
|
|
175
|
-
|
|
176
148
|
Update an existing activity feedback v2
|
|
177
149
|
|
|
178
|
-
|
|
179
150
|
```typescript
|
|
180
|
-
|
|
181
151
|
// PATCH /activity-feedback-v2/{id}
|
|
182
152
|
|
|
183
|
-
const id =
|
|
184
|
-
const updatePath =
|
|
185
|
-
|
|
186
|
-
|
|
153
|
+
const id = "your-resource-id";
|
|
154
|
+
const updatePath = "/activity-feedback-v2/{id}".replace("{id}", id);
|
|
187
155
|
|
|
188
156
|
const updateData = {
|
|
189
157
|
// Add your update properties here
|
|
190
158
|
};
|
|
191
159
|
|
|
192
160
|
const result = await fetch(`${baseURL}${updatePath}`, {
|
|
193
|
-
method:
|
|
161
|
+
method: "PATCH",
|
|
194
162
|
headers: {
|
|
195
|
-
|
|
196
|
-
|
|
163
|
+
Authorization: `Bearer ${apiKey}`,
|
|
164
|
+
"Content-Type": "application/json",
|
|
197
165
|
},
|
|
198
|
-
body: JSON.stringify(updateData)
|
|
166
|
+
body: JSON.stringify(updateData),
|
|
199
167
|
});
|
|
200
168
|
|
|
201
169
|
const data = await result.json();
|
|
202
170
|
console.log(data);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
171
|
```
|
|
207
172
|
|
|
208
|
-
|
|
209
173
|
**Expected Response:**
|
|
174
|
+
|
|
210
175
|
```json
|
|
211
176
|
{
|
|
212
177
|
"success": true,
|
|
@@ -216,39 +181,32 @@ console.log(data);
|
|
|
216
181
|
}
|
|
217
182
|
```
|
|
218
183
|
|
|
219
|
-
|
|
220
184
|
---
|
|
221
185
|
|
|
222
|
-
|
|
223
186
|
### Delete activity feedback v2
|
|
224
187
|
|
|
225
|
-
|
|
226
188
|
Delete an activity feedback v2 by ID
|
|
227
189
|
|
|
228
|
-
|
|
229
190
|
```typescript
|
|
230
|
-
|
|
231
191
|
// DELETE /activity-feedback-v2/{id}
|
|
232
192
|
|
|
233
|
-
const id =
|
|
234
|
-
const deletePath =
|
|
193
|
+
const id = "your-resource-id";
|
|
194
|
+
const deletePath = "/activity-feedback-v2/{id}".replace("{id}", id);
|
|
235
195
|
|
|
236
196
|
const result = await fetch(`${baseURL}${deletePath}`, {
|
|
237
|
-
method:
|
|
197
|
+
method: "DELETE",
|
|
238
198
|
headers: {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
199
|
+
Authorization: `Bearer ${apiKey}`,
|
|
200
|
+
"Content-Type": "application/json",
|
|
201
|
+
},
|
|
242
202
|
});
|
|
243
203
|
|
|
244
204
|
const data = await result.json();
|
|
245
205
|
console.log(data);
|
|
246
|
-
|
|
247
|
-
|
|
248
206
|
```
|
|
249
207
|
|
|
250
|
-
|
|
251
208
|
**Expected Response:**
|
|
209
|
+
|
|
252
210
|
```json
|
|
253
211
|
{
|
|
254
212
|
"success": true,
|
|
@@ -258,53 +216,46 @@ console.log(data);
|
|
|
258
216
|
}
|
|
259
217
|
```
|
|
260
218
|
|
|
261
|
-
|
|
262
219
|
---
|
|
263
220
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
221
|
### Get detailed feedback analytics
|
|
268
222
|
|
|
269
|
-
|
|
270
223
|
Get detailed analytics and insights for activity feedback v2
|
|
271
224
|
|
|
272
|
-
|
|
273
225
|
```typescript
|
|
274
|
-
|
|
275
226
|
// GET /activity-feedback-v2/analytics/detailed
|
|
276
227
|
|
|
277
228
|
const params = {
|
|
229
|
+
date_from: "example-value", // Start date for analytics
|
|
278
230
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
date_to: 'example-value', // End date for analytics
|
|
282
|
-
|
|
283
|
-
activity_type: 'example-value', // Filter by activity type
|
|
231
|
+
date_to: "example-value", // End date for analytics
|
|
284
232
|
|
|
285
|
-
|
|
233
|
+
activity_type: "example-value", // Filter by activity type
|
|
286
234
|
|
|
287
|
-
|
|
235
|
+
rep: "example-value", // Filter by representative ID
|
|
288
236
|
|
|
237
|
+
template_id: "example-value", // Filter by feedback template ID
|
|
289
238
|
};
|
|
290
239
|
|
|
291
|
-
const result = await fetch(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
240
|
+
const result = await fetch(
|
|
241
|
+
`${baseURL}/activity-feedback-v2/analytics/detailed?${new URLSearchParams(
|
|
242
|
+
params
|
|
243
|
+
)}`,
|
|
244
|
+
{
|
|
245
|
+
method: "GET",
|
|
246
|
+
headers: {
|
|
247
|
+
Authorization: `Bearer ${apiKey}`,
|
|
248
|
+
"Content-Type": "application/json",
|
|
249
|
+
},
|
|
296
250
|
}
|
|
297
|
-
|
|
251
|
+
);
|
|
298
252
|
|
|
299
253
|
const data = await result.json();
|
|
300
254
|
console.log(data);
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
255
|
```
|
|
305
256
|
|
|
306
|
-
|
|
307
257
|
**Expected Response:**
|
|
258
|
+
|
|
308
259
|
```json
|
|
309
260
|
{
|
|
310
261
|
"success": true,
|
|
@@ -314,27 +265,21 @@ console.log(data);
|
|
|
314
265
|
}
|
|
315
266
|
```
|
|
316
267
|
|
|
317
|
-
|
|
318
268
|
---
|
|
319
269
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
270
|
## Using with Repzo SDK Service Types
|
|
324
271
|
|
|
325
272
|
The Repzo SDK provides TypeScript interfaces for type safety:
|
|
326
273
|
|
|
327
274
|
```typescript
|
|
328
|
-
import { Service } from
|
|
275
|
+
import { Service } from "repzo";
|
|
329
276
|
|
|
330
277
|
// Example using SDK types
|
|
331
278
|
|
|
332
|
-
|
|
333
279
|
async function example() {
|
|
334
280
|
// Use the Service.Activityfeedbackv2 types for better type safety
|
|
335
281
|
// This provides intellisense and compile-time type checking
|
|
336
282
|
}
|
|
337
|
-
|
|
338
283
|
```
|
|
339
284
|
|
|
340
285
|
## Error Handling
|
|
@@ -342,11 +287,11 @@ async function example() {
|
|
|
342
287
|
```typescript
|
|
343
288
|
try {
|
|
344
289
|
const result = await fetch(`${baseURL}/endpoint`, {
|
|
345
|
-
method:
|
|
290
|
+
method: "GET",
|
|
346
291
|
headers: {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
292
|
+
Authorization: `Bearer ${apiKey}`,
|
|
293
|
+
"Content-Type": "application/json",
|
|
294
|
+
},
|
|
350
295
|
});
|
|
351
296
|
|
|
352
297
|
if (!result.ok) {
|
|
@@ -354,14 +299,14 @@ try {
|
|
|
354
299
|
}
|
|
355
300
|
|
|
356
301
|
const data = await result.json();
|
|
357
|
-
|
|
302
|
+
|
|
358
303
|
if (!data.success) {
|
|
359
|
-
throw new Error(data.error ||
|
|
304
|
+
throw new Error(data.error || "API request failed");
|
|
360
305
|
}
|
|
361
|
-
|
|
306
|
+
|
|
362
307
|
return data.data;
|
|
363
308
|
} catch (error) {
|
|
364
|
-
console.error(
|
|
309
|
+
console.error("API request failed:", error);
|
|
365
310
|
throw error;
|
|
366
311
|
}
|
|
367
312
|
```
|
|
@@ -377,18 +322,21 @@ const params = {
|
|
|
377
322
|
// other filters...
|
|
378
323
|
};
|
|
379
324
|
|
|
380
|
-
const result = await fetch(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
325
|
+
const result = await fetch(
|
|
326
|
+
`${baseURL}/endpoint?${new URLSearchParams(params)}`,
|
|
327
|
+
{
|
|
328
|
+
method: "GET",
|
|
329
|
+
headers: {
|
|
330
|
+
Authorization: `Bearer ${apiKey}`,
|
|
331
|
+
"Content-Type": "application/json",
|
|
332
|
+
},
|
|
385
333
|
}
|
|
386
|
-
|
|
334
|
+
);
|
|
387
335
|
|
|
388
336
|
const data = await result.json();
|
|
389
337
|
|
|
390
338
|
// Access pagination info
|
|
391
|
-
console.log(
|
|
392
|
-
console.log(
|
|
393
|
-
console.log(
|
|
394
|
-
```
|
|
339
|
+
console.log("Total items:", data.paging.total);
|
|
340
|
+
console.log("Current page:", data.paging.page);
|
|
341
|
+
console.log("Total pages:", data.paging.pages);
|
|
342
|
+
```
|