tradly 1.0.6 → 1.0.7

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  export var APPCONSTANT = {
3
- TOKEN: 'asl8msg11f1agc6c12361bs4516c5e1dl',
3
+ TOKEN: '',
4
4
  CURRENCY:'USD',
5
5
  };
6
6
 
@@ -20,6 +20,7 @@ export const LANGUAGES = 'v1/languages';
20
20
 
21
21
  export const CATEGORY = 'v1/categories';
22
22
  export const ATTRIBUTE= 'v1/attributes';
23
+ export const VALUES= '/values';
23
24
 
24
25
  export const ACCOUNTS = 'v1/accounts';
25
26
  export const FOLLOW = '/follow';
@@ -45,3 +46,12 @@ export const CART = 'products/v1/cart';
45
46
  export const CHECKOUT = '/checkout';
46
47
  export const STATUS = '/status';
47
48
  export const REVIEW = '/v1/reviews';
49
+
50
+
51
+ export const COLLECTIONS = '/v1/collections';
52
+ export const PROMO = '/v1/promos';
53
+ export const TRANSACTIONS = '/v1/transactions';
54
+ export const EARNINGS = '/v1/earnings';
55
+
56
+
57
+
@@ -19,11 +19,11 @@ export const Method = {
19
19
  }
20
20
 
21
21
  export var TradlyConfig = {
22
- path:String,
22
+ path:'',
23
23
  method:Method,
24
- params:'',
25
- authkey:String,
26
- refreshKey:String,
24
+ param:'',
25
+ authKey:'',
26
+ refreshKey:'',
27
27
  }
28
28
 
