tradly 1.0.39 → 1.0.40

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/Roots/App.js CHANGED
@@ -1,591 +1,1600 @@
1
-
2
- import network, { Method } from "./../NetworkManager/NetworkManager.js"
3
- import {
4
- ACCOUNTS, ATTRIBUTE,DEVICES, REPORT,
5
- CATEGORY, CURRENCY, HOME,USERS, BLOCK,SEARCHADDRESS,
6
- LANGUAGES, LIKE, LISTINGS, ORDERS,REVIEW,
7
- PAYMENTSMETHODS,ADDRESS, FOLLOW, COLLECTIONS, PROMO,
8
- SHIPPINGMETHOD, VARIANTS,CART, CHECKOUT,
9
- VALUES, TRANSACTIONS, EARNINGS, VARIANTTYPES,
10
- EPHERMERALKEY, PAYMENTINTENT, CONFIGLIST, STATUS,
11
- S3SIGNEDURL, STRIPECONNECTACCOUNT,
12
- CREATEACCOUNTLINK, CREATEEXPRESSLOGINLINK, SCHEDULE, SCHEDULEPERDAY, COUNTRIES, TENANTSCOUNTRIES,
13
- } from './../Constants/PathConstant.js'
14
- import serialization from "../Helper/Serialization.js";
15
- import { APPCONSTANT } from "../Constants/AppConstant.js";
16
- import { ImageConfig } from "../Helper/APIParam.js";
17
-
18
- class App {
19
- async getCountries() {
20
- try { const [error, responseJson] = await network.networkCall({path:COUNTRIES,method:Method.GET});
21
- if (error) { return error }
22
- else { return responseJson }
23
- } catch (error) { return error }
24
- }
25
- async getTenantCountries(param = {authKey}) {
26
- try { const [error, responseJson] = await network.networkCall({path:TENANTSCOUNTRIES,method:Method.GET,authKey:param.authKey});
27
- if (error) { return error }
28
- else { return responseJson }
29
- } catch (error) { return error }
30
- }
31
- async getConfigList(param = {paramBody,authKey}) {
32
- let url = `${CONFIGLIST}${param.paramBody}`
33
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
34
- if (error) { return error }
35
- else { return responseJson }
36
- } catch (error) { return error }
37
- }
38
- async updateDeviceInfo(param = {data,authKey}) {
39
- try { const [error,responseJson] = await network.networkCall({path:DEVICES,method:Method.POST,param:param.data,authKey:param.authKey});
40
- if (error) { return error;
41
- } else { return responseJson}
42
- } catch (error) {return error}
43
- }
44
- async updateUserInfo(param = {id,data,authKey}) {
45
- try { const [error,responseJson] = await network.networkCall({path:USERS + `/${param.id}`,method:Method.PATCH,param:param.data,authKey:param.authKey});
46
- if (error) { return error;
47
- } else { return responseJson}
48
- } catch (error) {return error}
49
- }
50
- async home(param = {authKey}) {
51
- try { const [error, responseJson] = await network.networkCall({path:HOME,method:Method.GET,authKey:param.authKey});
52
- if (error) { return error }
53
- else { return responseJson }
54
- } catch (error) { return error }
55
- }
56
- async getLanguages(param = {authKey}) {
57
- try { const [error, responseJson] = await network.networkCall({path:LANGUAGES,method:Method.GET,authKey:param.authKey});
58
- if (error) { return error }
59
- else { return responseJson }
60
- } catch (error) { return error }
61
- }
62
- async generateS3ImageURL(param = {authKey,data}) {
63
- try { const [error, responseJson] = await network.networkCall({path:S3SIGNEDURL,method:Method.POST,param:param.data,authKey:param.authKey})
64
- if (error) { return error }
65
- else { return responseJson }
66
- } catch (error) { return error }
67
- }
68
- async uploadS3Image(param = ImageConfig) {
69
- try { const [error, responseJson] = await network.uploadImage(param)
70
- if (error) { return error }
71
- else { return responseJson }
72
- } catch (error) { return error }
73
-
74
- }
75
- async getUserDetail(param={authKey,id}) {
76
- try { const [error, responseJson] = await network.networkCall({path:USERS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
77
- if (error) { return error }
78
- else { return responseJson }
79
- } catch (error) { return error }
80
- }
81
- //MARK:-  ADDRESS APIS 
82
- async addEditAddress(param = {id,data,authKey}) {
83
- let path = param.id == undefined || param.id == '' ? ADDRESS : ADDRESS + `/${param.id}`
84
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
85
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey})
86
- if (error) { return error }
87
- else { return responseJson }
88
- } catch (error) { return error }
89
- }
90
- async getAddress(param={bodyParam,authKey}) {
91
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
92
- try { const [error, responseJson] = await network.networkCall({path:ADDRESS + url,method:Method.GET,authKey:param.authKey});
93
- if (error) { return error }
94
- else { return responseJson }
95
- } catch (error) { return error }
96
- }
97
- async searchAddress(param={searchKey,authKey}) {
98
- let url = param.searchKey;
99
- try { const [error, responseJson] = await network.networkCall({path:SEARCHADDRESS + url,method:Method.GET,authKey:param.authKey});
100
- if (error) { return error }
101
- else { return responseJson }
102
- } catch (error) { return error }
103
- }
104
- async deleteAddress(param={id,authKey}) {
105
- try { const [error, responseJson] = await network.networkCall({path:ADDRESS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
106
- if (error) { return error }
107
- else { return responseJson }
108
- } catch (error) { return error }
109
- }
110
- //MARK:-  ACCOUNTS APIS 
111
- async getAccounts(param={bodyParam,authKey}) {
112
- let url = `?${serialization(param.bodyParam)}`;
113
- try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${url}`,method:Method.GET,authKey:param.authKey});
114
- if (error) { return error }
115
- else { return responseJson }
116
- } catch (error) { return error }
117
- }
118
- async getAccountDetail(param={id,authKey}) {
119
- try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${param.id}`,method:Method.GET,authKey:param.authKey});
120
- if (error) { return error }
121
- else { return responseJson }
122
- } catch (error) { return error }
123
- }
124
- async postAccounts(param={id,authKey,data}) {
125
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
126
- let path = param.id == undefined || param.id == '' ? ACCOUNTS : ACCOUNTS + `/${param.id}`
127
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
128
- if (error) { return error }
129
- else { return responseJson }
130
- } catch (error) { return error }
131
- }
132
- async followUnfollowAccounts(param={id,authKey,isFollowing:Boolean}) {
133
- let method = param.isFollowing ? Method.DELETE : Method.POST
134
- let path = ACCOUNTS + `/${param.id}` + FOLLOW
135
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
136
- if (error) { return error }
137
- else { return responseJson }
138
- } catch (error) { return error }
139
- }
140
- async blockAccount(param={id,authKey,isBlocked:Boolean}) {
141
- let method = param.isBlocked ? Method.DELETE : Method.POST
142
- let path = ACCOUNTS + `/${param.id}` + BLOCK
143
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
144
- if (error) { return error }
145
- else { return responseJson }
146
- } catch (error) { return error }
147
- }
148
- async reportAccount(param={id,authKey,data}) {
149
- let method = Method.POST
150
- let path = ACCOUNTS + `/${param.id}` + REPORT
151
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
152
- if (error) { return error }
153
- else { return responseJson }
154
- } catch (error) { return error }
155
- }
156
- //MARK:-  LISTINGS API 
157
- async getListings(param={bodyParam,authKey}) {
158
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
159
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + url,method:Method.GET,authKey:param.authKey});
160
- if (error) { return error }
161
- else { return responseJson }
162
- } catch (error) { return error }
163
- }
164
- async getListingDetail(param={id,authKey}) {
165
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
166
- if (error) { return error }
167
- else { return responseJson }
168
- } catch (error) { return error }
169
- }
170
- async deleteListing(param={id,authKey}) {
171
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
172
- if (error) { return error }
173
- else { return responseJson }
174
- } catch (error) { return error }
175
- }
176
- async postListing(param={id,authKey,data}) {
177
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PATCH
178
- let path = param.id == undefined || param.id == '' ? LISTINGS : LISTINGS + `/${param.id}`
179
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
180
- if (error) { return error }
181
- else { return responseJson }
182
- } catch (error) { return error }
183
- }
184
- async likeListing(param={id,authKey,isLiked:Boolean}) {
185
- let method = param.isLiked ? Method.DELETE : Method.POST
186
- let path = LISTINGS + `/${param.id}` + LIKE
187
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
188
- if (error) { return error }
189
- else { return responseJson }
190
- } catch (error) { return error }
191
- }
192
- async getMyListingsLikes(param={bodyParam,authKey}) {
193
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
194
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + LIKE+ url,method:Method.GET,authKey:param.authKey});
195
- if (error) { return error }
196
- else { return responseJson }
197
- } catch (error) { return error }
198
- }
199
- async commonFuntion(param={path,bodyParam,authKey,Method}) {
200
- try { const [error, responseJson] = await network.networkCall({path:param.path,method:param.Method,authKey:param.authKey});
201
- if (error) { return error }
202
- else { return responseJson }
203
- } catch (error) { return error }
204
- }
205
- //MARK:-  Schedules 
206
- async createSchedule(param={id,authKey,data}) {
207
- let path = LISTINGS + `/${param.id}` + SCHEDULE;
208
- try { const [error, responseJson] = await network.networkCall({path:path,method:Method.PUT,authKey:param.authKey,param:param.data});
209
- if (error) { return error }
210
- else { return responseJson }
211
- } catch (error) { return error }
212
- }
213
- async getSchedule(param = {id,bodyParam,authKey}) {
214
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `${serialization(param.bodyParam)}`;
215
- let path = LISTINGS + `/${param.id}` + SCHEDULEPERDAY;
216
- try { const [error, responseJson] = await network.networkCall({path:path + url, method:Method.GET,authKey:param.authKey});
217
- if (error) { return error }
218
- else { return responseJson }
219
- } catch (error) { return error }
220
- }
221
- //MARK:-  Variants 
222
- async getVariants(param={authKey}) {
223
- try { const [error, responseJson] = await network.networkCall({path:VARIANTS,method:Method.GET,authKey:param.authKey});
224
- if (error) { return error }
225
- else { return responseJson }
226
- } catch (error) { return error }
227
- }
228
- async addEditVariants(param={authKey,listingId,id,data}) {
229
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
230
- let path = param.id == undefined || param.id == '' ? LISTINGS + `/${param.listingId}` + VARIANTS : LISTINGS + `/${param.listingId}` + VARIANTS + `/${param.id}`
231
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
232
- if (error) { return error }
233
- else { return responseJson }
234
- } catch (error) { return error }
235
- }
236
- async deleteVariant(param={id,listingId,authKey}) {
237
- let url = LISTINGS + `/${param.listingId}` + VARIANTS + `/${param.id}`
238
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
239
- if (error) { return error }
240
- else { return responseJson }
241
- } catch (error) { return error }
242
- }
243
- //MARK:-  Variant Types 
244
- async getVariantTypes(param={authKey}) {
245
- try { const [error, responseJson] = await network.networkCall({path:VARIANTTYPES,method:Method.GET,authKey:param.authKey});
246
- if (error) { return error }
247
- else { return responseJson }
248
- } catch (error) { return error }
249
- }
250
- async addEditVariantsTypes(param={authKey,id,data}) {
251
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
252
- let path = param.id == undefined || param.id == '' ? VARIANTTYPES : VARIANTTYPES + `/${param.id}/`
253
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
254
- if (error) { return error }
255
- else { return responseJson }
256
- } catch (error) { return error }
257
- }
258
- async deleteVariantType(param={id,authKey}) {
259
- let url = VARIANTTYPES + `/${param.id}`
260
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
261
- if (error) { return error }
262
- else { return responseJson }
263
- } catch (error) { return error }
264
- }
265
- //MARK:-  Variant Types Values 
266
- async getVariantTypeValues(param = {id,authKey}) {
267
- let url = VARIANTTYPES + `/${param.id}` + VALUES;
268
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
269
- if (error) { return error }
270
- else { return responseJson }
271
- } catch (error) { return error }
272
- }
273
- async getVariantTypeValuesDetail(param = {id, valueID, authKey}) {
274
- let url = VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`;
275
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
276
- if (error) { return error }
277
- else { return responseJson }
278
- } catch (error) { return error }
279
- }
280
- async addEditVariantTypeValues(param = {id, valueID, data, authKey}) {
281
- let path = param.id == undefined || param.id == '' ? VARIANTTYPES + `/${param.id}` + VALUES : VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`
282
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
283
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
284
- if (error) { return error }
285
- else { return responseJson }
286
- } catch (error) { return error }
287
- }
288
- async deleteVariantTypeValues(param = {id, authKey, valueID}) {
289
- let url = VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`;
290
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
291
- if (error) { return error }
292
- else { return responseJson }
293
- } catch (error) { return error }
294
- }
295
- //MARK:-  CATEGORY APIS 
296
- async getCategory(param = {bodyParam,authKey}) {
297
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
298
- try { const [error, responseJson] = await network.networkCall({path:CATEGORY + url, method:Method.GET,authKey:param.authKey});
299
- if (error) { return error }
300
- else { return responseJson }
301
- } catch (error) { return error }
302
- }
303
- async addEditCategory(param = {id,data,authKey}) {
304
- let path = param.id == undefined || param.id == '' ? CATEGORY : CATEGORY + `/${param.id}`
305
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
306
- try { const [error, responseJson] = await network.networkCall({path:path,method:method, param:param.data, authKey:param.authKey});
307
- if (error) { return error }
308
- else { return responseJson }
309
- } catch (error) { return error }
310
- }
311
- async deleteCategory(param = {id,authKey}) {
312
- try { const [error, responseJson] = await network.networkCall({path:CATEGORY + `/${param.id}`, method:Method.DELETE,authKey:param.authKey})
313
- if (error) { return error }
314
- else { return responseJson }
315
- } catch (error) { return error }
316
- }
317
- //MARK:-  Attribute APIS 
318
-
319
- async getAttribute(param = {bodyParam,authKey}) {
320
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
321
- try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + url,method:Method.GET,authKey:param.authKey});
322
- if (error) { return error }
323
- else { return responseJson }
324
- } catch (error) { return error }
325
- }
326
- async addEditAttribute(param = {id,data,authKey}) {
327
- let path = param.id == undefined || param.id == '' ? ATTRIBUTE : ATTRIBUTE + `/${param.id}`
328
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
329
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
330
- if (error) { return error }
331
- else { return responseJson }
332
- } catch (error) { return error }
333
- }
334
- async deleteAttribute(param = {id,authKey}) {
335
- try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
336
- if (error) { return error }
337
- else { return responseJson }
338
- } catch (error) { return error }
339
- }
340
- //MARK:-  Values
341
- async getAttributeValues(param = {id,authKey}) {
342
- let url = ATTRIBUTE + `/${param.id}` + VALUES;
343
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
344
- if (error) { return error }
345
- else { return responseJson }
346
- } catch (error) { return error }
347
- }
348
- async getAttributeValuesDetail(param = {id,valueID,authKey}) {
349
- let url = ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
350
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
351
- if (error) { return error }
352
- else { return responseJson }
353
- } catch (error) { return error }
354
- }
355
- async addEditAttributeValues(param = { id,valueID, data, authKey}) {
356
- let path = param.id == undefined || param.id == '' ? ATTRIBUTE + `/${param.id}` + VALUES : ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`
357
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
358
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
359
- if (error) { return error }
360
- else { return responseJson }
361
- } catch (error) { return error }
362
- }
363
- async deleteAttributeValues(param = {id, authKey, valueID}) {
364
- let url = ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
365
- try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
366
- if (error) { return error }
367
- else { return responseJson }
368
- } catch (error) { return error }
369
- }
370
- //MARK:-  CART API 
371
- async addToCart(param={authKey,data}) {
372
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.POST,param:param.data,authKey:param.authKey});
373
- if (error) { return error }
374
- else { return responseJson }
375
- } catch (error) { return error }
376
- }
377
- async deleteFromCart(param={authKey,data}) {
378
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.PATCH,param:param.data,authKey:param.authKey});
379
- if (error) { return error }
380
- else { return responseJson }
381
- } catch (error) { return error }
382
- }
383
- async getCarts(param={authKey,bodyParam,currency}) {
384
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
385
- try { const [error, responseJson] = await network.networkCall({path:CART + url,method:Method.GET,authKey:param.authKey,currency:param.currency});
386
- if (error) {
387
- return error
388
- }
389
- else { return responseJson }
390
- } catch (error) { return error }
391
- }
392
- async deleteAllCartDetail(param={authKey}) {
393
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.DELETE,authKey:param.authKey});
394
- if (error) { return error }
395
- else { return responseJson }
396
- } catch (error) { return error }
397
- }
398
- async checkout(param={authKey,data,currency}) {
399
- try { const [error, responseJson] = await network.networkCall({path:CART + CHECKOUT,method:Method.POST,authKey:param.authKey,param:param.data,currency:param.currency});
400
- if (error) { return error }
401
- else { return responseJson }
402
- } catch (error) { return error }
403
- }
404
- async listingDirectCheckout(param={authKey,data,id,currency}) {
405
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}` + CHECKOUT,method:Method.POST,authKey:param.authKey,param:param.data,currency:param.currency});
406
- if (error) { return error }
407
- else { return responseJson }
408
- } catch (error) { return error }
409
- }
410
- async getEphemeralKey(param={authKey,data,id}) {
411
- try { const [error, responseJson] = await network.networkCall({path:EPHERMERALKEY,method:Method.POST,authKey:param.authKey,param:param.data});
412
- if (error) { return error }
413
- else { return responseJson }
414
- } catch (error) { return error }
415
- }
416
- async getPaymentIntentKey(param={authKey,data,id}) {
417
- try { const [error, responseJson] = await network.networkCall({path:PAYMENTINTENT,method:Method.POST,authKey:param.authKey,param:param.data});
418
- if (error) { return error }
419
- else { return responseJson }
420
- } catch (error) { return error }
421
- }
422
- //MARK:-  KYC 
423
- async getStripeConnectAccount(param={authKey,id}) {
424
- try { const [error, responseJson] = await network.networkCall({path:STRIPECONNECTACCOUNT + `${param.id}` ,method:Method.GET,authKey:param.authKey});
425
- if (error) { return error }
426
- else { return responseJson }
427
- } catch (error) { return error }
428
- }
429
- async createAccountLink(param={authKey,data}) {
430
- try { const [error, responseJson] = await network.networkCall({path:CREATEACCOUNTLINK,method:Method.POST,authKey:param.authKey,param:param.data});
431
- if (error) { return error }
432
- else { return responseJson }
433
- } catch (error) { return error }
434
- }
435
- async createExpressLoginLink(param={authKey,data}) {
436
- try { const [error, responseJson] = await network.networkCall({path:CREATEEXPRESSLOGINLINK,method:Method.POST,authKey:param.authKey,param:param.data});
437
- if (error) { return error }
438
- else { return responseJson }
439
- } catch (error) { return error }
440
- }
441
- //MARK:-  ORDERS API 
442
- async getOrders(param={authKey,bodyParam}) {
443
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
444
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + url,method:Method.GET,authKey:param.authKey});
445
- if (error) { return error }
446
- else { return responseJson }
447
- } catch (error) { return error }
448
- }
449
- async getOrderDetail(param={authKey,id,bodyParam}) {
450
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
451
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}` + url,method:Method.GET,authKey:param.authKey});
452
- if (error) { return error }
453
- else { return responseJson }
454
- } catch (error) { return error }
455
- }
456
- async updateOrderStatus(param={authKey,id,data,bodyParam}) {
457
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
458
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}` + STATUS + url,method:Method.PATCH,authKey:param.authKey,param:param.data});
459
- if (error) { return error }
460
- else { return responseJson }
461
- } catch (error) { return error }
462
- }
463
- async updateOrderDetail(param={authKey,id,data,bodyParam}) {
464
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
465
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}` + url,method:Method.PATCH,authKey:param.authKey,param:param.data});
466
- if (error) { return error }
467
- else { return responseJson }
468
- } catch (error) { return error }
469
- }
470
- async getReviewList(param={authKey,bodyParam}) {
471
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
472
- try { const [error, responseJson] = await network.networkCall({path:REVIEW + url,method:Method.GET,authKey:param.authKey});
473
- if (error) { return error }
474
- else { return responseJson }
475
- } catch (error) { return error }
476
- }
477
- async addReview(param={authKey,data}) {
478
- try { const [error, responseJson] = await network.networkCall({path:REVIEW,method:Method.POST,authKey:param.authKey,param:param.data});
479
- if (error) { return error }
480
- else { return responseJson }
481
- } catch (error) { return error }
482
- }
483
- async likeReview(param={authKey,data,id}) {
484
- try { const [error, responseJson] = await network.networkCall({path:REVIEW + `/${param.id}/like` ,method:Method.PATCH,authKey:param.authKey,param:param.data});
485
- if (error) { return error }
486
- else { return responseJson }
487
- } catch (error) { return error }
488
- }
489
- async getPaymentMethods(param={authKey}) {
490
- try { const [error, responseJson] = await network.networkCall({path:PAYMENTSMETHODS ,method:Method.GET,authKey:param.authKey});
491
- if (error) { return error }
492
- else { return responseJson }
493
- } catch (error) { return error }
494
- }
495
- async getShippingMethods(param={authKey}) {
496
- try { const [error, responseJson] = await network.networkCall({path:SHIPPINGMETHOD ,method:Method.GET,authKey:param.authKey});
497
- if (error) { return error }
498
- else { return responseJson }
499
- } catch (error) { return error }
500
- }
501
- //MARK:-  Currency 
502
- async getCurrency(param={authKey}) {
503
- try { const [error, responseJson] = await network.networkCall({path:CURRENCY,method:Method.GET,authKey:param.authKey})
504
- if (error) { return error }
505
- else { return responseJson }
506
- } catch (error) { return error }
507
- }
508
- async addEditCurrency(param={id,authKey,data}) {
509
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
510
- let path = param.id == undefined || param.id == '' ? CURRENCY : CURRENCY + `/${param.id}`
511
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
512
- if (error) { return error }
513
- else { return responseJson }
514
- } catch (error) { return error }
515
- }
516
- async deleteCurrency(param={id,authKey}) {
517
- try { const [error, responseJson] = await network.networkCall({path:CURRENCY + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
518
- if (error) { return error }
519
- else { return responseJson }
520
- } catch (error) { return error }
521
- }
522
- //MARK:-  Collections 
523
- async getCollection(param={authKey}) {
524
- try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS,method:Method.GET,authKey:param.authKey})
525
- if (error) { return error }
526
- else { return responseJson }
527
- } catch (error) { return error }
528
- }
529
- async getCollectionDetail(param={authKey,id}) {
530
- try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
531
- if (error) { return error }
532
- else { return responseJson }
533
- } catch (error) { return error }
534
- }
535
- async addEditCollection(param={id,authKey,data}) {
536
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
537
- let path = param.id == undefined || param.id == '' ? COLLECTIONS : COLLECTIONS + `/${param.id}`
538
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
539
- if (error) { return error }
540
- else { return responseJson }
541
- } catch (error) { return error }
542
- }
543
- async deleteCollections(param={id,authKey}) {
544
- try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
545
- if (error) { return error }
546
- else { return responseJson }
547
- } catch (error) { return error }
548
- }
549
- //MARK:-  Promo banner 
550
- async getPromoBanner(param={authKey,bodyParam}) {
551
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
552
- try { const [error, responseJson] = await network.networkCall({path:PROMO + url,method:Method.GET,authKey:param.authKey})
553
- if (error) { return error }
554
- else { return responseJson }
555
- } catch (error) { return error }
556
- }
557
- async addPromoBanner(param={id,authKey,data}) {
558
- let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
559
- let path = param.id == undefined || param.id == '' ? PROMO : PROMO + `/${param.id}`
560
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
561
- if (error) { return error }
562
- else { return responseJson }
563
- } catch (error) { return error }
564
- }
565
- async deletePromoBanner(param={id,authKey}) {
566
- try { const [error, responseJson] = await network.networkCall({path:PROMO + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
567
- if (error) { return error }
568
- else { return responseJson }
569
- } catch (error) { return error }
570
- }
571
- //MARK:-  Transaction 
572
- async getTransactions(param={authKey,bodyParam}) {
573
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
574
- try { const [error, responseJson] = await network.networkCall({path:TRANSACTIONS + url,method:Method.GET,authKey:param.authKey});
575
- if (error) { return error }
576
- else { return responseJson }
577
- } catch (error) { return error }
578
- }
579
- async getEarning(param={authKey,bodyParam}) {
580
- let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
581
- try { const [error, responseJson] = await network.networkCall({path:EARNINGS + url,method:Method.GET,authKey:param.authKey});
582
- if (error) { return error }
583
- else { return responseJson }
584
- } catch (error) { return error }
585
- }
586
-
587
-
588
- }
589
- const app = new App();
590
- export default app;
591
-
1
+ import network, { Method } from "./../NetworkManager/NetworkManager.js";
2
+ import {
3
+ ACCOUNTS,
4
+ ATTRIBUTE,
5
+ DEVICES,
6
+ REPORT,
7
+ CATEGORY,
8
+ CURRENCY,
9
+ HOME,
10
+ USERS,
11
+ BLOCK,
12
+ SEARCHADDRESS,
13
+ LANGUAGES,
14
+ LIKE,
15
+ LISTINGS,
16
+ ORDERS,
17
+ REVIEW,
18
+ PAYMENTSMETHODS,
19
+ ADDRESS,
20
+ FOLLOW,
21
+ COLLECTIONS,
22
+ PROMO,
23
+ SHIPPINGMETHOD,
24
+ VARIANTS,
25
+ CART,
26
+ CHECKOUT,
27
+ VALUES,
28
+ TRANSACTIONS,
29
+ EARNINGS,
30
+ VARIANTTYPES,
31
+ EPHERMERALKEY,
32
+ PAYMENTINTENT,
33
+ CONFIGLIST,
34
+ STATUS,
35
+ S3SIGNEDURL,
36
+ STRIPECONNECTACCOUNT,
37
+ CREATEACCOUNTLINK,
38
+ CREATEEXPRESSLOGINLINK,
39
+ SCHEDULE,
40
+ SCHEDULEPERDAY,
41
+ COUNTRIES,
42
+ TENANTSCOUNTRIES,
43
+ } from "./../Constants/PathConstant.js";
44
+ import serialization from "../Helper/Serialization.js";
45
+ import { APPCONSTANT } from "../Constants/AppConstant.js";
46
+ import { ImageConfig } from "../Helper/APIParam.js";
47
+
48
+ class App {
49
+ async getCountries() {
50
+ try {
51
+ const [error, responseJson] = await network.networkCall({
52
+ path: COUNTRIES,
53
+ method: Method.GET,
54
+ });
55
+ if (error) {
56
+ return error;
57
+ } else {
58
+ return responseJson;
59
+ }
60
+ } catch (error) {
61
+ return error;
62
+ }
63
+ }
64
+ async getTenantCountries(param = { authKey }) {
65
+ try {
66
+ const [error, responseJson] = await network.networkCall({
67
+ path: TENANTSCOUNTRIES,
68
+ method: Method.GET,
69
+ authKey: param.authKey,
70
+ });
71
+ if (error) {
72
+ return error;
73
+ } else {
74
+ return responseJson;
75
+ }
76
+ } catch (error) {
77
+ return error;
78
+ }
79
+ }
80
+ async getConfigList(param = { paramBody, authKey }) {
81
+ let url = `${CONFIGLIST}${param.paramBody}`;
82
+ try {
83
+ const [error, responseJson] = await network.networkCall({
84
+ path: url,
85
+ method: Method.GET,
86
+ authKey: param.authKey,
87
+ });
88
+ if (error) {
89
+ return error;
90
+ } else {
91
+ return responseJson;
92
+ }
93
+ } catch (error) {
94
+ return error;
95
+ }
96
+ }
97
+ async updateDeviceInfo(param = { data, authKey }) {
98
+ try {
99
+ const [error, responseJson] = await network.networkCall({
100
+ path: DEVICES,
101
+ method: Method.POST,
102
+ param: param.data,
103
+ authKey: param.authKey,
104
+ });
105
+ if (error) {
106
+ return error;
107
+ } else {
108
+ return responseJson;
109
+ }
110
+ } catch (error) {
111
+ return error;
112
+ }
113
+ }
114
+ async updateUserInfo(param = { id, data, authKey }) {
115
+ try {
116
+ const [error, responseJson] = await network.networkCall({
117
+ path: USERS + `/${param.id}`,
118
+ method: Method.PATCH,
119
+ param: param.data,
120
+ authKey: param.authKey,
121
+ });
122
+ if (error) {
123
+ return error;
124
+ } else {
125
+ return responseJson;
126
+ }
127
+ } catch (error) {
128
+ return error;
129
+ }
130
+ }
131
+ async home(param = { authKey }) {
132
+ try {
133
+ const [error, responseJson] = await network.networkCall({
134
+ path: HOME,
135
+ method: Method.GET,
136
+ authKey: param.authKey,
137
+ });
138
+ if (error) {
139
+ return error;
140
+ } else {
141
+ return responseJson;
142
+ }
143
+ } catch (error) {
144
+ return error;
145
+ }
146
+ }
147
+ async getLanguages(param = { authKey }) {
148
+ try {
149
+ const [error, responseJson] = await network.networkCall({
150
+ path: LANGUAGES,
151
+ method: Method.GET,
152
+ authKey: param.authKey,
153
+ });
154
+ if (error) {
155
+ return error;
156
+ } else {
157
+ return responseJson;
158
+ }
159
+ } catch (error) {
160
+ return error;
161
+ }
162
+ }
163
+ async generateS3ImageURL(param = { authKey, data }) {
164
+ try {
165
+ const [error, responseJson] = await network.networkCall({
166
+ path: S3SIGNEDURL,
167
+ method: Method.POST,
168
+ param: param.data,
169
+ authKey: param.authKey,
170
+ });
171
+ if (error) {
172
+ return error;
173
+ } else {
174
+ return responseJson;
175
+ }
176
+ } catch (error) {
177
+ return error;
178
+ }
179
+ }
180
+ async uploadS3Image(param = ImageConfig) {
181
+ try {
182
+ const [error, responseJson] = await network.uploadImage(
183
+ param
184
+ );
185
+ if (error) {
186
+ return error;
187
+ } else {
188
+ return responseJson;
189
+ }
190
+ } catch (error) {
191
+ return error;
192
+ }
193
+ }
194
+ async getUserDetail(param = { authKey, id }) {
195
+ try {
196
+ const [error, responseJson] = await network.networkCall({
197
+ path: USERS + `/${param.id}`,
198
+ method: Method.GET,
199
+ authKey: param.authKey,
200
+ });
201
+ if (error) {
202
+ return error;
203
+ } else {
204
+ return responseJson;
205
+ }
206
+ } catch (error) {
207
+ return error;
208
+ }
209
+ }
210
+ //MARK:-  ADDRESS APIS 
211
+ async addEditAddress(param = { id, data, authKey }) {
212
+ let path =
213
+ param.id == undefined || param.id == ""
214
+ ? ADDRESS
215
+ : ADDRESS + `/${param.id}`;
216
+ let method =
217
+ param.id == undefined || param.id == ""
218
+ ? Method.POST
219
+ : Method.PUT;
220
+ try {
221
+ const [error, responseJson] = await network.networkCall({
222
+ path: path,
223
+ method: method,
224
+ param: param.data,
225
+ authKey: param.authKey,
226
+ });
227
+ if (error) {
228
+ return error;
229
+ } else {
230
+ return responseJson;
231
+ }
232
+ } catch (error) {
233
+ return error;
234
+ }
235
+ }
236
+ async getAddress(param = { bodyParam, authKey }) {
237
+ let url =
238
+ param.bodyParam == undefined || param.bodyParam == ""
239
+ ? ""
240
+ : `?${serialization(param.bodyParam)}`;
241
+ try {
242
+ const [error, responseJson] = await network.networkCall({
243
+ path: ADDRESS + url,
244
+ method: Method.GET,
245
+ authKey: param.authKey,
246
+ });
247
+ if (error) {
248
+ return error;
249
+ } else {
250
+ return responseJson;
251
+ }
252
+ } catch (error) {
253
+ return error;
254
+ }
255
+ }
256
+ async searchAddress(param = { searchKey, authKey }) {
257
+ let url = param.searchKey;
258
+ try {
259
+ const [error, responseJson] = await network.networkCall({
260
+ path: SEARCHADDRESS + url,
261
+ method: Method.GET,
262
+ authKey: param.authKey,
263
+ });
264
+ if (error) {
265
+ return error;
266
+ } else {
267
+ return responseJson;
268
+ }
269
+ } catch (error) {
270
+ return error;
271
+ }
272
+ }
273
+ async deleteAddress(param = { id, authKey }) {
274
+ try {
275
+ const [error, responseJson] = await network.networkCall({
276
+ path: ADDRESS + `/${param.id}`,
277
+ method: Method.DELETE,
278
+ authKey: param.authKey,
279
+ });
280
+ if (error) {
281
+ return error;
282
+ } else {
283
+ return responseJson;
284
+ }
285
+ } catch (error) {
286
+ return error;
287
+ }
288
+ }
289
+ //MARK:-  ACCOUNTS APIS 
290
+ async getAccounts(param = { bodyParam, authKey }) {
291
+ let url = `?${serialization(param.bodyParam)}`;
292
+ try {
293
+ const [error, responseJson] = await network.networkCall({
294
+ path: ACCOUNTS + `${url}`,
295
+ method: Method.GET,
296
+ authKey: param.authKey,
297
+ });
298
+ if (error) {
299
+ return error;
300
+ } else {
301
+ return responseJson;
302
+ }
303
+ } catch (error) {
304
+ return error;
305
+ }
306
+ }
307
+ async getAccountDetail(param = { id, authKey }) {
308
+ try {
309
+ const [error, responseJson] = await network.networkCall({
310
+ path: ACCOUNTS + `${param.id}`,
311
+ method: Method.GET,
312
+ authKey: param.authKey,
313
+ });
314
+ if (error) {
315
+ return error;
316
+ } else {
317
+ return responseJson;
318
+ }
319
+ } catch (error) {
320
+ return error;
321
+ }
322
+ }
323
+ async postAccounts(param = { id, authKey, data }) {
324
+ let method =
325
+ param.id == undefined || param.id == ""
326
+ ? Method.POST
327
+ : Method.PUT;
328
+ let path =
329
+ param.id == undefined || param.id == ""
330
+ ? ACCOUNTS
331
+ : ACCOUNTS + `/${param.id}`;
332
+ try {
333
+ const [error, responseJson] = await network.networkCall({
334
+ path: path,
335
+ method: method,
336
+ authKey: param.authKey,
337
+ param: param.data,
338
+ });
339
+ if (error) {
340
+ return error;
341
+ } else {
342
+ return responseJson;
343
+ }
344
+ } catch (error) {
345
+ return error;
346
+ }
347
+ }
348
+ async followUnfollowAccounts(
349
+ param = { id, authKey, isFollowing: Boolean }
350
+ ) {
351
+ let method = param.isFollowing ? Method.DELETE : Method.POST;
352
+ let path = ACCOUNTS + `/${param.id}` + FOLLOW;
353
+ try {
354
+ const [error, responseJson] = await network.networkCall({
355
+ path: path,
356
+ method: method,
357
+ authKey: param.authKey,
358
+ });
359
+ if (error) {
360
+ return error;
361
+ } else {
362
+ return responseJson;
363
+ }
364
+ } catch (error) {
365
+ return error;
366
+ }
367
+ }
368
+ async blockAccount(param = { id, authKey, isBlocked: Boolean }) {
369
+ let method = param.isBlocked ? Method.DELETE : Method.POST;
370
+ let path = ACCOUNTS + `/${param.id}` + BLOCK;
371
+ try {
372
+ const [error, responseJson] = await network.networkCall({
373
+ path: path,
374
+ method: method,
375
+ authKey: param.authKey,
376
+ });
377
+ if (error) {
378
+ return error;
379
+ } else {
380
+ return responseJson;
381
+ }
382
+ } catch (error) {
383
+ return error;
384
+ }
385
+ }
386
+ async reportAccount(param = { id, authKey, data }) {
387
+ let method = Method.POST;
388
+ let path = ACCOUNTS + `/${param.id}` + REPORT;
389
+ try {
390
+ const [error, responseJson] = await network.networkCall({
391
+ path: path,
392
+ method: method,
393
+ authKey: param.authKey,
394
+ param: param.data,
395
+ });
396
+ if (error) {
397
+ return error;
398
+ } else {
399
+ return responseJson;
400
+ }
401
+ } catch (error) {
402
+ return error;
403
+ }
404
+ }
405
+ //MARK:-  LISTINGS API 
406
+ async getListings(param = { bodyParam, authKey }) {
407
+ let url =
408
+ param.bodyParam == undefined || param.bodyParam == ""
409
+ ? ""
410
+ : `?${serialization(param.bodyParam)}`;
411
+ try {
412
+ const [error, responseJson] = await network.networkCall({
413
+ path: LISTINGS + url,
414
+ method: Method.GET,
415
+ authKey: param.authKey,
416
+ });
417
+ if (error) {
418
+ return error;
419
+ } else {
420
+ return responseJson;
421
+ }
422
+ } catch (error) {
423
+ return error;
424
+ }
425
+ }
426
+ async getListingDetail(param = { id, authKey }) {
427
+ try {
428
+ const [error, responseJson] = await network.networkCall({
429
+ path: LISTINGS + `/${param.id}`,
430
+ method: Method.GET,
431
+ authKey: param.authKey,
432
+ });
433
+ if (error) {
434
+ return error;
435
+ } else {
436
+ return responseJson;
437
+ }
438
+ } catch (error) {
439
+ return error;
440
+ }
441
+ }
442
+ async deleteListing(param = { id, authKey }) {
443
+ try {
444
+ const [error, responseJson] = await network.networkCall({
445
+ path: LISTINGS + `/${param.id}`,
446
+ method: Method.DELETE,
447
+ authKey: param.authKey,
448
+ });
449
+ if (error) {
450
+ return error;
451
+ } else {
452
+ return responseJson;
453
+ }
454
+ } catch (error) {
455
+ return error;
456
+ }
457
+ }
458
+ async postListing(param = { id, authKey, data }) {
459
+ let method =
460
+ param.id == undefined || param.id == ""
461
+ ? Method.POST
462
+ : Method.PATCH;
463
+ let path =
464
+ param.id == undefined || param.id == ""
465
+ ? LISTINGS
466
+ : LISTINGS + `/${param.id}`;
467
+ try {
468
+ const [error, responseJson] = await network.networkCall({
469
+ path: path,
470
+ method: method,
471
+ authKey: param.authKey,
472
+ param: param.data,
473
+ });
474
+ if (error) {
475
+ return error;
476
+ } else {
477
+ return responseJson;
478
+ }
479
+ } catch (error) {
480
+ return error;
481
+ }
482
+ }
483
+ async likeListing(param = { id, authKey, isLiked: Boolean }) {
484
+ let method = param.isLiked ? Method.DELETE : Method.POST;
485
+ let path = LISTINGS + `/${param.id}` + LIKE;
486
+ try {
487
+ const [error, responseJson] = await network.networkCall({
488
+ path: path,
489
+ method: method,
490
+ authKey: param.authKey,
491
+ });
492
+ if (error) {
493
+ return error;
494
+ } else {
495
+ return responseJson;
496
+ }
497
+ } catch (error) {
498
+ return error;
499
+ }
500
+ }
501
+ async getMyListingsLikes(param = { bodyParam, authKey }) {
502
+ let url =
503
+ param.bodyParam == undefined || param.bodyParam == ""
504
+ ? ""
505
+ : `?${serialization(param.bodyParam)}`;
506
+ try {
507
+ const [error, responseJson] = await network.networkCall({
508
+ path: LISTINGS + LIKE + url,
509
+ method: Method.GET,
510
+ authKey: param.authKey,
511
+ });
512
+ if (error) {
513
+ return error;
514
+ } else {
515
+ return responseJson;
516
+ }
517
+ } catch (error) {
518
+ return error;
519
+ }
520
+ }
521
+ async commonFuntion(param = { path, bodyParam, authKey, Method }) {
522
+ let url =
523
+ param.bodyParam == undefined || param.bodyParam == ""
524
+ ? ""
525
+ : `?${serialization(param.bodyParam)}`;
526
+ try {
527
+ const [error, responseJson] = await network.networkCall({
528
+ path: param.path + url,
529
+ method: param.Method,
530
+ authKey: param.authKey,
531
+ });
532
+ if (error) {
533
+ return error;
534
+ } else {
535
+ return responseJson;
536
+ }
537
+ } catch (error) {
538
+ return error;
539
+ }
540
+ }
541
+ //MARK:-  Schedules 
542
+ async createSchedule(param = { id, authKey, data }) {
543
+ let path = LISTINGS + `/${param.id}` + SCHEDULE;
544
+ try {
545
+ const [error, responseJson] = await network.networkCall({
546
+ path: path,
547
+ method: Method.PUT,
548
+ authKey: param.authKey,
549
+ param: param.data,
550
+ });
551
+ if (error) {
552
+ return error;
553
+ } else {
554
+ return responseJson;
555
+ }
556
+ } catch (error) {
557
+ return error;
558
+ }
559
+ }
560
+ async getSchedule(param = { id, bodyParam, authKey }) {
561
+ let url =
562
+ param.bodyParam == undefined || param.bodyParam == ""
563
+ ? ""
564
+ : `${serialization(param.bodyParam)}`;
565
+ let path = LISTINGS + `/${param.id}` + SCHEDULEPERDAY;
566
+ try {
567
+ const [error, responseJson] = await network.networkCall({
568
+ path: path + url,
569
+ method: Method.GET,
570
+ authKey: param.authKey,
571
+ });
572
+ if (error) {
573
+ return error;
574
+ } else {
575
+ return responseJson;
576
+ }
577
+ } catch (error) {
578
+ return error;
579
+ }
580
+ }
581
+ //MARK:-  Variants 
582
+ async getVariants(param = { authKey }) {
583
+ try {
584
+ const [error, responseJson] = await network.networkCall({
585
+ path: VARIANTS,
586
+ method: Method.GET,
587
+ authKey: param.authKey,
588
+ });
589
+ if (error) {
590
+ return error;
591
+ } else {
592
+ return responseJson;
593
+ }
594
+ } catch (error) {
595
+ return error;
596
+ }
597
+ }
598
+ async addEditVariants(param = { authKey, listingId, id, data }) {
599
+ let method =
600
+ param.id == undefined || param.id == ""
601
+ ? Method.POST
602
+ : Method.PUT;
603
+ let path =
604
+ param.id == undefined || param.id == ""
605
+ ? LISTINGS + `/${param.listingId}` + VARIANTS
606
+ : LISTINGS +
607
+ `/${param.listingId}` +
608
+ VARIANTS +
609
+ `/${param.id}`;
610
+ try {
611
+ const [error, responseJson] = await network.networkCall({
612
+ path: path,
613
+ method: method,
614
+ param: param.data,
615
+ authKey: param.authKey,
616
+ });
617
+ if (error) {
618
+ return error;
619
+ } else {
620
+ return responseJson;
621
+ }
622
+ } catch (error) {
623
+ return error;
624
+ }
625
+ }
626
+ async deleteVariant(param = { id, listingId, authKey }) {
627
+ let url =
628
+ LISTINGS +
629
+ `/${param.listingId}` +
630
+ VARIANTS +
631
+ `/${param.id}`;
632
+ try {
633
+ const [error, responseJson] = await network.networkCall({
634
+ path: url,
635
+ method: Method.DELETE,
636
+ authKey: param.authKey,
637
+ });
638
+ if (error) {
639
+ return error;
640
+ } else {
641
+ return responseJson;
642
+ }
643
+ } catch (error) {
644
+ return error;
645
+ }
646
+ }
647
+ //MARK:-  Variant Types 
648
+ async getVariantTypes(param = { authKey }) {
649
+ try {
650
+ const [error, responseJson] = await network.networkCall({
651
+ path: VARIANTTYPES,
652
+ method: Method.GET,
653
+ authKey: param.authKey,
654
+ });
655
+ if (error) {
656
+ return error;
657
+ } else {
658
+ return responseJson;
659
+ }
660
+ } catch (error) {
661
+ return error;
662
+ }
663
+ }
664
+ async addEditVariantsTypes(param = { authKey, id, data }) {
665
+ let method =
666
+ param.id == undefined || param.id == ""
667
+ ? Method.POST
668
+ : Method.PUT;
669
+ let path =
670
+ param.id == undefined || param.id == ""
671
+ ? VARIANTTYPES
672
+ : VARIANTTYPES + `/${param.id}/`;
673
+ try {
674
+ const [error, responseJson] = await network.networkCall({
675
+ path: path,
676
+ method: method,
677
+ param: param.data,
678
+ authKey: param.authKey,
679
+ });
680
+ if (error) {
681
+ return error;
682
+ } else {
683
+ return responseJson;
684
+ }
685
+ } catch (error) {
686
+ return error;
687
+ }
688
+ }
689
+ async deleteVariantType(param = { id, authKey }) {
690
+ let url = VARIANTTYPES + `/${param.id}`;
691
+ try {
692
+ const [error, responseJson] = await network.networkCall({
693
+ path: url,
694
+ method: Method.DELETE,
695
+ authKey: param.authKey,
696
+ });
697
+ if (error) {
698
+ return error;
699
+ } else {
700
+ return responseJson;
701
+ }
702
+ } catch (error) {
703
+ return error;
704
+ }
705
+ }
706
+ //MARK:-  Variant Types Values 
707
+ async getVariantTypeValues(param = { id, authKey }) {
708
+ let url = VARIANTTYPES + `/${param.id}` + VALUES;
709
+ try {
710
+ const [error, responseJson] = await network.networkCall({
711
+ path: url,
712
+ method: Method.GET,
713
+ authKey: param.authKey,
714
+ });
715
+ if (error) {
716
+ return error;
717
+ } else {
718
+ return responseJson;
719
+ }
720
+ } catch (error) {
721
+ return error;
722
+ }
723
+ }
724
+ async getVariantTypeValuesDetail(param = { id, valueID, authKey }) {
725
+ let url =
726
+ VARIANTTYPES +
727
+ `/${param.id}` +
728
+ VALUES +
729
+ `/${param.valueID}`;
730
+ try {
731
+ const [error, responseJson] = await network.networkCall({
732
+ path: url,
733
+ method: Method.GET,
734
+ authKey: param.authKey,
735
+ });
736
+ if (error) {
737
+ return error;
738
+ } else {
739
+ return responseJson;
740
+ }
741
+ } catch (error) {
742
+ return error;
743
+ }
744
+ }
745
+ async addEditVariantTypeValues(param = { id, valueID, data, authKey }) {
746
+ let path =
747
+ param.id == undefined || param.id == ""
748
+ ? VARIANTTYPES + `/${param.id}` + VALUES
749
+ : VARIANTTYPES +
750
+ `/${param.id}` +
751
+ VALUES +
752
+ `/${param.valueID}`;
753
+ let method =
754
+ param.id == undefined || param.id == ""
755
+ ? Method.POST
756
+ : Method.PUT;
757
+ try {
758
+ const [error, responseJson] = await network.networkCall({
759
+ path: path,
760
+ method: method,
761
+ param: param.data,
762
+ authKey: param.authKey,
763
+ });
764
+ if (error) {
765
+ return error;
766
+ } else {
767
+ return responseJson;
768
+ }
769
+ } catch (error) {
770
+ return error;
771
+ }
772
+ }
773
+ async deleteVariantTypeValues(param = { id, authKey, valueID }) {
774
+ let url =
775
+ VARIANTTYPES +
776
+ `/${param.id}` +
777
+ VALUES +
778
+ `/${param.valueID}`;
779
+ try {
780
+ const [error, responseJson] = await network.networkCall({
781
+ path: url,
782
+ method: Method.DELETE,
783
+ authKey: param.authKey,
784
+ });
785
+ if (error) {
786
+ return error;
787
+ } else {
788
+ return responseJson;
789
+ }
790
+ } catch (error) {
791
+ return error;
792
+ }
793
+ }
794
+ //MARK:-  CATEGORY APIS 
795
+ async getCategory(param = { bodyParam, authKey }) {
796
+ let url =
797
+ param.bodyParam == undefined || param.bodyParam == ""
798
+ ? ""
799
+ : `?${serialization(param.bodyParam)}`;
800
+ try {
801
+ const [error, responseJson] = await network.networkCall({
802
+ path: CATEGORY + url,
803
+ method: Method.GET,
804
+ authKey: param.authKey,
805
+ });
806
+ if (error) {
807
+ return error;
808
+ } else {
809
+ return responseJson;
810
+ }
811
+ } catch (error) {
812
+ return error;
813
+ }
814
+ }
815
+ async addEditCategory(param = { id, data, authKey }) {
816
+ let path =
817
+ param.id == undefined || param.id == ""
818
+ ? CATEGORY
819
+ : CATEGORY + `/${param.id}`;
820
+ let method =
821
+ param.id == undefined || param.id == ""
822
+ ? Method.POST
823
+ : Method.PUT;
824
+ try {
825
+ const [error, responseJson] = await network.networkCall({
826
+ path: path,
827
+ method: method,
828
+ param: param.data,
829
+ authKey: param.authKey,
830
+ });
831
+ if (error) {
832
+ return error;
833
+ } else {
834
+ return responseJson;
835
+ }
836
+ } catch (error) {
837
+ return error;
838
+ }
839
+ }
840
+ async deleteCategory(param = { id, authKey }) {
841
+ try {
842
+ const [error, responseJson] = await network.networkCall({
843
+ path: CATEGORY + `/${param.id}`,
844
+ method: Method.DELETE,
845
+ authKey: param.authKey,
846
+ });
847
+ if (error) {
848
+ return error;
849
+ } else {
850
+ return responseJson;
851
+ }
852
+ } catch (error) {
853
+ return error;
854
+ }
855
+ }
856
+ //MARK:-  Attribute APIS 
857
+
858
+ async getAttribute(param = { bodyParam, authKey }) {
859
+ let url =
860
+ param.bodyParam == undefined || param.bodyParam == ""
861
+ ? ""
862
+ : `?${serialization(param.bodyParam)}`;
863
+ try {
864
+ const [error, responseJson] = await network.networkCall({
865
+ path: ATTRIBUTE + url,
866
+ method: Method.GET,
867
+ authKey: param.authKey,
868
+ });
869
+ if (error) {
870
+ return error;
871
+ } else {
872
+ return responseJson;
873
+ }
874
+ } catch (error) {
875
+ return error;
876
+ }
877
+ }
878
+ async addEditAttribute(param = { id, data, authKey }) {
879
+ let path =
880
+ param.id == undefined || param.id == ""
881
+ ? ATTRIBUTE
882
+ : ATTRIBUTE + `/${param.id}`;
883
+ let method =
884
+ param.id == undefined || param.id == ""
885
+ ? Method.POST
886
+ : Method.PUT;
887
+ try {
888
+ const [error, responseJson] = await network.networkCall({
889
+ path: path,
890
+ method: method,
891
+ param: param.data,
892
+ authKey: param.authKey,
893
+ });
894
+ if (error) {
895
+ return error;
896
+ } else {
897
+ return responseJson;
898
+ }
899
+ } catch (error) {
900
+ return error;
901
+ }
902
+ }
903
+ async deleteAttribute(param = { id, authKey }) {
904
+ try {
905
+ const [error, responseJson] = await network.networkCall({
906
+ path: ATTRIBUTE + `/${param.id}`,
907
+ method: Method.DELETE,
908
+ authKey: param.authKey,
909
+ });
910
+ if (error) {
911
+ return error;
912
+ } else {
913
+ return responseJson;
914
+ }
915
+ } catch (error) {
916
+ return error;
917
+ }
918
+ }
919
+ //MARK:-  Values
920
+ async getAttributeValues(param = { id, authKey }) {
921
+ let url = ATTRIBUTE + `/${param.id}` + VALUES;
922
+ try {
923
+ const [error, responseJson] = await network.networkCall({
924
+ path: url,
925
+ method: Method.GET,
926
+ authKey: param.authKey,
927
+ });
928
+ if (error) {
929
+ return error;
930
+ } else {
931
+ return responseJson;
932
+ }
933
+ } catch (error) {
934
+ return error;
935
+ }
936
+ }
937
+ async getAttributeValuesDetail(param = { id, valueID, authKey }) {
938
+ let url =
939
+ ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
940
+ try {
941
+ const [error, responseJson] = await network.networkCall({
942
+ path: url,
943
+ method: Method.GET,
944
+ authKey: param.authKey,
945
+ });
946
+ if (error) {
947
+ return error;
948
+ } else {
949
+ return responseJson;
950
+ }
951
+ } catch (error) {
952
+ return error;
953
+ }
954
+ }
955
+ async addEditAttributeValues(param = { id, valueID, data, authKey }) {
956
+ let path =
957
+ param.id == undefined || param.id == ""
958
+ ? ATTRIBUTE + `/${param.id}` + VALUES
959
+ : ATTRIBUTE +
960
+ `/${param.id}` +
961
+ VALUES +
962
+ `/${param.valueID}`;
963
+ let method =
964
+ param.id == undefined || param.id == ""
965
+ ? Method.POST
966
+ : Method.PUT;
967
+ try {
968
+ const [error, responseJson] = await network.networkCall({
969
+ path: path,
970
+ method: method,
971
+ param: param.data,
972
+ authKey: param.authKey,
973
+ });
974
+ if (error) {
975
+ return error;
976
+ } else {
977
+ return responseJson;
978
+ }
979
+ } catch (error) {
980
+ return error;
981
+ }
982
+ }
983
+ async deleteAttributeValues(param = { id, authKey, valueID }) {
984
+ let url =
985
+ ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
986
+ try {
987
+ const [error, responseJson] = await network.networkCall({
988
+ path: url,
989
+ method: Method.DELETE,
990
+ authKey: param.authKey,
991
+ });
992
+ if (error) {
993
+ return error;
994
+ } else {
995
+ return responseJson;
996
+ }
997
+ } catch (error) {
998
+ return error;
999
+ }
1000
+ }
1001
+ //MARK:-  CART API 
1002
+ async addToCart(param = { authKey, data }) {
1003
+ try {
1004
+ const [error, responseJson] = await network.networkCall({
1005
+ path: CART,
1006
+ method: Method.POST,
1007
+ param: param.data,
1008
+ authKey: param.authKey,
1009
+ });
1010
+ if (error) {
1011
+ return error;
1012
+ } else {
1013
+ return responseJson;
1014
+ }
1015
+ } catch (error) {
1016
+ return error;
1017
+ }
1018
+ }
1019
+ async deleteFromCart(param = { authKey, data }) {
1020
+ try {
1021
+ const [error, responseJson] = await network.networkCall({
1022
+ path: CART,
1023
+ method: Method.PATCH,
1024
+ param: param.data,
1025
+ authKey: param.authKey,
1026
+ });
1027
+ if (error) {
1028
+ return error;
1029
+ } else {
1030
+ return responseJson;
1031
+ }
1032
+ } catch (error) {
1033
+ return error;
1034
+ }
1035
+ }
1036
+ async getCarts(param = { authKey, bodyParam, currency }) {
1037
+ let url =
1038
+ param.bodyParam == undefined || param.bodyParam == ""
1039
+ ? ""
1040
+ : `?${serialization(param.bodyParam)}`;
1041
+ try {
1042
+ const [error, responseJson] = await network.networkCall({
1043
+ path: CART + url,
1044
+ method: Method.GET,
1045
+ authKey: param.authKey,
1046
+ currency: param.currency,
1047
+ });
1048
+ if (error) {
1049
+ return error;
1050
+ } else {
1051
+ return responseJson;
1052
+ }
1053
+ } catch (error) {
1054
+ return error;
1055
+ }
1056
+ }
1057
+ async deleteAllCartDetail(param = { authKey }) {
1058
+ try {
1059
+ const [error, responseJson] = await network.networkCall({
1060
+ path: CART,
1061
+ method: Method.DELETE,
1062
+ authKey: param.authKey,
1063
+ });
1064
+ if (error) {
1065
+ return error;
1066
+ } else {
1067
+ return responseJson;
1068
+ }
1069
+ } catch (error) {
1070
+ return error;
1071
+ }
1072
+ }
1073
+ async checkout(param = { authKey, data, currency }) {
1074
+ try {
1075
+ const [error, responseJson] = await network.networkCall({
1076
+ path: CART + CHECKOUT,
1077
+ method: Method.POST,
1078
+ authKey: param.authKey,
1079
+ param: param.data,
1080
+ currency: param.currency,
1081
+ });
1082
+ if (error) {
1083
+ return error;
1084
+ } else {
1085
+ return responseJson;
1086
+ }
1087
+ } catch (error) {
1088
+ return error;
1089
+ }
1090
+ }
1091
+ async listingDirectCheckout(param = { authKey, data, id, currency }) {
1092
+ try {
1093
+ const [error, responseJson] = await network.networkCall({
1094
+ path: LISTINGS + `/${param.id}` + CHECKOUT,
1095
+ method: Method.POST,
1096
+ authKey: param.authKey,
1097
+ param: param.data,
1098
+ currency: param.currency,
1099
+ });
1100
+ if (error) {
1101
+ return error;
1102
+ } else {
1103
+ return responseJson;
1104
+ }
1105
+ } catch (error) {
1106
+ return error;
1107
+ }
1108
+ }
1109
+ async getEphemeralKey(param = { authKey, data, id }) {
1110
+ try {
1111
+ const [error, responseJson] = await network.networkCall({
1112
+ path: EPHERMERALKEY,
1113
+ method: Method.POST,
1114
+ authKey: param.authKey,
1115
+ param: param.data,
1116
+ });
1117
+ if (error) {
1118
+ return error;
1119
+ } else {
1120
+ return responseJson;
1121
+ }
1122
+ } catch (error) {
1123
+ return error;
1124
+ }
1125
+ }
1126
+ async getPaymentIntentKey(param = { authKey, data, id }) {
1127
+ try {
1128
+ const [error, responseJson] = await network.networkCall({
1129
+ path: PAYMENTINTENT,
1130
+ method: Method.POST,
1131
+ authKey: param.authKey,
1132
+ param: param.data,
1133
+ });
1134
+ if (error) {
1135
+ return error;
1136
+ } else {
1137
+ return responseJson;
1138
+ }
1139
+ } catch (error) {
1140
+ return error;
1141
+ }
1142
+ }
1143
+ //MARK:-  KYC 
1144
+ async getStripeConnectAccount(param = { authKey, id }) {
1145
+ try {
1146
+ const [error, responseJson] = await network.networkCall({
1147
+ path: STRIPECONNECTACCOUNT + `${param.id}`,
1148
+ method: Method.GET,
1149
+ authKey: param.authKey,
1150
+ });
1151
+ if (error) {
1152
+ return error;
1153
+ } else {
1154
+ return responseJson;
1155
+ }
1156
+ } catch (error) {
1157
+ return error;
1158
+ }
1159
+ }
1160
+ async createAccountLink(param = { authKey, data }) {
1161
+ try {
1162
+ const [error, responseJson] = await network.networkCall({
1163
+ path: CREATEACCOUNTLINK,
1164
+ method: Method.POST,
1165
+ authKey: param.authKey,
1166
+ param: param.data,
1167
+ });
1168
+ if (error) {
1169
+ return error;
1170
+ } else {
1171
+ return responseJson;
1172
+ }
1173
+ } catch (error) {
1174
+ return error;
1175
+ }
1176
+ }
1177
+ async createExpressLoginLink(param = { authKey, data }) {
1178
+ try {
1179
+ const [error, responseJson] = await network.networkCall({
1180
+ path: CREATEEXPRESSLOGINLINK,
1181
+ method: Method.POST,
1182
+ authKey: param.authKey,
1183
+ param: param.data,
1184
+ });
1185
+ if (error) {
1186
+ return error;
1187
+ } else {
1188
+ return responseJson;
1189
+ }
1190
+ } catch (error) {
1191
+ return error;
1192
+ }
1193
+ }
1194
+ //MARK:-  ORDERS API 
1195
+ async getOrders(param = { authKey, bodyParam }) {
1196
+ let url =
1197
+ param.bodyParam == undefined || param.bodyParam == ""
1198
+ ? ""
1199
+ : `?${serialization(param.bodyParam)}`;
1200
+ try {
1201
+ const [error, responseJson] = await network.networkCall({
1202
+ path: ORDERS + url,
1203
+ method: Method.GET,
1204
+ authKey: param.authKey,
1205
+ });
1206
+ if (error) {
1207
+ return error;
1208
+ } else {
1209
+ return responseJson;
1210
+ }
1211
+ } catch (error) {
1212
+ return error;
1213
+ }
1214
+ }
1215
+ async getOrderDetail(param = { authKey, id, bodyParam }) {
1216
+ let url =
1217
+ param.bodyParam == undefined || param.bodyParam == ""
1218
+ ? ""
1219
+ : `?${serialization(param.bodyParam)}`;
1220
+ try {
1221
+ const [error, responseJson] = await network.networkCall({
1222
+ path: ORDERS + `/${param.id}` + url,
1223
+ method: Method.GET,
1224
+ authKey: param.authKey,
1225
+ });
1226
+ if (error) {
1227
+ return error;
1228
+ } else {
1229
+ return responseJson;
1230
+ }
1231
+ } catch (error) {
1232
+ return error;
1233
+ }
1234
+ }
1235
+ async updateOrderStatus(param = { authKey, id, data, bodyParam }) {
1236
+ let url =
1237
+ param.bodyParam == undefined || param.bodyParam == ""
1238
+ ? ""
1239
+ : `?${serialization(param.bodyParam)}`;
1240
+ try {
1241
+ const [error, responseJson] = await network.networkCall({
1242
+ path: ORDERS + `/${param.id}` + STATUS + url,
1243
+ method: Method.PATCH,
1244
+ authKey: param.authKey,
1245
+ param: param.data,
1246
+ });
1247
+ if (error) {
1248
+ return error;
1249
+ } else {
1250
+ return responseJson;
1251
+ }
1252
+ } catch (error) {
1253
+ return error;
1254
+ }
1255
+ }
1256
+ async updateOrderDetail(param = { authKey, id, data, bodyParam }) {
1257
+ let url =
1258
+ param.bodyParam == undefined || param.bodyParam == ""
1259
+ ? ""
1260
+ : `?${serialization(param.bodyParam)}`;
1261
+ try {
1262
+ const [error, responseJson] = await network.networkCall({
1263
+ path: ORDERS + `/${param.id}` + url,
1264
+ method: Method.PATCH,
1265
+ authKey: param.authKey,
1266
+ param: param.data,
1267
+ });
1268
+ if (error) {
1269
+ return error;
1270
+ } else {
1271
+ return responseJson;
1272
+ }
1273
+ } catch (error) {
1274
+ return error;
1275
+ }
1276
+ }
1277
+ async getReviewList(param = { authKey, bodyParam }) {
1278
+ let url =
1279
+ param.bodyParam == undefined || param.bodyParam == ""
1280
+ ? ""
1281
+ : `?${serialization(param.bodyParam)}`;
1282
+ try {
1283
+ const [error, responseJson] = await network.networkCall({
1284
+ path: REVIEW + url,
1285
+ method: Method.GET,
1286
+ authKey: param.authKey,
1287
+ });
1288
+ if (error) {
1289
+ return error;
1290
+ } else {
1291
+ return responseJson;
1292
+ }
1293
+ } catch (error) {
1294
+ return error;
1295
+ }
1296
+ }
1297
+ async addReview(param = { authKey, data }) {
1298
+ try {
1299
+ const [error, responseJson] = await network.networkCall({
1300
+ path: REVIEW,
1301
+ method: Method.POST,
1302
+ authKey: param.authKey,
1303
+ param: param.data,
1304
+ });
1305
+ if (error) {
1306
+ return error;
1307
+ } else {
1308
+ return responseJson;
1309
+ }
1310
+ } catch (error) {
1311
+ return error;
1312
+ }
1313
+ }
1314
+ async likeReview(param = { authKey, data, id }) {
1315
+ try {
1316
+ const [error, responseJson] = await network.networkCall({
1317
+ path: REVIEW + `/${param.id}/like`,
1318
+ method: Method.PATCH,
1319
+ authKey: param.authKey,
1320
+ param: param.data,
1321
+ });
1322
+ if (error) {
1323
+ return error;
1324
+ } else {
1325
+ return responseJson;
1326
+ }
1327
+ } catch (error) {
1328
+ return error;
1329
+ }
1330
+ }
1331
+ async getPaymentMethods(param = { authKey }) {
1332
+ try {
1333
+ const [error, responseJson] = await network.networkCall({
1334
+ path: PAYMENTSMETHODS,
1335
+ method: Method.GET,
1336
+ authKey: param.authKey,
1337
+ });
1338
+ if (error) {
1339
+ return error;
1340
+ } else {
1341
+ return responseJson;
1342
+ }
1343
+ } catch (error) {
1344
+ return error;
1345
+ }
1346
+ }
1347
+ async getShippingMethods(param = { authKey }) {
1348
+ try {
1349
+ const [error, responseJson] = await network.networkCall({
1350
+ path: SHIPPINGMETHOD,
1351
+ method: Method.GET,
1352
+ authKey: param.authKey,
1353
+ });
1354
+ if (error) {
1355
+ return error;
1356
+ } else {
1357
+ return responseJson;
1358
+ }
1359
+ } catch (error) {
1360
+ return error;
1361
+ }
1362
+ }
1363
+ //MARK:-  Currency 
1364
+ async getCurrency(param = { authKey }) {
1365
+ try {
1366
+ const [error, responseJson] = await network.networkCall({
1367
+ path: CURRENCY,
1368
+ method: Method.GET,
1369
+ authKey: param.authKey,
1370
+ });
1371
+ if (error) {
1372
+ return error;
1373
+ } else {
1374
+ return responseJson;
1375
+ }
1376
+ } catch (error) {
1377
+ return error;
1378
+ }
1379
+ }
1380
+ async addEditCurrency(param = { id, authKey, data }) {
1381
+ let method =
1382
+ param.id == undefined || param.id == ""
1383
+ ? Method.POST
1384
+ : Method.PUT;
1385
+ let path =
1386
+ param.id == undefined || param.id == ""
1387
+ ? CURRENCY
1388
+ : CURRENCY + `/${param.id}`;
1389
+ try {
1390
+ const [error, responseJson] = await network.networkCall({
1391
+ path: path,
1392
+ method: method,
1393
+ authKey: param.authKey,
1394
+ param: param.data,
1395
+ });
1396
+ if (error) {
1397
+ return error;
1398
+ } else {
1399
+ return responseJson;
1400
+ }
1401
+ } catch (error) {
1402
+ return error;
1403
+ }
1404
+ }
1405
+ async deleteCurrency(param = { id, authKey }) {
1406
+ try {
1407
+ const [error, responseJson] = await network.networkCall({
1408
+ path: CURRENCY + `/${param.id}`,
1409
+ method: Method.DELETE,
1410
+ authKey: param.authKey,
1411
+ });
1412
+ if (error) {
1413
+ return error;
1414
+ } else {
1415
+ return responseJson;
1416
+ }
1417
+ } catch (error) {
1418
+ return error;
1419
+ }
1420
+ }
1421
+ //MARK:-  Collections 
1422
+ async getCollection(param = { authKey }) {
1423
+ try {
1424
+ const [error, responseJson] = await network.networkCall({
1425
+ path: COLLECTIONS,
1426
+ method: Method.GET,
1427
+ authKey: param.authKey,
1428
+ });
1429
+ if (error) {
1430
+ return error;
1431
+ } else {
1432
+ return responseJson;
1433
+ }
1434
+ } catch (error) {
1435
+ return error;
1436
+ }
1437
+ }
1438
+ async getCollectionDetail(param = { authKey, id }) {
1439
+ try {
1440
+ const [error, responseJson] = await network.networkCall({
1441
+ path: COLLECTIONS + `/${param.id}`,
1442
+ method: Method.GET,
1443
+ authKey: param.authKey,
1444
+ });
1445
+ if (error) {
1446
+ return error;
1447
+ } else {
1448
+ return responseJson;
1449
+ }
1450
+ } catch (error) {
1451
+ return error;
1452
+ }
1453
+ }
1454
+ async addEditCollection(param = { id, authKey, data }) {
1455
+ let method =
1456
+ param.id == undefined || param.id == ""
1457
+ ? Method.POST
1458
+ : Method.PUT;
1459
+ let path =
1460
+ param.id == undefined || param.id == ""
1461
+ ? COLLECTIONS
1462
+ : COLLECTIONS + `/${param.id}`;
1463
+ try {
1464
+ const [error, responseJson] = await network.networkCall({
1465
+ path: path,
1466
+ method: method,
1467
+ authKey: param.authKey,
1468
+ param: param.data,
1469
+ });
1470
+ if (error) {
1471
+ return error;
1472
+ } else {
1473
+ return responseJson;
1474
+ }
1475
+ } catch (error) {
1476
+ return error;
1477
+ }
1478
+ }
1479
+ async deleteCollections(param = { id, authKey }) {
1480
+ try {
1481
+ const [error, responseJson] = await network.networkCall({
1482
+ path: COLLECTIONS + `/${param.id}`,
1483
+ method: Method.DELETE,
1484
+ authKey: param.authKey,
1485
+ });
1486
+ if (error) {
1487
+ return error;
1488
+ } else {
1489
+ return responseJson;
1490
+ }
1491
+ } catch (error) {
1492
+ return error;
1493
+ }
1494
+ }
1495
+ //MARK:-  Promo banner 
1496
+ async getPromoBanner(param = { authKey, bodyParam }) {
1497
+ let url =
1498
+ param.bodyParam == undefined || param.bodyParam == ""
1499
+ ? ""
1500
+ : `?${serialization(param.bodyParam)}`;
1501
+ try {
1502
+ const [error, responseJson] = await network.networkCall({
1503
+ path: PROMO + url,
1504
+ method: Method.GET,
1505
+ authKey: param.authKey,
1506
+ });
1507
+ if (error) {
1508
+ return error;
1509
+ } else {
1510
+ return responseJson;
1511
+ }
1512
+ } catch (error) {
1513
+ return error;
1514
+ }
1515
+ }
1516
+ async addPromoBanner(param = { id, authKey, data }) {
1517
+ let method =
1518
+ param.id == undefined || param.id == ""
1519
+ ? Method.POST
1520
+ : Method.PUT;
1521
+ let path =
1522
+ param.id == undefined || param.id == ""
1523
+ ? PROMO
1524
+ : PROMO + `/${param.id}`;
1525
+ try {
1526
+ const [error, responseJson] = await network.networkCall({
1527
+ path: path,
1528
+ method: method,
1529
+ authKey: param.authKey,
1530
+ param: param.data,
1531
+ });
1532
+ if (error) {
1533
+ return error;
1534
+ } else {
1535
+ return responseJson;
1536
+ }
1537
+ } catch (error) {
1538
+ return error;
1539
+ }
1540
+ }
1541
+ async deletePromoBanner(param = { id, authKey }) {
1542
+ try {
1543
+ const [error, responseJson] = await network.networkCall({
1544
+ path: PROMO + `/${param.id}`,
1545
+ method: Method.DELETE,
1546
+ authKey: param.authKey,
1547
+ });
1548
+ if (error) {
1549
+ return error;
1550
+ } else {
1551
+ return responseJson;
1552
+ }
1553
+ } catch (error) {
1554
+ return error;
1555
+ }
1556
+ }
1557
+ //MARK:-  Transaction 
1558
+ async getTransactions(param = { authKey, bodyParam }) {
1559
+ let url =
1560
+ param.bodyParam == undefined || param.bodyParam == ""
1561
+ ? ""
1562
+ : `?${serialization(param.bodyParam)}`;
1563
+ try {
1564
+ const [error, responseJson] = await network.networkCall({
1565
+ path: TRANSACTIONS + url,
1566
+ method: Method.GET,
1567
+ authKey: param.authKey,
1568
+ });
1569
+ if (error) {
1570
+ return error;
1571
+ } else {
1572
+ return responseJson;
1573
+ }
1574
+ } catch (error) {
1575
+ return error;
1576
+ }
1577
+ }
1578
+ async getEarning(param = { authKey, bodyParam }) {
1579
+ let url =
1580
+ param.bodyParam == undefined || param.bodyParam == ""
1581
+ ? ""
1582
+ : `?${serialization(param.bodyParam)}`;
1583
+ try {
1584
+ const [error, responseJson] = await network.networkCall({
1585
+ path: EARNINGS + url,
1586
+ method: Method.GET,
1587
+ authKey: param.authKey,
1588
+ });
1589
+ if (error) {
1590
+ return error;
1591
+ } else {
1592
+ return responseJson;
1593
+ }
1594
+ } catch (error) {
1595
+ return error;
1596
+ }
1597
+ }
1598
+ }
1599
+ const app = new App();
1600
+ export default app;