repzo 1.0.2 → 1.0.5
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/changelog.md +19 -0
- package/lib/index.d.ts +197 -0
- package/lib/index.js +539 -10
- package/lib/types/index.d.ts +3429 -30
- package/package.json +34 -26
- package/src/index.ts +1312 -6
- package/src/types/index.ts +3507 -30
- package/tsconfig.json +16 -15
package/lib/index.js
CHANGED
|
@@ -21,49 +21,578 @@ export default class Repzo {
|
|
|
21
21
|
remove: async (id) => {
|
|
22
22
|
let res = await this._delete(this.svAPIEndpoint, this.client._path + `/${id}`);
|
|
23
23
|
return res;
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
this.product = {
|
|
27
|
+
_path: "/product",
|
|
28
|
+
find: async (params) => {
|
|
29
|
+
let res = await this._fetch(this.svAPIEndpoint, this.product._path, params);
|
|
30
|
+
return res;
|
|
31
|
+
},
|
|
32
|
+
get: async (id, params) => {
|
|
33
|
+
return await this._fetch(this.svAPIEndpoint, this.product._path + `/${id}`, params);
|
|
34
|
+
},
|
|
35
|
+
create: async (body) => {
|
|
36
|
+
let res = await this._create(this.svAPIEndpoint, this.product._path, body);
|
|
37
|
+
return res;
|
|
38
|
+
},
|
|
39
|
+
update: async (id, body) => {
|
|
40
|
+
let res = await this._update(this.svAPIEndpoint, this.product._path + `/${id}`, body);
|
|
41
|
+
return res;
|
|
42
|
+
},
|
|
43
|
+
remove: async (id) => {
|
|
44
|
+
let res = await this._delete(this.svAPIEndpoint, this.product._path + `/${id}`);
|
|
45
|
+
return res;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
this.variant = {
|
|
49
|
+
_path: "/variant",
|
|
50
|
+
find: async (params) => {
|
|
51
|
+
let res = await this._fetch(this.svAPIEndpoint, this.variant._path, params);
|
|
52
|
+
return res;
|
|
53
|
+
},
|
|
54
|
+
get: async (id, params) => {
|
|
55
|
+
return await this._fetch(this.svAPIEndpoint, this.variant._path + `/${id}`, params);
|
|
56
|
+
},
|
|
57
|
+
create: async (body) => {
|
|
58
|
+
let res = await this._create(this.svAPIEndpoint, this.variant._path, body);
|
|
59
|
+
return res;
|
|
60
|
+
},
|
|
61
|
+
update: async (id, body) => {
|
|
62
|
+
let res = await this._update(this.svAPIEndpoint, this.variant._path + `/${id}`, body);
|
|
63
|
+
return res;
|
|
64
|
+
},
|
|
65
|
+
remove: async (id) => {
|
|
66
|
+
let res = await this._delete(this.svAPIEndpoint, this.variant._path + `/${id}`);
|
|
67
|
+
return res;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
this.category = {
|
|
71
|
+
_path: "/product-category",
|
|
72
|
+
find: async (params) => {
|
|
73
|
+
let res = await this._fetch(this.svAPIEndpoint, this.category._path, params);
|
|
74
|
+
return res;
|
|
75
|
+
},
|
|
76
|
+
get: async (id) => {
|
|
77
|
+
return await this._fetch(this.svAPIEndpoint, this.category._path + `/${id}`);
|
|
78
|
+
},
|
|
79
|
+
create: async (body) => {
|
|
80
|
+
let res = await this._create(this.svAPIEndpoint, this.category._path, body);
|
|
81
|
+
return res;
|
|
82
|
+
},
|
|
83
|
+
update: async (id, body) => {
|
|
84
|
+
let res = await this._update(this.svAPIEndpoint, this.category._path + `/${id}`, body);
|
|
85
|
+
return res;
|
|
86
|
+
},
|
|
87
|
+
remove: async (id) => {
|
|
88
|
+
let res = await this._delete(this.svAPIEndpoint, this.category._path + `/${id}`);
|
|
89
|
+
return res;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
this.sub_category = {
|
|
93
|
+
_path: "/product-sub-category",
|
|
94
|
+
find: async (params) => {
|
|
95
|
+
let res = await this._fetch(this.svAPIEndpoint, this.sub_category._path, params);
|
|
96
|
+
return res;
|
|
97
|
+
},
|
|
98
|
+
get: async (id, params) => {
|
|
99
|
+
return await this._fetch(this.svAPIEndpoint, this.sub_category._path + `/${id}`, params);
|
|
100
|
+
},
|
|
101
|
+
create: async (body) => {
|
|
102
|
+
let res = await this._create(this.svAPIEndpoint, this.sub_category._path, body);
|
|
103
|
+
return res;
|
|
104
|
+
},
|
|
105
|
+
update: async (id, body) => {
|
|
106
|
+
let res = await this._update(this.svAPIEndpoint, this.sub_category._path + `/${id}`, body);
|
|
107
|
+
return res;
|
|
108
|
+
},
|
|
109
|
+
remove: async (id) => {
|
|
110
|
+
let res = await this._delete(this.svAPIEndpoint, this.sub_category._path + `/${id}`);
|
|
111
|
+
return res;
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
this.brand = {
|
|
115
|
+
_path: "/product-brand",
|
|
116
|
+
find: async (params) => {
|
|
117
|
+
let res = await this._fetch(this.svAPIEndpoint, this.brand._path, params);
|
|
118
|
+
return res;
|
|
119
|
+
},
|
|
120
|
+
get: async (id) => {
|
|
121
|
+
return await this._fetch(this.svAPIEndpoint, this.brand._path + `/${id}`);
|
|
122
|
+
},
|
|
123
|
+
create: async (body) => {
|
|
124
|
+
let res = await this._create(this.svAPIEndpoint, this.brand._path, body);
|
|
125
|
+
return res;
|
|
126
|
+
},
|
|
127
|
+
update: async (id, body) => {
|
|
128
|
+
let res = await this._update(this.svAPIEndpoint, this.brand._path + `/${id}`, body);
|
|
129
|
+
return res;
|
|
130
|
+
},
|
|
131
|
+
remove: async (id) => {
|
|
132
|
+
let res = await this._delete(this.svAPIEndpoint, this.brand._path + `/${id}`);
|
|
133
|
+
return res;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
this.product_group = {
|
|
137
|
+
_path: "/product-group",
|
|
138
|
+
find: async (params) => {
|
|
139
|
+
let res = await this._fetch(this.svAPIEndpoint, this.product_group._path, params);
|
|
140
|
+
return res;
|
|
141
|
+
},
|
|
142
|
+
get: async (id) => {
|
|
143
|
+
return await this._fetch(this.svAPIEndpoint, this.product_group._path + `/${id}`);
|
|
144
|
+
},
|
|
145
|
+
create: async (body) => {
|
|
146
|
+
let res = await this._create(this.svAPIEndpoint, this.product_group._path, body);
|
|
147
|
+
return res;
|
|
148
|
+
},
|
|
149
|
+
update: async (id, body) => {
|
|
150
|
+
let res = await this._update(this.svAPIEndpoint, this.product_group._path + `/${id}`, body);
|
|
151
|
+
return res;
|
|
152
|
+
},
|
|
153
|
+
remove: async (id) => {
|
|
154
|
+
let res = await this._delete(this.svAPIEndpoint, this.product_group._path + `/${id}`);
|
|
155
|
+
return res;
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
this.tax = {
|
|
159
|
+
_path: "/tax",
|
|
160
|
+
find: async (params) => {
|
|
161
|
+
let res = await this._fetch(this.svAPIEndpoint, this.tax._path, params);
|
|
162
|
+
return res;
|
|
163
|
+
},
|
|
164
|
+
get: async (id) => {
|
|
165
|
+
return await this._fetch(this.svAPIEndpoint, this.tax._path + `/${id}`);
|
|
166
|
+
},
|
|
167
|
+
create: async (body) => {
|
|
168
|
+
let res = await this._create(this.svAPIEndpoint, this.tax._path, body);
|
|
169
|
+
return res;
|
|
170
|
+
},
|
|
171
|
+
update: async (id, body) => {
|
|
172
|
+
let res = await this._update(this.svAPIEndpoint, this.tax._path + `/${id}`, body);
|
|
173
|
+
return res;
|
|
174
|
+
},
|
|
175
|
+
remove: async (id) => {
|
|
176
|
+
let res = await this._delete(this.svAPIEndpoint, this.tax._path + `/${id}`);
|
|
177
|
+
return res;
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
this.measureunit = {
|
|
181
|
+
_path: "/measureunits",
|
|
182
|
+
find: async (params) => {
|
|
183
|
+
let res = await this._fetch(this.svAPIEndpoint, this.measureunit._path, params);
|
|
184
|
+
return res;
|
|
185
|
+
},
|
|
186
|
+
get: async (id) => {
|
|
187
|
+
return await this._fetch(this.svAPIEndpoint, this.measureunit._path + `/${id}`);
|
|
188
|
+
},
|
|
189
|
+
create: async (body) => {
|
|
190
|
+
let res = await this._create(this.svAPIEndpoint, this.measureunit._path, body);
|
|
191
|
+
return res;
|
|
192
|
+
},
|
|
193
|
+
update: async (id, body) => {
|
|
194
|
+
let res = await this._update(this.svAPIEndpoint, this.measureunit._path + `/${id}`, body);
|
|
195
|
+
return res;
|
|
196
|
+
},
|
|
197
|
+
remove: async (id) => {
|
|
198
|
+
let res = await this._delete(this.svAPIEndpoint, this.measureunit._path + `/${id}`);
|
|
199
|
+
return res;
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
this.measureunitFamily = {
|
|
203
|
+
_path: "/measureunit-family",
|
|
204
|
+
find: async (params) => {
|
|
205
|
+
let res = await this._fetch(this.svAPIEndpoint, this.measureunitFamily._path, params);
|
|
206
|
+
return res;
|
|
207
|
+
},
|
|
208
|
+
get: async (id) => {
|
|
209
|
+
return await this._fetch(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`);
|
|
210
|
+
},
|
|
211
|
+
create: async (body) => {
|
|
212
|
+
let res = await this._create(this.svAPIEndpoint, this.measureunitFamily._path, body);
|
|
213
|
+
return res;
|
|
214
|
+
},
|
|
215
|
+
update: async (id, body) => {
|
|
216
|
+
let res = await this._update(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`, body);
|
|
217
|
+
return res;
|
|
218
|
+
},
|
|
219
|
+
remove: async (id) => {
|
|
220
|
+
let res = await this._delete(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`);
|
|
221
|
+
return res;
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
this.media = {
|
|
225
|
+
_path: "/media",
|
|
226
|
+
find: async (params) => {
|
|
227
|
+
let res = await this._fetch(this.svAPIEndpoint, this.media._path, params);
|
|
228
|
+
return res;
|
|
229
|
+
},
|
|
230
|
+
get: async (id) => {
|
|
231
|
+
return await this._fetch(this.svAPIEndpoint, this.media._path + `/${id}`);
|
|
232
|
+
},
|
|
233
|
+
create: async (body) => {
|
|
234
|
+
let res = await this._create(this.svAPIEndpoint, this.media._path, body);
|
|
235
|
+
return res;
|
|
236
|
+
},
|
|
237
|
+
update: async (id, body) => {
|
|
238
|
+
let res = await this._update(this.svAPIEndpoint, this.media._path + `/${id}`, body);
|
|
239
|
+
return res;
|
|
240
|
+
},
|
|
241
|
+
remove: async (id) => {
|
|
242
|
+
let res = await this._delete(this.svAPIEndpoint, this.media._path + `/${id}`);
|
|
243
|
+
return res;
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
this.priceList = {
|
|
247
|
+
_path: "/pricelists",
|
|
248
|
+
find: async (params) => {
|
|
249
|
+
let res = await this._fetch(this.svAPIEndpoint, this.priceList._path, params);
|
|
250
|
+
return res;
|
|
251
|
+
},
|
|
252
|
+
get: async (id) => {
|
|
253
|
+
return await this._fetch(this.svAPIEndpoint, this.priceList._path + `/${id}`);
|
|
254
|
+
},
|
|
255
|
+
create: async (body) => {
|
|
256
|
+
let res = await this._create(this.svAPIEndpoint, this.priceList._path, body);
|
|
257
|
+
return res;
|
|
258
|
+
},
|
|
259
|
+
update: async (id, body) => {
|
|
260
|
+
let res = await this._update(this.svAPIEndpoint, this.priceList._path + `/${id}`, body);
|
|
261
|
+
return res;
|
|
262
|
+
},
|
|
263
|
+
remove: async (id) => {
|
|
264
|
+
let res = await this._delete(this.svAPIEndpoint, this.priceList._path + `/${id}`);
|
|
265
|
+
return res;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
this.priceListItem = {
|
|
269
|
+
_path: "/pricelists",
|
|
270
|
+
find: async (params) => {
|
|
271
|
+
let res = await this._fetch(this.svAPIEndpoint, this.priceListItem._path, params);
|
|
272
|
+
return res;
|
|
273
|
+
},
|
|
274
|
+
get: async (id) => {
|
|
275
|
+
return await this._fetch(this.svAPIEndpoint, this.priceListItem._path + `/${id}`);
|
|
276
|
+
},
|
|
277
|
+
create: async (body) => {
|
|
278
|
+
let res = await this._create(this.svAPIEndpoint, this.priceListItem._path, body);
|
|
279
|
+
return res;
|
|
280
|
+
},
|
|
281
|
+
update: async (id, body) => {
|
|
282
|
+
let res = await this._update(this.svAPIEndpoint, this.priceListItem._path + `/${id}`, body);
|
|
283
|
+
return res;
|
|
284
|
+
},
|
|
285
|
+
remove: async (id) => {
|
|
286
|
+
let res = await this._delete(this.svAPIEndpoint, this.priceListItem._path + `/${id}`);
|
|
287
|
+
return res;
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
this.team = {
|
|
291
|
+
_path: "/teams",
|
|
292
|
+
find: async (params) => {
|
|
293
|
+
let res = await this._fetch(this.svAPIEndpoint, this.team._path, params);
|
|
294
|
+
return res;
|
|
295
|
+
},
|
|
296
|
+
get: async (id) => {
|
|
297
|
+
return await this._fetch(this.svAPIEndpoint, this.team._path + `/${id}`);
|
|
298
|
+
},
|
|
299
|
+
create: async (body) => {
|
|
300
|
+
let res = await this._create(this.svAPIEndpoint, this.team._path, body);
|
|
301
|
+
return res;
|
|
302
|
+
},
|
|
303
|
+
update: async (id, body) => {
|
|
304
|
+
let res = await this._update(this.svAPIEndpoint, this.team._path + `/${id}`, body);
|
|
305
|
+
return res;
|
|
306
|
+
},
|
|
307
|
+
remove: async (id) => {
|
|
308
|
+
let res = await this._delete(this.svAPIEndpoint, this.team._path + `/${id}`);
|
|
309
|
+
return res;
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
this.rep = {
|
|
313
|
+
_path: "/rep",
|
|
314
|
+
find: async (params) => {
|
|
315
|
+
let res = await this._fetch(this.svAPIEndpoint, this.rep._path, params);
|
|
316
|
+
return res;
|
|
317
|
+
},
|
|
318
|
+
get: async (id, params) => {
|
|
319
|
+
return await this._fetch(this.svAPIEndpoint, this.rep._path + `/${id}`, params);
|
|
320
|
+
},
|
|
321
|
+
create: async (body) => {
|
|
322
|
+
let res = await this._create(this.svAPIEndpoint, this.rep._path, body);
|
|
323
|
+
return res;
|
|
324
|
+
},
|
|
325
|
+
update: async (id, body) => {
|
|
326
|
+
let res = await this._update(this.svAPIEndpoint, this.rep._path + `/${id}`, body);
|
|
327
|
+
return res;
|
|
328
|
+
},
|
|
329
|
+
remove: async (id) => {
|
|
330
|
+
let res = await this._delete(this.svAPIEndpoint, this.rep._path + `/${id}`);
|
|
331
|
+
return res;
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
this.tag = {
|
|
335
|
+
_path: "/tag",
|
|
336
|
+
find: async (params) => {
|
|
337
|
+
let res = await this._fetch(this.svAPIEndpoint, this.tag._path, params);
|
|
338
|
+
return res;
|
|
339
|
+
},
|
|
340
|
+
get: async (id) => {
|
|
341
|
+
return await this._fetch(this.svAPIEndpoint, this.tag._path + `/${id}`);
|
|
342
|
+
},
|
|
343
|
+
create: async (body) => {
|
|
344
|
+
let res = await this._create(this.svAPIEndpoint, this.tag._path, body);
|
|
345
|
+
return res;
|
|
346
|
+
},
|
|
347
|
+
update: async (id, body) => {
|
|
348
|
+
let res = await this._update(this.svAPIEndpoint, this.tag._path + `/${id}`, body);
|
|
349
|
+
return res;
|
|
350
|
+
},
|
|
351
|
+
remove: async (id) => {
|
|
352
|
+
let res = await this._delete(this.svAPIEndpoint, this.tag._path + `/${id}`);
|
|
353
|
+
return res;
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
this.warehouse = {
|
|
357
|
+
_path: "/warehouse",
|
|
358
|
+
find: async (params) => {
|
|
359
|
+
let res = await this._fetch(this.svAPIEndpoint, this.warehouse._path, params);
|
|
360
|
+
return res;
|
|
361
|
+
},
|
|
362
|
+
get: async (id) => {
|
|
363
|
+
return await this._fetch(this.svAPIEndpoint, this.warehouse._path + `/${id}`);
|
|
364
|
+
},
|
|
365
|
+
create: async (body) => {
|
|
366
|
+
let res = await this._create(this.svAPIEndpoint, this.warehouse._path, body);
|
|
367
|
+
return res;
|
|
368
|
+
},
|
|
369
|
+
update: async (id, body) => {
|
|
370
|
+
let res = await this._update(this.svAPIEndpoint, this.warehouse._path + `/${id}`, body);
|
|
371
|
+
return res;
|
|
372
|
+
},
|
|
373
|
+
remove: async (id) => {
|
|
374
|
+
let res = await this._delete(this.svAPIEndpoint, this.warehouse._path + `/${id}`);
|
|
375
|
+
return res;
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
this.channel = {
|
|
379
|
+
_path: "/client-channel",
|
|
380
|
+
find: async (params) => {
|
|
381
|
+
let res = await this._fetch(this.svAPIEndpoint, this.channel._path, params);
|
|
382
|
+
return res;
|
|
383
|
+
},
|
|
384
|
+
get: async (id) => {
|
|
385
|
+
return await this._fetch(this.svAPIEndpoint, this.channel._path + `/${id}`);
|
|
386
|
+
},
|
|
387
|
+
create: async (body) => {
|
|
388
|
+
let res = await this._create(this.svAPIEndpoint, this.channel._path, body);
|
|
389
|
+
return res;
|
|
390
|
+
},
|
|
391
|
+
update: async (id, body) => {
|
|
392
|
+
let res = await this._update(this.svAPIEndpoint, this.channel._path + `/${id}`, body);
|
|
393
|
+
return res;
|
|
394
|
+
},
|
|
395
|
+
remove: async (id) => {
|
|
396
|
+
let res = await this._delete(this.svAPIEndpoint, this.channel._path + `/${id}`);
|
|
397
|
+
return res;
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
this.paymentTerm = {
|
|
401
|
+
_path: "/paymentterms",
|
|
402
|
+
find: async (params) => {
|
|
403
|
+
let res = await this._fetch(this.svAPIEndpoint, this.paymentTerm._path, params);
|
|
404
|
+
return res;
|
|
405
|
+
},
|
|
406
|
+
get: async (id) => {
|
|
407
|
+
return await this._fetch(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`);
|
|
408
|
+
},
|
|
409
|
+
create: async (body) => {
|
|
410
|
+
let res = await this._create(this.svAPIEndpoint, this.paymentTerm._path, body);
|
|
411
|
+
return res;
|
|
412
|
+
},
|
|
413
|
+
update: async (id, body) => {
|
|
414
|
+
let res = await this._update(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`, body);
|
|
415
|
+
return res;
|
|
416
|
+
},
|
|
417
|
+
remove: async (id) => {
|
|
418
|
+
let res = await this._delete(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`);
|
|
419
|
+
return res;
|
|
420
|
+
},
|
|
421
|
+
};
|
|
422
|
+
this.bank = {
|
|
423
|
+
_path: "/banks",
|
|
424
|
+
find: async (params) => {
|
|
425
|
+
let res = await this._fetch(this.svAPIEndpoint, this.bank._path, params);
|
|
426
|
+
return res;
|
|
427
|
+
},
|
|
428
|
+
get: async (id) => {
|
|
429
|
+
return await this._fetch(this.svAPIEndpoint, this.bank._path + `/${id}`);
|
|
430
|
+
},
|
|
431
|
+
create: async (body) => {
|
|
432
|
+
let res = await this._create(this.svAPIEndpoint, this.bank._path, body);
|
|
433
|
+
return res;
|
|
434
|
+
},
|
|
435
|
+
update: async (id, body) => {
|
|
436
|
+
let res = await this._update(this.svAPIEndpoint, this.bank._path + `/${id}`, body);
|
|
437
|
+
return res;
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
this.customStatus = {
|
|
441
|
+
_path: "/custom-status",
|
|
442
|
+
find: async (params) => {
|
|
443
|
+
let res = await this._fetch(this.svAPIEndpoint, this.customStatus._path, params);
|
|
444
|
+
return res;
|
|
445
|
+
},
|
|
446
|
+
get: async (id) => {
|
|
447
|
+
return await this._fetch(this.svAPIEndpoint, this.customStatus._path + `/${id}`);
|
|
448
|
+
},
|
|
449
|
+
create: async (body) => {
|
|
450
|
+
let res = await this._create(this.svAPIEndpoint, this.customStatus._path, body);
|
|
451
|
+
return res;
|
|
452
|
+
},
|
|
453
|
+
update: async (id, body) => {
|
|
454
|
+
let res = await this._update(this.svAPIEndpoint, this.customStatus._path + `/${id}`, body);
|
|
455
|
+
return res;
|
|
456
|
+
},
|
|
457
|
+
remove: async (id) => {
|
|
458
|
+
let res = await this._delete(this.svAPIEndpoint, this.customStatus._path + `/${id}`);
|
|
459
|
+
return res;
|
|
460
|
+
},
|
|
461
|
+
};
|
|
462
|
+
this.invoice = {
|
|
463
|
+
_path: "/fullinvoices",
|
|
464
|
+
find: async (params) => {
|
|
465
|
+
let res = await this._fetch(this.svAPIEndpoint, this.invoice._path, params);
|
|
466
|
+
return res;
|
|
467
|
+
},
|
|
468
|
+
get: async (id, params) => {
|
|
469
|
+
return await this._fetch(this.svAPIEndpoint, this.invoice._path + `/${id}`, params);
|
|
470
|
+
},
|
|
471
|
+
create: async (body) => {
|
|
472
|
+
let res = await this._create(this.svAPIEndpoint, this.invoice._path, body);
|
|
473
|
+
return res;
|
|
474
|
+
},
|
|
475
|
+
update: async (id, body) => {
|
|
476
|
+
let res = await this._update(this.svAPIEndpoint, this.invoice._path + `/${id}`, body);
|
|
477
|
+
return res;
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
this.proforma = {
|
|
481
|
+
_path: "/proforma",
|
|
482
|
+
find: async (params) => {
|
|
483
|
+
let res = await this._fetch(this.svAPIEndpoint, this.proforma._path, params);
|
|
484
|
+
return res;
|
|
485
|
+
},
|
|
486
|
+
get: async (id, params) => {
|
|
487
|
+
return await this._fetch(this.svAPIEndpoint, this.proforma._path + `/${id}`, params);
|
|
488
|
+
},
|
|
489
|
+
create: async (body) => {
|
|
490
|
+
let res = await this._create(this.svAPIEndpoint, this.proforma._path, body);
|
|
491
|
+
return res;
|
|
492
|
+
},
|
|
493
|
+
update: async (id, body) => {
|
|
494
|
+
let res = await this._update(this.svAPIEndpoint, this.proforma._path + `/${id}`, body);
|
|
495
|
+
return res;
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
this.payment = {
|
|
499
|
+
_path: "/payments",
|
|
500
|
+
find: async (params) => {
|
|
501
|
+
let res = await this._fetch(this.svAPIEndpoint, this.payment._path, params);
|
|
502
|
+
return res;
|
|
503
|
+
},
|
|
504
|
+
get: async (id, params) => {
|
|
505
|
+
return await this._fetch(this.svAPIEndpoint, this.payment._path + `/${id}`, params);
|
|
506
|
+
},
|
|
507
|
+
create: async (body) => {
|
|
508
|
+
let res = await this._create(this.svAPIEndpoint, this.payment._path, body);
|
|
509
|
+
return res;
|
|
510
|
+
},
|
|
511
|
+
update: async (id, body) => {
|
|
512
|
+
let res = await this._update(this.svAPIEndpoint, this.payment._path + `/${id}`, body);
|
|
513
|
+
return res;
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
this.transfer = {
|
|
517
|
+
_path: "/transfer",
|
|
518
|
+
find: async (params) => {
|
|
519
|
+
let res = await this._fetch(this.svAPIEndpoint, this.transfer._path, params);
|
|
520
|
+
return res;
|
|
521
|
+
},
|
|
522
|
+
get: async (id, params) => {
|
|
523
|
+
return await this._fetch(this.svAPIEndpoint, this.transfer._path + `/${id}`, params);
|
|
524
|
+
},
|
|
525
|
+
create: async (body) => {
|
|
526
|
+
let res = await this._create(this.svAPIEndpoint, this.transfer._path, body);
|
|
527
|
+
return res;
|
|
528
|
+
},
|
|
529
|
+
update: async (id, body) => {
|
|
530
|
+
let res = await this._update(this.svAPIEndpoint, this.transfer._path + `/${id}`, body);
|
|
531
|
+
return res;
|
|
532
|
+
},
|
|
533
|
+
};
|
|
534
|
+
this.adjustInventory = {
|
|
535
|
+
_path: "/adjust-inventory",
|
|
536
|
+
find: async (params) => {
|
|
537
|
+
let res = await this._fetch(this.svAPIEndpoint, this.adjustInventory._path, params);
|
|
538
|
+
return res;
|
|
539
|
+
},
|
|
540
|
+
get: async (id, params) => {
|
|
541
|
+
return await this._fetch(this.svAPIEndpoint, this.adjustInventory._path + `/${id}`, params);
|
|
542
|
+
},
|
|
543
|
+
create: async (body) => {
|
|
544
|
+
let res = await this._create(this.svAPIEndpoint, this.adjustInventory._path, body);
|
|
545
|
+
return res;
|
|
546
|
+
},
|
|
547
|
+
};
|
|
548
|
+
this.inventory = {
|
|
549
|
+
_path: "/inventory",
|
|
550
|
+
find: async (params) => {
|
|
551
|
+
let res = await this._fetch(this.svAPIEndpoint, this.inventory._path, params);
|
|
552
|
+
return res;
|
|
553
|
+
},
|
|
25
554
|
};
|
|
26
555
|
this.svAPIEndpoint =
|
|
27
|
-
!
|
|
556
|
+
!options?.env || options?.env == "production"
|
|
28
557
|
? "https://sv.api.repzo.me"
|
|
29
|
-
:
|
|
558
|
+
: options?.env == "staging"
|
|
30
559
|
? "https://staging.sv.api.repzo.me"
|
|
31
|
-
:
|
|
560
|
+
: options?.env == "local"
|
|
32
561
|
? "http://localhost:3030"
|
|
33
562
|
: "";
|
|
34
563
|
this.headers = {
|
|
35
564
|
"api-key": apiKey,
|
|
36
565
|
"Content-Type": "application/json",
|
|
37
|
-
Accept: "application/json"
|
|
566
|
+
Accept: "application/json",
|
|
38
567
|
};
|
|
39
|
-
if (options
|
|
568
|
+
if (options?.headers)
|
|
40
569
|
Object.assign(this.headers, options.headers);
|
|
41
570
|
}
|
|
42
571
|
async _fetch(baseUrl, path, params) {
|
|
43
572
|
let res = await axios.get(baseUrl + path, {
|
|
44
573
|
params,
|
|
45
|
-
headers: this.headers
|
|
574
|
+
headers: this.headers,
|
|
46
575
|
});
|
|
47
576
|
return res.data;
|
|
48
577
|
}
|
|
49
578
|
async _create(baseUrl, path, body, params) {
|
|
50
579
|
let res = await axios.post(baseUrl + path, body, {
|
|
51
580
|
params,
|
|
52
|
-
headers: this.headers
|
|
581
|
+
headers: this.headers,
|
|
53
582
|
});
|
|
54
583
|
return res.data;
|
|
55
584
|
}
|
|
56
585
|
async _update(baseUrl, path, body, params) {
|
|
57
586
|
let res = await axios.put(baseUrl + path, body, {
|
|
58
587
|
params,
|
|
59
|
-
headers: this.headers
|
|
588
|
+
headers: this.headers,
|
|
60
589
|
});
|
|
61
590
|
return res.data;
|
|
62
591
|
}
|
|
63
592
|
async _delete(baseUrl, path, params) {
|
|
64
593
|
let res = await axios.delete(baseUrl + path, {
|
|
65
594
|
params,
|
|
66
|
-
headers: this.headers
|
|
595
|
+
headers: this.headers,
|
|
67
596
|
});
|
|
68
597
|
return res.data;
|
|
69
598
|
}
|