29
29
  class NetworkManager {
@@ -32,18 +32,24 @@ class NetworkManager {
32
32
  var url = BaseURL + config.path;
33
33
  header['Authorization'] = "Bearer " + APPCONSTANT.TOKEN;
34
34
  header['x-currency'] = APPCONSTANT.CURRENCY;
35
- if (config.authkey != undefined || config.authkey == '') {
36
- header['x-auth-key'] = config.authkey;
35
+ if (config.authKey != undefined || config.authKey == '') {
36
+ header['x-auth-key'] = config.authKey;
37
37
  }
38
38
  if (config.refreshKey != undefined || config.refreshKey == '') {
39
39
  header['X-Refresh-Key'] = config.refreshKey;
40
40
  }
41
41
  console.log('header',header )
42
- const [err,response] = await to(axios({url:url,method:config.method,responseType:'json',headers:header,data:config.params}))
42
+ console.log('config',config )
43
+ console.log('param.param',config.param )
44
+
45
+ console.log('config.authkey',config.authKey )
46
+
47
+ const [err,response] = await to(axios({url:url,method:config.method,responseType:'json',headers:header,data:config.param}))
43
48
  if (err) {
44
49
  let errData = err['response']['data'];
45
50
  return [errData, undefined];
46
51
  } else {
52
+ console.log('fddf ===> ',response['data']);
47
53
  return [undefined, response['data']];
48
54
  }
49
55
  }
package/Roots/App.js CHANGED
@@ -4,314 +4,475 @@ import {
4
4
  ACCOUNTS, ATTRIBUTE,DEVICES, REPORT,
5
5
  CATEGORY, CURRENCY, HOME,USERS, BLOCK,
6
6
  LANGUAGES, LIKE, LISTINGS, ORDERS,REVIEW,
7
- PAYMENTSMETHODS,ADDRESS, FOLLOW,
8
- SHIPPINGMETHOD, VARIANTS,CART, CHECKOUT,
7
+ PAYMENTSMETHODS,ADDRESS, FOLLOW, COLLECTIONS, PROMO,
8
+ SHIPPINGMETHOD, VARIANTS,CART, CHECKOUT,
9
+ VALUES, TRANSACTIONS, EARNINGS, VARIANTTYPES,
9
10
  } from './../Constants/PathConstant.js'
10
11
  import serialization from "../Helper/Serialization.js";
11
12
 
12
13
  class App {
13
- async updateDeviceInfo(params = {data:'',authKey:''}) {
14
- try { const [error,responseJson] = await network.networkCall({path:DEVICES,method:Method.POST,params:params.data,authkey:params.authKey});
14
+ async updateDeviceInfo(param = {data,authKey}) {
15
+ try { const [error,responseJson] = await network.networkCall({path:DEVICES,method:Method.POST,param:param.data,authKey:param.authKey});
15
16
  if (error) { return error;
16
17
  } else { return responseJson}
17
18
  } catch (error) {return error}
18
19
  }
19
- async updateUserInfo(params = {data:'',authKey:''}) {
20
- try { const [error,responseJson] = await network.networkCall({path:USERS,method:Method.POST,params:params.data,authkey:params.authKey});
20
+ async updateUserInfo(param = {data,authKey}) {
21
+ try { const [error,responseJson] = await network.networkCall({path:USERS,method:Method.POST,param:param.data,authKey:param.authKey});
21
22
  if (error) { return error;
22
23
  } else { return responseJson}
23
24
  } catch (error) {return error}
24
25
  }
25
- async home(params = {authKey:''}) {
26
- try { const [error, responseJson] = await network.networkCall({path:HOME,method:Method.GET,authKey:params.authKey});
26
+ async home(param = {authKey}) {
27
+ try { const [error, responseJson] = await network.networkCall({path:HOME,method:Method.GET,authKey:param.authKey});
27
28
  if (error) { return error }
28
29
  else { return responseJson }
29
30
  } catch (error) { return error }
30
31
  }
31
- async getLanguages() {
32
- try { const [error, responseJson] = await network.networkCall({path:LANGUAGES,method:Method.GET});
32
+ async getLanguages(param = {authKey}) {
33
+ try { const [error, responseJson] = await network.networkCall({path:LANGUAGES,method:Method.GET,authKey:param.authKey});
33
34
  if (error) { return error }
34
35
  else { return responseJson }
35
36
  } catch (error) { return error }
36
37
  }
37
-
38
- //MARK:-  CATEGORY APIS 
39
- async getCategory(params = {bodyParam:''}) {
40
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
41
- try { const [error, responseJson] = await network.networkCall({path:CATEGORY + url, method:Method.GET});
38
+ //MARK:-  ADDRESS APIS 
39
+ async addEditAddress(param = {id,data,authKey}) {
40
+ let path = param.id == undefined || param.id == '' ? ADDRESS : ADDRESS + `/${param.id}`
41
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
42
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey})
42
43
  if (error) { return error }
43
44
  else { return responseJson }
44
45
  } catch (error) { return error }
45
46
  }
46
- async addEditCategory(params = {id:'',data:'',authKey:''}) {
47
- let path = params.id == undefined || params.id == '' ? CATEGORY : CATEGORY + `/${params.id}`
48
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PUT
49
- try { const [error, responseJson] = await network.networkCall({path:path,method:method, params:params.data, authkey:params.authKey});
47
+ async getAddress(param={bodyParam,authKey}) {
48
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
49
+ try { const [error, responseJson] = await network.networkCall({path:ADDRESS + url,method:Method.GET,authKey:param.authKey});
50
50
  if (error) { return error }
51
51
  else { return responseJson }
52
52
  } catch (error) { return error }
53
53
  }
54
- async deleteCategory(params = {id:'',authKey:''}) {
55
- try { const [error, responseJson] = await network.networkCall({path:CATEGORY + `/${params.id}`, method:Method.DELETE,authkey:params.authKey})
54
+ async deleteAddress(param={id,authKey}) {
55
+ try { const [error, responseJson] = await network.networkCall({path:ADDRESS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
56
56
  if (error) { return error }
57
57
  else { return responseJson }
58
58
  } catch (error) { return error }
59
59
  }
60
- //MARK:-  Attribute APIS 
61
-
62
- async getAttribute(params = {bodyParam:''}) {
63
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
64
- try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + url,method:Method.GET});
60
+ //MARK:-  ACCOUNTS APIS 
61
+ async getAccounts(param={bodyParam,authKey}) {
62
+ let url = `?${serialization(param.bodyParam)}`;
63
+ try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${url}`,method:Method.GET,authKey:param.authKey});
65
64
  if (error) { return error }
66
65
  else { return responseJson }
67
66
  } catch (error) { return error }
68
67
  }
69
- async addEditAttribute(params = {id:'',data:'',authKey:''}) {
70
- let path = params.id == undefined || params.id == '' ? ATTRIBUTE : ATTRIBUTE + `/${params.id}`
71
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PUT;
72
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,params:params.data,authkey:params.authKey});
68
+ async getAccountDetail(param={id,authKey}) {
69
+ try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${param.id}`,method:Method.GET,authKey:param.authKey});
73
70
  if (error) { return error }
74
71
  else { return responseJson }
75
72
  } catch (error) { return error }
76
73
  }
77
- async deleteAttribute(params = {id:'',authKey:''}) {
78
- try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + `/${params.id}`,method:Method.DELETE,authkey:params.authKey});
74
+ async postAccounts(param={id,authKey,data}) {
75
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PATCH
76
+ let path = param.id == undefined || param.id == '' ? ACCOUNTS : ACCOUNTS + `/${param.id}`
77
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
79
78
  if (error) { return error }
80
79
  else { return responseJson }
81
80
  } catch (error) { return error }
82
81
  }
83
-
84
- //MARK:-  ADDRESS APIS 
85
- async addEditAddress(params = {id:'',data:'',authKey:''}) {
86
- let path = params.id == undefined || params.id == '' ? ADDRESS : ADDRESS + `/${params.id}`
87
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PUT;
88
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,params:params.data,authkey:params.authKey})
82
+ async followUnfollowAccounts(param={id,authKey,isFollowing:Boolean}) {
83
+ let method = param.isFollowing ? Method.DELETE : Method.POST
84
+ let path = ACCOUNTS + `/${param.id}` + FOLLOW
85
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
89
86
  if (error) { return error }
90
87
  else { return responseJson }
91
88
  } catch (error) { return error }
92
89
  }
93
- async getAddress(params={bodyParam:'',authKey:''}) {
94
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
95
- try { const [error, responseJson] = await network.networkCall({path:ADDRESS + url,method:Method.GET,authkey:params.authKey});
90
+ async blockAccount(param={id,authKey,isBlocked:Boolean}) {
91
+ let method = param.isBlocked ? Method.DELETE : Method.POST
92
+ let path = ACCOUNTS + `/${param.id}` + BLOCK
93
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
96
94
  if (error) { return error }
97
95
  else { return responseJson }
98
96
  } catch (error) { return error }
99
97
  }
100
- async deleteAddress(params={id:'',authKey:''}) {
101
- try { const [error, responseJson] = await network.networkCall({path:ADDRESS + `/${params.id}`,method:Method.DELETE,authkey:params.authKey});
98
+ async blockAccount(param={id,authKey,data}) {
99
+ let method = Method.POST
100
+ let path = ACCOUNTS + `/${param.id}` + REPORT
101
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
102
102
  if (error) { return error }
103
103
  else { return responseJson }
104
104
  } catch (error) { return error }
105
105
  }
106
- //MARK:-  ACCOUNTS APIS 
107
- async getAccounts(params={bodyParam:'',authKey:''}) {
108
- let url = `?${serialization(params.bodyParam)}`;
109
- try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${url}`,method:Method.GET,authkey:params.authKey});
106
+ //MARK:-  LISTINGS API 
107
+ async getListings(param={bodyParam,authKey}) {
108
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
109
+ try { const [error, responseJson] = await network.networkCall({path:LISTINGS + url,method:Method.GET,authKey:param.authKey});
110
110
  if (error) { return error }
111
111
  else { return responseJson }
112
112
  } catch (error) { return error }
113
113
  }
114
- async getAccountDetail(params={id:'',authKey:''}) {
115
- try { const [error, responseJson] = await network.networkCall({path:ACCOUNTS + `${params.id}`,method:Method.GET,authkey:params.authKey});
114
+ async getListingDetail(param={id,authKey}) {
115
+ try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
116
116
  if (error) { return error }
117
117
  else { return responseJson }
118
118
  } catch (error) { return error }
119
119
  }
120
- async postAccounts(params={id:'',authKey:'',data:''}) {
121
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PATCH
122
- let path = params.id == undefined || params.id == '' ? ACCOUNTS : ACCOUNTS + `/${params.id}`
123
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey,params:params.data});
120
+ async deleteListing(param={id,authKey}) {
121
+ try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
124
122
  if (error) { return error }
125
123
  else { return responseJson }
126
124
  } catch (error) { return error }
127
125
  }
128
- async followUnfollowAccounts(params={id:'',authKey:'',isFollowing:Boolean}) {
129
- let method = params.isFollowing ? Method.DELETE : Method.POST
130
- let path = ACCOUNTS + `/${params.id}` + FOLLOW
131
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey});
126
+ async postListing(param={id,authKey,data}) {
127
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PATCH
128
+ let path = param.id == undefined || param.id == '' ? LISTINGS : LISTINGS + `/${param.id}`
129
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
132
130
  if (error) { return error }
133
131
  else { return responseJson }
134
132
  } catch (error) { return error }
135
133
  }
136
- async blockAccount(params={id:'',authKey:'',isBlocked:Boolean}) {
137
- let method = params.isBlocked ? Method.DELETE : Method.POST
138
- let path = ACCOUNTS + `/${params.id}` + BLOCK
139
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey});
134
+ async likeListing(param={id,authKey,isLiked:Boolean}) {
135
+ let method = param.isLiked ? Method.DELETE : Method.POST
136
+ let path = LISTINGS + `/${param.id}` + LIKE
137
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey});
140
138
  if (error) { return error }
141
139
  else { return responseJson }
142
140
  } catch (error) { return error }
143
141
  }
144
- async blockAccount(params={id:'',authKey:'',data:''}) {
145
- let method = Method.POST
146
- let path = ACCOUNTS + `/${params.id}` + REPORT
147
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey,params:params.data});
142
+ async getVariants(param={authKey:''}) {
143
+ try { const [error, responseJson] = await network.networkCall({path:VARIANTS,method:Method.GET,authKey:param.authKey});
148
144
  if (error) { return error }
149
145
  else { return responseJson }
150
146
  } catch (error) { return error }
151
147
  }
152
- //MARK:-  LISTINGS API 
153
- async getListings(params={bodyParam:'',authKey:''}) {
154
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
155
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + url,method:Method.GET,authkey:params.authKey});
148
+ async addEditVariants(param={authKey:'',listingId:'',id:'',data:{}}) {
149
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
150
+ let path = param.id == undefined || param.id == '' ? LISTINGS + `/${param.listingId}/` + VARIANTS : LISTINGS + `/${param.listingId}/` + VARIANTS + `/${param.id}`
151
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
152
+ if (error) { return error }
153
+ else { return responseJson }
154
+ } catch (error) { return error }
155
+ }
156
+ async deleteVariant(param={id:'',listingId:'',authKey:''}) {
157
+ let url = LISTINGS + `/${param.listingId}/` + VARIANTS + `/${param.id}`
158
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
159
+ if (error) { return error }
160
+ else { return responseJson }
161
+ } catch (error) { return error }
162
+ }
163
+ //MARK:-  Variant Types 
164
+ async getVariantTypes(param={authKey:''}) {
165
+ try { const [error, responseJson] = await network.networkCall({path:VARIANTTYPES,method:Method.GET,authKey:param.authKey});
166
+ if (error) { return error }
167
+ else { return responseJson }
168
+ } catch (error) { return error }
169
+ }
170
+ async addEditVariantsTypes(param={authKey:'',id:'',data:{}}) {
171
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
172
+ let path = param.id == undefined || param.id == '' ? VARIANTTYPES : VARIANTTYPES + `/${param.id}/`
173
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
174
+ if (error) { return error }
175
+ else { return responseJson }
176
+ } catch (error) { return error }
177
+ }
178
+ async deleteVariantType(param={id:'',authKey:''}) {
179
+ let url = VARIANTTYPES + `/${param.id}`
180
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
181
+ if (error) { return error }
182
+ else { return responseJson }
183
+ } catch (error) { return error }
184
+ }
185
+ //MARK:-  Variant Types Values 
186
+ async getVariantTypeValues(param = {id:'',authKey:''}) {
187
+ let url = VARIANTTYPES + `/${param.id}` + VALUES;
188
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
156
189
  if (error) { return error }
157
190
  else { return responseJson }
158
191
  } catch (error) { return error }
159
192
  }
160
- async getListingDetail(params={id:'',authKey:''}) {
161
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${params.id}`,method:Method.GET,authkey:params.authKey});
193
+ async getVariantTypeValuesDetail(param = { id: '', valueID: '', authKey: '' }) {
194
+ let url = VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`;
195
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
162
196
  if (error) { return error }
163
197
  else { return responseJson }
164
198
  } catch (error) { return error }
165
199
  }
166
- async deteteListing(params={id:'',authKey:''}) {
167
- try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${params.id}`,method:Method.DELETE,authkey:params.authKey});
200
+ async addEditVariantTypeValues(param = { id: '', valueID: '', data: {}, authKey: '' }) {
201
+ let path = param.id == undefined || param.id == '' ? VARIANTTYPES + `/${param.id}` + VALUES : VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`
202
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
203
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
168
204
  if (error) { return error }
169
205
  else { return responseJson }
170
206
  } catch (error) { return error }
171
207
  }
172
- async postListing(params={id:'',authKey:'',data:''}) {
173
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PATCH
174
- let path = params.id == undefined || params.id == '' ? LISTINGS : LISTINGS + `/${params.id}`
175
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey,params:params.data});
208
+ async deleteVariantTypeValues(param = { id: '', authKey: '', valueID: '' }) {
209
+ let url = VARIANTTYPES + `/${param.id}` + VALUES + `/${param.valueID}`;
210
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
176
211
  if (error) { return error }
177
212
  else { return responseJson }
178
213
  } catch (error) { return error }
179
214
  }
180
- async likeListing(params={id:'',authKey:'',isLiked:Boolean}) {
181
- let method = params.isLiked ? Method.DELETE : Method.POST
182
- let path = LISTINGS + `/${params.id}` + LIKE
183
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey});
215
+ //MARK:-  CATEGORY APIS 
216
+ async getCategory(param = {bodyParam,authKey}) {
217
+ console.log('dsds', param.bodyParam);
218
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
219
+ try { const [error, responseJson] = await network.networkCall({path:CATEGORY + url, method:Method.GET,authKey:param.authKey});
184
220
  if (error) { return error }
185
221
  else { return responseJson }
186
222
  } catch (error) { return error }
187
223
  }
188
- async getVariants(params={authKey:''}) {
189
- try { const [error, responseJson] = await network.networkCall({path:VARIANTS,method:Method.GET,authkey:params.authKey});
224
+ async addEditCategory(param = {id:'',data:{},authKey:''}) {
225
+ let path = param.id == undefined || param.id == '' ? CATEGORY : CATEGORY + `/${param.id}`
226
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
227
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method, param:param.data, authKey:param.authKey});
190
228
  if (error) { return error }
191
229
  else { return responseJson }
192
230
  } catch (error) { return error }
193
231
  }
194
- async postVariants(params={authKey:'',listingId:'',id:'',data:''}) {
195
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PUT
196
- let path = params.id == undefined || params.id == '' ? LISTINGS + `/${params.listingId}/` + VARIANTS : LISTINGS + `/${params.listingId}/` + VARIANTS + `/${params.id}`
197
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,params:params.data,authkey:params.authKey});
232
+ async deleteCategory(param = {id:'',authKey:''}) {
233
+ try { const [error, responseJson] = await network.networkCall({path:CATEGORY + `/${param.id}`, method:Method.DELETE,authKey:param.authKey})
198
234
  if (error) { return error }
199
235
  else { return responseJson }
200
236
  } catch (error) { return error }
201
237
  }
238
+ //MARK:-  Attribute APIS 
202
239
 
240
+ async getAttribute(param = {bodyParam:{},authKey:''}) {
241
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
242
+ try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + url,method:Method.GET,authKey:param.authKey});
243
+ if (error) { return error }
244
+ else { return responseJson }
245
+ } catch (error) { return error }
246
+ }
247
+ async addEditAttribute(param = {id:'',data:{},authKey:''}) {
248
+ let path = param.id == undefined || param.id == '' ? ATTRIBUTE : ATTRIBUTE + `/${param.id}`
249
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
250
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
251
+ if (error) { return error }
252
+ else { return responseJson }
253
+ } catch (error) { return error }
254
+ }
255
+ async deleteAttribute(param = {id:'',authKey:''}) {
256
+ try { const [error, responseJson] = await network.networkCall({path:ATTRIBUTE + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
257
+ if (error) { return error }
258
+ else { return responseJson }
259
+ } catch (error) { return error }
260
+ }
261
+ //MARK:-  Values
262
+ async getAttributeValues(param = {id:'',authKey:''}) {
263
+ let url = ATTRIBUTE + `/${param.id}` + VALUES;
264
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
265
+ if (error) { return error }
266
+ else { return responseJson }
267
+ } catch (error) { return error }
268
+ }
269
+ async getAttributeValuesDetail(param = { id: '', valueID: '', authKey: '' }) {
270
+ let url = ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
271
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.GET,authKey:param.authKey});
272
+ if (error) { return error }
273
+ else { return responseJson }
274
+ } catch (error) { return error }
275
+ }
276
+ async addEditAttributeValues(param = { id: '', valueID: '', data: {}, authKey: '' }) {
277
+ let path = param.id == undefined || param.id == '' ? ATTRIBUTE + `/${param.id}` + VALUES : ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`
278
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT;
279
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,param:param.data,authKey:param.authKey});
280
+ if (error) { return error }
281
+ else { return responseJson }
282
+ } catch (error) { return error }
283
+ }
284
+ async deleteAttributeValues(param = { id: '', authKey: '', valueID: '' }) {
285
+ let url = ATTRIBUTE + `/${param.id}` + VALUES + `/${param.valueID}`;
286
+ try { const [error, responseJson] = await network.networkCall({path:url,method:Method.DELETE,authKey:param.authKey});
287
+ if (error) { return error }
288
+ else { return responseJson }
289
+ } catch (error) { return error }
290
+ }
203
291
  //MARK:-  CART API 
204
- async addToCart(params={authKey:'',data:''}) {
205
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.POST,params:params.data,authkey:params.authKey});
292
+ async addToCart(param={authKey:'',data:{}}) {
293
+ try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.POST,param:param.data,authKey:param.authKey});
206
294
  if (error) { return error }
207
295
  else { return responseJson }
208
296
  } catch (error) { return error }
209
297
  }
210
- async deleteFromCart(params={authKey:'',data:''}) {
211
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.PATCH,params:params.data,authkey:params.authKey});
298
+ async deleteFromCart(param={authKey:'',data:{}}) {
299
+ try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.PATCH,param:param.data,authKey:param.authKey});
212
300
  if (error) { return error }
