@selfcommunity/api-services 0.1.6 → 0.1.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/lib/cjs/index.js +36 -0
- package/lib/cjs/services/category/index.js +168 -286
- package/lib/cjs/services/comment/index.js +107 -186
- package/lib/cjs/services/custom_adv/index.js +31 -51
- package/lib/cjs/services/custom_page/index.js +32 -52
- package/lib/cjs/services/data_portability/index.js +18 -43
- package/lib/cjs/services/embed/index.js +90 -151
- package/lib/cjs/services/feature/index.js +8 -16
- package/lib/cjs/services/feed/index.js +46 -81
- package/lib/cjs/services/feed_object/index.js +339 -505
- package/lib/cjs/services/incubator/index.js +64 -116
- package/lib/cjs/services/insight/index.js +51 -94
- package/lib/cjs/services/legal_page/index.js +60 -101
- package/lib/cjs/services/locality/index.js +14 -30
- package/lib/cjs/services/loyalty/index.js +92 -154
- package/lib/cjs/services/media/index.js +80 -122
- package/lib/cjs/services/moderation/index.js +65 -103
- package/lib/cjs/services/notification/index.js +67 -136
- package/lib/cjs/services/preference/index.js +25 -51
- package/lib/cjs/services/private_message/index.js +98 -177
- package/lib/cjs/services/score/index.js +22 -46
- package/lib/cjs/services/sso/index.js +17 -32
- package/lib/cjs/services/suggestion/index.js +23 -57
- package/lib/cjs/services/tag/index.js +72 -119
- package/lib/cjs/services/user/index.js +420 -767
- package/lib/cjs/services/webhook/index.js +4 -7
- package/lib/cjs/types/baseParams.js +3 -0
- package/lib/cjs/types/category.js +3 -0
- package/lib/cjs/types/comment.js +3 -0
- package/lib/cjs/types/customAdv.js +3 -0
- package/lib/cjs/types/customPage.js +3 -0
- package/lib/cjs/types/embed.js +3 -0
- package/lib/cjs/types/feed.js +3 -0
- package/lib/cjs/types/feedObject.js +3 -0
- package/lib/cjs/types/incubator.js +3 -0
- package/lib/cjs/types/index.js +91 -1
- package/lib/cjs/types/legalPage.js +3 -0
- package/lib/cjs/types/media.js +29 -0
- package/lib/cjs/types/moderation.js +3 -0
- package/lib/cjs/types/notification.js +3 -0
- package/lib/cjs/types/privateMessage.js +3 -0
- package/lib/cjs/types/prize.js +3 -0
- package/lib/cjs/types/sso.js +3 -0
- package/lib/cjs/types/tag.js +3 -0
- package/lib/cjs/types/user.js +3 -0
- package/lib/cjs/utils/apiRequest.js +2 -1
- package/lib/esm/index.js +36 -0
- package/lib/esm/services/category/index.js +168 -286
- package/lib/esm/services/comment/index.js +107 -186
- package/lib/esm/services/custom_adv/index.js +31 -51
- package/lib/esm/services/custom_page/index.js +32 -52
- package/lib/esm/services/data_portability/index.js +18 -43
- package/lib/esm/services/embed/index.js +90 -151
- package/lib/esm/services/feature/index.js +8 -16
- package/lib/esm/services/feed/index.js +46 -81
- package/lib/esm/services/feed_object/index.js +339 -505
- package/lib/esm/services/incubator/index.js +64 -116
- package/lib/esm/services/insight/index.js +51 -94
- package/lib/esm/services/legal_page/index.js +60 -101
- package/lib/esm/services/locality/index.js +14 -30
- package/lib/esm/services/loyalty/index.js +92 -154
- package/lib/esm/services/media/index.js +80 -122
- package/lib/esm/services/moderation/index.js +65 -103
- package/lib/esm/services/notification/index.js +67 -136
- package/lib/esm/services/preference/index.js +25 -51
- package/lib/esm/services/private_message/index.js +98 -177
- package/lib/esm/services/score/index.js +22 -46
- package/lib/esm/services/sso/index.js +17 -32
- package/lib/esm/services/suggestion/index.js +23 -57
- package/lib/esm/services/tag/index.js +72 -119
- package/lib/esm/services/user/index.js +420 -767
- package/lib/esm/services/webhook/index.js +4 -7
- package/lib/esm/types/baseParams.js +3 -0
- package/lib/esm/types/category.js +3 -0
- package/lib/esm/types/comment.js +3 -0
- package/lib/esm/types/customAdv.js +3 -0
- package/lib/esm/types/customPage.js +3 -0
- package/lib/esm/types/embed.js +3 -0
- package/lib/esm/types/feed.js +3 -0
- package/lib/esm/types/feedObject.js +3 -0
- package/lib/esm/types/incubator.js +3 -0
- package/lib/esm/types/index.js +91 -1
- package/lib/esm/types/legalPage.js +3 -0
- package/lib/esm/types/media.js +29 -0
- package/lib/esm/types/moderation.js +3 -0
- package/lib/esm/types/notification.js +3 -0
- package/lib/esm/types/privateMessage.js +3 -0
- package/lib/esm/types/prize.js +3 -0
- package/lib/esm/types/sso.js +3 -0
- package/lib/esm/types/tag.js +3 -0
- package/lib/esm/types/user.js +3 -0
- package/lib/esm/utils/apiRequest.js +2 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/services/category/index.d.ts +114 -42
- package/lib/types/services/category/index.d.ts.map +1 -1
- package/lib/types/services/comment/index.d.ts +74 -23
- package/lib/types/services/comment/index.d.ts.map +1 -1
- package/lib/types/services/custom_adv/index.d.ts +26 -9
- package/lib/types/services/custom_adv/index.d.ts.map +1 -1
- package/lib/types/services/custom_page/index.d.ts +26 -9
- package/lib/types/services/custom_page/index.d.ts.map +1 -1
- package/lib/types/services/data_portability/index.d.ts +19 -6
- package/lib/types/services/data_portability/index.d.ts.map +1 -1
- package/lib/types/services/embed/index.d.ts +62 -24
- package/lib/types/services/embed/index.d.ts.map +1 -1
- package/lib/types/services/feature/index.d.ts +11 -3
- package/lib/types/services/feature/index.d.ts.map +1 -1
- package/lib/types/services/feed/index.d.ts +37 -15
- package/lib/types/services/feed/index.d.ts.map +1 -1
- package/lib/types/services/feed_object/index.d.ts +229 -81
- package/lib/types/services/feed_object/index.d.ts.map +1 -1
- package/lib/types/services/incubator/index.d.ts +51 -18
- package/lib/types/services/incubator/index.d.ts.map +1 -1
- package/lib/types/services/insight/index.d.ts +44 -18
- package/lib/types/services/insight/index.d.ts.map +1 -1
- package/lib/types/services/legal_page/index.d.ts +46 -18
- package/lib/types/services/legal_page/index.d.ts.map +1 -1
- package/lib/types/services/locality/index.d.ts +17 -6
- package/lib/types/services/locality/index.d.ts.map +1 -1
- package/lib/types/services/loyalty/index.d.ts +70 -27
- package/lib/types/services/loyalty/index.d.ts.map +1 -1
- package/lib/types/services/media/index.d.ts +55 -18
- package/lib/types/services/media/index.d.ts.map +1 -1
- package/lib/types/services/moderation/index.d.ts +51 -18
- package/lib/types/services/moderation/index.d.ts.map +1 -1
- package/lib/types/services/notification/index.d.ts +63 -27
- package/lib/types/services/notification/index.d.ts.map +1 -1
- package/lib/types/services/preference/index.d.ts +28 -9
- package/lib/types/services/preference/index.d.ts.map +1 -1
- package/lib/types/services/private_message/index.d.ts +68 -24
- package/lib/types/services/private_message/index.d.ts.map +1 -1
- package/lib/types/services/score/index.d.ts +24 -9
- package/lib/types/services/score/index.d.ts.map +1 -1
- package/lib/types/services/sso/index.d.ts +18 -6
- package/lib/types/services/sso/index.d.ts.map +1 -1
- package/lib/types/services/suggestion/index.d.ts +29 -12
- package/lib/types/services/suggestion/index.d.ts.map +1 -1
- package/lib/types/services/tag/index.d.ts +57 -21
- package/lib/types/services/tag/index.d.ts.map +1 -1
- package/lib/types/services/user/index.d.ts +313 -114
- package/lib/types/services/user/index.d.ts.map +1 -1
- package/lib/types/services/webhook/index.d.ts +3 -4
- package/lib/types/services/webhook/index.d.ts.map +1 -1
- package/lib/types/tsconfig.build.tsbuildinfo +1 -1
- package/lib/types/types/baseParams.d.ts +23 -0
- package/lib/types/types/baseParams.d.ts.map +1 -0
- package/lib/types/types/category.d.ts +15 -0
- package/lib/types/types/category.d.ts.map +1 -0
- package/lib/types/types/comment.d.ts +51 -0
- package/lib/types/types/comment.d.ts.map +1 -0
- package/lib/types/types/customAdv.d.ts +19 -0
- package/lib/types/types/customAdv.d.ts.map +1 -0
- package/lib/types/types/customPage.d.ts +24 -0
- package/lib/types/types/customPage.d.ts.map +1 -0
- package/lib/types/types/embed.d.ts +26 -0
- package/lib/types/types/embed.d.ts.map +1 -0
- package/lib/types/types/feed.d.ts +11 -0
- package/lib/types/types/feed.d.ts.map +1 -0
- package/lib/types/types/feedObject.d.ts +56 -0
- package/lib/types/types/feedObject.d.ts.map +1 -0
- package/lib/types/types/incubator.d.ts +33 -0
- package/lib/types/types/incubator.d.ts.map +1 -0
- package/lib/types/types/index.d.ts +19 -1
- package/lib/types/types/index.d.ts.map +1 -1
- package/lib/types/types/legalPage.d.ts +19 -0
- package/lib/types/types/legalPage.d.ts.map +1 -0
- package/lib/types/types/media.d.ts +80 -0
- package/lib/types/types/media.d.ts.map +1 -0
- package/lib/types/types/moderation.d.ts +23 -0
- package/lib/types/types/moderation.d.ts.map +1 -0
- package/lib/types/types/notification.d.ts +31 -0
- package/lib/types/types/notification.d.ts.map +1 -0
- package/lib/types/types/privateMessage.d.ts +176 -0
- package/lib/types/types/privateMessage.d.ts.map +1 -0
- package/lib/types/types/prize.d.ts +47 -0
- package/lib/types/types/prize.d.ts.map +1 -0
- package/lib/types/types/sso.d.ts +12 -0
- package/lib/types/types/sso.d.ts.map +1 -0
- package/lib/types/types/tag.d.ts +39 -0
- package/lib/types/types/tag.d.ts.map +1 -0
- package/lib/types/types/user.d.ts +105 -0
- package/lib/types/types/user.d.ts.map +1 -0
- package/lib/types/utils/apiRequest.d.ts +1 -1
- package/lib/types/utils/apiRequest.d.ts.map +1 -1
- package/lib/umd/api-services.js +1 -1
- package/lib/umd/api-services.js.map +1 -1
- package/package.json +4 -4
|
@@ -3,174 +3,112 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.LoyaltyApiClient = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _apiRequest = require("../../utils/apiRequest");
|
|
7
7
|
|
|
8
8
|
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Contains all the endpoints needed to manage loyalty program.
|
|
14
|
+
*/
|
|
12
15
|
class LoyaltyApiClient {
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves all prizes.
|
|
18
|
+
*/
|
|
13
19
|
static getPrizes() {
|
|
14
|
-
return
|
|
15
|
-
url: _Endpoints.default.GetPrizes.url({}),
|
|
16
|
-
method: _Endpoints.default.GetPrizes.method
|
|
17
|
-
}).then(res => {
|
|
18
|
-
if (res.status >= 300) {
|
|
19
|
-
console.log(`Unable to retrieve prizes (Response code: ${res.status}).`);
|
|
20
|
-
return Promise.reject(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to retrieve prizes.');
|
|
26
|
-
return Promise.reject(error);
|
|
27
|
-
});
|
|
20
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetPrizes.url({}), _Endpoints.default.GetPrizes.method);
|
|
28
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* This endpoint creates a prize.
|
|
24
|
+
* @param data
|
|
25
|
+
*/
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
method: _Endpoints.default.CreatePrize.method
|
|
34
|
-
}).then(res => {
|
|
35
|
-
if (res.status >= 300) {
|
|
36
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
37
|
-
return Promise.reject(res);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return Promise.resolve(res);
|
|
41
|
-
}).catch(error => {
|
|
42
|
-
console.log('Unable to perform action.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
27
|
+
|
|
28
|
+
static createPrize(data) {
|
|
29
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CreatePrize.url({}), _Endpoints.default.CreatePrize.method, data);
|
|
45
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* This endpoint retrieves a specific prize
|
|
33
|
+
* @param id
|
|
34
|
+
*/
|
|
35
|
+
|
|
46
36
|
|
|
47
37
|
static getSpecificPrize(id) {
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
method: _Endpoints.default.GetSpecificPrize.method
|
|
53
|
-
}).then(res => {
|
|
54
|
-
if (res.status >= 300) {
|
|
55
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
56
|
-
return Promise.reject(res);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return Promise.resolve(res);
|
|
60
|
-
}).catch(error => {
|
|
61
|
-
console.log('Unable to perform action.');
|
|
62
|
-
return Promise.reject(error);
|
|
63
|
-
});
|
|
38
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetSpecificPrize.url({
|
|
39
|
+
id
|
|
40
|
+
}), _Endpoints.default.GetSpecificPrize.method);
|
|
64
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* This endpoint updates a specific prize.
|
|
44
|
+
* @param id
|
|
45
|
+
* @param data
|
|
46
|
+
*/
|
|
65
47
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
method: _Endpoints.default.UpdatePrize.method
|
|
72
|
-
}).then(res => {
|
|
73
|
-
if (res.status >= 300) {
|
|
74
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
75
|
-
return Promise.reject(res);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return Promise.resolve(res);
|
|
79
|
-
}).catch(error => {
|
|
80
|
-
console.log('Unable to perform action.');
|
|
81
|
-
return Promise.reject(error);
|
|
82
|
-
});
|
|
48
|
+
|
|
49
|
+
static updatePrize(id, data) {
|
|
50
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.UpdatePrize.url({
|
|
51
|
+
id
|
|
52
|
+
}), _Endpoints.default.UpdatePrize.method, data != null ? data : null);
|
|
83
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* This endpoint patches a specific prize.
|
|
56
|
+
* @param id
|
|
57
|
+
* @param data
|
|
58
|
+
*/
|
|
84
59
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
method: _Endpoints.default.PatchPrize.method
|
|
91
|
-
}).then(res => {
|
|
92
|
-
if (res.status >= 300) {
|
|
93
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
94
|
-
return Promise.reject(res);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return Promise.resolve(res);
|
|
98
|
-
}).catch(error => {
|
|
99
|
-
console.log('Unable to perform action.');
|
|
100
|
-
return Promise.reject(error);
|
|
101
|
-
});
|
|
60
|
+
|
|
61
|
+
static patchPrize(id, data) {
|
|
62
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.PatchPrize.url({
|
|
63
|
+
id
|
|
64
|
+
}), _Endpoints.default.PatchPrize.method, data != null ? data : null);
|
|
102
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* This endpoint retrieves all requests of loyalty prizes.
|
|
68
|
+
*/
|
|
103
69
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
method: _Endpoints.default.GetPrizeRequests.method
|
|
108
|
-
}).then(res => {
|
|
109
|
-
if (res.status >= 300) {
|
|
110
|
-
console.log(`Unable to retrieve prize requests (Response code: ${res.status}).`);
|
|
111
|
-
return Promise.reject(res);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return Promise.resolve(res);
|
|
115
|
-
}).catch(error => {
|
|
116
|
-
console.log('Unable to retrieve prize requests.');
|
|
117
|
-
return Promise.reject(error);
|
|
118
|
-
});
|
|
70
|
+
|
|
71
|
+
static getAllPrizeRequests() {
|
|
72
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetPrizeRequests.url({}), _Endpoints.default.GetPrizeRequests.method);
|
|
119
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* This endpoint creates a request for a loyalty prize
|
|
76
|
+
* @param prize
|
|
77
|
+
*/
|
|
120
78
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}).then(res => {
|
|
126
|
-
if (res.status >= 300) {
|
|
127
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
128
|
-
return Promise.reject(res);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return Promise.resolve(res);
|
|
132
|
-
}).catch(error => {
|
|
133
|
-
console.log('Unable to perform action.');
|
|
134
|
-
return Promise.reject(error);
|
|
79
|
+
|
|
80
|
+
static createPrizeRequest(prize) {
|
|
81
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CreatePrizeRequest.url({}), _Endpoints.default.CreatePrizeRequest.method, {
|
|
82
|
+
prize: prize
|
|
135
83
|
});
|
|
136
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* This endpoint retrieves a specific request for a loyalty prize.
|
|
87
|
+
* @param id
|
|
88
|
+
*/
|
|
89
|
+
|
|
137
90
|
|
|
138
91
|
static getSpecificPrizeRequest(id) {
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}),
|
|
143
|
-
method: _Endpoints.default.GetSpecificPrizeRequest.method
|
|
144
|
-
}).then(res => {
|
|
145
|
-
if (res.status >= 300) {
|
|
146
|
-
console.log(`Unable to retrieve prize request (Response code: ${res.status}).`);
|
|
147
|
-
return Promise.reject(res);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return Promise.resolve(res);
|
|
151
|
-
}).catch(error => {
|
|
152
|
-
console.log('Unable to retrieve prize request.');
|
|
153
|
-
return Promise.reject(error);
|
|
154
|
-
});
|
|
92
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetSpecificPrizeRequest.url({
|
|
93
|
+
id
|
|
94
|
+
}), _Endpoints.default.GetSpecificPrizeRequest.method);
|
|
155
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* This endpoint patches a specific request for a loyalty prize.
|
|
98
|
+
* You can use this endpoint to to change status in an admin list/table interface.
|
|
99
|
+
* @param id
|
|
100
|
+
* @param status
|
|
101
|
+
*/
|
|
156
102
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}).
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return Promise.reject(res);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return Promise.resolve(res);
|
|
170
|
-
}).catch(error => {
|
|
171
|
-
console.log('Unable to perform action.');
|
|
172
|
-
return Promise.reject(error);
|
|
173
|
-
});
|
|
103
|
+
|
|
104
|
+
static patchPrizeRequest(id, status) {
|
|
105
|
+
var _status;
|
|
106
|
+
|
|
107
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.PatchPrizeRequest.url({
|
|
108
|
+
id
|
|
109
|
+
}), _Endpoints.default.PatchPrizeRequest.method, (_status = {
|
|
110
|
+
status: status
|
|
111
|
+
}) != null ? _status : null);
|
|
174
112
|
}
|
|
175
113
|
|
|
176
114
|
}
|
|
@@ -182,36 +120,36 @@ class LoyaltyService {
|
|
|
182
120
|
return LoyaltyApiClient.getPrizes();
|
|
183
121
|
}
|
|
184
122
|
|
|
185
|
-
static async createPrize() {
|
|
186
|
-
return LoyaltyApiClient.createPrize();
|
|
123
|
+
static async createPrize(data) {
|
|
124
|
+
return LoyaltyApiClient.createPrize(data);
|
|
187
125
|
}
|
|
188
126
|
|
|
189
127
|
static async getSpecificPrize(id) {
|
|
190
128
|
return LoyaltyApiClient.getSpecificPrize(id);
|
|
191
129
|
}
|
|
192
130
|
|
|
193
|
-
static async updatePrize(id) {
|
|
194
|
-
return LoyaltyApiClient.updatePrize(id);
|
|
131
|
+
static async updatePrize(id, data) {
|
|
132
|
+
return LoyaltyApiClient.updatePrize(id, data);
|
|
195
133
|
}
|
|
196
134
|
|
|
197
|
-
static async patchPrize(id) {
|
|
198
|
-
return LoyaltyApiClient.patchPrize(id);
|
|
135
|
+
static async patchPrize(id, data) {
|
|
136
|
+
return LoyaltyApiClient.patchPrize(id, data);
|
|
199
137
|
}
|
|
200
138
|
|
|
201
|
-
static async
|
|
202
|
-
return LoyaltyApiClient.
|
|
139
|
+
static async getAllPrizeRequests() {
|
|
140
|
+
return LoyaltyApiClient.getAllPrizeRequests();
|
|
203
141
|
}
|
|
204
142
|
|
|
205
|
-
static async createPrizeRequest() {
|
|
206
|
-
return LoyaltyApiClient.createPrizeRequest();
|
|
143
|
+
static async createPrizeRequest(prize) {
|
|
144
|
+
return LoyaltyApiClient.createPrizeRequest(prize);
|
|
207
145
|
}
|
|
208
146
|
|
|
209
147
|
static async getSpecificPrizeRequest(id) {
|
|
210
148
|
return LoyaltyApiClient.getSpecificPrizeRequest(id);
|
|
211
149
|
}
|
|
212
150
|
|
|
213
|
-
static async patchPrizeRequest(id) {
|
|
214
|
-
return LoyaltyApiClient.patchPrizeRequest(id);
|
|
151
|
+
static async patchPrizeRequest(id, status) {
|
|
152
|
+
return LoyaltyApiClient.patchPrizeRequest(id, status);
|
|
215
153
|
}
|
|
216
154
|
|
|
217
155
|
}
|
|
@@ -3,138 +3,96 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.MediaApiClient = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _apiRequest = require("../../utils/apiRequest");
|
|
7
7
|
|
|
8
8
|
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Contains all the endpoints needed to manage medias.
|
|
14
|
+
*/
|
|
12
15
|
class MediaApiClient {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to perform action.');
|
|
26
|
-
return Promise.reject(error);
|
|
27
|
-
});
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint performs the chunk upload of a media with type image or document.
|
|
18
|
+
* The client must split the file into chunks and send to the server in series. After all the chunks have been uploaded the client must call the Chunk Upload Complete endpoint with the given upload_id parameter to finalize the upload and retrieve the Media.
|
|
19
|
+
* To perform chunk upload the request must contain Content-Range header with the information about the chunk.
|
|
20
|
+
* @param data
|
|
21
|
+
*/
|
|
22
|
+
static chunkUploadMedia(data) {
|
|
23
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.ComposerChunkUploadMedia.url({}), _Endpoints.default.ComposerChunkUploadMedia.method, {
|
|
24
|
+
'Content-Range': 'bytes 1433600-1638399/2124437'
|
|
25
|
+
}, data);
|
|
28
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* This endpoint completes the chunk upload and create the media.
|
|
29
|
+
* @param data
|
|
30
|
+
*/
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
method: _Endpoints.default.ComposerChunkUploadMediaComplete.method
|
|
34
|
-
}).then(res => {
|
|
35
|
-
if (res.status >= 300) {
|
|
36
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
37
|
-
return Promise.reject(res);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return Promise.resolve(res);
|
|
41
|
-
}).catch(error => {
|
|
42
|
-
console.log('Unable to perform action.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
32
|
+
|
|
33
|
+
static chunkUploadMediaComplete(data) {
|
|
34
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.ComposerChunkUploadMediaComplete.url({}), _Endpoints.default.ComposerChunkUploadMediaComplete.method, data);
|
|
45
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This endpoint creates a media.
|
|
38
|
+
* @param data
|
|
39
|
+
*/
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
method: _Endpoints.default.ComposerMediaCreate.method
|
|
51
|
-
}).then(res => {
|
|
52
|
-
if (res.status >= 300) {
|
|
53
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
54
|
-
return Promise.reject(res);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return Promise.resolve(res);
|
|
58
|
-
}).catch(error => {
|
|
59
|
-
console.log('Unable to perform action.');
|
|
60
|
-
return Promise.reject(error);
|
|
61
|
-
});
|
|
41
|
+
|
|
42
|
+
static createMedia(data) {
|
|
43
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.ComposerMediaCreate.url({}), _Endpoints.default.ComposerMediaCreate.method, data);
|
|
62
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* This endpoint saves a click on a specific media using ID.
|
|
47
|
+
* @param id
|
|
48
|
+
* @param ip
|
|
49
|
+
*/
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}).
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return Promise.reject(res);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return Promise.resolve(res);
|
|
77
|
-
}).catch(error => {
|
|
78
|
-
console.log('Unable to perform action.');
|
|
79
|
-
return Promise.reject(error);
|
|
80
|
-
});
|
|
51
|
+
|
|
52
|
+
static clickMedia(id, ip) {
|
|
53
|
+
var _ip;
|
|
54
|
+
|
|
55
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.MediaClickTracker.url({
|
|
56
|
+
id
|
|
57
|
+
}), _Endpoints.default.MediaClickTracker.method, (_ip = {
|
|
58
|
+
ip: ip
|
|
59
|
+
}) != null ? _ip : null);
|
|
81
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* This endpoint retrieves a specific media using ID.
|
|
63
|
+
* @param id
|
|
64
|
+
*/
|
|
65
|
+
|
|
82
66
|
|
|
83
67
|
static getSpecificMedia(id) {
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
method: _Endpoints.default.GetMedia.method
|
|
89
|
-
}).then(res => {
|
|
90
|
-
if (res.status >= 300) {
|
|
91
|
-
console.log(`Unable to retrieve media (Response code: ${res.status}).`);
|
|
92
|
-
return Promise.reject(res);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return Promise.resolve(res);
|
|
96
|
-
}).catch(error => {
|
|
97
|
-
console.log('Unable to retrieve media.');
|
|
98
|
-
return Promise.reject(error);
|
|
99
|
-
});
|
|
68
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetMedia.url({
|
|
69
|
+
id
|
|
70
|
+
}), _Endpoints.default.GetMedia.method);
|
|
100
71
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return Promise.resolve(res);
|
|
115
|
-
}).catch(error => {
|
|
116
|
-
console.log('Unable to perform action.');
|
|
117
|
-
return Promise.reject(error);
|
|
72
|
+
/**
|
|
73
|
+
* This endpoint updates a media.
|
|
74
|
+
* @param id
|
|
75
|
+
* @param image
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
static updateMedia(id, image) {
|
|
80
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.UpdateMedia.url({
|
|
81
|
+
id
|
|
82
|
+
}), _Endpoints.default.UpdateMedia.method, {
|
|
83
|
+
image: image
|
|
118
84
|
});
|
|
119
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* This endpoint deletes a media.
|
|
88
|
+
* @param id
|
|
89
|
+
*/
|
|
90
|
+
|
|
120
91
|
|
|
121
92
|
static deleteMedia(id) {
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
method: _Endpoints.default.DeleteMedia.method
|
|
127
|
-
}).then(res => {
|
|
128
|
-
if (res.status >= 300) {
|
|
129
|
-
console.log(`Unable to perform action(Response code: ${res.status}).`);
|
|
130
|
-
return Promise.reject(res);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return Promise.resolve(res);
|
|
134
|
-
}).catch(error => {
|
|
135
|
-
console.log('Unable to perform action.');
|
|
136
|
-
return Promise.reject(error);
|
|
137
|
-
});
|
|
93
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.DeleteMedia.url({
|
|
94
|
+
id
|
|
95
|
+
}), _Endpoints.default.DeleteMedia.method);
|
|
138
96
|
}
|
|
139
97
|
|
|
140
98
|
}
|
|
@@ -142,28 +100,28 @@ class MediaApiClient {
|
|
|
142
100
|
exports.MediaApiClient = MediaApiClient;
|
|
143
101
|
|
|
144
102
|
class MediaService {
|
|
145
|
-
static async chunkUploadMedia() {
|
|
146
|
-
return MediaApiClient.chunkUploadMedia();
|
|
103
|
+
static async chunkUploadMedia(data) {
|
|
104
|
+
return MediaApiClient.chunkUploadMedia(data);
|
|
147
105
|
}
|
|
148
106
|
|
|
149
|
-
static async chunkUploadMediaComplete() {
|
|
150
|
-
return MediaApiClient.chunkUploadMediaComplete();
|
|
107
|
+
static async chunkUploadMediaComplete(data) {
|
|
108
|
+
return MediaApiClient.chunkUploadMediaComplete(data);
|
|
151
109
|
}
|
|
152
110
|
|
|
153
|
-
static async createMedia() {
|
|
154
|
-
return MediaApiClient.createMedia();
|
|
111
|
+
static async createMedia(data) {
|
|
112
|
+
return MediaApiClient.createMedia(data);
|
|
155
113
|
}
|
|
156
114
|
|
|
157
|
-
static async clickMedia(id) {
|
|
158
|
-
return MediaApiClient.clickMedia(id);
|
|
115
|
+
static async clickMedia(id, ip) {
|
|
116
|
+
return MediaApiClient.clickMedia(id, ip);
|
|
159
117
|
}
|
|
160
118
|
|
|
161
119
|
static async getSpecificMedia(id) {
|
|
162
120
|
return MediaApiClient.getSpecificMedia(id);
|
|
163
121
|
}
|
|
164
122
|
|
|
165
|
-
static async updateMedia(id) {
|
|
166
|
-
return MediaApiClient.updateMedia(id);
|
|
123
|
+
static async updateMedia(id, image) {
|
|
124
|
+
return MediaApiClient.updateMedia(id, image);
|
|
167
125
|
}
|
|
168
126
|
|
|
169
127
|
static async deleteMedia(id) {
|