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,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 contract installments
|
|
26
24
|
|
|
27
|
-
|
|
28
25
|
Retrieve a list of all contract installments with optional filtering and pagination
|
|
29
26
|
|
|
30
|
-
|
|
31
27
|
```typescript
|
|
32
|
-
|
|
33
28
|
// GET /contract-installment
|
|
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
|
-
contract:
|
|
39
|
+
contract: "example-value", // Filter by contract ID
|
|
46
40
|
|
|
47
|
-
status:
|
|
41
|
+
status: "example-value", // Filter by payment status
|
|
48
42
|
|
|
49
|
-
due_date_from:
|
|
43
|
+
due_date_from: "example-value", // Filter by due date from
|
|
50
44
|
|
|
51
|
-
due_date_to:
|
|
45
|
+
due_date_to: "example-value", // Filter by due date to
|
|
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}/contract-installment?${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 a new contract installment
|
|
88
79
|
|
|
89
|
-
|
|
90
80
|
Create a new contract installment
|
|
91
81
|
|
|
92
|
-
|
|
93
82
|
```typescript
|
|
94
|
-
|
|
95
83
|
// POST /contract-installment
|
|
96
84
|
|
|
97
85
|
const requestBody = {
|
|
@@ -100,61 +88,48 @@ const requestBody = {
|
|
|
100
88
|
};
|
|
101
89
|
|
|
102
90
|
const result = await fetch(`${baseURL}/contract-installment`, {
|
|
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 contract installment by ID
|
|
126
106
|
|
|
127
|
-
|
|
128
107
|
Retrieve a specific contract installment by its ID
|
|
129
108
|
|
|
130
|
-
|
|
131
109
|
```typescript
|
|
132
|
-
|
|
133
110
|
// GET /contract-installment/{id}
|
|
134
111
|
|
|
135
112
|
const params = {
|
|
136
|
-
|
|
137
|
-
id: 'example-value', // Contract installment ID
|
|
138
|
-
|
|
113
|
+
id: "example-value", // Contract installment ID
|
|
139
114
|
};
|
|
140
115
|
|
|
141
|
-
const result = await fetch(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
116
|
+
const result = await fetch(
|
|
117
|
+
`${baseURL}/contract-installment/{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 contract installment
|
|
172
145
|
|
|
173
|
-
|
|
174
146
|
Update an existing contract installment
|
|
175
147
|
|
|
176
|
-
|
|
177
148
|
```typescript
|
|
178
|
-
|
|
179
149
|
// PATCH /contract-installment/{id}
|
|
180
150
|
|
|
181
|
-
const id =
|
|
182
|
-
const updatePath =
|
|
183
|
-
|
|
184
|
-
|
|
151
|
+
const id = "your-resource-id";
|
|
152
|
+
const updatePath = "/contract-installment/{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 contract installment
|
|
222
185
|
|
|
223
|
-
|
|
224
186
|
Delete a contract installment by ID
|
|
225
187
|
|
|
226
|
-
|
|
227
188
|
```typescript
|
|
228
|
-
|
|
229
189
|
// DELETE /contract-installment/{id}
|
|
230
190
|
|
|
231
|
-
const id =
|
|
232
|
-
const deletePath =
|
|
191
|
+
const id = "your-resource-id";
|
|
192
|
+
const deletePath = "/contract-installment/{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,20 +214,13 @@ console.log(data);
|
|
|
256
214
|
}
|
|
257
215
|
```
|
|
258
216
|
|
|
259
|
-
|
|
260
217
|
---
|
|
261
218
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
219
|
### Mark installment as paid
|
|
266
220
|
|
|
267
|
-
|
|
268
221
|
Mark a contract installment as paid
|
|
269
222
|
|
|
270
|
-
|
|
271
223
|
```typescript
|
|
272
|
-
|
|
273
224
|
// POST /contract-installment/{id}/pay
|
|
274
225
|
|
|
275
226
|
const requestBody = {
|
|
@@ -278,23 +229,20 @@ const requestBody = {
|
|
|
278
229
|
};
|
|
279
230
|
|
|
280
231
|
const result = await fetch(`${baseURL}/contract-installment/{id}/pay`, {
|
|
281
|
-
method:
|
|
232
|
+
method: "POST",
|
|
282
233
|
headers: {
|
|
283
|
-
|
|
284
|
-
|
|
234
|
+
Authorization: `Bearer ${apiKey}`,
|
|
235
|
+
"Content-Type": "application/json",
|
|
285
236
|
},
|
|
286
|
-
body: JSON.stringify(requestBody)
|
|
237
|
+
body: JSON.stringify(requestBody),
|
|
287
238
|
});
|
|
288
239
|
|
|
289
240
|
const data = await result.json();
|
|
290
241
|
console.log(data);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
242
|
```
|
|
295
243
|
|
|
296
|
-
|
|
297
244
|
**Expected Response:**
|
|
245
|
+
|
|
298
246
|
```json
|
|
299
247
|
{
|
|
300
248
|
"success": true,
|
|
@@ -304,49 +252,40 @@ console.log(data);
|
|
|
304
252
|
}
|
|
305
253
|
```
|
|
306
254
|
|
|
307
|
-
|
|
308
255
|
---
|
|
309
256
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
257
|
### Get overdue installments
|
|
314
258
|
|
|
315
|
-
|
|
316
259
|
Get all overdue contract installments
|
|
317
260
|
|
|
318
|
-
|
|
319
261
|
```typescript
|
|
320
|
-
|
|
321
262
|
// GET /contract-installment/overdue
|
|
322
263
|
|
|
323
264
|
const params = {
|
|
324
|
-
|
|
325
265
|
page: 1, // Page number for pagination
|
|
326
266
|
|
|
327
267
|
per_page: 1, // Number of items per page
|
|
328
268
|
|
|
329
269
|
days_overdue: 1, // Minimum days overdue
|
|
330
|
-
|
|
331
270
|
};
|
|
332
271
|
|
|
333
|
-
const result = await fetch(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
272
|
+
const result = await fetch(
|
|
273
|
+
`${baseURL}/contract-installment/overdue?${new URLSearchParams(params)}`,
|
|
274
|
+
{
|
|
275
|
+
method: "GET",
|
|
276
|
+
headers: {
|
|
277
|
+
Authorization: `Bearer ${apiKey}`,
|
|
278
|
+
"Content-Type": "application/json",
|
|
279
|
+
},
|
|
338
280
|
}
|
|
339
|
-
|
|
281
|
+
);
|
|
340
282
|
|
|
341
283
|
const data = await result.json();
|
|
342
284
|
console.log(data);
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
285
|
```
|
|
347
286
|
|
|
348
|
-
|
|
349
287
|
**Expected Response:**
|
|
288
|
+
|
|
350
289
|
```json
|
|
351
290
|
{
|
|
352
291
|
"success": true,
|
|
@@ -356,27 +295,21 @@ console.log(data);
|
|
|
356
295
|
}
|
|
357
296
|
```
|
|
358
297
|
|
|
359
|
-
|
|
360
298
|
---
|
|
361
299
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
300
|
## Using with Repzo SDK Service Types
|
|
366
301
|
|
|
367
302
|
The Repzo SDK provides TypeScript interfaces for type safety:
|
|
368
303
|
|
|
369
304
|
```typescript
|
|
370
|
-
import { Service } from
|
|
305
|
+
import { Service } from "repzo";
|
|
371
306
|
|
|
372
307
|
// Example using SDK types
|
|
373
308
|
|
|
374
|
-
|
|
375
309
|
async function example() {
|
|
376
310
|
// Use the Service.Contractinstallment types for better type safety
|
|
377
311
|
// This provides intellisense and compile-time type checking
|
|
378
312
|
}
|
|
379
|
-
|
|
380
313
|
```
|
|
381
314
|
|
|
382
315
|
## Error Handling
|
|
@@ -384,11 +317,11 @@ async function example() {
|
|
|
384
317
|
```typescript
|
|
385
318
|
try {
|
|
386
319
|
const result = await fetch(`${baseURL}/endpoint`, {
|
|
387
|
-
method:
|
|
320
|
+
method: "GET",
|
|
388
321
|
headers: {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
322
|
+
Authorization: `Bearer ${apiKey}`,
|
|
323
|
+
"Content-Type": "application/json",
|
|
324
|
+
},
|
|
392
325
|
});
|
|
393
326
|
|
|
394
327
|
if (!result.ok) {
|
|
@@ -396,14 +329,14 @@ try {
|
|
|
396
329
|
}
|
|
397
330
|
|
|
398
331
|
const data = await result.json();
|
|
399
|
-
|
|
332
|
+
|
|
400
333
|
if (!data.success) {
|
|
401
|
-
throw new Error(data.error ||
|
|
334
|
+
throw new Error(data.error || "API request failed");
|
|
402
335
|
}
|
|
403
|
-
|
|
336
|
+
|
|
404
337
|
return data.data;
|
|
405
338
|
} catch (error) {
|
|
406
|
-
console.error(
|
|
339
|
+
console.error("API request failed:", error);
|
|
407
340
|
throw error;
|
|
408
341
|
}
|
|
409
342
|
```
|
|
@@ -419,18 +352,21 @@ const params = {
|
|
|
419
352
|
// other filters...
|
|
420
353
|
};
|
|
421
354
|
|
|
422
|
-
const result = await fetch(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
355
|
+
const result = await fetch(
|
|
356
|
+
`${baseURL}/endpoint?${new URLSearchParams(params)}`,
|
|
357
|
+
{
|
|
358
|
+
method: "GET",
|
|
359
|
+
headers: {
|
|
360
|
+
Authorization: `Bearer ${apiKey}`,
|
|
361
|
+
"Content-Type": "application/json",
|
|
362
|
+
},
|
|
427
363
|
}
|
|
428
|
-
|
|
364
|
+
);
|
|
429
365
|
|
|
430
366
|
const data = await result.json();
|
|
431
367
|
|
|
432
368
|
// Access pagination info
|
|
433
|
-
console.log(
|
|
434
|
-
console.log(
|
|
435
|
-
console.log(
|
|
436
|
-
```
|
|
369
|
+
console.log("Total items:", data.paging.total);
|
|
370
|
+
console.log("Current page:", data.paging.page);
|
|
371
|
+
console.log("Total pages:", data.paging.pages);
|
|
372
|
+
```
|