repzo 1.0.96 → 1.0.97

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/lib/index.js CHANGED
@@ -1,2700 +1,1687 @@
1
1
  import axios from "axios";
2
2
  import { v4 as uuid } from "uuid";
3
3
  class Repzo {
4
- constructor(apiKey, options) {
5
- this._end_points = {
6
- CLIENT: "client",
7
- PRODUCT: "product",
8
- VARIANT: "variant",
9
- CATEGORY: "product-category",
10
- SUB_CATEGORY: "product-sub-category",
11
- BRAND: "product-brand",
12
- PRODUCT_GROUP: "product-group",
13
- TAX: "tax",
14
- MEASUREUNIT: "measureunits",
15
- MEASUREUNIT_FAMILY: "measureunit-family",
16
- MEDIA: "media",
17
- PRICELIST: "pricelists",
18
- PRICELIST_ITEM: "pricelistsitems",
19
- TEAM: "teams",
20
- RETURN_REASON: "return-reason",
21
- REP: "rep",
22
- TAG: "tag",
23
- WAREHOUSE: "warehouse",
24
- ROUTE: "route",
25
- PRODUCT_MODIFIERS_GROUP: "product-modifiers-group",
26
- CHANNEL: "client-channel",
27
- SPECIALITY: "speciality",
28
- CLIENT_CONTACT: "client-contact",
29
- PAYMENT_TERM: "paymentterms",
30
- BANK: "banks",
31
- BANK_LIST: "bankslists",
32
- CUSTOM_STATUS: "custom-status",
33
- CUSTOM_LIST: "custom-list",
34
- CUSTOM_LIST_ITEM: "custom-list-item",
35
- INVENTORY_ADJUSTMENT_REASON: "inventory-adjustment-reason",
36
- WORKORDER: "workorder",
37
- SUPPLIER: "supplier",
38
- QUICK_CONVERT_TO_PDF: "quick-convert-to-pdf",
39
- VISIT: "visit",
40
- INVOICE: "fullinvoices",
41
- PROFORMA: "proforma",
42
- PAYMENT: "payments",
43
- REFUND: "refund",
44
- SETTLEMENT: "settlement",
45
- CHECK: "checks",
46
- DAY: "day",
47
- RECEIVING_MATERIAL: "receiving-material",
48
- ADJUST_ACCOUNT: "adjust-account",
49
- TRANSFER: "transfer",
50
- MSL: "msl",
51
- MSL_PRODUCT: "msl-products",
52
- MEDIA_STORAGE: "media-storage",
53
- STORECHECK_TEMPLATE: "storecheck-template",
54
- ACTIVITY_STORECHECK: "activity-storecheck",
55
- ADJUST_INVENTORY: "adjust-inventory",
56
- INVENTORY: "inventory",
57
- INTEGRATION_APP: "integration-app",
58
- JOIN_ACTIONS_WEBHOOK: "svix-integration",
59
- INTEGRATION_ACTION_LOG: "integration-action-log",
60
- INTEGRATION_COMMAND_LOG: "integration-command-log",
61
- PATCH_ACTION: "patch-action",
62
- UPDATE_INTEGRATION_META: "update-integration-meta",
63
- ASSET_PART_TYPE: "asset-part-type",
64
- ASSET_PART: "asset-part",
65
- ASSET_PART_UNIT: "asset-part-unit",
66
- ASSET_PART_RECEIVAL: "asset-part-receival",
67
- ASSET_PART_TRANSFER: "asset-part-transfer",
68
- RETURN_ASSET_PART_UNIT: "return-asset-part-unit",
69
- STORE_ASSET_PART_UNIT: "store-asset-part-unit",
70
- OCR_INVOICE_JOB_TEMPLATE: "ocr-invoice-job-template",
71
- OCR_INVOICE_JOB_GROUP: "ocr-invoice-job-group",
72
- ACTIVITY_AI_SALES_ORDER: "activity-ai-sales-order",
73
- OCR_INVOICE_JOB: "ocr-invoice-job",
74
- OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
75
- };
76
- this.END_POINTS = this._end_points;
77
- this.client = {
78
- _path: this._end_points.CLIENT,
79
- find: async (params) => {
80
- let res = await this._fetch(
81
- this.svAPIEndpoint,
82
- this.client._path,
83
- params
84
- );
85
- return res;
86
- },
87
- get: async (id, params) => {
88
- return await this._fetch(
89
- this.svAPIEndpoint,
90
- this.client._path + `/${id}`,
91
- params
92
- );
93
- },
94
- create: async (body) => {
95
- let res = await this._create(
96
- this.svAPIEndpoint,
97
- this.client._path,
98
- body
99
- );
100
- return res;
101
- },
102
- update: async (id, body) => {
103
- let res = await this._update(
104
- this.svAPIEndpoint,
105
- this.client._path + `/${id}`,
106
- body
107
- );
108
- return res;
109
- },
110
- remove: async (id) => {
111
- let res = await this._delete(
112
- this.svAPIEndpoint,
113
- this.client._path + `/${id}`
114
- );
115
- return res;
116
- },
117
- };
118
- this.product = {
119
- _path: this._end_points.PRODUCT,
120
- find: async (params) => {
121
- let res = await this._fetch(
122
- this.svAPIEndpoint,
123
- this.product._path,
124
- params
125
- );
126
- return res;
127
- },
128
- get: async (id, params) => {
129
- return await this._fetch(
130
- this.svAPIEndpoint,
131
- this.product._path + `/${id}`,
132
- params
133
- );
134
- },
135
- create: async (body) => {
136
- let res = await this._create(
137
- this.svAPIEndpoint,
138
- this.product._path,
139
- body
140
- );
141
- return res;
142
- },
143
- update: async (id, body) => {
144
- let res = await this._update(
145
- this.svAPIEndpoint,
146
- this.product._path + `/${id}`,
147
- body
148
- );
149
- return res;
150
- },
151
- remove: async (id) => {
152
- let res = await this._delete(
153
- this.svAPIEndpoint,
154
- this.product._path + `/${id}`
155
- );
156
- return res;
157
- },
158
- };
159
- this.variant = {
160
- _path: this._end_points.VARIANT,
161
- find: async (params) => {
162
- let res = await this._fetch(
163
- this.svAPIEndpoint,
164
- this.variant._path,
165
- params
166
- );
167
- return res;
168
- },
169
- get: async (id, params) => {
170
- return await this._fetch(
171
- this.svAPIEndpoint,
172
- this.variant._path + `/${id}`,
173
- params
174
- );
175
- },
176
- create: async (body) => {
177
- let res = await this._create(
178
- this.svAPIEndpoint,
179
- this.variant._path,
180
- body
181
- );
182
- return res;
183
- },
184
- update: async (id, body) => {
185
- let res = await this._update(
186
- this.svAPIEndpoint,
187
- this.variant._path + `/${id}`,
188
- body
189
- );
190
- return res;
191
- },
192
- remove: async (id) => {
193
- let res = await this._delete(
194
- this.svAPIEndpoint,
195
- this.variant._path + `/${id}`
196
- );
197
- return res;
198
- },
199
- };
200
- this.category = {
201
- _path: this._end_points.CATEGORY,
202
- find: async (params) => {
203
- let res = await this._fetch(
204
- this.svAPIEndpoint,
205
- this.category._path,
206
- params
207
- );
208
- return res;
209
- },
210
- get: async (id) => {
211
- return await this._fetch(
212
- this.svAPIEndpoint,
213
- this.category._path + `/${id}`
214
- );
215
- },
216
- create: async (body) => {
217
- let res = await this._create(
218
- this.svAPIEndpoint,
219
- this.category._path,
220
- body
221
- );
222
- return res;
223
- },
224
- update: async (id, body) => {
225
- let res = await this._update(
226
- this.svAPIEndpoint,
227
- this.category._path + `/${id}`,
228
- body
229
- );
230
- return res;
231
- },
232
- remove: async (id) => {
233
- let res = await this._delete(
234
- this.svAPIEndpoint,
235
- this.category._path + `/${id}`
236
- );
237
- return res;
238
- },
239
- };
240
- this.sub_category = {
241
- _path: this._end_points.SUB_CATEGORY,
242
- find: async (params) => {
243
- let res = await this._fetch(
244
- this.svAPIEndpoint,
245
- this.sub_category._path,
246
- params
247
- );
248
- return res;
249
- },
250
- get: async (id, params) => {
251
- return await this._fetch(
252
- this.svAPIEndpoint,
253
- this.sub_category._path + `/${id}`,
254
- params
255
- );
256
- },
257
- create: async (body) => {
258
- let res = await this._create(
259
- this.svAPIEndpoint,
260
- this.sub_category._path,
261
- body
262
- );
263
- return res;
264
- },
265
- update: async (id, body) => {
266
- let res = await this._update(
267
- this.svAPIEndpoint,
268
- this.sub_category._path + `/${id}`,
269
- body
270
- );
271
- return res;
272
- },
273
- remove: async (id) => {
274
- let res = await this._delete(
275
- this.svAPIEndpoint,
276
- this.sub_category._path + `/${id}`
277
- );
278
- return res;
279
- },
280
- };
281
- this.brand = {
282
- _path: this._end_points.BRAND,
283
- find: async (params) => {
284
- let res = await this._fetch(
285
- this.svAPIEndpoint,
286
- this.brand._path,
287
- params
288
- );
289
- return res;
290
- },
291
- get: async (id) => {
292
- return await this._fetch(
293
- this.svAPIEndpoint,
294
- this.brand._path + `/${id}`
295
- );
296
- },
297
- create: async (body) => {
298
- let res = await this._create(
299
- this.svAPIEndpoint,
300
- this.brand._path,
301
- body
302
- );
303
- return res;
304
- },
305
- update: async (id, body) => {
306
- let res = await this._update(
307
- this.svAPIEndpoint,
308
- this.brand._path + `/${id}`,
309
- body
310
- );
311
- return res;
312
- },
313
- remove: async (id) => {
314
- let res = await this._delete(
315
- this.svAPIEndpoint,
316
- this.brand._path + `/${id}`
317
- );
318
- return res;
319
- },
320
- };
321
- this.product_group = {
322
- _path: this._end_points.PRODUCT_GROUP,
323
- find: async (params) => {
324
- let res = await this._fetch(
325
- this.svAPIEndpoint,
326
- this.product_group._path,
327
- params
328
- );
329
- return res;
330
- },
331
- get: async (id) => {
332
- return await this._fetch(
333
- this.svAPIEndpoint,
334
- this.product_group._path + `/${id}`
335
- );
336
- },
337
- create: async (body) => {
338
- let res = await this._create(
339
- this.svAPIEndpoint,
340
- this.product_group._path,
341
- body
342
- );
343
- return res;
344
- },
345
- update: async (id, body) => {
346
- let res = await this._update(
347
- this.svAPIEndpoint,
348
- this.product_group._path + `/${id}`,
349
- body
350
- );
351
- return res;
352
- },
353
- remove: async (id) => {
354
- let res = await this._delete(
355
- this.svAPIEndpoint,
356
- this.product_group._path + `/${id}`
357
- );
358
- return res;
359
- },
360
- };
361
- this.tax = {
362
- _path: this._end_points.TAX,
363
- find: async (params) => {
364
- let res = await this._fetch(this.svAPIEndpoint, this.tax._path, params);
365
- return res;
366
- },
367
- get: async (id) => {
368
- return await this._fetch(this.svAPIEndpoint, this.tax._path + `/${id}`);
369
- },
370
- create: async (body) => {
371
- let res = await this._create(this.svAPIEndpoint, this.tax._path, body);
372
- return res;
373
- },
374
- update: async (id, body) => {
375
- let res = await this._update(
376
- this.svAPIEndpoint,
377
- this.tax._path + `/${id}`,
378
- body
379
- );
380
- return res;
381
- },
382
- remove: async (id) => {
383
- let res = await this._delete(
384
- this.svAPIEndpoint,
385
- this.tax._path + `/${id}`
386
- );
387
- return res;
388
- },
389
- };
390
- this.measureunit = {
391
- _path: this._end_points.MEASUREUNIT,
392
- find: async (params) => {
393
- let res = await this._fetch(
394
- this.svAPIEndpoint,
395
- this.measureunit._path,
396
- params
397
- );
398
- return res;
399
- },
400
- get: async (id) => {
401
- return await this._fetch(
402
- this.svAPIEndpoint,
403
- this.measureunit._path + `/${id}`
404
- );
405
- },
406
- create: async (body) => {
407
- let res = await this._create(
408
- this.svAPIEndpoint,
409
- this.measureunit._path,
410
- body
411
- );
412
- return res;
413
- },
414
- update: async (id, body) => {
415
- let res = await this._update(
416
- this.svAPIEndpoint,
417
- this.measureunit._path + `/${id}`,
418
- body
419
- );
420
- return res;
421
- },
422
- remove: async (id) => {
423
- let res = await this._delete(
424
- this.svAPIEndpoint,
425
- this.measureunit._path + `/${id}`
426
- );
427
- return res;
428
- },
429
- };
430
- this.measureunitFamily = {
431
- _path: this._end_points.MEASUREUNIT_FAMILY,
432
- find: async (params) => {
433
- let res = await this._fetch(
434
- this.svAPIEndpoint,
435
- this.measureunitFamily._path,
436
- params
437
- );
438
- return res;
439
- },
440
- get: async (id) => {
441
- return await this._fetch(
442
- this.svAPIEndpoint,
443
- this.measureunitFamily._path + `/${id}`
444
- );
445
- },
446
- create: async (body) => {
447
- let res = await this._create(
448
- this.svAPIEndpoint,
449
- this.measureunitFamily._path,
450
- body
451
- );
452
- return res;
453
- },
454
- update: async (id, body) => {
455
- let res = await this._update(
456
- this.svAPIEndpoint,
457
- this.measureunitFamily._path + `/${id}`,
458
- body
459
- );
460
- return res;
461
- },
462
- remove: async (id) => {
463
- let res = await this._delete(
464
- this.svAPIEndpoint,
465
- this.measureunitFamily._path + `/${id}`
466
- );
467
- return res;
468
- },
469
- };
470
- this.media = {
471
- _path: this._end_points.MEDIA,
472
- find: async (params) => {
473
- let res = await this._fetch(
474
- this.svAPIEndpoint,
475
- this.media._path,
476
- params
477
- );
478
- return res;
479
- },
480
- get: async (id) => {
481
- return await this._fetch(
482
- this.svAPIEndpoint,
483
- this.media._path + `/${id}`
484
- );
485
- },
486
- create: async (body) => {
487
- let res = await this._create(
488
- this.svAPIEndpoint,
489
- this.media._path,
490
- body
491
- );
492
- return res;
493
- },
494
- update: async (id, body) => {
495
- let res = await this._update(
496
- this.svAPIEndpoint,
497
- this.media._path + `/${id}`,
498
- body
499
- );
500
- return res;
501
- },
502
- remove: async (id) => {
503
- let res = await this._delete(
504
- this.svAPIEndpoint,
505
- this.media._path + `/${id}`
506
- );
507
- return res;
508
- },
509
- };
510
- this.priceList = {
511
- _path: this._end_points.PRICELIST,
512
- find: async (params) => {
513
- let res = await this._fetch(
514
- this.svAPIEndpoint,
515
- this.priceList._path,
516
- params
517
- );
518
- return res;
519
- },
520
- get: async (id) => {
521
- return await this._fetch(
522
- this.svAPIEndpoint,
523
- this.priceList._path + `/${id}`
524
- );
525
- },
526
- create: async (body) => {
527
- let res = await this._create(
528
- this.svAPIEndpoint,
529
- this.priceList._path,
530
- body
531
- );
532
- return res;
533
- },
534
- update: async (id, body) => {
535
- let res = await this._update(
536
- this.svAPIEndpoint,
537
- this.priceList._path + `/${id}`,
538
- body
539
- );
540
- return res;
541
- },
542
- remove: async (id) => {
543
- let res = await this._delete(
544
- this.svAPIEndpoint,
545
- this.priceList._path + `/${id}`
546
- );
547
- return res;
548
- },
549
- };
550
- this.priceListItem = {
551
- _path: this._end_points.PRICELIST_ITEM,
552
- find: async (params) => {
553
- let res = await this._fetch(
554
- this.svAPIEndpoint,
555
- this.priceListItem._path,
556
- params
557
- );
558
- return res;
559
- },
560
- get: async (id) => {
561
- return await this._fetch(
562
- this.svAPIEndpoint,
563
- this.priceListItem._path + `/${id}`
564
- );
565
- },
566
- create: async (body) => {
567
- let res = await this._create(
568
- this.svAPIEndpoint,
569
- this.priceListItem._path,
570
- body
571
- );
572
- return res;
573
- },
574
- update: async (id, body) => {
575
- let res = await this._update(
576
- this.svAPIEndpoint,
577
- this.priceListItem._path + `/${id}`,
578
- body
579
- );
580
- return res;
581
- },
582
- remove: async (id) => {
583
- let res = await this._delete(
584
- this.svAPIEndpoint,
585
- this.priceListItem._path + `/${id}`
586
- );
587
- return res;
588
- },
589
- };
590
- this.team = {
591
- _path: this._end_points.TEAM,
592
- find: async (params) => {
593
- let res = await this._fetch(
594
- this.svAPIEndpoint,
595
- this.team._path,
596
- params
597
- );
598
- return res;
599
- },
600
- get: async (id) => {
601
- return await this._fetch(
602
- this.svAPIEndpoint,
603
- this.team._path + `/${id}`
604
- );
605
- },
606
- create: async (body) => {
607
- let res = await this._create(this.svAPIEndpoint, this.team._path, body);
608
- return res;
609
- },
610
- update: async (id, body) => {
611
- let res = await this._update(
612
- this.svAPIEndpoint,
613
- this.team._path + `/${id}`,
614
- body
615
- );
616
- return res;
617
- },
618
- remove: async (id) => {
619
- let res = await this._delete(
620
- this.svAPIEndpoint,
621
- this.team._path + `/${id}`
622
- );
623
- return res;
624
- },
625
- };
626
- this.returnReason = {
627
- _path: this._end_points.RETURN_REASON,
628
- find: async (params) => {
629
- let res = await this._fetch(
630
- this.svAPIEndpoint,
631
- this.returnReason._path,
632
- params
633
- );
634
- return res;
635
- },
636
- get: async (id) => {
637
- return await this._fetch(
638
- this.svAPIEndpoint,
639
- this.returnReason._path + `/${id}`
640
- );
641
- },
642
- create: async (body) => {
643
- let res = await this._create(
644
- this.svAPIEndpoint,
645
- this.returnReason._path,
646
- body
647
- );
648
- return res;
649
- },
650
- update: async (id, body) => {
651
- let res = await this._update(
652
- this.svAPIEndpoint,
653
- this.returnReason._path + `/${id}`,
654
- body
655
- );
656
- return res;
657
- },
658
- remove: async (id) => {
659
- let res = await this._delete(
660
- this.svAPIEndpoint,
661
- this.returnReason._path + `/${id}`
662
- );
663
- return res;
664
- },
665
- };
666
- this.rep = {
667
- _path: this._end_points.REP,
668
- find: async (params) => {
669
- let res = await this._fetch(this.svAPIEndpoint, this.rep._path, params);
670
- return res;
671
- },
672
- get: async (id, params) => {
673
- return await this._fetch(
674
- this.svAPIEndpoint,
675
- this.rep._path + `/${id}`,
676
- params
677
- );
678
- },
679
- create: async (body) => {
680
- let res = await this._create(this.svAPIEndpoint, this.rep._path, body);
681
- return res;
682
- },
683
- update: async (id, body) => {
684
- let res = await this._update(
685
- this.svAPIEndpoint,
686
- this.rep._path + `/${id}`,
687
- body
688
- );
689
- return res;
690
- },
691
- remove: async (id) => {
692
- let res = await this._delete(
693
- this.svAPIEndpoint,
694
- this.rep._path + `/${id}`
695
- );
696
- return res;
697
- },
698
- };
699
- this.tag = {
700
- _path: this._end_points.TAG,
701
- find: async (params) => {
702
- let res = await this._fetch(this.svAPIEndpoint, this.tag._path, params);
703
- return res;
704
- },
705
- get: async (id) => {
706
- return await this._fetch(this.svAPIEndpoint, this.tag._path + `/${id}`);
707
- },
708
- create: async (body) => {
709
- let res = await this._create(this.svAPIEndpoint, this.tag._path, body);
710
- return res;
711
- },
712
- update: async (id, body) => {
713
- let res = await this._update(
714
- this.svAPIEndpoint,
715
- this.tag._path + `/${id}`,
716
- body
717
- );
718
- return res;
719
- },
720
- remove: async (id) => {
721
- let res = await this._delete(
722
- this.svAPIEndpoint,
723
- this.tag._path + `/${id}`
724
- );
725
- return res;
726
- },
727
- };
728
- this.warehouse = {
729
- _path: this._end_points.WAREHOUSE,
730
- find: async (params) => {
731
- let res = await this._fetch(
732
- this.svAPIEndpoint,
733
- this.warehouse._path,
734
- params
735
- );
736
- return res;
737
- },
738
- get: async (id) => {
739
- return await this._fetch(
740
- this.svAPIEndpoint,
741
- this.warehouse._path + `/${id}`
742
- );
743
- },
744
- create: async (body) => {
745
- let res = await this._create(
746
- this.svAPIEndpoint,
747
- this.warehouse._path,
748
- body
749
- );
750
- return res;
751
- },
752
- update: async (id, body) => {
753
- let res = await this._update(
754
- this.svAPIEndpoint,
755
- this.warehouse._path + `/${id}`,
756
- body
757
- );
758
- return res;
759
- },
760
- remove: async (id) => {
761
- let res = await this._delete(
762
- this.svAPIEndpoint,
763
- this.warehouse._path + `/${id}`
764
- );
765
- return res;
766
- },
767
- };
768
- this.route = {
769
- _path: this._end_points.ROUTE,
770
- find: async (params) => {
771
- let res = await this._fetch(
772
- this.svAPIEndpoint,
773
- this.route._path,
774
- params
775
- );
776
- return res;
777
- },
778
- get: async (id) => {
779
- return await this._fetch(
780
- this.svAPIEndpoint,
781
- this.route._path + `/${id}`
782
- );
783
- },
784
- create: async (body) => {
785
- let res = await this._create(
786
- this.svAPIEndpoint,
787
- this.route._path,
788
- body
789
- );
790
- return res;
791
- },
792
- update: async (id, body) => {
793
- let res = await this._update(
794
- this.svAPIEndpoint,
795
- this.route._path + `/${id}`,
796
- body
797
- );
798
- return res;
799
- },
800
- remove: async (id) => {
801
- let res = await this._delete(
802
- this.svAPIEndpoint,
803
- this.route._path + `/${id}`
804
- );
805
- return res;
806
- },
807
- };
808
- this.productModifiersGroup = {
809
- _path: this._end_points.PRODUCT_MODIFIERS_GROUP,
810
- find: async (params) => {
811
- let res = await this._fetch(
812
- this.svAPIEndpoint,
813
- this.productModifiersGroup._path,
814
- params
815
- );
816
- return res;
817
- },
818
- get: async (id) => {
819
- return await this._fetch(
820
- this.svAPIEndpoint,
821
- this.productModifiersGroup._path + `/${id}`
822
- );
823
- },
824
- create: async (body) => {
825
- let res = await this._create(
826
- this.svAPIEndpoint,
827
- this.productModifiersGroup._path,
828
- body
829
- );
830
- return res;
831
- },
832
- update: async (id, body) => {
833
- let res = await this._update(
834
- this.svAPIEndpoint,
835
- this.productModifiersGroup._path + `/${id}`,
836
- body
837
- );
838
- return res;
839
- },
840
- remove: async (id) => {
841
- let res = await this._delete(
842
- this.svAPIEndpoint,
843
- this.productModifiersGroup._path + `/${id}`
844
- );
845
- return res;
846
- },
847
- };
848
- this.channel = {
849
- _path: this._end_points.CHANNEL,
850
- find: async (params) => {
851
- let res = await this._fetch(
852
- this.svAPIEndpoint,
853
- this.channel._path,
854
- params
855
- );
856
- return res;
857
- },
858
- get: async (id) => {
859
- return await this._fetch(
860
- this.svAPIEndpoint,
861
- this.channel._path + `/${id}`
862
- );
863
- },
864
- create: async (body) => {
865
- let res = await this._create(
866
- this.svAPIEndpoint,
867
- this.channel._path,
868
- body
869
- );
870
- return res;
871
- },
872
- update: async (id, body) => {
873
- let res = await this._update(
874
- this.svAPIEndpoint,
875
- this.channel._path + `/${id}`,
876
- body
877
- );
878
- return res;
879
- },
880
- remove: async (id) => {
881
- let res = await this._delete(
882
- this.svAPIEndpoint,
883
- this.channel._path + `/${id}`
884
- );
885
- return res;
886
- },
887
- };
888
- this.speciality = {
889
- _path: this._end_points.SPECIALITY,
890
- find: async (params) => {
891
- let res = await this._fetch(
892
- this.svAPIEndpoint,
893
- this.speciality._path,
894
- params
895
- );
896
- return res;
897
- },
898
- get: async (id) => {
899
- return await this._fetch(
900
- this.svAPIEndpoint,
901
- this.speciality._path + `/${id}`
902
- );
903
- },
904
- create: async (body) => {
905
- let res = await this._create(
906
- this.svAPIEndpoint,
907
- this.speciality._path,
908
- body
909
- );
910
- return res;
911
- },
912
- update: async (id, body) => {
913
- let res = await this._update(
914
- this.svAPIEndpoint,
915
- this.speciality._path + `/${id}`,
916
- body
917
- );
918
- return res;
919
- },
920
- remove: async (id) => {
921
- let res = await this._delete(
922
- this.svAPIEndpoint,
923
- this.speciality._path + `/${id}`
924
- );
925
- return res;
926
- },
927
- };
928
- this.clientContact = {
929
- _path: this._end_points.CLIENT_CONTACT,
930
- find: async (params) => {
931
- let res = await this._fetch(
932
- this.svAPIEndpoint,
933
- this.clientContact._path,
934
- params
935
- );
936
- return res;
937
- },
938
- get: async (id) => {
939
- return await this._fetch(
940
- this.svAPIEndpoint,
941
- this.clientContact._path + `/${id}`
942
- );
943
- },
944
- create: async (body) => {
945
- let res = await this._create(
946
- this.svAPIEndpoint,
947
- this.clientContact._path,
948
- body
949
- );
950
- return res;
951
- },
952
- update: async (id, body) => {
953
- let res = await this._update(
954
- this.svAPIEndpoint,
955
- this.clientContact._path + `/${id}`,
956
- body
957
- );
958
- return res;
959
- },
960
- remove: async (id) => {
961
- let res = await this._delete(
962
- this.svAPIEndpoint,
963
- this.clientContact._path + `/${id}`
964
- );
965
- return res;
966
- },
967
- };
968
- this.paymentTerm = {
969
- _path: this._end_points.PAYMENT_TERM,
970
- find: async (params) => {
971
- let res = await this._fetch(
972
- this.svAPIEndpoint,
973
- this.paymentTerm._path,
974
- params
975
- );
976
- return res;
977
- },
978
- get: async (id) => {
979
- return await this._fetch(
980
- this.svAPIEndpoint,
981
- this.paymentTerm._path + `/${id}`
982
- );
983
- },
984
- create: async (body) => {
985
- let res = await this._create(
986
- this.svAPIEndpoint,
987
- this.paymentTerm._path,
988
- body
989
- );
990
- return res;
991
- },
992
- update: async (id, body) => {
993
- let res = await this._update(
994
- this.svAPIEndpoint,
995
- this.paymentTerm._path + `/${id}`,
996
- body
997
- );
998
- return res;
999
- },
1000
- remove: async (id) => {
1001
- let res = await this._delete(
1002
- this.svAPIEndpoint,
1003
- this.paymentTerm._path + `/${id}`
1004
- );
1005
- return res;
1006
- },
1007
- };
1008
- this.bank = {
1009
- _path: this._end_points.BANK,
1010
- find: async (params) => {
1011
- let res = await this._fetch(
1012
- this.svAPIEndpoint,
1013
- this.bank._path,
1014
- params
1015
- );
1016
- return res;
1017
- },
1018
- get: async (id) => {
1019
- return await this._fetch(
1020
- this.svAPIEndpoint,
1021
- this.bank._path + `/${id}`
1022
- );
1023
- },
1024
- create: async (body) => {
1025
- let res = await this._create(this.svAPIEndpoint, this.bank._path, body);
1026
- return res;
1027
- },
1028
- update: async (id, body) => {
1029
- let res = await this._update(
1030
- this.svAPIEndpoint,
1031
- this.bank._path + `/${id}`,
1032
- body
1033
- );
1034
- return res;
1035
- },
1036
- };
1037
- this.bank_list = {
1038
- _path: this._end_points.BANK_LIST,
1039
- find: async (params) => {
1040
- let res = await this._fetch(
1041
- this.svAPIEndpoint,
1042
- this.bank_list._path,
1043
- params
1044
- );
1045
- return res;
1046
- },
1047
- get: async (id) => {
1048
- return await this._fetch(
1049
- this.svAPIEndpoint,
1050
- this.bank_list._path + `/${id}`
1051
- );
1052
- },
1053
- create: async (body) => {
1054
- let res = await this._create(
1055
- this.svAPIEndpoint,
1056
- this.bank_list._path,
1057
- body
1058
- );
1059
- return res;
1060
- },
1061
- update: async (id, body) => {
1062
- let res = await this._update(
1063
- this.svAPIEndpoint,
1064
- this.bank_list._path + `/${id}`,
1065
- body
1066
- );
1067
- return res;
1068
- },
1069
- };
1070
- this.customStatus = {
1071
- _path: this._end_points.CUSTOM_STATUS,
1072
- find: async (params) => {
1073
- let res = await this._fetch(
1074
- this.svAPIEndpoint,
1075
- this.customStatus._path,
1076
- params
1077
- );
1078
- return res;
1079
- },
1080
- get: async (id) => {
1081
- return await this._fetch(
1082
- this.svAPIEndpoint,
1083
- this.customStatus._path + `/${id}`
1084
- );
1085
- },
1086
- create: async (body) => {
1087
- let res = await this._create(
1088
- this.svAPIEndpoint,
1089
- this.customStatus._path,
1090
- body
1091
- );
1092
- return res;
1093
- },
1094
- update: async (id, body) => {
1095
- let res = await this._update(
1096
- this.svAPIEndpoint,
1097
- this.customStatus._path + `/${id}`,
1098
- body
1099
- );
1100
- return res;
1101
- },
1102
- remove: async (id) => {
1103
- let res = await this._delete(
1104
- this.svAPIEndpoint,
1105
- this.customStatus._path + `/${id}`
1106
- );
1107
- return res;
1108
- },
1109
- };
1110
- this.customList = {
1111
- _path: this._end_points.CUSTOM_LIST,
1112
- find: async (params) => {
1113
- let res = await this._fetch(
1114
- this.svAPIEndpoint,
1115
- this.customList._path,
1116
- params
1117
- );
1118
- return res;
1119
- },
1120
- get: async (id, params) => {
1121
- return await this._fetch(
1122
- this.svAPIEndpoint,
1123
- this.customList._path + `/${id}`,
1124
- params
1125
- );
1126
- },
1127
- create: async (body) => {
1128
- let res = await this._create(
1129
- this.svAPIEndpoint,
1130
- this.customList._path,
1131
- body
1132
- );
1133
- return res;
1134
- },
1135
- update: async (id, body) => {
1136
- let res = await this._update(
1137
- this.svAPIEndpoint,
1138
- this.customList._path + `/${id}`,
1139
- body
1140
- );
1141
- return res;
1142
- },
1143
- remove: async (id) => {
1144
- let res = await this._delete(
1145
- this.svAPIEndpoint,
1146
- this.customList._path + `/${id}`
1147
- );
1148
- return res;
1149
- },
1150
- };
1151
- this.customListItem = {
1152
- _path: this._end_points.CUSTOM_LIST_ITEM,
1153
- find: async (params) => {
1154
- let res = await this._fetch(
1155
- this.svAPIEndpoint,
1156
- this.customListItem._path,
1157
- params
1158
- );
1159
- return res;
1160
- },
1161
- get: async (id, params) => {
1162
- return await this._fetch(
1163
- this.svAPIEndpoint,
1164
- this.customListItem._path + `/${id}`,
1165
- params
1166
- );
1167
- },
1168
- create: async (body) => {
1169
- let res = await this._create(
1170
- this.svAPIEndpoint,
1171
- this.customListItem._path,
1172
- body
1173
- );
1174
- return res;
1175
- },
1176
- update: async (id, body) => {
1177
- let res = await this._update(
1178
- this.svAPIEndpoint,
1179
- this.customListItem._path + `/${id}`,
1180
- body
1181
- );
1182
- return res;
1183
- },
1184
- remove: async (id) => {
1185
- let res = await this._delete(
1186
- this.svAPIEndpoint,
1187
- this.customListItem._path + `/${id}`
1188
- );
1189
- return res;
1190
- },
1191
- };
1192
- this.inventoryAdjustmentReason = {
1193
- _path: this._end_points.INVENTORY_ADJUSTMENT_REASON,
1194
- find: async (params) => {
1195
- let res = await this._fetch(
1196
- this.svAPIEndpoint,
1197
- this.inventoryAdjustmentReason._path,
1198
- params
1199
- );
1200
- return res;
1201
- },
1202
- get: async (id) => {
1203
- return await this._fetch(
1204
- this.svAPIEndpoint,
1205
- this.inventoryAdjustmentReason._path + `/${id}`
1206
- );
1207
- },
1208
- create: async (body) => {
1209
- let res = await this._create(
1210
- this.svAPIEndpoint,
1211
- this.inventoryAdjustmentReason._path,
1212
- body
1213
- );
1214
- return res;
1215
- },
1216
- update: async (id, body) => {
1217
- let res = await this._update(
1218
- this.svAPIEndpoint,
1219
- this.customListItem._path + `/${id}`,
1220
- body
1221
- );
1222
- return res;
1223
- },
1224
- remove: async (id) => {
1225
- let res = await this._delete(
1226
- this.svAPIEndpoint,
1227
- this.inventoryAdjustmentReason._path + `/${id}`
1228
- );
1229
- return res;
1230
- },
1231
- };
1232
- this.workorder = {
1233
- _path: this._end_points.WORKORDER,
1234
- find: async (params) => {
1235
- let res = await this._fetch(
1236
- this.svAPIEndpoint,
1237
- this.workorder._path,
1238
- params
1239
- );
1240
- return res;
1241
- },
1242
- get: async (id, params) => {
1243
- return await this._fetch(
1244
- this.svAPIEndpoint,
1245
- this.workorder._path + `/${id}`,
1246
- params
1247
- );
1248
- },
1249
- };
1250
- this.supplier = {
1251
- _path: this._end_points.SUPPLIER,
1252
- find: async (params) => {
1253
- let res = await this._fetch(
1254
- this.svAPIEndpoint,
1255
- this.supplier._path,
1256
- params
1257
- );
1258
- return res;
1259
- },
1260
- get: async (id, params) => {
1261
- return await this._fetch(
1262
- this.svAPIEndpoint,
1263
- this.supplier._path + `/${id}`,
1264
- params
1265
- );
1266
- },
1267
- create: async (body) => {
1268
- let res = await this._create(
1269
- this.svAPIEndpoint,
1270
- this.supplier._path,
1271
- body
1272
- );
1273
- return res;
1274
- },
1275
- update: async (id, body) => {
1276
- let res = await this._update(
1277
- this.svAPIEndpoint,
1278
- this.supplier._path + `/${id}`,
1279
- body
1280
- );
1281
- return res;
1282
- },
1283
- };
1284
- this.quickConvertToPdf = {
1285
- _path: this._end_points.QUICK_CONVERT_TO_PDF,
1286
- find: async (params) => {
1287
- let res = await this._fetch(
1288
- this.svAPIEndpoint,
1289
- this.quickConvertToPdf._path,
1290
- params
1291
- );
1292
- return res;
1293
- },
1294
- get: async (id, params) => {
1295
- return await this._fetch(
1296
- this.svAPIEndpoint,
1297
- this.quickConvertToPdf._path + `/${id}`,
1298
- params
1299
- );
1300
- },
1301
- create: async (body) => {
1302
- let res = await this._create(
1303
- this.svAPIEndpoint,
1304
- this.quickConvertToPdf._path,
1305
- body
1306
- );
1307
- return res;
1308
- },
1309
- remove: async (id) => {
1310
- let res = await this._delete(
1311
- this.svAPIEndpoint,
1312
- this.quickConvertToPdf._path + `/${id}`
1313
- );
1314
- return res;
1315
- },
1316
- };
1317
- this.visit = {
1318
- _path: this._end_points.VISIT,
1319
- find: async (params) => {
1320
- let res = await this._fetch(
1321
- this.svAPIEndpoint,
1322
- this.visit._path,
1323
- params
1324
- );
1325
- return res;
1326
- },
1327
- get: async (id, params) => {
1328
- return await this._fetch(
1329
- this.svAPIEndpoint,
1330
- this.visit._path + `/${id}`,
1331
- params
1332
- );
1333
- },
1334
- create: async (body) => {
1335
- let res = await this._create(
1336
- this.svAPIEndpoint,
1337
- this.visit._path,
1338
- body
1339
- );
1340
- return res;
1341
- },
1342
- update: async (id, body) => {
1343
- let res = await this._update(
1344
- this.svAPIEndpoint,
1345
- this.visit._path + `/${id}`,
1346
- body
1347
- );
1348
- return res;
1349
- },
1350
- };
1351
- this.invoice = {
1352
- _path: this._end_points.INVOICE,
1353
- find: async (params) => {
1354
- let res = await this._fetch(
1355
- this.svAPIEndpoint,
1356
- this.invoice._path,
1357
- params
1358
- );
1359
- return res;
1360
- },
1361
- get: async (id, params) => {
1362
- return await this._fetch(
1363
- this.svAPIEndpoint,
1364
- this.invoice._path + `/${id}`,
1365
- params
1366
- );
1367
- },
1368
- create: async (body) => {
1369
- let res = await this._create(
1370
- this.svAPIEndpoint,
1371
- this.invoice._path,
1372
- body
1373
- );
1374
- return res;
1375
- },
1376
- update: async (id, body) => {
1377
- let res = await this._update(
1378
- this.svAPIEndpoint,
1379
- this.invoice._path + `/${id}`,
1380
- body
1381
- );
1382
- return res;
1383
- },
1384
- };
1385
- this.proforma = {
1386
- _path: this._end_points.PROFORMA,
1387
- find: async (params) => {
1388
- let res = await this._fetch(
1389
- this.svAPIEndpoint,
1390
- this.proforma._path,
1391
- params
1392
- );
1393
- return res;
1394
- },
1395
- get: async (id, params) => {
1396
- return await this._fetch(
1397
- this.svAPIEndpoint,
1398
- this.proforma._path + `/${id}`,
1399
- params
1400
- );
1401
- },
1402
- create: async (body) => {
1403
- let res = await this._create(
1404
- this.svAPIEndpoint,
1405
- this.proforma._path,
1406
- body
1407
- );
1408
- return res;
1409
- },
1410
- update: async (id, body) => {
1411
- let res = await this._update(
1412
- this.svAPIEndpoint,
1413
- this.proforma._path + `/${id}`,
1414
- body
1415
- );
1416
- return res;
1417
- },
1418
- };
1419
- this.payment = {
1420
- _path: this._end_points.PAYMENT,
1421
- find: async (params) => {
1422
- let res = await this._fetch(
1423
- this.svAPIEndpoint,
1424
- this.payment._path,
1425
- params
1426
- );
1427
- return res;
1428
- },
1429
- get: async (id, params) => {
1430
- return await this._fetch(
1431
- this.svAPIEndpoint,
1432
- this.payment._path + `/${id}`,
1433
- params
1434
- );
1435
- },
1436
- create: async (body) => {
1437
- let res = await this._create(
1438
- this.svAPIEndpoint,
1439
- this.payment._path,
1440
- body
1441
- );
1442
- return res;
1443
- },
1444
- update: async (id, body) => {
1445
- let res = await this._update(
1446
- this.svAPIEndpoint,
1447
- this.payment._path + `/${id}`,
1448
- body
1449
- );
1450
- return res;
1451
- },
1452
- };
1453
- this.refund = {
1454
- _path: this._end_points.REFUND,
1455
- find: async (params) => {
1456
- let res = await this._fetch(
1457
- this.svAPIEndpoint,
1458
- this.refund._path,
1459
- params
1460
- );
1461
- return res;
1462
- },
1463
- get: async (id, params) => {
1464
- return await this._fetch(
1465
- this.svAPIEndpoint,
1466
- this.refund._path + `/${id}`,
1467
- params
1468
- );
1469
- },
1470
- create: async (body) => {
1471
- let res = await this._create(
1472
- this.svAPIEndpoint,
1473
- this.refund._path,
1474
- body
1475
- );
1476
- return res;
1477
- },
1478
- update: async (id, body) => {
1479
- let res = await this._update(
1480
- this.svAPIEndpoint,
1481
- this.refund._path + `/${id}`,
1482
- body
1483
- );
1484
- return res;
1485
- },
1486
- };
1487
- this.settlement = {
1488
- _path: this._end_points.SETTLEMENT,
1489
- find: async (params) => {
1490
- let res = await this._fetch(
1491
- this.svAPIEndpoint,
1492
- this.settlement._path,
1493
- params
1494
- );
1495
- return res;
1496
- },
1497
- get: async (id, params) => {
1498
- return await this._fetch(
1499
- this.svAPIEndpoint,
1500
- this.settlement._path + `/${id}`,
1501
- params
1502
- );
1503
- },
1504
- create: async (body) => {
1505
- let res = await this._create(
1506
- this.svAPIEndpoint,
1507
- this.settlement._path,
1508
- body
1509
- );
1510
- return res;
1511
- },
1512
- };
1513
- this.check = {
1514
- _path: this._end_points.CHECK,
1515
- find: async (params) => {
1516
- let res = await this._fetch(
1517
- this.svAPIEndpoint,
1518
- this.check._path,
1519
- params
1520
- );
1521
- return res;
1522
- },
1523
- get: async (id, params) => {
1524
- return await this._fetch(
1525
- this.svAPIEndpoint,
1526
- this.check._path + `/${id}`,
1527
- params
1528
- );
1529
- },
1530
- create: async (body) => {
1531
- let res = await this._create(
1532
- this.svAPIEndpoint,
1533
- this.check._path,
1534
- body
1535
- );
1536
- return res;
1537
- },
1538
- };
1539
- this.day = {
1540
- _path: this._end_points.DAY,
1541
- find: async (params) => {
1542
- let res = await this._fetch(this.svAPIEndpoint, this.day._path, params);
1543
- return res;
1544
- },
1545
- get: async (id, params) => {
1546
- return await this._fetch(
1547
- this.svAPIEndpoint,
1548
- this.day._path + `/${id}`,
1549
- params
1550
- );
1551
- },
1552
- create: async (body) => {
1553
- let res = await this._create(this.svAPIEndpoint, this.day._path, body);
1554
- return res;
1555
- },
1556
- };
1557
- this.receivingMaterial = {
1558
- _path: this._end_points.RECEIVING_MATERIAL,
1559
- find: async (params) => {
1560
- let res = await this._fetch(
1561
- this.svAPIEndpoint,
1562
- this.receivingMaterial._path,
1563
- params
1564
- );
1565
- return res;
1566
- },
1567
- get: async (id, params) => {
1568
- return await this._fetch(
1569
- this.svAPIEndpoint,
1570
- this.receivingMaterial._path + `/${id}`,
1571
- params
1572
- );
1573
- },
1574
- create: async (body) => {
1575
- let res = await this._create(
1576
- this.svAPIEndpoint,
1577
- this.receivingMaterial._path,
1578
- body
1579
- );
1580
- return res;
1581
- },
1582
- update: async (id, body) => {
1583
- let res = await this._update(
1584
- this.svAPIEndpoint,
1585
- this.receivingMaterial._path + `/${id}`,
1586
- body
1587
- );
1588
- return res;
1589
- },
1590
- };
1591
- this.adjustAccount = {
1592
- _path: this._end_points.ADJUST_ACCOUNT,
1593
- find: async (params) => {
1594
- let res = await this._fetch(
1595
- this.svAPIEndpoint,
1596
- this.adjustAccount._path,
1597
- params
1598
- );
1599
- return res;
1600
- },
1601
- get: async (id, params) => {
1602
- return await this._fetch(
1603
- this.svAPIEndpoint,
1604
- this.adjustAccount._path + `/${id}`,
1605
- params
1606
- );
1607
- },
1608
- create: async (body) => {
1609
- let res = await this._create(
1610
- this.svAPIEndpoint,
1611
- this.adjustAccount._path,
1612
- body
1613
- );
1614
- return res;
1615
- },
1616
- };
1617
- this.transfer = {
1618
- _path: this._end_points.TRANSFER,
1619
- find: async (params) => {
1620
- let res = await this._fetch(
1621
- this.svAPIEndpoint,
1622
- this.transfer._path,
1623
- params
1624
- );
1625
- return res;
1626
- },
1627
- get: async (id, params) => {
1628
- return await this._fetch(
1629
- this.svAPIEndpoint,
1630
- this.transfer._path + `/${id}`,
1631
- params
1632
- );
1633
- },
1634
- create: async (body) => {
1635
- let res = await this._create(
1636
- this.svAPIEndpoint,
1637
- this.transfer._path,
1638
- body
1639
- );
1640
- return res;
1641
- },
1642
- update: async (id, body) => {
1643
- let res = await this._update(
1644
- this.svAPIEndpoint,
1645
- this.transfer._path + `/${id}`,
1646
- body
1647
- );
1648
- return res;
1649
- },
1650
- };
1651
- this.msl = {
1652
- _path: this._end_points.MSL,
1653
- find: async (params) => {
1654
- let res = await this._fetch(this.svAPIEndpoint, this.msl._path, params);
1655
- return res;
1656
- },
1657
- get: async (id, params) => {
1658
- return await this._fetch(
1659
- this.svAPIEndpoint,
1660
- this.msl._path + `/${id}`,
1661
- params
1662
- );
1663
- },
1664
- create: async (body) => {
1665
- let res = await this._create(this.svAPIEndpoint, this.msl._path, body);
1666
- return res;
1667
- },
1668
- update: async (id, body) => {
1669
- let res = await this._update(
1670
- this.svAPIEndpoint,
1671
- this.msl._path + `/${id}`,
1672
- body
1673
- );
1674
- return res;
1675
- },
1676
- remove: async (id) => {
1677
- let res = await this._delete(
1678
- this.svAPIEndpoint,
1679
- this.msl._path + `/${id}`
1680
- );
1681
- return res;
1682
- },
1683
- };
1684
- this.mslProduct = {
1685
- _path: this._end_points.MSL_PRODUCT,
1686
- find: async (params) => {
1687
- let res = await this._fetch(
1688
- this.svAPIEndpoint,
1689
- this.mslProduct._path,
1690
- params
1691
- );
1692
- return res;
1693
- },
1694
- get: async (id, params) => {
1695
- return await this._fetch(
1696
- this.svAPIEndpoint,
1697
- this.mslProduct._path + `/${id}`,
1698
- params
1699
- );
1700
- },
1701
- create: async (body) => {
1702
- let res = await this._create(
1703
- this.svAPIEndpoint,
1704
- this.mslProduct._path,
1705
- body
1706
- );
1707
- return res;
1708
- },
1709
- update: async (id, body) => {
1710
- let res = await this._update(
1711
- this.svAPIEndpoint,
1712
- this.mslProduct._path + `/${id}`,
1713
- body
1714
- );
1715
- return res;
1716
- },
1717
- remove: async (id) => {
1718
- let res = await this._delete(
1719
- this.svAPIEndpoint,
1720
- this.mslProduct._path + `/${id}`
1721
- );
1722
- return res;
1723
- },
1724
- };
1725
- this.mediaStorage = {
1726
- _path: this._end_points.MEDIA_STORAGE,
1727
- find: async (params) => {
1728
- let res = await this._fetch(
1729
- this.svAPIEndpoint,
1730
- this.mediaStorage._path,
1731
- params
1732
- );
1733
- return res;
1734
- },
1735
- get: async (id, params) => {
1736
- return await this._fetch(
1737
- this.svAPIEndpoint,
1738
- this.mediaStorage._path + `/${id}`,
1739
- params
1740
- );
1741
- },
1742
- create: async (body) => {
1743
- let res = await this._create(
1744
- this.svAPIEndpoint,
1745
- this.mediaStorage._path,
1746
- body
1747
- );
1748
- return res;
1749
- },
1750
- update: async (id, body) => {
1751
- let res = await this._update(
1752
- this.svAPIEndpoint,
1753
- this.mediaStorage._path + `/${id}`,
1754
- body
1755
- );
1756
- return res;
1757
- },
1758
- remove: async (id) => {
1759
- let res = await this._delete(
1760
- this.svAPIEndpoint,
1761
- this.mediaStorage._path + `/${id}`
1762
- );
1763
- return res;
1764
- },
1765
- };
1766
- this.storecheckTemplate = {
1767
- _path: this._end_points.STORECHECK_TEMPLATE,
1768
- find: async (params) => {
1769
- let res = await this._fetch(
1770
- this.svAPIEndpoint,
1771
- this.storecheckTemplate._path,
1772
- params
1773
- );
1774
- return res;
1775
- },
1776
- get: async (id, params) => {
1777
- return await this._fetch(
1778
- this.svAPIEndpoint,
1779
- this.storecheckTemplate._path + `/${id}`,
1780
- params
1781
- );
1782
- },
1783
- create: async (body) => {
1784
- let res = await this._create(
1785
- this.svAPIEndpoint,
1786
- this.storecheckTemplate._path,
1787
- body
1788
- );
1789
- return res;
1790
- },
1791
- update: async (id, body) => {
1792
- let res = await this._update(
1793
- this.svAPIEndpoint,
1794
- this.storecheckTemplate._path + `/${id}`,
1795
- body
1796
- );
1797
- return res;
1798
- },
1799
- remove: async (id) => {
1800
- let res = await this._delete(
1801
- this.svAPIEndpoint,
1802
- this.storecheckTemplate._path + `/${id}`
1803
- );
1804
- return res;
1805
- },
1806
- };
1807
- this.activityStorecheck = {
1808
- _path: this._end_points.ACTIVITY_STORECHECK,
1809
- find: async (params) => {
1810
- let res = await this._fetch(
1811
- this.svAPIEndpoint,
1812
- this.activityStorecheck._path,
1813
- params
1814
- );
1815
- return res;
1816
- },
1817
- get: async (id, params) => {
1818
- return await this._fetch(
1819
- this.svAPIEndpoint,
1820
- this.activityStorecheck._path + `/${id}`,
1821
- params
1822
- );
1823
- },
1824
- create: async (body) => {
1825
- let res = await this._create(
1826
- this.svAPIEndpoint,
1827
- this.activityStorecheck._path,
1828
- body
1829
- );
1830
- return res;
1831
- },
1832
- update: async (id, body) => {
1833
- let res = await this._update(
1834
- this.svAPIEndpoint,
1835
- this.activityStorecheck._path + `/${id}`,
1836
- body
1837
- );
1838
- return res;
1839
- },
1840
- };
1841
- this.adjustInventory = {
1842
- _path: this._end_points.ADJUST_INVENTORY,
1843
- find: async (params) => {
1844
- let res = await this._fetch(
1845
- this.svAPIEndpoint,
1846
- this.adjustInventory._path,
1847
- params
1848
- );
1849
- return res;
1850
- },
1851
- get: async (id, params) => {
1852
- return await this._fetch(
1853
- this.svAPIEndpoint,
1854
- this.adjustInventory._path + `/${id}`,
1855
- params
1856
- );
1857
- },
1858
- create: async (body) => {
1859
- let res = await this._create(
1860
- this.svAPIEndpoint,
1861
- this.adjustInventory._path,
1862
- body
1863
- );
1864
- return res;
1865
- },
1866
- };
1867
- this.inventory = {
1868
- _path: this._end_points.INVENTORY,
1869
- find: async (params) => {
1870
- let res = await this._fetch(
1871
- this.svAPIEndpoint,
1872
- this.inventory._path,
1873
- params
1874
- );
1875
- return res;
1876
- },
1877
- };
1878
- this.integrationApp = {
1879
- _path: this._end_points.INTEGRATION_APP,
1880
- find: async (params) => {
1881
- let res = await this._fetch(
1882
- this.svAPIEndpoint,
1883
- this.integrationApp._path,
1884
- params
1885
- );
1886
- return res;
1887
- },
1888
- get: async (id, params) => {
1889
- return await this._fetch(
1890
- this.svAPIEndpoint,
1891
- this.integrationApp._path + `/${id}`,
1892
- params
1893
- );
1894
- },
1895
- create: async (body) => {
1896
- let res = await this._create(
1897
- this.svAPIEndpoint,
1898
- this.integrationApp._path,
1899
- body
1900
- );
1901
- return res;
1902
- },
1903
- update: async (id, body) => {
1904
- let res = await this._update(
1905
- this.svAPIEndpoint,
1906
- this.integrationApp._path + `/${id}`,
1907
- body
1908
- );
1909
- return res;
1910
- },
1911
- };
1912
- this.joinActionsWebHook = {
1913
- _path: this._end_points.JOIN_ACTIONS_WEBHOOK,
1914
- update: async (id, body) => {
1915
- let res = await this._update(
1916
- this.svAPIEndpoint,
1917
- this.joinActionsWebHook._path,
1918
- body
1919
- );
1920
- return res;
1921
- },
1922
- };
1923
- this.patchAction = {
1924
- _path: this._end_points.PATCH_ACTION,
1925
- create: async (body, params) => {
1926
- const res = await this._create(
1927
- this.svAPIEndpoint,
1928
- this.patchAction._path,
1929
- body,
1930
- params
1931
- );
1932
- return res;
1933
- },
1934
- update: async (body) => {
1935
- const res = await this._update(
1936
- this.svAPIEndpoint,
1937
- this.patchAction._path,
1938
- body
1939
- );
1940
- return res;
1941
- },
1942
- };
1943
- this.updateIntegrationMeta = {
1944
- _path: this._end_points.UPDATE_INTEGRATION_META,
1945
- create: async (body, params) => {
1946
- let res = await this._create(
1947
- this.svAPIEndpoint,
1948
- this.updateIntegrationMeta._path,
1949
- body,
1950
- params
1951
- );
1952
- return res;
1953
- },
1954
- };
1955
- this.assetPartType = {
1956
- _path: this._end_points.ASSET_PART_TYPE,
1957
- find: async (params) => {
1958
- let res = await this._fetch(
1959
- this.svAPIEndpoint,
1960
- this.assetPartType._path,
1961
- params
1962
- );
1963
- return res;
1964
- },
1965
- get: async (id) => {
1966
- return await this._fetch(
1967
- this.svAPIEndpoint,
1968
- this.assetPartType._path + `/${id}`
1969
- );
1970
- },
1971
- create: async (body) => {
1972
- let res = await this._create(
1973
- this.svAPIEndpoint,
1974
- this.assetPartType._path,
1975
- body
1976
- );
1977
- return res;
1978
- },
1979
- update: async (id, body) => {
1980
- let res = await this._update(
1981
- this.svAPIEndpoint,
1982
- this.assetPartType._path + `/${id}`,
1983
- body
1984
- );
1985
- return res;
1986
- },
1987
- remove: async (id) => {
1988
- let res = await this._delete(
1989
- this.svAPIEndpoint,
1990
- this.assetPartType._path + `/${id}`
1991
- );
1992
- return res;
1993
- },
1994
- };
1995
- this.assetPart = {
1996
- _path: this._end_points.ASSET_PART,
1997
- find: async (params) => {
1998
- let res = await this._fetch(
1999
- this.svAPIEndpoint,
2000
- this.assetPart._path,
2001
- params
2002
- );
2003
- return res;
2004
- },
2005
- get: async (id) => {
2006
- return await this._fetch(
2007
- this.svAPIEndpoint,
2008
- this.assetPart._path + `/${id}`
2009
- );
2010
- },
2011
- create: async (body) => {
2012
- let res = await this._create(
2013
- this.svAPIEndpoint,
2014
- this.assetPart._path,
2015
- body
2016
- );
2017
- return res;
2018
- },
2019
- update: async (id, body) => {
2020
- let res = await this._update(
2021
- this.svAPIEndpoint,
2022
- this.assetPart._path + `/${id}`,
2023
- body
2024
- );
2025
- return res;
2026
- },
2027
- remove: async (id) => {
2028
- let res = await this._delete(
2029
- this.svAPIEndpoint,
2030
- this.assetPart._path + `/${id}`
2031
- );
2032
- return res;
2033
- },
2034
- };
2035
- this.assetPartUnit = {
2036
- _path: this._end_points.ASSET_PART_UNIT,
2037
- find: async (params) => {
2038
- let res = await this._fetch(
2039
- this.svAPIEndpoint,
2040
- this.assetPartUnit._path,
2041
- params
2042
- );
2043
- return res;
2044
- },
2045
- get: async (id) => {
2046
- return await this._fetch(
2047
- this.svAPIEndpoint,
2048
- this.assetPartUnit._path + `/${id}`
2049
- );
2050
- },
2051
- update: async (id, body) => {
2052
- let res = await this._update(
2053
- this.svAPIEndpoint,
2054
- this.assetPartUnit._path + `/${id}`,
2055
- body
2056
- );
2057
- return res;
2058
- },
2059
- };
2060
- this.assetPartReceival = {
2061
- _path: this._end_points.ASSET_PART_RECEIVAL,
2062
- find: async (params) => {
2063
- let res = await this._fetch(
2064
- this.svAPIEndpoint,
2065
- this.assetPartReceival._path,
2066
- params
2067
- );
2068
- return res;
2069
- },
2070
- get: async (id) => {
2071
- return await this._fetch(
2072
- this.svAPIEndpoint,
2073
- this.assetPartReceival._path + `/${id}`
2074
- );
2075
- },
2076
- create: async (body) => {
2077
- let res = await this._create(
2078
- this.svAPIEndpoint,
2079
- this.assetPartReceival._path,
2080
- body
2081
- );
2082
- return res;
2083
- },
2084
- update: async (id, body) => {
2085
- let res = await this._update(
2086
- this.svAPIEndpoint,
2087
- this.assetPartReceival._path + `/${id}`,
2088
- body
2089
- );
2090
- return res;
2091
- },
2092
- patch: async (params, body) => {
2093
- let res = await this._patch(
2094
- this.svAPIEndpoint,
2095
- this.assetPartReceival._path,
2096
- body,
2097
- params
2098
- );
2099
- return res;
2100
- },
2101
- };
2102
- this.assetPartTransfer = {
2103
- _path: this._end_points.ASSET_PART_TRANSFER,
2104
- find: async (params) => {
2105
- let res = await this._fetch(
2106
- this.svAPIEndpoint,
2107
- this.assetPartTransfer._path,
2108
- params
2109
- );
2110
- return res;
2111
- },
2112
- get: async (id) => {
2113
- return await this._fetch(
2114
- this.svAPIEndpoint,
2115
- this.assetPartTransfer._path + `/${id}`
2116
- );
2117
- },
2118
- create: async (body) => {
2119
- let res = await this._create(
2120
- this.svAPIEndpoint,
2121
- this.assetPartTransfer._path,
2122
- body
2123
- );
2124
- return res;
2125
- },
2126
- update: async (id, body) => {
2127
- let res = await this._update(
2128
- this.svAPIEndpoint,
2129
- this.assetPartTransfer._path + `/${id}`,
2130
- body
2131
- );
2132
- return res;
2133
- },
2134
- patch: async (params, body) => {
2135
- let res = await this._patch(
2136
- this.svAPIEndpoint,
2137
- this.assetPartTransfer._path,
2138
- body,
2139
- params
2140
- );
2141
- return res;
2142
- },
2143
- };
2144
- this.returnAssetPartUnit = {
2145
- _path: this._end_points.RETURN_ASSET_PART_UNIT,
2146
- find: async (params) => {
2147
- let res = await this._fetch(
2148
- this.svAPIEndpoint,
2149
- this.returnAssetPartUnit._path,
2150
- params
2151
- );
2152
- return res;
2153
- },
2154
- get: async (id) => {
2155
- return await this._fetch(
2156
- this.svAPIEndpoint,
2157
- this.returnAssetPartUnit._path + `/${id}`
2158
- );
2159
- },
2160
- create: async (body) => {
2161
- let res = await this._create(
2162
- this.svAPIEndpoint,
2163
- this.returnAssetPartUnit._path,
2164
- body
2165
- );
2166
- return res;
2167
- },
2168
- update: async (id, body) => {
2169
- let res = await this._update(
2170
- this.svAPIEndpoint,
2171
- this.returnAssetPartUnit._path + `/${id}`,
2172
- body
2173
- );
2174
- return res;
2175
- },
2176
- patch: async (params, body) => {
2177
- let res = await this._patch(
2178
- this.svAPIEndpoint,
2179
- this.returnAssetPartUnit._path,
2180
- body,
2181
- params
2182
- );
2183
- return res;
2184
- },
2185
- };
2186
- this.storeAssetPartUnit = {
2187
- _path: this._end_points.STORE_ASSET_PART_UNIT,
2188
- find: async (params) => {
2189
- let res = await this._fetch(
2190
- this.svAPIEndpoint,
2191
- this.storeAssetPartUnit._path,
2192
- params
2193
- );
2194
- return res;
2195
- },
2196
- get: async (id) => {
2197
- return await this._fetch(
2198
- this.svAPIEndpoint,
2199
- this.storeAssetPartUnit._path + `/${id}`
2200
- );
2201
- },
2202
- create: async (body) => {
2203
- let res = await this._create(
2204
- this.svAPIEndpoint,
2205
- this.storeAssetPartUnit._path,
2206
- body
2207
- );
2208
- return res;
2209
- },
2210
- update: async (id, body) => {
2211
- let res = await this._update(
2212
- this.svAPIEndpoint,
2213
- this.storeAssetPartUnit._path + `/${id}`,
2214
- body
2215
- );
2216
- return res;
2217
- },
2218
- patch: async (params, body) => {
2219
- let res = await this._patch(
2220
- this.svAPIEndpoint,
2221
- this.storeAssetPartUnit._path,
2222
- body,
2223
- params
2224
- );
2225
- return res;
2226
- },
2227
- };
2228
- this.ocrInvoiceJobTemplate = {
2229
- _path: this._end_points.OCR_INVOICE_JOB_TEMPLATE,
2230
- find: async (params) => {
2231
- let res = await this._fetch(
2232
- this.svAPIEndpoint,
2233
- this.ocrInvoiceJobTemplate._path,
2234
- params
2235
- );
2236
- return res;
2237
- },
2238
- get: async (id) => {
2239
- return await this._fetch(
2240
- this.svAPIEndpoint,
2241
- this.ocrInvoiceJobTemplate._path + `/${id}`
2242
- );
2243
- },
2244
- create: async (body) => {
2245
- let res = await this._create(
2246
- this.svAPIEndpoint,
2247
- this.ocrInvoiceJobTemplate._path,
2248
- body
2249
- );
2250
- return res;
2251
- },
2252
- update: async (id, body) => {
2253
- let res = await this._update(
2254
- this.svAPIEndpoint,
2255
- this.ocrInvoiceJobTemplate._path + `/${id}`,
2256
- body
2257
- );
2258
- return res;
2259
- },
2260
- };
2261
- this.ocrInvoiceJobGroup = {
2262
- _path: this._end_points.OCR_INVOICE_JOB_GROUP,
2263
- find: async (params) => {
2264
- let res = await this._fetch(
2265
- this.svAPIEndpoint,
2266
- this.ocrInvoiceJobGroup._path,
2267
- params
2268
- );
2269
- return res;
2270
- },
2271
- get: async (id) => {
2272
- return await this._fetch(
2273
- this.svAPIEndpoint,
2274
- this.ocrInvoiceJobGroup._path + `/${id}`
2275
- );
2276
- },
2277
- create: async (body) => {
2278
- let res = await this._create(
2279
- this.svAPIEndpoint,
2280
- this.ocrInvoiceJobGroup._path,
2281
- body
2282
- );
2283
- return res;
2284
- },
2285
- };
2286
- this.activityAiSalesOrder = {
2287
- _path: this._end_points.ACTIVITY_AI_SALES_ORDER,
2288
- find: async (params) => {
2289
- let res = await this._fetch(
2290
- this.svAPIEndpoint,
2291
- this.activityAiSalesOrder._path,
2292
- params
2293
- );
2294
- return res;
2295
- },
2296
- get: async (id) => {
2297
- return await this._fetch(
2298
- this.svAPIEndpoint,
2299
- this.activityAiSalesOrder._path + `/${id}`
2300
- );
2301
- },
2302
- create: async (body) => {
2303
- let res = await this._create(
2304
- this.svAPIEndpoint,
2305
- this.activityAiSalesOrder._path,
2306
- body
2307
- );
2308
- return res;
2309
- },
2310
- };
2311
- this.ocrInvoiceJob = {
2312
- _path: this._end_points.OCR_INVOICE_JOB,
2313
- find: async (params) => {
2314
- let res = await this._fetch(
2315
- this.svAPIEndpoint,
2316
- this.ocrInvoiceJob._path,
2317
- params
2318
- );
2319
- return res;
2320
- },
2321
- get: async (id) => {
2322
- return await this._fetch(
2323
- this.svAPIEndpoint,
2324
- this.ocrInvoiceJob._path + `/${id}`
2325
- );
2326
- },
2327
- };
2328
- this.ocrInvoiceJobPage = {
2329
- _path: this._end_points.OCR_INVOICE_JOB_PAGE,
2330
- find: async (params) => {
2331
- let res = await this._fetch(
2332
- this.svAPIEndpoint,
2333
- this.ocrInvoiceJobPage._path,
2334
- params
2335
- );
2336
- return res;
2337
- },
2338
- get: async (id) => {
2339
- return await this._fetch(
2340
- this.svAPIEndpoint,
2341
- this.ocrInvoiceJobPage._path + `/${id}`
2342
- );
2343
- },
2344
- update: async (id, body) => {
2345
- let res = await this._update(
2346
- this.svAPIEndpoint,
2347
- this.ocrInvoiceJobPage._path + `/${id}`,
2348
- body
2349
- );
2350
- return res;
2351
- },
2352
- };
2353
- this.svAPIEndpoint =
2354
- !options?.env || options?.env == "production"
2355
- ? "https://sv.api.repzo.me"
2356
- : options?.env == "staging"
2357
- ? "https://staging.sv.api.repzo.me"
2358
- : options?.env == "local"
2359
- ? "http://localhost:3030"
2360
- : "";
2361
- this.headers = {
2362
- "api-key": apiKey,
2363
- "Content-Type": "application/json",
2364
- Accept: "application/json",
2365
- };
2366
- if (options?.headers) Object.assign(this.headers, options.headers);
2367
- }
2368
- async _fetch(baseUrl, path, params) {
2369
- let res = await axios.get(`${baseUrl}/${path}`, {
2370
- params,
2371
- headers: this.headers,
2372
- });
2373
- return res.data;
2374
- }
2375
- async _create(baseUrl, path, body, params) {
2376
- let res = await axios.post(`${baseUrl}/${path}`, body, {
2377
- params,
2378
- headers: this.headers,
2379
- });
2380
- return res.data;
2381
- }
2382
- async _update(baseUrl, path, body, params) {
2383
- let res = await axios.put(`${baseUrl}/${path}`, body, {
2384
- params,
2385
- headers: this.headers,
2386
- });
2387
- return res.data;
2388
- }
2389
- async _patch(baseUrl, path, body, params) {
2390
- let res = await axios.put(`${baseUrl}/${path}`, body, {
2391
- params,
2392
- headers: this.headers,
2393
- });
2394
- return res.data;
2395
- }
2396
- async _delete(baseUrl, path, params) {
2397
- let res = await axios.delete(`${baseUrl}/${path}`, {
2398
- params,
2399
- headers: this.headers,
2400
- });
2401
- return res.data;
2402
- }
4
+ constructor(apiKey, options) {
5
+ this._end_points = {
6
+ CLIENT: "client",
7
+ PRODUCT: "product",
8
+ VARIANT: "variant",
9
+ CATEGORY: "product-category",
10
+ SUB_CATEGORY: "product-sub-category",
11
+ BRAND: "product-brand",
12
+ PRODUCT_GROUP: "product-group",
13
+ TAX: "tax",
14
+ MEASUREUNIT: "measureunits",
15
+ MEASUREUNIT_FAMILY: "measureunit-family",
16
+ MEDIA: "media",
17
+ PRICELIST: "pricelists",
18
+ PRICELIST_ITEM: "pricelistsitems",
19
+ TEAM: "teams",
20
+ RETURN_REASON: "return-reason",
21
+ REP: "rep",
22
+ TAG: "tag",
23
+ WAREHOUSE: "warehouse",
24
+ ROUTE: "route",
25
+ PRODUCT_MODIFIERS_GROUP: "product-modifiers-group",
26
+ CHANNEL: "client-channel",
27
+ SPECIALITY: "speciality",
28
+ CLIENT_CONTACT: "client-contact",
29
+ PAYMENT_TERM: "paymentterms",
30
+ BANK: "banks",
31
+ BANK_LIST: "bankslists",
32
+ CUSTOM_STATUS: "custom-status",
33
+ CUSTOM_LIST: "custom-list",
34
+ CUSTOM_LIST_ITEM: "custom-list-item",
35
+ INVENTORY_ADJUSTMENT_REASON: "inventory-adjustment-reason",
36
+ WORKORDER: "workorder",
37
+ SUPPLIER: "supplier",
38
+ QUICK_CONVERT_TO_PDF: "quick-convert-to-pdf",
39
+ VISIT: "visit",
40
+ INVOICE: "fullinvoices",
41
+ PROFORMA: "proforma",
42
+ PAYMENT: "payments",
43
+ REFUND: "refund",
44
+ SETTLEMENT: "settlement",
45
+ CHECK: "checks",
46
+ DAY: "day",
47
+ RECEIVING_MATERIAL: "receiving-material",
48
+ ADJUST_ACCOUNT: "adjust-account",
49
+ TRANSFER: "transfer",
50
+ MSL: "msl",
51
+ MSL_PRODUCT: "msl-products",
52
+ MEDIA_STORAGE: "media-storage",
53
+ STORECHECK_TEMPLATE: "storecheck-template",
54
+ ACTIVITY_STORECHECK: "activity-storecheck",
55
+ ADJUST_INVENTORY: "adjust-inventory",
56
+ INVENTORY: "inventory",
57
+ INTEGRATION_APP: "integration-app",
58
+ JOIN_ACTIONS_WEBHOOK: "svix-integration",
59
+ INTEGRATION_ACTION_LOG: "integration-action-log",
60
+ INTEGRATION_COMMAND_LOG: "integration-command-log",
61
+ PATCH_ACTION: "patch-action",
62
+ UPDATE_INTEGRATION_META: "update-integration-meta",
63
+ ASSET_PART_TYPE: "asset-part-type",
64
+ ASSET_PART: "asset-part",
65
+ ASSET_PART_UNIT: "asset-part-unit",
66
+ ASSET_PART_RECEIVAL: "asset-part-receival",
67
+ ASSET_PART_TRANSFER: "asset-part-transfer",
68
+ RETURN_ASSET_PART_UNIT: "return-asset-part-unit",
69
+ STORE_ASSET_PART_UNIT: "store-asset-part-unit",
70
+ OCR_INVOICE_JOB_TEMPLATE: "ocr-invoice-job-template",
71
+ OCR_INVOICE_JOB_GROUP: "ocr-invoice-job-group",
72
+ ACTIVITY_AI_SALES_ORDER: "activity-ai-sales-order",
73
+ OCR_INVOICE_JOB: "ocr-invoice-job",
74
+ OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
75
+ };
76
+ this.END_POINTS = this._end_points;
77
+ this.client = {
78
+ _path: this._end_points.CLIENT,
79
+ find: async (params) => {
80
+ let res = await this._fetch(this.svAPIEndpoint, this.client._path, params);
81
+ return res;
82
+ },
83
+ get: async (id, params) => {
84
+ return await this._fetch(this.svAPIEndpoint, this.client._path + `/${id}`, params);
85
+ },
86
+ create: async (body) => {
87
+ let res = await this._create(this.svAPIEndpoint, this.client._path, body);
88
+ return res;
89
+ },
90
+ update: async (id, body) => {
91
+ let res = await this._update(this.svAPIEndpoint, this.client._path + `/${id}`, body);
92
+ return res;
93
+ },
94
+ remove: async (id) => {
95
+ let res = await this._delete(this.svAPIEndpoint, this.client._path + `/${id}`);
96
+ return res;
97
+ },
98
+ };
99
+ this.product = {
100
+ _path: this._end_points.PRODUCT,
101
+ find: async (params) => {
102
+ let res = await this._fetch(this.svAPIEndpoint, this.product._path, params);
103
+ return res;
104
+ },
105
+ get: async (id, params) => {
106
+ return await this._fetch(this.svAPIEndpoint, this.product._path + `/${id}`, params);
107
+ },
108
+ create: async (body) => {
109
+ let res = await this._create(this.svAPIEndpoint, this.product._path, body);
110
+ return res;
111
+ },
112
+ update: async (id, body) => {
113
+ let res = await this._update(this.svAPIEndpoint, this.product._path + `/${id}`, body);
114
+ return res;
115
+ },
116
+ remove: async (id) => {
117
+ let res = await this._delete(this.svAPIEndpoint, this.product._path + `/${id}`);
118
+ return res;
119
+ },
120
+ };
121
+ this.variant = {
122
+ _path: this._end_points.VARIANT,
123
+ find: async (params) => {
124
+ let res = await this._fetch(this.svAPIEndpoint, this.variant._path, params);
125
+ return res;
126
+ },
127
+ get: async (id, params) => {
128
+ return await this._fetch(this.svAPIEndpoint, this.variant._path + `/${id}`, params);
129
+ },
130
+ create: async (body) => {
131
+ let res = await this._create(this.svAPIEndpoint, this.variant._path, body);
132
+ return res;
133
+ },
134
+ update: async (id, body) => {
135
+ let res = await this._update(this.svAPIEndpoint, this.variant._path + `/${id}`, body);
136
+ return res;
137
+ },
138
+ remove: async (id) => {
139
+ let res = await this._delete(this.svAPIEndpoint, this.variant._path + `/${id}`);
140
+ return res;
141
+ },
142
+ };
143
+ this.category = {
144
+ _path: this._end_points.CATEGORY,
145
+ find: async (params) => {
146
+ let res = await this._fetch(this.svAPIEndpoint, this.category._path, params);
147
+ return res;
148
+ },
149
+ get: async (id) => {
150
+ return await this._fetch(this.svAPIEndpoint, this.category._path + `/${id}`);
151
+ },
152
+ create: async (body) => {
153
+ let res = await this._create(this.svAPIEndpoint, this.category._path, body);
154
+ return res;
155
+ },
156
+ update: async (id, body) => {
157
+ let res = await this._update(this.svAPIEndpoint, this.category._path + `/${id}`, body);
158
+ return res;
159
+ },
160
+ remove: async (id) => {
161
+ let res = await this._delete(this.svAPIEndpoint, this.category._path + `/${id}`);
162
+ return res;
163
+ },
164
+ };
165
+ this.sub_category = {
166
+ _path: this._end_points.SUB_CATEGORY,
167
+ find: async (params) => {
168
+ let res = await this._fetch(this.svAPIEndpoint, this.sub_category._path, params);
169
+ return res;
170
+ },
171
+ get: async (id, params) => {
172
+ return await this._fetch(this.svAPIEndpoint, this.sub_category._path + `/${id}`, params);
173
+ },
174
+ create: async (body) => {
175
+ let res = await this._create(this.svAPIEndpoint, this.sub_category._path, body);
176
+ return res;
177
+ },
178
+ update: async (id, body) => {
179
+ let res = await this._update(this.svAPIEndpoint, this.sub_category._path + `/${id}`, body);
180
+ return res;
181
+ },
182
+ remove: async (id) => {
183
+ let res = await this._delete(this.svAPIEndpoint, this.sub_category._path + `/${id}`);
184
+ return res;
185
+ },
186
+ };
187
+ this.brand = {
188
+ _path: this._end_points.BRAND,
189
+ find: async (params) => {
190
+ let res = await this._fetch(this.svAPIEndpoint, this.brand._path, params);
191
+ return res;
192
+ },
193
+ get: async (id) => {
194
+ return await this._fetch(this.svAPIEndpoint, this.brand._path + `/${id}`);
195
+ },
196
+ create: async (body) => {
197
+ let res = await this._create(this.svAPIEndpoint, this.brand._path, body);
198
+ return res;
199
+ },
200
+ update: async (id, body) => {
201
+ let res = await this._update(this.svAPIEndpoint, this.brand._path + `/${id}`, body);
202
+ return res;
203
+ },
204
+ remove: async (id) => {
205
+ let res = await this._delete(this.svAPIEndpoint, this.brand._path + `/${id}`);
206
+ return res;
207
+ },
208
+ };
209
+ this.product_group = {
210
+ _path: this._end_points.PRODUCT_GROUP,
211
+ find: async (params) => {
212
+ let res = await this._fetch(this.svAPIEndpoint, this.product_group._path, params);
213
+ return res;
214
+ },
215
+ get: async (id) => {
216
+ return await this._fetch(this.svAPIEndpoint, this.product_group._path + `/${id}`);
217
+ },
218
+ create: async (body) => {
219
+ let res = await this._create(this.svAPIEndpoint, this.product_group._path, body);
220
+ return res;
221
+ },
222
+ update: async (id, body) => {
223
+ let res = await this._update(this.svAPIEndpoint, this.product_group._path + `/${id}`, body);
224
+ return res;
225
+ },
226
+ remove: async (id) => {
227
+ let res = await this._delete(this.svAPIEndpoint, this.product_group._path + `/${id}`);
228
+ return res;
229
+ },
230
+ };
231
+ this.tax = {
232
+ _path: this._end_points.TAX,
233
+ find: async (params) => {
234
+ let res = await this._fetch(this.svAPIEndpoint, this.tax._path, params);
235
+ return res;
236
+ },
237
+ get: async (id) => {
238
+ return await this._fetch(this.svAPIEndpoint, this.tax._path + `/${id}`);
239
+ },
240
+ create: async (body) => {
241
+ let res = await this._create(this.svAPIEndpoint, this.tax._path, body);
242
+ return res;
243
+ },
244
+ update: async (id, body) => {
245
+ let res = await this._update(this.svAPIEndpoint, this.tax._path + `/${id}`, body);
246
+ return res;
247
+ },
248
+ remove: async (id) => {
249
+ let res = await this._delete(this.svAPIEndpoint, this.tax._path + `/${id}`);
250
+ return res;
251
+ },
252
+ };
253
+ this.measureunit = {
254
+ _path: this._end_points.MEASUREUNIT,
255
+ find: async (params) => {
256
+ let res = await this._fetch(this.svAPIEndpoint, this.measureunit._path, params);
257
+ return res;
258
+ },
259
+ get: async (id) => {
260
+ return await this._fetch(this.svAPIEndpoint, this.measureunit._path + `/${id}`);
261
+ },
262
+ create: async (body) => {
263
+ let res = await this._create(this.svAPIEndpoint, this.measureunit._path, body);
264
+ return res;
265
+ },
266
+ update: async (id, body) => {
267
+ let res = await this._update(this.svAPIEndpoint, this.measureunit._path + `/${id}`, body);
268
+ return res;
269
+ },
270
+ remove: async (id) => {
271
+ let res = await this._delete(this.svAPIEndpoint, this.measureunit._path + `/${id}`);
272
+ return res;
273
+ },
274
+ };
275
+ this.measureunitFamily = {
276
+ _path: this._end_points.MEASUREUNIT_FAMILY,
277
+ find: async (params) => {
278
+ let res = await this._fetch(this.svAPIEndpoint, this.measureunitFamily._path, params);
279
+ return res;
280
+ },
281
+ get: async (id) => {
282
+ return await this._fetch(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`);
283
+ },
284
+ create: async (body) => {
285
+ let res = await this._create(this.svAPIEndpoint, this.measureunitFamily._path, body);
286
+ return res;
287
+ },
288
+ update: async (id, body) => {
289
+ let res = await this._update(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`, body);
290
+ return res;
291
+ },
292
+ remove: async (id) => {
293
+ let res = await this._delete(this.svAPIEndpoint, this.measureunitFamily._path + `/${id}`);
294
+ return res;
295
+ },
296
+ };
297
+ this.media = {
298
+ _path: this._end_points.MEDIA,
299
+ find: async (params) => {
300
+ let res = await this._fetch(this.svAPIEndpoint, this.media._path, params);
301
+ return res;
302
+ },
303
+ get: async (id) => {
304
+ return await this._fetch(this.svAPIEndpoint, this.media._path + `/${id}`);
305
+ },
306
+ create: async (body) => {
307
+ let res = await this._create(this.svAPIEndpoint, this.media._path, body);
308
+ return res;
309
+ },
310
+ update: async (id, body) => {
311
+ let res = await this._update(this.svAPIEndpoint, this.media._path + `/${id}`, body);
312
+ return res;
313
+ },
314
+ remove: async (id) => {
315
+ let res = await this._delete(this.svAPIEndpoint, this.media._path + `/${id}`);
316
+ return res;
317
+ },
318
+ };
319
+ this.priceList = {
320
+ _path: this._end_points.PRICELIST,
321
+ find: async (params) => {
322
+ let res = await this._fetch(this.svAPIEndpoint, this.priceList._path, params);
323
+ return res;
324
+ },
325
+ get: async (id) => {
326
+ return await this._fetch(this.svAPIEndpoint, this.priceList._path + `/${id}`);
327
+ },
328
+ create: async (body) => {
329
+ let res = await this._create(this.svAPIEndpoint, this.priceList._path, body);
330
+ return res;
331
+ },
332
+ update: async (id, body) => {
333
+ let res = await this._update(this.svAPIEndpoint, this.priceList._path + `/${id}`, body);
334
+ return res;
335
+ },
336
+ remove: async (id) => {
337
+ let res = await this._delete(this.svAPIEndpoint, this.priceList._path + `/${id}`);
338
+ return res;
339
+ },
340
+ };
341
+ this.priceListItem = {
342
+ _path: this._end_points.PRICELIST_ITEM,
343
+ find: async (params) => {
344
+ let res = await this._fetch(this.svAPIEndpoint, this.priceListItem._path, params);
345
+ return res;
346
+ },
347
+ get: async (id) => {
348
+ return await this._fetch(this.svAPIEndpoint, this.priceListItem._path + `/${id}`);
349
+ },
350
+ create: async (body) => {
351
+ let res = await this._create(this.svAPIEndpoint, this.priceListItem._path, body);
352
+ return res;
353
+ },
354
+ update: async (id, body) => {
355
+ let res = await this._update(this.svAPIEndpoint, this.priceListItem._path + `/${id}`, body);
356
+ return res;
357
+ },
358
+ remove: async (id) => {
359
+ let res = await this._delete(this.svAPIEndpoint, this.priceListItem._path + `/${id}`);
360
+ return res;
361
+ },
362
+ };
363
+ this.team = {
364
+ _path: this._end_points.TEAM,
365
+ find: async (params) => {
366
+ let res = await this._fetch(this.svAPIEndpoint, this.team._path, params);
367
+ return res;
368
+ },
369
+ get: async (id) => {
370
+ return await this._fetch(this.svAPIEndpoint, this.team._path + `/${id}`);
371
+ },
372
+ create: async (body) => {
373
+ let res = await this._create(this.svAPIEndpoint, this.team._path, body);
374
+ return res;
375
+ },
376
+ update: async (id, body) => {
377
+ let res = await this._update(this.svAPIEndpoint, this.team._path + `/${id}`, body);
378
+ return res;
379
+ },
380
+ remove: async (id) => {
381
+ let res = await this._delete(this.svAPIEndpoint, this.team._path + `/${id}`);
382
+ return res;
383
+ },
384
+ };
385
+ this.returnReason = {
386
+ _path: this._end_points.RETURN_REASON,
387
+ find: async (params) => {
388
+ let res = await this._fetch(this.svAPIEndpoint, this.returnReason._path, params);
389
+ return res;
390
+ },
391
+ get: async (id) => {
392
+ return await this._fetch(this.svAPIEndpoint, this.returnReason._path + `/${id}`);
393
+ },
394
+ create: async (body) => {
395
+ let res = await this._create(this.svAPIEndpoint, this.returnReason._path, body);
396
+ return res;
397
+ },
398
+ update: async (id, body) => {
399
+ let res = await this._update(this.svAPIEndpoint, this.returnReason._path + `/${id}`, body);
400
+ return res;
401
+ },
402
+ remove: async (id) => {
403
+ let res = await this._delete(this.svAPIEndpoint, this.returnReason._path + `/${id}`);
404
+ return res;
405
+ },
406
+ };
407
+ this.rep = {
408
+ _path: this._end_points.REP,
409
+ find: async (params) => {
410
+ let res = await this._fetch(this.svAPIEndpoint, this.rep._path, params);
411
+ return res;
412
+ },
413
+ get: async (id, params) => {
414
+ return await this._fetch(this.svAPIEndpoint, this.rep._path + `/${id}`, params);
415
+ },
416
+ create: async (body) => {
417
+ let res = await this._create(this.svAPIEndpoint, this.rep._path, body);
418
+ return res;
419
+ },
420
+ update: async (id, body) => {
421
+ let res = await this._update(this.svAPIEndpoint, this.rep._path + `/${id}`, body);
422
+ return res;
423
+ },
424
+ remove: async (id) => {
425
+ let res = await this._delete(this.svAPIEndpoint, this.rep._path + `/${id}`);
426
+ return res;
427
+ },
428
+ };
429
+ this.tag = {
430
+ _path: this._end_points.TAG,
431
+ find: async (params) => {
432
+ let res = await this._fetch(this.svAPIEndpoint, this.tag._path, params);
433
+ return res;
434
+ },
435
+ get: async (id) => {
436
+ return await this._fetch(this.svAPIEndpoint, this.tag._path + `/${id}`);
437
+ },
438
+ create: async (body) => {
439
+ let res = await this._create(this.svAPIEndpoint, this.tag._path, body);
440
+ return res;
441
+ },
442
+ update: async (id, body) => {
443
+ let res = await this._update(this.svAPIEndpoint, this.tag._path + `/${id}`, body);
444
+ return res;
445
+ },
446
+ remove: async (id) => {
447
+ let res = await this._delete(this.svAPIEndpoint, this.tag._path + `/${id}`);
448
+ return res;
449
+ },
450
+ };
451
+ this.warehouse = {
452
+ _path: this._end_points.WAREHOUSE,
453
+ find: async (params) => {
454
+ let res = await this._fetch(this.svAPIEndpoint, this.warehouse._path, params);
455
+ return res;
456
+ },
457
+ get: async (id) => {
458
+ return await this._fetch(this.svAPIEndpoint, this.warehouse._path + `/${id}`);
459
+ },
460
+ create: async (body) => {
461
+ let res = await this._create(this.svAPIEndpoint, this.warehouse._path, body);
462
+ return res;
463
+ },
464
+ update: async (id, body) => {
465
+ let res = await this._update(this.svAPIEndpoint, this.warehouse._path + `/${id}`, body);
466
+ return res;
467
+ },
468
+ remove: async (id) => {
469
+ let res = await this._delete(this.svAPIEndpoint, this.warehouse._path + `/${id}`);
470
+ return res;
471
+ },
472
+ };
473
+ this.route = {
474
+ _path: this._end_points.ROUTE,
475
+ find: async (params) => {
476
+ let res = await this._fetch(this.svAPIEndpoint, this.route._path, params);
477
+ return res;
478
+ },
479
+ get: async (id) => {
480
+ return await this._fetch(this.svAPIEndpoint, this.route._path + `/${id}`);
481
+ },
482
+ create: async (body) => {
483
+ let res = await this._create(this.svAPIEndpoint, this.route._path, body);
484
+ return res;
485
+ },
486
+ update: async (id, body) => {
487
+ let res = await this._update(this.svAPIEndpoint, this.route._path + `/${id}`, body);
488
+ return res;
489
+ },
490
+ remove: async (id) => {
491
+ let res = await this._delete(this.svAPIEndpoint, this.route._path + `/${id}`);
492
+ return res;
493
+ },
494
+ };
495
+ this.productModifiersGroup = {
496
+ _path: this._end_points.PRODUCT_MODIFIERS_GROUP,
497
+ find: async (params) => {
498
+ let res = await this._fetch(this.svAPIEndpoint, this.productModifiersGroup._path, params);
499
+ return res;
500
+ },
501
+ get: async (id) => {
502
+ return await this._fetch(this.svAPIEndpoint, this.productModifiersGroup._path + `/${id}`);
503
+ },
504
+ create: async (body) => {
505
+ let res = await this._create(this.svAPIEndpoint, this.productModifiersGroup._path, body);
506
+ return res;
507
+ },
508
+ update: async (id, body) => {
509
+ let res = await this._update(this.svAPIEndpoint, this.productModifiersGroup._path + `/${id}`, body);
510
+ return res;
511
+ },
512
+ remove: async (id) => {
513
+ let res = await this._delete(this.svAPIEndpoint, this.productModifiersGroup._path + `/${id}`);
514
+ return res;
515
+ },
516
+ };
517
+ this.channel = {
518
+ _path: this._end_points.CHANNEL,
519
+ find: async (params) => {
520
+ let res = await this._fetch(this.svAPIEndpoint, this.channel._path, params);
521
+ return res;
522
+ },
523
+ get: async (id) => {
524
+ return await this._fetch(this.svAPIEndpoint, this.channel._path + `/${id}`);
525
+ },
526
+ create: async (body) => {
527
+ let res = await this._create(this.svAPIEndpoint, this.channel._path, body);
528
+ return res;
529
+ },
530
+ update: async (id, body) => {
531
+ let res = await this._update(this.svAPIEndpoint, this.channel._path + `/${id}`, body);
532
+ return res;
533
+ },
534
+ remove: async (id) => {
535
+ let res = await this._delete(this.svAPIEndpoint, this.channel._path + `/${id}`);
536
+ return res;
537
+ },
538
+ };
539
+ this.speciality = {
540
+ _path: this._end_points.SPECIALITY,
541
+ find: async (params) => {
542
+ let res = await this._fetch(this.svAPIEndpoint, this.speciality._path, params);
543
+ return res;
544
+ },
545
+ get: async (id) => {
546
+ return await this._fetch(this.svAPIEndpoint, this.speciality._path + `/${id}`);
547
+ },
548
+ create: async (body) => {
549
+ let res = await this._create(this.svAPIEndpoint, this.speciality._path, body);
550
+ return res;
551
+ },
552
+ update: async (id, body) => {
553
+ let res = await this._update(this.svAPIEndpoint, this.speciality._path + `/${id}`, body);
554
+ return res;
555
+ },
556
+ remove: async (id) => {
557
+ let res = await this._delete(this.svAPIEndpoint, this.speciality._path + `/${id}`);
558
+ return res;
559
+ },
560
+ };
561
+ this.clientContact = {
562
+ _path: this._end_points.CLIENT_CONTACT,
563
+ find: async (params) => {
564
+ let res = await this._fetch(this.svAPIEndpoint, this.clientContact._path, params);
565
+ return res;
566
+ },
567
+ get: async (id) => {
568
+ return await this._fetch(this.svAPIEndpoint, this.clientContact._path + `/${id}`);
569
+ },
570
+ create: async (body) => {
571
+ let res = await this._create(this.svAPIEndpoint, this.clientContact._path, body);
572
+ return res;
573
+ },
574
+ update: async (id, body) => {
575
+ let res = await this._update(this.svAPIEndpoint, this.clientContact._path + `/${id}`, body);
576
+ return res;
577
+ },
578
+ remove: async (id) => {
579
+ let res = await this._delete(this.svAPIEndpoint, this.clientContact._path + `/${id}`);
580
+ return res;
581
+ },
582
+ };
583
+ this.paymentTerm = {
584
+ _path: this._end_points.PAYMENT_TERM,
585
+ find: async (params) => {
586
+ let res = await this._fetch(this.svAPIEndpoint, this.paymentTerm._path, params);
587
+ return res;
588
+ },
589
+ get: async (id) => {
590
+ return await this._fetch(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`);
591
+ },
592
+ create: async (body) => {
593
+ let res = await this._create(this.svAPIEndpoint, this.paymentTerm._path, body);
594
+ return res;
595
+ },
596
+ update: async (id, body) => {
597
+ let res = await this._update(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`, body);
598
+ return res;
599
+ },
600
+ remove: async (id) => {
601
+ let res = await this._delete(this.svAPIEndpoint, this.paymentTerm._path + `/${id}`);
602
+ return res;
603
+ },
604
+ };
605
+ this.bank = {
606
+ _path: this._end_points.BANK,
607
+ find: async (params) => {
608
+ let res = await this._fetch(this.svAPIEndpoint, this.bank._path, params);
609
+ return res;
610
+ },
611
+ get: async (id) => {
612
+ return await this._fetch(this.svAPIEndpoint, this.bank._path + `/${id}`);
613
+ },
614
+ create: async (body) => {
615
+ let res = await this._create(this.svAPIEndpoint, this.bank._path, body);
616
+ return res;
617
+ },
618
+ update: async (id, body) => {
619
+ let res = await this._update(this.svAPIEndpoint, this.bank._path + `/${id}`, body);
620
+ return res;
621
+ },
622
+ };
623
+ this.bank_list = {
624
+ _path: this._end_points.BANK_LIST,
625
+ find: async (params) => {
626
+ let res = await this._fetch(this.svAPIEndpoint, this.bank_list._path, params);
627
+ return res;
628
+ },
629
+ get: async (id) => {
630
+ return await this._fetch(this.svAPIEndpoint, this.bank_list._path + `/${id}`);
631
+ },
632
+ create: async (body) => {
633
+ let res = await this._create(this.svAPIEndpoint, this.bank_list._path, body);
634
+ return res;
635
+ },
636
+ update: async (id, body) => {
637
+ let res = await this._update(this.svAPIEndpoint, this.bank_list._path + `/${id}`, body);
638
+ return res;
639
+ },
640
+ };
641
+ this.customStatus = {
642
+ _path: this._end_points.CUSTOM_STATUS,
643
+ find: async (params) => {
644
+ let res = await this._fetch(this.svAPIEndpoint, this.customStatus._path, params);
645
+ return res;
646
+ },
647
+ get: async (id) => {
648
+ return await this._fetch(this.svAPIEndpoint, this.customStatus._path + `/${id}`);
649
+ },
650
+ create: async (body) => {
651
+ let res = await this._create(this.svAPIEndpoint, this.customStatus._path, body);
652
+ return res;
653
+ },
654
+ update: async (id, body) => {
655
+ let res = await this._update(this.svAPIEndpoint, this.customStatus._path + `/${id}`, body);
656
+ return res;
657
+ },
658
+ remove: async (id) => {
659
+ let res = await this._delete(this.svAPIEndpoint, this.customStatus._path + `/${id}`);
660
+ return res;
661
+ },
662
+ };
663
+ this.customList = {
664
+ _path: this._end_points.CUSTOM_LIST,
665
+ find: async (params) => {
666
+ let res = await this._fetch(this.svAPIEndpoint, this.customList._path, params);
667
+ return res;
668
+ },
669
+ get: async (id, params) => {
670
+ return await this._fetch(this.svAPIEndpoint, this.customList._path + `/${id}`, params);
671
+ },
672
+ create: async (body) => {
673
+ let res = await this._create(this.svAPIEndpoint, this.customList._path, body);
674
+ return res;
675
+ },
676
+ update: async (id, body) => {
677
+ let res = await this._update(this.svAPIEndpoint, this.customList._path + `/${id}`, body);
678
+ return res;
679
+ },
680
+ remove: async (id) => {
681
+ let res = await this._delete(this.svAPIEndpoint, this.customList._path + `/${id}`);
682
+ return res;
683
+ },
684
+ };
685
+ this.customListItem = {
686
+ _path: this._end_points.CUSTOM_LIST_ITEM,
687
+ find: async (params) => {
688
+ let res = await this._fetch(this.svAPIEndpoint, this.customListItem._path, params);
689
+ return res;
690
+ },
691
+ get: async (id, params) => {
692
+ return await this._fetch(this.svAPIEndpoint, this.customListItem._path + `/${id}`, params);
693
+ },
694
+ create: async (body) => {
695
+ let res = await this._create(this.svAPIEndpoint, this.customListItem._path, body);
696
+ return res;
697
+ },
698
+ update: async (id, body) => {
699
+ let res = await this._update(this.svAPIEndpoint, this.customListItem._path + `/${id}`, body);
700
+ return res;
701
+ },
702
+ remove: async (id) => {
703
+ let res = await this._delete(this.svAPIEndpoint, this.customListItem._path + `/${id}`);
704
+ return res;
705
+ },
706
+ };
707
+ this.inventoryAdjustmentReason = {
708
+ _path: this._end_points.INVENTORY_ADJUSTMENT_REASON,
709
+ find: async (params) => {
710
+ let res = await this._fetch(this.svAPIEndpoint, this.inventoryAdjustmentReason._path, params);
711
+ return res;
712
+ },
713
+ get: async (id) => {
714
+ return await this._fetch(this.svAPIEndpoint, this.inventoryAdjustmentReason._path + `/${id}`);
715
+ },
716
+ create: async (body) => {
717
+ let res = await this._create(this.svAPIEndpoint, this.inventoryAdjustmentReason._path, body);
718
+ return res;
719
+ },
720
+ update: async (id, body) => {
721
+ let res = await this._update(this.svAPIEndpoint, this.customListItem._path + `/${id}`, body);
722
+ return res;
723
+ },
724
+ remove: async (id) => {
725
+ let res = await this._delete(this.svAPIEndpoint, this.inventoryAdjustmentReason._path + `/${id}`);
726
+ return res;
727
+ },
728
+ };
729
+ this.workorder = {
730
+ _path: this._end_points.WORKORDER,
731
+ find: async (params) => {
732
+ let res = await this._fetch(this.svAPIEndpoint, this.workorder._path, params);
733
+ return res;
734
+ },
735
+ get: async (id, params) => {
736
+ return await this._fetch(this.svAPIEndpoint, this.workorder._path + `/${id}`, params);
737
+ },
738
+ };
739
+ this.supplier = {
740
+ _path: this._end_points.SUPPLIER,
741
+ find: async (params) => {
742
+ let res = await this._fetch(this.svAPIEndpoint, this.supplier._path, params);
743
+ return res;
744
+ },
745
+ get: async (id, params) => {
746
+ return await this._fetch(this.svAPIEndpoint, this.supplier._path + `/${id}`, params);
747
+ },
748
+ create: async (body) => {
749
+ let res = await this._create(this.svAPIEndpoint, this.supplier._path, body);
750
+ return res;
751
+ },
752
+ update: async (id, body) => {
753
+ let res = await this._update(this.svAPIEndpoint, this.supplier._path + `/${id}`, body);
754
+ return res;
755
+ },
756
+ };
757
+ this.quickConvertToPdf = {
758
+ _path: this._end_points.QUICK_CONVERT_TO_PDF,
759
+ find: async (params) => {
760
+ let res = await this._fetch(this.svAPIEndpoint, this.quickConvertToPdf._path, params);
761
+ return res;
762
+ },
763
+ get: async (id, params) => {
764
+ return await this._fetch(this.svAPIEndpoint, this.quickConvertToPdf._path + `/${id}`, params);
765
+ },
766
+ create: async (body) => {
767
+ let res = await this._create(this.svAPIEndpoint, this.quickConvertToPdf._path, body);
768
+ return res;
769
+ },
770
+ remove: async (id) => {
771
+ let res = await this._delete(this.svAPIEndpoint, this.quickConvertToPdf._path + `/${id}`);
772
+ return res;
773
+ },
774
+ };
775
+ this.visit = {
776
+ _path: this._end_points.VISIT,
777
+ find: async (params) => {
778
+ let res = await this._fetch(this.svAPIEndpoint, this.visit._path, params);
779
+ return res;
780
+ },
781
+ get: async (id, params) => {
782
+ return await this._fetch(this.svAPIEndpoint, this.visit._path + `/${id}`, params);
783
+ },
784
+ create: async (body) => {
785
+ let res = await this._create(this.svAPIEndpoint, this.visit._path, body);
786
+ return res;
787
+ },
788
+ update: async (id, body) => {
789
+ let res = await this._update(this.svAPIEndpoint, this.visit._path + `/${id}`, body);
790
+ return res;
791
+ },
792
+ };
793
+ this.invoice = {
794
+ _path: this._end_points.INVOICE,
795
+ find: async (params) => {
796
+ let res = await this._fetch(this.svAPIEndpoint, this.invoice._path, params);
797
+ return res;
798
+ },
799
+ get: async (id, params) => {
800
+ return await this._fetch(this.svAPIEndpoint, this.invoice._path + `/${id}`, params);
801
+ },
802
+ create: async (body) => {
803
+ let res = await this._create(this.svAPIEndpoint, this.invoice._path, body);
804
+ return res;
805
+ },
806
+ update: async (id, body) => {
807
+ let res = await this._update(this.svAPIEndpoint, this.invoice._path + `/${id}`, body);
808
+ return res;
809
+ },
810
+ };
811
+ this.proforma = {
812
+ _path: this._end_points.PROFORMA,
813
+ find: async (params) => {
814
+ let res = await this._fetch(this.svAPIEndpoint, this.proforma._path, params);
815
+ return res;
816
+ },
817
+ get: async (id, params) => {
818
+ return await this._fetch(this.svAPIEndpoint, this.proforma._path + `/${id}`, params);
819
+ },
820
+ create: async (body) => {
821
+ let res = await this._create(this.svAPIEndpoint, this.proforma._path, body);
822
+ return res;
823
+ },
824
+ update: async (id, body) => {
825
+ let res = await this._update(this.svAPIEndpoint, this.proforma._path + `/${id}`, body);
826
+ return res;
827
+ },
828
+ };
829
+ this.payment = {
830
+ _path: this._end_points.PAYMENT,
831
+ find: async (params) => {
832
+ let res = await this._fetch(this.svAPIEndpoint, this.payment._path, params);
833
+ return res;
834
+ },
835
+ get: async (id, params) => {
836
+ return await this._fetch(this.svAPIEndpoint, this.payment._path + `/${id}`, params);
837
+ },
838
+ create: async (body) => {
839
+ let res = await this._create(this.svAPIEndpoint, this.payment._path, body);
840
+ return res;
841
+ },
842
+ update: async (id, body) => {
843
+ let res = await this._update(this.svAPIEndpoint, this.payment._path + `/${id}`, body);
844
+ return res;
845
+ },
846
+ };
847
+ this.refund = {
848
+ _path: this._end_points.REFUND,
849
+ find: async (params) => {
850
+ let res = await this._fetch(this.svAPIEndpoint, this.refund._path, params);
851
+ return res;
852
+ },
853
+ get: async (id, params) => {
854
+ return await this._fetch(this.svAPIEndpoint, this.refund._path + `/${id}`, params);
855
+ },
856
+ create: async (body) => {
857
+ let res = await this._create(this.svAPIEndpoint, this.refund._path, body);
858
+ return res;
859
+ },
860
+ update: async (id, body) => {
861
+ let res = await this._update(this.svAPIEndpoint, this.refund._path + `/${id}`, body);
862
+ return res;
863
+ },
864
+ };
865
+ this.settlement = {
866
+ _path: this._end_points.SETTLEMENT,
867
+ find: async (params) => {
868
+ let res = await this._fetch(this.svAPIEndpoint, this.settlement._path, params);
869
+ return res;
870
+ },
871
+ get: async (id, params) => {
872
+ return await this._fetch(this.svAPIEndpoint, this.settlement._path + `/${id}`, params);
873
+ },
874
+ create: async (body) => {
875
+ let res = await this._create(this.svAPIEndpoint, this.settlement._path, body);
876
+ return res;
877
+ },
878
+ };
879
+ this.check = {
880
+ _path: this._end_points.CHECK,
881
+ find: async (params) => {
882
+ let res = await this._fetch(this.svAPIEndpoint, this.check._path, params);
883
+ return res;
884
+ },
885
+ get: async (id, params) => {
886
+ return await this._fetch(this.svAPIEndpoint, this.check._path + `/${id}`, params);
887
+ },
888
+ create: async (body) => {
889
+ let res = await this._create(this.svAPIEndpoint, this.check._path, body);
890
+ return res;
891
+ },
892
+ };
893
+ this.day = {
894
+ _path: this._end_points.DAY,
895
+ find: async (params) => {
896
+ let res = await this._fetch(this.svAPIEndpoint, this.day._path, params);
897
+ return res;
898
+ },
899
+ get: async (id, params) => {
900
+ return await this._fetch(this.svAPIEndpoint, this.day._path + `/${id}`, params);
901
+ },
902
+ create: async (body) => {
903
+ let res = await this._create(this.svAPIEndpoint, this.day._path, body);
904
+ return res;
905
+ },
906
+ };
907
+ this.receivingMaterial = {
908
+ _path: this._end_points.RECEIVING_MATERIAL,
909
+ find: async (params) => {
910
+ let res = await this._fetch(this.svAPIEndpoint, this.receivingMaterial._path, params);
911
+ return res;
912
+ },
913
+ get: async (id, params) => {
914
+ return await this._fetch(this.svAPIEndpoint, this.receivingMaterial._path + `/${id}`, params);
915
+ },
916
+ create: async (body) => {
917
+ let res = await this._create(this.svAPIEndpoint, this.receivingMaterial._path, body);
918
+ return res;
919
+ },
920
+ update: async (id, body) => {
921
+ let res = await this._update(this.svAPIEndpoint, this.receivingMaterial._path + `/${id}`, body);
922
+ return res;
923
+ },
924
+ };
925
+ this.adjustAccount = {
926
+ _path: this._end_points.ADJUST_ACCOUNT,
927
+ find: async (params) => {
928
+ let res = await this._fetch(this.svAPIEndpoint, this.adjustAccount._path, params);
929
+ return res;
930
+ },
931
+ get: async (id, params) => {
932
+ return await this._fetch(this.svAPIEndpoint, this.adjustAccount._path + `/${id}`, params);
933
+ },
934
+ create: async (body) => {
935
+ let res = await this._create(this.svAPIEndpoint, this.adjustAccount._path, body);
936
+ return res;
937
+ },
938
+ };
939
+ this.transfer = {
940
+ _path: this._end_points.TRANSFER,
941
+ find: async (params) => {
942
+ let res = await this._fetch(this.svAPIEndpoint, this.transfer._path, params);
943
+ return res;
944
+ },
945
+ get: async (id, params) => {
946
+ return await this._fetch(this.svAPIEndpoint, this.transfer._path + `/${id}`, params);
947
+ },
948
+ create: async (body) => {
949
+ let res = await this._create(this.svAPIEndpoint, this.transfer._path, body);
950
+ return res;
951
+ },
952
+ update: async (id, body) => {
953
+ let res = await this._update(this.svAPIEndpoint, this.transfer._path + `/${id}`, body);
954
+ return res;
955
+ },
956
+ };
957
+ this.msl = {
958
+ _path: this._end_points.MSL,
959
+ find: async (params) => {
960
+ let res = await this._fetch(this.svAPIEndpoint, this.msl._path, params);
961
+ return res;
962
+ },
963
+ get: async (id, params) => {
964
+ return await this._fetch(this.svAPIEndpoint, this.msl._path + `/${id}`, params);
965
+ },
966
+ create: async (body) => {
967
+ let res = await this._create(this.svAPIEndpoint, this.msl._path, body);
968
+ return res;
969
+ },
970
+ update: async (id, body) => {
971
+ let res = await this._update(this.svAPIEndpoint, this.msl._path + `/${id}`, body);
972
+ return res;
973
+ },
974
+ remove: async (id) => {
975
+ let res = await this._delete(this.svAPIEndpoint, this.msl._path + `/${id}`);
976
+ return res;
977
+ },
978
+ };
979
+ this.mslProduct = {
980
+ _path: this._end_points.MSL_PRODUCT,
981
+ find: async (params) => {
982
+ let res = await this._fetch(this.svAPIEndpoint, this.mslProduct._path, params);
983
+ return res;
984
+ },
985
+ get: async (id, params) => {
986
+ return await this._fetch(this.svAPIEndpoint, this.mslProduct._path + `/${id}`, params);
987
+ },
988
+ create: async (body) => {
989
+ let res = await this._create(this.svAPIEndpoint, this.mslProduct._path, body);
990
+ return res;
991
+ },
992
+ update: async (id, body) => {
993
+ let res = await this._update(this.svAPIEndpoint, this.mslProduct._path + `/${id}`, body);
994
+ return res;
995
+ },
996
+ remove: async (id) => {
997
+ let res = await this._delete(this.svAPIEndpoint, this.mslProduct._path + `/${id}`);
998
+ return res;
999
+ },
1000
+ };
1001
+ this.mediaStorage = {
1002
+ _path: this._end_points.MEDIA_STORAGE,
1003
+ find: async (params) => {
1004
+ let res = await this._fetch(this.svAPIEndpoint, this.mediaStorage._path, params);
1005
+ return res;
1006
+ },
1007
+ get: async (id, params) => {
1008
+ return await this._fetch(this.svAPIEndpoint, this.mediaStorage._path + `/${id}`, params);
1009
+ },
1010
+ create: async (body) => {
1011
+ let res = await this._create(this.svAPIEndpoint, this.mediaStorage._path, body);
1012
+ return res;
1013
+ },
1014
+ update: async (id, body) => {
1015
+ let res = await this._update(this.svAPIEndpoint, this.mediaStorage._path + `/${id}`, body);
1016
+ return res;
1017
+ },
1018
+ remove: async (id) => {
1019
+ let res = await this._delete(this.svAPIEndpoint, this.mediaStorage._path + `/${id}`);
1020
+ return res;
1021
+ },
1022
+ };
1023
+ this.storecheckTemplate = {
1024
+ _path: this._end_points.STORECHECK_TEMPLATE,
1025
+ find: async (params) => {
1026
+ let res = await this._fetch(this.svAPIEndpoint, this.storecheckTemplate._path, params);
1027
+ return res;
1028
+ },
1029
+ get: async (id, params) => {
1030
+ return await this._fetch(this.svAPIEndpoint, this.storecheckTemplate._path + `/${id}`, params);
1031
+ },
1032
+ create: async (body) => {
1033
+ let res = await this._create(this.svAPIEndpoint, this.storecheckTemplate._path, body);
1034
+ return res;
1035
+ },
1036
+ update: async (id, body) => {
1037
+ let res = await this._update(this.svAPIEndpoint, this.storecheckTemplate._path + `/${id}`, body);
1038
+ return res;
1039
+ },
1040
+ remove: async (id) => {
1041
+ let res = await this._delete(this.svAPIEndpoint, this.storecheckTemplate._path + `/${id}`);
1042
+ return res;
1043
+ },
1044
+ };
1045
+ this.activityStorecheck = {
1046
+ _path: this._end_points.ACTIVITY_STORECHECK,
1047
+ find: async (params) => {
1048
+ let res = await this._fetch(this.svAPIEndpoint, this.activityStorecheck._path, params);
1049
+ return res;
1050
+ },
1051
+ get: async (id, params) => {
1052
+ return await this._fetch(this.svAPIEndpoint, this.activityStorecheck._path + `/${id}`, params);
1053
+ },
1054
+ create: async (body) => {
1055
+ let res = await this._create(this.svAPIEndpoint, this.activityStorecheck._path, body);
1056
+ return res;
1057
+ },
1058
+ update: async (id, body) => {
1059
+ let res = await this._update(this.svAPIEndpoint, this.activityStorecheck._path + `/${id}`, body);
1060
+ return res;
1061
+ },
1062
+ };
1063
+ this.adjustInventory = {
1064
+ _path: this._end_points.ADJUST_INVENTORY,
1065
+ find: async (params) => {
1066
+ let res = await this._fetch(this.svAPIEndpoint, this.adjustInventory._path, params);
1067
+ return res;
1068
+ },
1069
+ get: async (id, params) => {
1070
+ return await this._fetch(this.svAPIEndpoint, this.adjustInventory._path + `/${id}`, params);
1071
+ },
1072
+ create: async (body) => {
1073
+ let res = await this._create(this.svAPIEndpoint, this.adjustInventory._path, body);
1074
+ return res;
1075
+ },
1076
+ };
1077
+ this.inventory = {
1078
+ _path: this._end_points.INVENTORY,
1079
+ find: async (params) => {
1080
+ let res = await this._fetch(this.svAPIEndpoint, this.inventory._path, params);
1081
+ return res;
1082
+ },
1083
+ };
1084
+ this.integrationApp = {
1085
+ _path: this._end_points.INTEGRATION_APP,
1086
+ find: async (params) => {
1087
+ let res = await this._fetch(this.svAPIEndpoint, this.integrationApp._path, params);
1088
+ return res;
1089
+ },
1090
+ get: async (id, params) => {
1091
+ return await this._fetch(this.svAPIEndpoint, this.integrationApp._path + `/${id}`, params);
1092
+ },
1093
+ create: async (body) => {
1094
+ let res = await this._create(this.svAPIEndpoint, this.integrationApp._path, body);
1095
+ return res;
1096
+ },
1097
+ update: async (id, body) => {
1098
+ let res = await this._update(this.svAPIEndpoint, this.integrationApp._path + `/${id}`, body);
1099
+ return res;
1100
+ },
1101
+ };
1102
+ this.joinActionsWebHook = {
1103
+ _path: this._end_points.JOIN_ACTIONS_WEBHOOK,
1104
+ update: async (id, body) => {
1105
+ let res = await this._update(this.svAPIEndpoint, this.joinActionsWebHook._path, body);
1106
+ return res;
1107
+ },
1108
+ };
1109
+ this.patchAction = {
1110
+ _path: this._end_points.PATCH_ACTION,
1111
+ create: async (body, params) => {
1112
+ const res = await this._create(this.svAPIEndpoint, this.patchAction._path, body, params);
1113
+ return res;
1114
+ },
1115
+ update: async (body) => {
1116
+ const res = await this._update(this.svAPIEndpoint, this.patchAction._path, body);
1117
+ return res;
1118
+ },
1119
+ };
1120
+ this.updateIntegrationMeta = {
1121
+ _path: this._end_points.UPDATE_INTEGRATION_META,
1122
+ create: async (body, params) => {
1123
+ let res = await this._create(this.svAPIEndpoint, this.updateIntegrationMeta._path, body, params);
1124
+ return res;
1125
+ },
1126
+ };
1127
+ this.assetPartType = {
1128
+ _path: this._end_points.ASSET_PART_TYPE,
1129
+ find: async (params) => {
1130
+ let res = await this._fetch(this.svAPIEndpoint, this.assetPartType._path, params);
1131
+ return res;
1132
+ },
1133
+ get: async (id) => {
1134
+ return await this._fetch(this.svAPIEndpoint, this.assetPartType._path + `/${id}`);
1135
+ },
1136
+ create: async (body) => {
1137
+ let res = await this._create(this.svAPIEndpoint, this.assetPartType._path, body);
1138
+ return res;
1139
+ },
1140
+ update: async (id, body) => {
1141
+ let res = await this._update(this.svAPIEndpoint, this.assetPartType._path + `/${id}`, body);
1142
+ return res;
1143
+ },
1144
+ remove: async (id) => {
1145
+ let res = await this._delete(this.svAPIEndpoint, this.assetPartType._path + `/${id}`);
1146
+ return res;
1147
+ },
1148
+ };
1149
+ this.assetPart = {
1150
+ _path: this._end_points.ASSET_PART,
1151
+ find: async (params) => {
1152
+ let res = await this._fetch(this.svAPIEndpoint, this.assetPart._path, params);
1153
+ return res;
1154
+ },
1155
+ get: async (id) => {
1156
+ return await this._fetch(this.svAPIEndpoint, this.assetPart._path + `/${id}`);
1157
+ },
1158
+ create: async (body) => {
1159
+ let res = await this._create(this.svAPIEndpoint, this.assetPart._path, body);
1160
+ return res;
1161
+ },
1162
+ update: async (id, body) => {
1163
+ let res = await this._update(this.svAPIEndpoint, this.assetPart._path + `/${id}`, body);
1164
+ return res;
1165
+ },
1166
+ remove: async (id) => {
1167
+ let res = await this._delete(this.svAPIEndpoint, this.assetPart._path + `/${id}`);
1168
+ return res;
1169
+ },
1170
+ };
1171
+ this.assetPartUnit = {
1172
+ _path: this._end_points.ASSET_PART_UNIT,
1173
+ find: async (params) => {
1174
+ let res = await this._fetch(this.svAPIEndpoint, this.assetPartUnit._path, params);
1175
+ return res;
1176
+ },
1177
+ get: async (id) => {
1178
+ return await this._fetch(this.svAPIEndpoint, this.assetPartUnit._path + `/${id}`);
1179
+ },
1180
+ update: async (id, body) => {
1181
+ let res = await this._update(this.svAPIEndpoint, this.assetPartUnit._path + `/${id}`, body);
1182
+ return res;
1183
+ },
1184
+ };
1185
+ this.assetPartReceival = {
1186
+ _path: this._end_points.ASSET_PART_RECEIVAL,
1187
+ find: async (params) => {
1188
+ let res = await this._fetch(this.svAPIEndpoint, this.assetPartReceival._path, params);
1189
+ return res;
1190
+ },
1191
+ get: async (id) => {
1192
+ return await this._fetch(this.svAPIEndpoint, this.assetPartReceival._path + `/${id}`);
1193
+ },
1194
+ create: async (body) => {
1195
+ let res = await this._create(this.svAPIEndpoint, this.assetPartReceival._path, body);
1196
+ return res;
1197
+ },
1198
+ update: async (id, body) => {
1199
+ let res = await this._update(this.svAPIEndpoint, this.assetPartReceival._path + `/${id}`, body);
1200
+ return res;
1201
+ },
1202
+ patch: async (params, body) => {
1203
+ let res = await this._patch(this.svAPIEndpoint, this.assetPartReceival._path, body, params);
1204
+ return res;
1205
+ },
1206
+ };
1207
+ this.assetPartTransfer = {
1208
+ _path: this._end_points.ASSET_PART_TRANSFER,
1209
+ find: async (params) => {
1210
+ let res = await this._fetch(this.svAPIEndpoint, this.assetPartTransfer._path, params);
1211
+ return res;
1212
+ },
1213
+ get: async (id) => {
1214
+ return await this._fetch(this.svAPIEndpoint, this.assetPartTransfer._path + `/${id}`);
1215
+ },
1216
+ create: async (body) => {
1217
+ let res = await this._create(this.svAPIEndpoint, this.assetPartTransfer._path, body);
1218
+ return res;
1219
+ },
1220
+ update: async (id, body) => {
1221
+ let res = await this._update(this.svAPIEndpoint, this.assetPartTransfer._path + `/${id}`, body);
1222
+ return res;
1223
+ },
1224
+ patch: async (params, body) => {
1225
+ let res = await this._patch(this.svAPIEndpoint, this.assetPartTransfer._path, body, params);
1226
+ return res;
1227
+ },
1228
+ };
1229
+ this.returnAssetPartUnit = {
1230
+ _path: this._end_points.RETURN_ASSET_PART_UNIT,
1231
+ find: async (params) => {
1232
+ let res = await this._fetch(this.svAPIEndpoint, this.returnAssetPartUnit._path, params);
1233
+ return res;
1234
+ },
1235
+ get: async (id) => {
1236
+ return await this._fetch(this.svAPIEndpoint, this.returnAssetPartUnit._path + `/${id}`);
1237
+ },
1238
+ create: async (body) => {
1239
+ let res = await this._create(this.svAPIEndpoint, this.returnAssetPartUnit._path, body);
1240
+ return res;
1241
+ },
1242
+ update: async (id, body) => {
1243
+ let res = await this._update(this.svAPIEndpoint, this.returnAssetPartUnit._path + `/${id}`, body);
1244
+ return res;
1245
+ },
1246
+ patch: async (params, body) => {
1247
+ let res = await this._patch(this.svAPIEndpoint, this.returnAssetPartUnit._path, body, params);
1248
+ return res;
1249
+ },
1250
+ };
1251
+ this.storeAssetPartUnit = {
1252
+ _path: this._end_points.STORE_ASSET_PART_UNIT,
1253
+ find: async (params) => {
1254
+ let res = await this._fetch(this.svAPIEndpoint, this.storeAssetPartUnit._path, params);
1255
+ return res;
1256
+ },
1257
+ get: async (id) => {
1258
+ return await this._fetch(this.svAPIEndpoint, this.storeAssetPartUnit._path + `/${id}`);
1259
+ },
1260
+ create: async (body) => {
1261
+ let res = await this._create(this.svAPIEndpoint, this.storeAssetPartUnit._path, body);
1262
+ return res;
1263
+ },
1264
+ update: async (id, body) => {
1265
+ let res = await this._update(this.svAPIEndpoint, this.storeAssetPartUnit._path + `/${id}`, body);
1266
+ return res;
1267
+ },
1268
+ patch: async (params, body) => {
1269
+ let res = await this._patch(this.svAPIEndpoint, this.storeAssetPartUnit._path, body, params);
1270
+ return res;
1271
+ },
1272
+ };
1273
+ this.ocrInvoiceJobTemplate = {
1274
+ _path: this._end_points.OCR_INVOICE_JOB_TEMPLATE,
1275
+ find: async (params) => {
1276
+ let res = await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobTemplate._path, params);
1277
+ return res;
1278
+ },
1279
+ get: async (id) => {
1280
+ return await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobTemplate._path + `/${id}`);
1281
+ },
1282
+ create: async (body) => {
1283
+ let res = await this._create(this.svAPIEndpoint, this.ocrInvoiceJobTemplate._path, body);
1284
+ return res;
1285
+ },
1286
+ update: async (id, body) => {
1287
+ let res = await this._update(this.svAPIEndpoint, this.ocrInvoiceJobTemplate._path + `/${id}`, body);
1288
+ return res;
1289
+ },
1290
+ };
1291
+ this.ocrInvoiceJobGroup = {
1292
+ _path: this._end_points.OCR_INVOICE_JOB_GROUP,
1293
+ find: async (params) => {
1294
+ let res = await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobGroup._path, params);
1295
+ return res;
1296
+ },
1297
+ get: async (id) => {
1298
+ return await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobGroup._path + `/${id}`);
1299
+ },
1300
+ create: async (body) => {
1301
+ let res = await this._create(this.svAPIEndpoint, this.ocrInvoiceJobGroup._path, body);
1302
+ return res;
1303
+ },
1304
+ };
1305
+ this.activityAiSalesOrder = {
1306
+ _path: this._end_points.ACTIVITY_AI_SALES_ORDER,
1307
+ find: async (params) => {
1308
+ let res = await this._fetch(this.svAPIEndpoint, this.activityAiSalesOrder._path, params);
1309
+ return res;
1310
+ },
1311
+ get: async (id) => {
1312
+ return await this._fetch(this.svAPIEndpoint, this.activityAiSalesOrder._path + `/${id}`);
1313
+ },
1314
+ create: async (body) => {
1315
+ let res = await this._create(this.svAPIEndpoint, this.activityAiSalesOrder._path, body);
1316
+ return res;
1317
+ },
1318
+ };
1319
+ this.ocrInvoiceJob = {
1320
+ _path: this._end_points.OCR_INVOICE_JOB,
1321
+ find: async (params) => {
1322
+ let res = await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJob._path, params);
1323
+ return res;
1324
+ },
1325
+ get: async (id) => {
1326
+ return await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJob._path + `/${id}`);
1327
+ },
1328
+ };
1329
+ this.ocrInvoiceJobPage = {
1330
+ _path: this._end_points.OCR_INVOICE_JOB_PAGE,
1331
+ find: async (params) => {
1332
+ let res = await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobPage._path, params);
1333
+ return res;
1334
+ },
1335
+ get: async (id) => {
1336
+ return await this._fetch(this.svAPIEndpoint, this.ocrInvoiceJobPage._path + `/${id}`);
1337
+ },
1338
+ update: async (id, body) => {
1339
+ let res = await this._update(this.svAPIEndpoint, this.ocrInvoiceJobPage._path + `/${id}`, body);
1340
+ return res;
1341
+ },
1342
+ };
1343
+ this.svAPIEndpoint =
1344
+ !options?.env || options?.env == "production"
1345
+ ? "https://sv.api.repzo.me"
1346
+ : options?.env == "staging"
1347
+ ? "https://staging.sv.api.repzo.me"
1348
+ : options?.env == "local"
1349
+ ? "http://localhost:3030"
1350
+ : "";
1351
+ this.headers = {
1352
+ "api-key": apiKey,
1353
+ "Content-Type": "application/json",
1354
+ Accept: "application/json",
1355
+ };
1356
+ if (options?.headers)
1357
+ Object.assign(this.headers, options.headers);
1358
+ }
1359
+ async _fetch(baseUrl, path, params) {
1360
+ let res = await axios.get(`${baseUrl}/${path}`, {
1361
+ params,
1362
+ headers: this.headers,
1363
+ });
1364
+ return res.data;
1365
+ }
1366
+ async _create(baseUrl, path, body, params) {
1367
+ let res = await axios.post(`${baseUrl}/${path}`, body, {
1368
+ params,
1369
+ headers: this.headers,
1370
+ });
1371
+ return res.data;
1372
+ }
1373
+ async _update(baseUrl, path, body, params) {
1374
+ let res = await axios.put(`${baseUrl}/${path}`, body, {
1375
+ params,
1376
+ headers: this.headers,
1377
+ });
1378
+ return res.data;
1379
+ }
1380
+ async _patch(baseUrl, path, body, params) {
1381
+ let res = await axios.put(`${baseUrl}/${path}`, body, {
1382
+ params,
1383
+ headers: this.headers,
1384
+ });
1385
+ return res.data;
1386
+ }
1387
+ async _delete(baseUrl, path, params) {
1388
+ let res = await axios.delete(`${baseUrl}/${path}`, {
1389
+ params,
1390
+ headers: this.headers,
1391
+ });
1392
+ return res.data;
1393
+ }
2403
1394
  }
