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