213
301
  else { return responseJson }
214
302
  } catch (error) { return error }
215
303
  }
216
- async getCarts(params={authKey:''}) {
217
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.GET,authkey:params.authKey});
304
+ async getCarts(param={authKey:''}) {
305
+ try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.GET,authKey:param.authKey});
218
306
  if (error) {
219
307
  return error
220
308
  }
221
309
  else { return responseJson }
222
310
  } catch (error) { return error }
223
311
  }
224
- async deleteAllCartDetail(params={authKey:''}) {
225
- try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.DELETE,authkey:params.authKey});
312
+ async deleteAllCartDetail(param={authKey}) {
313
+ try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.DELETE,authKey:param.authKey});
226
314
  if (error) { return error }
227
315
  else { return responseJson }
228
316
  } catch (error) { return error }
229
317
  }
230
318
 
231
- async checkout(params={authKey:'',data:''}) {
232
- try { const [error, responseJson] = await network.networkCall({path:CART + CHECKOUT,method:Method.POST,authkey:params.authKey,params:params.data});
319
+ async checkout(param={authKey,data}) {
320
+ try { const [error, responseJson] = await network.networkCall({path:CART + CHECKOUT,method:Method.POST,authKey:param.authKey,param:param.data});
321
+ if (error) { return error }
322
+ else { return responseJson }
323
+ } catch (error) { return error }
324
+ }
325
+ async listingDirectCheckout(param={authKey,data,id}) {
326
+ try { const [error, responseJson] = await network.networkCall({path:LISTINGS + `/${param.id}` + CHECKOUT,method:Method.POST,authKey:param.authKey,param:param.data});
233
327
  if (error) { return error }
234
328
  else { return responseJson }
235
329
  } catch (error) { return error }
236
330
  }
237
-
238
331
  //MARK:-  ORDERS API 
239
332
 
240
- async getOrders(params={authKey:'',bodyParam:''}) {
241
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
242
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + url,method:Method.GET,authkey:params.authKey});
333
+ async getOrders(param={authKey,bodyParam}) {
334
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
335
+ try { const [error, responseJson] = await network.networkCall({path:ORDERS + url,method:Method.GET,authKey:param.authKey});
243
336
  if (error) { return error }
244
337
  else { return responseJson }
245
338
  } catch (error) { return error }
246
339
  }
247
- async getOrderDetail(params={authKey:'',id:''}) {
248
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${params.id}`,method:Method.GET,authkey:params.authKey});
340
+ async getOrderDetail(param={authKey,id}) {
341
+ try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
249
342
  if (error) { return error }
250
343
  else { return responseJson }
251
344
  } catch (error) { return error }
252
345
  }
253
- async updateOrderStatus(params={authKey:'',id:'',data:''}) {
254
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${params.id}` + STATUS,method:Method.PATCH,authkey:params.authKey,params:params.data});
346
+ async updateOrderStatus(param={authKey,id,data}) {
347
+ try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}` + STATUS,method:Method.PATCH,authKey:param.authKey,param:param.data});
255
348
  if (error) { return error }
256
349
  else { return responseJson }
257
350
  } catch (error) { return error }
258
351
  }
259
- async updateOrderDetail(params={authKey:'',id:'',data:''}) {
260
- try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${params.id}`,method:Method.PATCH,authkey:params.authKey,params:params.data});
352
+ async updateOrderDetail(param={authKey,id,data}) {
353
+ try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${param.id}`,method:Method.PATCH,authKey:param.authKey,param:param.data});
261
354
  if (error) { return error }
262
355
  else { return responseJson }
263
356
  } catch (error) { return error }
264
357
  }
265
- async getReviewList(params={authKey:'',bodyParam:''}) {
266
- let url = params.bodyParam == undefined || params.bodyParam == '' ? '' : `?${serialization(params.bodyParam)}`;
267
- try { const [error, responseJson] = await network.networkCall({path:REVIEW + url,method:Method.GET,authkey:params.authKey});
358
+ async getReviewList(param={authKey,bodyParam}) {
359
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
360
+ try { const [error, responseJson] = await network.networkCall({path:REVIEW + url,method:Method.GET,authKey:param.authKey});
268
361
  if (error) { return error }
269
362
  else { return responseJson }
270
363
  } catch (error) { return error }
271
364
  }
272
- async addReview(params={authKey:'',data:''}) {
273
- try { const [error, responseJson] = await network.networkCall({path:REVIEW,method:Method.POST,authkey:params.authKey,params:params.data});
365
+ async addReview(param={authKey,data}) {
366
+ try { const [error, responseJson] = await network.networkCall({path:REVIEW,method:Method.POST,authKey:param.authKey,param:param.data});
274
367
  if (error) { return error }
275
368
  else { return responseJson }
276
369
  } catch (error) { return error }
277
370
  }
278
- async likeReview(params={authKey:'',data:'',id:''}) {
279
- try { const [error, responseJson] = await network.networkCall({path:REVIEW + `/${params.id}` ,method:Method.PATCH,authkey:params.authKey,params:params.data});
371
+ async likeReview(param={authKey,data,id}) {
372
+ try { const [error, responseJson] = await network.networkCall({path:REVIEW + `/${param.id}` ,method:Method.PATCH,authKey:param.authKey,param:param.data});
280
373
  if (error) { return error }
281
374
  else { return responseJson }
282
375
  } catch (error) { return error }
283
376
  }
284
-
285
- async getPaymentMethods(params={authKey:''}) {
286
- try { const [error, responseJson] = await network.networkCall({path:PAYMENTSMETHODS ,method:Method.GET,authkey:params.authKey});
377
+ async getPaymentMethods(param={authKey}) {
378
+ try { const [error, responseJson] = await network.networkCall({path:PAYMENTSMETHODS ,method:Method.GET,authKey:param.authKey});
287
379
  if (error) { return error }
288
380
  else { return responseJson }
289
381
  } catch (error) { return error }
290
382
  }
291
- async getShippingMethods(params={authKey:''}) {
292
- try { const [error, responseJson] = await network.networkCall({path:SHIPPINGMETHOD ,method:Method.GET,authkey:params.authKey});
383
+ async getShippingMethods(param={authKey}) {
384
+ try { const [error, responseJson] = await network.networkCall({path:SHIPPINGMETHOD ,method:Method.GET,authKey:param.authKey});
293
385
  if (error) { return error }
294
386
  else { return responseJson }
295
387
  } catch (error) { return error }
296
388
  }
297
-
298
389
  //MARK:-  Currency 
299
- async getCurrency() {
300
- try { const [error, responseJson] = await network.networkCall({path:CURRENCY,method:Method.GET})
390
+ async getCurrency(param={authKey}) {
391
+ try { const [error, responseJson] = await network.networkCall({path:CURRENCY,method:Method.GET,authKey:param.authKey})
392
+ if (error) { return error }
393
+ else { return responseJson }
394
+ } catch (error) { return error }
395
+ }
396
+ async addEditCurrency(param={id,authKey,data}) {
397
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
398
+ let path = param.id == undefined || param.id == '' ? CURRENCY : CURRENCY + `/${param.id}`
399
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
400
+ if (error) { return error }
401
+ else { return responseJson }
402
+ } catch (error) { return error }
403
+ }
404
+ async deleteCurrency(param={id,authKey}) {
405
+ try { const [error, responseJson] = await network.networkCall({path:CURRENCY + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
406
+ if (error) { return error }
407
+ else { return responseJson }
408
+ } catch (error) { return error }
409
+ }
410
+ //MARK:-  Collections 
411
+ async getCollection(param={authKey}) {
412
+ try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS,method:Method.GET,authKey:param.authKey})
413
+ if (error) { return error }
414
+ else { return responseJson }
415
+ } catch (error) { return error }
416
+ }
417
+ async getCollectionDetail(param={authKey,id}) {
418
+ try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS + `/${param.id}`,method:Method.GET,authKey:param.authKey});
419
+ if (error) { return error }
420
+ else { return responseJson }
421
+ } catch (error) { return error }
422
+ }
423
+ async addEditCollection(param={id,authKey,data}) {
424
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
425
+ let path = param.id == undefined || param.id == '' ? COLLECTIONS : COLLECTIONS + `/${param.id}`
426
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
427
+ if (error) { return error }
428
+ else { return responseJson }
429
+ } catch (error) { return error }
430
+ }
431
+ async deleteCollections(param={id,authKey}) {
432
+ try { const [error, responseJson] = await network.networkCall({path:COLLECTIONS + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
433
+ if (error) { return error }
434
+ else { return responseJson }
435
+ } catch (error) { return error }
436
+ }
437
+ //MARK:-  Promo banner 
438
+ async getPromoBanner(param={authKey,bodyParam}) {
439
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
440
+ try { const [error, responseJson] = await network.networkCall({path:PROMO + url,method:Method.GET,authKey:param.authKey})
441
+ if (error) { return error }
442
+ else { return responseJson }
443
+ } catch (error) { return error }
444
+ }
445
+ async getPromoBanner(param={authKey,id}) {
446
+ try { const [error, responseJson] = await network.networkCall({path:PROMO + `/${param.id}`,method:Method.GET,authKey:param.authKey});
447
+ if (error) { return error }
448
+ else { return responseJson }
449
+ } catch (error) { return error }
450
+ }
451
+ async addPromoBanner(param={id,authKey,data}) {
452
+ let method = param.id == undefined || param.id == '' ? Method.POST : Method.PUT
453
+ let path = param.id == undefined || param.id == '' ? PROMO : PROMO + `/${param.id}`
454
+ try { const [error, responseJson] = await network.networkCall({path:path,method:method,authKey:param.authKey,param:param.data});
455
+ if (error) { return error }
456
+ else { return responseJson }
457
+ } catch (error) { return error }
458
+ }
459
+ async deletePromoBanner(param={id,authKey}) {
460
+ try { const [error, responseJson] = await network.networkCall({path:PROMO + `/${param.id}`,method:Method.DELETE,authKey:param.authKey});
301
461
  if (error) { return error }
302
462
  else { return responseJson }
303
463
  } catch (error) { return error }
304
464
  }
305
- async addCurrency(params={id:'',authKey:'',data:''}) {
306
- let method = params.id == undefined || params.id == '' ? Method.POST : Method.PUT
307
- let path = params.id == undefined || params.id == '' ? CURRENCY : CURRENCY + `/${params.id}`
308
- try { const [error, responseJson] = await network.networkCall({path:path,method:method,authkey:params.authKey,params:params.data});
465
+ //MARK:-  Transaction 
466
+ async getTransactions(param={authKey,bodyParam}) {
467
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
468
+ try { const [error, responseJson] = await network.networkCall({path:TRANSACTIONS + url,method:Method.GET,authKey:param.authKey});
309
469
  if (error) { return error }
310
470
  else { return responseJson }
311
471
  } catch (error) { return error }
312
472
  }
313
- async deteteCurrency(params={id:'',authKey:''}) {
314
- try { const [error, responseJson] = await network.networkCall({path:CURRENCY + `/${params.id}`,method:Method.DELETE,authkey:params.authKey});
473
+ async getEarning(param={authKey,bodyParam}) {
474
+ let url = param.bodyParam == undefined || param.bodyParam == '' ? '' : `?${serialization(param.bodyParam)}`;
475
+ try { const [error, responseJson] = await network.networkCall({path:EARNINGS + url,method:Method.GET,authKey:param.authKey});
315
476
  if (error) { return error }
316
477
  else { return responseJson }
317
478
  } catch (error) { return error }
package/Roots/Roots.js CHANGED
@@ -3,6 +3,4 @@
3
3
  import user from "./User.js";
4
4
  import init from "./Initialize.js";
5
5
  import app from './App.js';
6
-
7
6
  export default {init,user,app};
8
-
package/Roots/User.js CHANGED
@@ -5,24 +5,24 @@ import { UserParameter } from "../Helper/APIParam.js";
5
5
 
6
6
  class User {
7
7
  async login(param = UserParameter) {
8
- try { const [error,responseJson] = await network.networkCall({path:LOGIN,method:Method.POST,params:param.data});
8
+ try { const [error,responseJson] = await network.networkCall({path:LOGIN,method:Method.POST,param:param.data});
9
9
  if (error) { return error
10
10
  } else { return responseJson}
11
11
  } catch (error) { return error}
12
12
  }
13
13
  async register(param = UserParameter) {
14
- try { const [error,responseJson] = await network.networkCall({path:REGISTER,method:Method.POST,params:param.data});
14
+ try { const [error,responseJson] = await network.networkCall({path:REGISTER,method:Method.POST,param:param.data});
15
15
  if (error) { return error} else { return responseJson }
16
16
  } catch (error) { return error }
17
17
  }
18
18
  async verify(param = UserParameter) {
19
- try { const [error,responseJson] = await network.networkCall({path:VERIFY,method:Method.POST,params:param.data});
19
+ try { const [error,responseJson] = await network.networkCall({path:VERIFY,method:Method.POST,param:param.data});
20
20
  if (error) {return error
21
21
  } else { return responseJson }
22
22
  } catch (error) { return error}
23
23
  }
24
24
  async resendOTP(param = UserParameter) {
25
- try { const [error,responseJson] = await network.networkCall({path:REGISTER,method:Method.POST,params:param.data});
25
+ try { const [error,responseJson] = await network.networkCall({path:REGISTER,method:Method.POST,param:param.data});
26
26
  if (error) { return error
27
27
  } else { return responseJson}
28
28
  } catch (error) { return error}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tradly",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Tradly JS SDK",
5
5
  "main": "index.js",
6
6
  "type": "module",