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.
- package/Constants/AppConstant.js +1 -1
- package/Constants/PathConstant.js +10 -0
- package/NetworkManager/NetworkManager.js +13 -7
- package/Roots/App.js +289 -128
- package/Roots/Roots.js +0 -2
- package/Roots/User.js +4 -4
- package/package.json +1 -1
package/Constants/AppConstant.js
CHANGED
|
@@ -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:
|
|
22
|
+
path:'',
|
|
23
23
|
method:Method,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
refreshKey:
|
|
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.
|
|
36
|
-
header['x-auth-key'] = config.
|
|
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
|
-
|
|
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(
|
|
14
|
-
try { const [error,responseJson] = await network.networkCall({path:DEVICES,method:Method.POST,
|
|
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(
|
|
20
|
-
try { const [error,responseJson] = await network.networkCall({path:USERS,method:Method.POST,
|
|
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(
|
|
26
|
-
try { const [error, responseJson] = await network.networkCall({path:HOME,method:Method.GET,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
|
-
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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
|
|
47
|
-
let
|
|
48
|
-
|
|
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
|
|
55
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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:-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
70
|
-
|
|
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
|
|
78
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
94
|
-
let
|
|
95
|
-
|
|
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
|
|
101
|
-
|
|
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:-
|
|
107
|
-
async
|
|
108
|
-
let url = `?${serialization(
|
|
109
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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
|
|
115
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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
|
|
121
|
-
|
|
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
|
|
129
|
-
let method =
|
|
130
|
-
let path =
|
|
131
|
-
try { const [error, responseJson] = await network.networkCall({path:path,method:method,
|
|
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
|
|
137
|
-
let method =
|
|
138
|
-
let path =
|
|
139
|
-
try { const [error, responseJson] = await network.networkCall({path:path,method:method,
|
|
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
|
|
145
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
let
|
|
155
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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
|
|
161
|
-
|
|
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
|
|
167
|
-
|
|
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
|
|
173
|
-
let
|
|
174
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
|
189
|
-
|
|
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
|
|
195
|
-
|
|
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(
|
|
205
|
-
try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.POST,
|
|
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(
|
|
211
|
-
try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.PATCH,
|
|
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(
|
|
217
|
-
try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.GET,
|
|
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(
|
|
225
|
-
try { const [error, responseJson] = await network.networkCall({path:CART,method:Method.DELETE,
|
|
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(
|
|
232
|
-
try { const [error, responseJson] = await network.networkCall({path:CART + CHECKOUT,method:Method.POST,
|
|
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(
|
|
241
|
-
let url =
|
|
242
|
-
try { const [error, responseJson] = await network.networkCall({path:ORDERS + url,method:Method.GET,
|
|
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(
|
|
248
|
-
try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${
|
|
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(
|
|
254
|
-
try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${
|
|
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(
|
|
260
|
-
try { const [error, responseJson] = await network.networkCall({path:ORDERS + `/${
|
|
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(
|
|
266
|
-
let url =
|
|
267
|
-
try { const [error, responseJson] = await network.networkCall({path:REVIEW + url,method:Method.GET,
|
|
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(
|
|
273
|
-
try { const [error, responseJson] = await network.networkCall({path:REVIEW,method:Method.POST,
|
|
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(
|
|
279
|
-
try { const [error, responseJson] = await network.networkCall({path:REVIEW + `/${
|
|
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
|
-
|
|
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(
|
|
292
|
-
try { const [error, responseJson] = await network.networkCall({path:SHIPPINGMETHOD ,method:Method.GET,
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
let
|
|
308
|
-
try { const [error, responseJson] = await network.networkCall({path:
|
|
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
|
|
314
|
-
|
|
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
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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}
|