2404
1395
  Repzo.ActionLogs = class {
2405
- constructor(superThis, sync_id) {
2406
- this.superThis = superThis;
2407
- this._path = "/integration-action-log";
2408
- this.available_app_name = "";
2409
- this.available_app_id = "";
2410
- this.app_id = "";
2411
- this.action = "";
2412
- this.start_time = Date.now();
2413
- this.status = "processing";
2414
- this.message = "Log Created";
2415
- this.details = [];
2416
- this.sync_id = sync_id;
2417
- this.isOld = true;
2418
- }
2419
- async load(sync_id) {
2420
- const params = { sync_id: sync_id };
2421
- const res = await this.superThis._fetch(
2422
- this.superThis.svAPIEndpoint,
2423
- this._path,
2424
- params
2425
- );
2426
- if (!res?.data?.length)
2427
- throw new Error(`Action Log Not found, sync_id: ${sync_id}`);
2428
- const action_log = res.data[0];
2429
- this.sync_id = sync_id;
2430
- this.details = action_log.details;
2431
- this.status = action_log.status;
2432
- this.error = action_log.error;
2433
- this.start_time = action_log.start_time;
2434
- this.body = action_log.body;
2435
- this.meta = action_log.meta;
2436
- this.message = action_log.message;
2437
- this.app_id = action_log.app_id;
2438
- this.available_app_id = action_log.available_app_id;
2439
- this.available_app_name = action_log.available_app_name;
2440
- this.company_namespace = action_log.company_namespace;
2441
- this.action = action_log.action;
2442
- this.isOld = true;
2443
- return this;
2444
- }
2445
- setStatus(status, error) {
2446
- this.details.push({
2447
- timestamp: Date.now(),
2448
- content: `status was changed from ${this.status} to ${status}`,
2449
- });
2450
- this.status = status;
2451
- if (error) {
2452
- if (typeof error == "string") {
2453
- this.error = { message: error };
2454
- } else if (error.message || error.response?.data) {
2455
- this.error = {
2456
- // json: error.toJSON ? error.toJSON() : undefined,
2457
- message: error.message,
2458
- responseData: error.response?.data,
2459
- };
2460
- } else {
2461
- this.error = error;
2462
- }
2463
- return this;
2464
- }
2465
- return this;
2466
- }
2467
- setBody(body) {
2468
- this.body = body;
2469
- return this;
2470
- }
2471
- setMeta(meta) {
2472
- this.meta = meta;
2473
- return this;
2474
- }
2475
- async commit() {
2476
- let doc = {
2477
- available_app_name: this.available_app_name,
2478
- available_app_id: this.available_app_id,
2479
- app_id: this.app_id,
2480
- action: this.action,
2481
- company_namespace: this.company_namespace,
2482
- status: this.status,
2483
- error: this.error ? this.error : undefined,
2484
- start_time: this.start_time,
2485
- end_time: Date.now(),
2486
- total_time: Date.now() - this.start_time,
2487
- body: this.body,
2488
- meta: this.meta,
2489
- message: this.message,
2490
- details: this.details,
2491
- sync_id: this.sync_id,
2492
- };
2493
- try {
2494
- const res = await this.superThis._create(
2495
- this.superThis.svAPIEndpoint,
2496
- this._path,
2497
- doc
2498
- );
2499
- } catch (e) {
2500
- console.error(e);
1396
+ constructor(superThis, sync_id) {
1397
+ this.superThis = superThis;
1398
+ this._path = "integration-action-log";
1399
+ this.available_app_name = "";
1400
+ this.available_app_id = "";
1401
+ this.app_id = "";
1402
+ this.action = "";
1403
+ this.start_time = Date.now();
1404
+ this.status = "processing";
1405
+ this.message = "Log Created";
1406
+ this.details = [];
1407
+ this.sync_id = sync_id;
1408
+ this.isOld = true;
2501
1409
  }
2502
- return this;
2503
- }
2504
- addDetail(detail, meta) {
2505
- let d = {
2506
- timestamp: Date.now(),
2507
- content: detail,
2508
- };
2509
- this.message = detail;
2510
- if (meta) d.meta = meta;
2511
- this.details.push(d);
2512
- return this;
2513
- }
2514
- };
2515
- Repzo.CommandLog = class {
2516
- constructor(superThis, app, command, trigger) {
2517
- this.superThis = superThis;
2518
- this._path = "/integration-command-log";
2519
- this.app_id = app._id;
2520
- this.available_app_id = app.available_app._id;
2521
- this.available_app_name = app.available_app.name;
2522
- this.company_namespace = app.company_namespace;
2523
- this.start_time = Date.now();
2524
- this.status = "received";
2525
- this.message = "Request received";
2526
- this.command = command;
2527
- this.details = [{ timestamp: Date.now(), content: "Request received" }];
2528
- this.sync_id = uuid();
2529
- this.isOld = false;
2530
- this.isPrioritized = false;
2531
- this.retries = 1;
2532
- this.trigger = trigger;
2533
- this.onGoing = true;
2534
- this.sync_details = [];
2535
- this.error_details = [];
2536
- }
2537
- async load(sync_id, retries) {
2538
- if (sync_id) {
2539
- const params = { sync_id: sync_id };
2540
- const res = await this.superThis._fetch(
2541
- this.superThis.svAPIEndpoint,
2542
- this._path,
2543
- params
2544
- );
2545
- if (!res?.data?.length)
2546
- throw new Error(`Command Log Not found, sync_id: ${sync_id}`);
2547
- const command_log = res.data[0];
2548
- if (command_log) {
1410
+ async load(sync_id) {
1411
+ const params = { sync_id: sync_id };
1412
+ const res = await this.superThis._fetch(this.superThis.svAPIEndpoint, this._path, params);
1413
+ if (!res?.data?.length)
1414
+ throw new Error(`Action Log Not found, sync_id: ${sync_id}`);
1415
+ const action_log = res.data[0];
2549
1416
  this.sync_id = sync_id;
2550
- this.details = command_log.details;
2551
- this.status = command_log.status;
2552
- this.error = command_log.error;
2553
- this.start_time = command_log.start_time;
2554
- this.body = command_log.body;
2555
- this.meta = command_log.meta;
2556
- this.message = command_log.message;
2557
- this.retries =
2558
- retries !== undefined ? retries : command_log.retries || this.retries; // retries !== undefined ? retries : command_log.retries;
1417
+ this.details = action_log.details;
1418
+ this.status = action_log.status;
1419
+ this.error = action_log.error;
1420
+ this.start_time = action_log.start_time;
1421
+ this.body = action_log.body;
1422
+ this.meta = action_log.meta;
1423
+ this.message = action_log.message;
1424
+ this.app_id = action_log.app_id;
1425
+ this.available_app_id = action_log.available_app_id;
1426
+ this.available_app_name = action_log.available_app_name;
1427
+ this.company_namespace = action_log.company_namespace;
1428
+ this.action = action_log.action;
2559
1429
  this.isOld = true;
2560
- this.failedAt = command_log.failedAt;
2561
- this.succeededAt = command_log.succeededAt;
2562
- this.skippedAt = command_log.skippedAt;
2563
- this.receivedAt = command_log.receivedAt;
2564
- this.processedAt = command_log.processedAt;
2565
- this.onGoing = command_log.onGoing || false;
2566
- this.trigger = command_log.trigger;
2567
- this.sync_details = command_log.sync_details;
2568
- this.error_details = command_log.error_details;
2569
- // this.priority = command_log.priority
2570
- // ? command_log.priority
2571
- // : this.priority
2572
- // ? this.priority
2573
- // : undefined;
2574
- }
1430
+ return this;
2575
1431
  }
2576
- return this;
2577
- }
2578
- setStatus(status, error) {
2579
- this.addDetail(`status was changed from ${this.status} to ${status}`);
2580
- this.status = status;
2581
- if (error) {
2582
- if (!this.error_details) this.error_details = [];
2583
- if (typeof error == "string") {
2584
- this.error = { message: error };
2585
- } else if (error.message || error.response?.data) {
2586
- this.error = {
2587
- // json: error.toJSON ? error.toJSON() : undefined,
2588
- message: error.message,
2589
- responseData: error.response?.data,
2590
- };
2591
- } else {
2592
- this.error = error;
2593
- }
2594
- this.error_details = [
2595
- {
2596
- timestamp: Date.now(),
2597
- error: this.error,
2598
- },
2599
- ];
2600
- return this;
1432
+ setStatus(status, error) {
1433
+ this.details.push({
1434
+ timestamp: Date.now(),
1435
+ content: `status was changed from ${this.status} to ${status}`,
1436
+ });
1437
+ this.status = status;
1438
+ if (error) {
1439
+ if (typeof error == "string") {
1440
+ this.error = { message: error };
1441
+ }
1442
+ else if (error.message || error.response?.data) {
1443
+ this.error = {
1444
+ // json: error.toJSON ? error.toJSON() : undefined,
1445
+ message: error.message,
1446
+ responseData: error.response?.data,
1447
+ };
1448
+ }
1449
+ else {
1450
+ this.error = error;
1451
+ }
1452
+ return this;
1453
+ }
1454
+ return this;
2601
1455
  }
2602
- switch (status) {
2603
- case "fail":
2604
- this.failedAt = new Date();
2605
- this.onGoing = false;
2606
- break;
2607
- case "processing":
2608
- this.processedAt = new Date();
2609
- this.onGoing = true;
2610
- break;
2611
- case "queued":
2612
- this.queuedAt = new Date();
2613
- this.onGoing = true;
2614
- break;
2615
- case "received":
2616
- this.receivedAt = new Date();
1456
+ setBody(body) {
1457
+ this.body = body;
1458
+ return this;
1459
+ }
1460
+ setMeta(meta) {
1461
+ this.meta = meta;
1462
+ return this;
1463
+ }
1464
+ async commit() {
1465
+ let doc = {
1466
+ available_app_name: this.available_app_name,
1467
+ available_app_id: this.available_app_id,
1468
+ app_id: this.app_id,
1469
+ action: this.action,
1470
+ company_namespace: this.company_namespace,
1471
+ status: this.status,
1472
+ error: this.error ? this.error : undefined,
1473
+ start_time: this.start_time,
1474
+ end_time: Date.now(),
1475
+ total_time: Date.now() - this.start_time,
1476
+ body: this.body,
1477
+ meta: this.meta,
1478
+ message: this.message,
1479
+ details: this.details,
1480
+ sync_id: this.sync_id,
1481
+ };
1482
+ try {
1483
+ const res = await this.superThis._create(this.superThis.svAPIEndpoint, this._path, doc);
1484
+ }
1485
+ catch (e) {
1486
+ console.error(e);
1487
+ }
1488
+ return this;
1489
+ }
1490
+ addDetail(detail, meta) {
1491
+ let d = {
1492
+ timestamp: Date.now(),
1493
+ content: detail,
1494
+ };
1495
+ this.message = detail;
1496
+ if (meta)
1497
+ d.meta = meta;
1498
+ this.details.push(d);
1499
+ return this;
1500
+ }
1501
+ };
1502
+ Repzo.CommandLog = class {
1503
+ constructor(superThis, app, command, trigger) {
1504
+ this.superThis = superThis;
1505
+ this._path = "integration-command-log";
1506
+ this.app_id = app._id;
1507
+ this.available_app_id = app.available_app._id;
1508
+ this.available_app_name = app.available_app.name;
1509
+ this.company_namespace = app.company_namespace;
1510
+ this.start_time = Date.now();
1511
+ this.status = "received";
1512
+ this.message = "Request received";
1513
+ this.command = command;
1514
+ this.details = [{ timestamp: Date.now(), content: "Request received" }];
1515
+ this.sync_id = uuid();
1516
+ this.isOld = false;
1517
+ this.isPrioritized = false;
1518
+ this.retries = 1;
1519
+ this.trigger = trigger;
2617
1520
  this.onGoing = true;
2618
- break;
2619
- case "skipped":
2620
- this.skippedAt = new Date();
2621
- this.onGoing = false;
2622
- break;
2623
- case "success":
2624
- this.succeededAt = new Date();
2625
- this.onGoing = false;
2626
- break;
1521
+ this.sync_details = [];
1522
+ this.error_details = [];
1523
+ }
1524
+ async load(sync_id, retries) {
1525
+ if (sync_id) {
1526
+ const params = { sync_id: sync_id };
1527
+ const res = await this.superThis._fetch(this.superThis.svAPIEndpoint, this._path, params);
1528
+ if (!res?.data?.length)
1529
+ throw new Error(`Command Log Not found, sync_id: ${sync_id}`);
1530
+ const command_log = res.data[0];
1531
+ if (command_log) {
1532
+ this.sync_id = sync_id;
1533
+ this.details = command_log.details;
1534
+ this.status = command_log.status;
1535
+ this.error = command_log.error;
1536
+ this.start_time = command_log.start_time;
1537
+ this.body = command_log.body;
1538
+ this.meta = command_log.meta;
1539
+ this.message = command_log.message;
1540
+ this.retries =
1541
+ retries !== undefined
1542
+ ? retries
1543
+ : command_log.retries || this.retries; // retries !== undefined ? retries : command_log.retries;
1544
+ this.isOld = true;
1545
+ this.failedAt = command_log.failedAt;
1546
+ this.succeededAt = command_log.succeededAt;
1547
+ this.skippedAt = command_log.skippedAt;
1548
+ this.receivedAt = command_log.receivedAt;
1549
+ this.processedAt = command_log.processedAt;
1550
+ this.onGoing = command_log.onGoing || false;
1551
+ this.trigger = command_log.trigger;
1552
+ this.sync_details = command_log.sync_details;
1553
+ this.error_details = command_log.error_details;
1554
+ // this.priority = command_log.priority
1555
+ // ? command_log.priority
1556
+ // : this.priority
1557
+ // ? this.priority
1558
+ // : undefined;
1559
+ }
1560
+ }
1561
+ return this;
1562
+ }
1563
+ setStatus(status, error) {
1564
+ this.addDetail(`status was changed from ${this.status} to ${status}`);
1565
+ this.status = status;
1566
+ if (error) {
1567
+ if (!this.error_details)
1568
+ this.error_details = [];
1569
+ if (typeof error == "string") {
1570
+ this.error = { message: error };
1571
+ }
1572
+ else if (error.message || error.response?.data) {
1573
+ this.error = {
1574
+ // json: error.toJSON ? error.toJSON() : undefined,
1575
+ message: error.message,
1576
+ responseData: error.response?.data,
1577
+ };
1578
+ }
1579
+ else {
1580
+ this.error = error;
1581
+ }
1582
+ this.error_details = [
1583
+ {
1584
+ timestamp: Date.now(),
1585
+ error: this.error,
1586
+ },
1587
+ ];
1588
+ return this;
1589
+ }
1590
+ switch (status) {
1591
+ case "fail":
1592
+ this.failedAt = new Date();
1593
+ this.onGoing = false;
1594
+ break;
1595
+ case "processing":
1596
+ this.processedAt = new Date();
1597
+ this.onGoing = true;
1598
+ break;
1599
+ case "queued":
1600
+ this.queuedAt = new Date();
1601
+ this.onGoing = true;
1602
+ break;
1603
+ case "received":
1604
+ this.receivedAt = new Date();
1605
+ this.onGoing = true;
1606
+ break;
1607
+ case "skipped":
1608
+ this.skippedAt = new Date();
1609
+ this.onGoing = false;
1610
+ break;
1611
+ case "success":
1612
+ this.succeededAt = new Date();
1613
+ this.onGoing = false;
1614
+ break;
1615
+ }
1616
+ return this;
1617
+ }
1618
+ setBody(body) {
1619
+ this.body = body;
1620
+ if (!this.sync_details)
1621
+ this.sync_details = [];
1622
+ this.sync_details = [
1623
+ {
1624
+ timestamp: Date.now(),
1625
+ body: this.body,
1626
+ },
1627
+ ];
1628
+ return this;
1629
+ }
1630
+ setMeta(meta) {
1631
+ this.meta = meta;
1632
+ return this;
1633
+ }
1634
+ async commit() {
1635
+ let doc = {
1636
+ available_app_name: this.available_app_name,
1637
+ available_app_id: this.available_app_id,
1638
+ app_id: this.app_id,
1639
+ command: this.command,
1640
+ status: this.status,
1641
+ error: this.error ? this.error : undefined,
1642
+ start_time: this.start_time,
1643
+ end_time: Date.now(),
1644
+ total_time: Date.now() - this.start_time,
1645
+ company_namespace: this.company_namespace,
1646
+ body: this.body,
1647
+ meta: this.meta,
1648
+ message: this.message,
1649
+ details: this.details,
1650
+ sync_id: this.sync_id,
1651
+ // priority: this.priority ? this.priority : undefined,
1652
+ queuedAt: this.queuedAt ? this.queuedAt : undefined,
1653
+ failedAt: this.failedAt ? this.failedAt : undefined,
1654
+ succeededAt: this.succeededAt ? this.succeededAt : undefined,
1655
+ skippedAt: this.skippedAt ? this.skippedAt : undefined,
1656
+ receivedAt: this.receivedAt ? this.receivedAt : undefined,
1657
+ processedAt: this.processedAt ? this.processedAt : undefined,
1658
+ onGoing: this.onGoing !== undefined ? this.onGoing : undefined,
1659
+ retries: this.retries !== undefined ? this.retries : undefined,
1660
+ trigger: this.trigger,
1661
+ sync_details: this.sync_details,
1662
+ error_details: this.error_details,
1663
+ };
1664
+ try {
1665
+ const res = await this.superThis._create(this.superThis.svAPIEndpoint, this._path, doc);
1666
+ this.isOld = true;
1667
+ }
1668
+ catch (e) {
1669
+ console.error(e);
1670
+ }
1671
+ return this;
2627
1672
  }
2628
- return this;
2629
- }
2630
- setBody(body) {
2631
- this.body = body;
2632
- if (!this.sync_details) this.sync_details = [];
2633
- this.sync_details = [
2634
- {
2635
- timestamp: Date.now(),
2636
- body: this.body,
2637
- },
2638
- ];
2639
- return this;
2640
- }
2641
- setMeta(meta) {
2642
- this.meta = meta;
2643
- return this;
2644
- }
2645
- async commit() {
2646
- let doc = {
2647
- available_app_name: this.available_app_name,
2648
- available_app_id: this.available_app_id,
2649
- app_id: this.app_id,
2650
- command: this.command,
2651
- status: this.status,
2652
- error: this.error ? this.error : undefined,
2653
- start_time: this.start_time,
2654
- end_time: Date.now(),
2655
- total_time: Date.now() - this.start_time,
2656
- company_namespace: this.company_namespace,
2657
- body: this.body,
2658
- meta: this.meta,
2659
- message: this.message,
2660
- details: this.details,
2661
- sync_id: this.sync_id,
2662
- // priority: this.priority ? this.priority : undefined,
2663
- queuedAt: this.queuedAt ? this.queuedAt : undefined,
2664
- failedAt: this.failedAt ? this.failedAt : undefined,
2665
- succeededAt: this.succeededAt ? this.succeededAt : undefined,
2666
- skippedAt: this.skippedAt ? this.skippedAt : undefined,
2667
- receivedAt: this.receivedAt ? this.receivedAt : undefined,
2668
- processedAt: this.processedAt ? this.processedAt : undefined,
2669
- onGoing: this.onGoing !== undefined ? this.onGoing : undefined,
2670
- retries: this.retries !== undefined ? this.retries : undefined,
2671
- trigger: this.trigger,
2672
- sync_details: this.sync_details,
2673
- error_details: this.error_details,
2674
- };
2675
- try {
2676
- const res = await this.superThis._create(
2677
- this.superThis.svAPIEndpoint,
2678
- this._path,
2679
- doc
2680
- );
2681
- this.isOld = true;
2682
- } catch (e) {
2683
- console.error(e);
1673
+ addDetail(detail, meta) {
1674
+ if (!this.details)
1675
+ this.details = [];
1676
+ this.details = [
1677
+ {
1678
+ timestamp: Date.now(),
1679
+ content: detail,
1680
+ meta,
1681
+ },
1682
+ ];
1683
+ this.message = detail;
1684
+ return this;
2684
1685
  }
2685
- return this;
2686
- }
2687
- addDetail(detail, meta) {
2688
- if (!this.details) this.details = [];
2689
- this.details = [
2690
- {
2691
- timestamp: Date.now(),
2692
- content: detail,
2693
- meta,
2694
- },
2695
- ];
2696
- this.message = detail;
2697
- return this;
2698
- }
2699
1686
  };
2700
1687
  export default Repzo;