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