@selfcommunity/api-services 0.1.4 → 0.1.5
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/constants/Endpoints.js +497 -57
- package/lib/cjs/index.js +147 -10
- package/lib/cjs/services/category/index.js +317 -3
- package/lib/cjs/services/comment/index.js +269 -0
- package/lib/cjs/services/custom_adv/index.js +85 -0
- package/lib/cjs/services/custom_page/index.js +85 -0
- package/lib/cjs/services/data_portability/index.js +83 -0
- package/lib/cjs/services/dynamic_preference/index.js +85 -0
- package/lib/cjs/services/embed/index.js +198 -0
- package/lib/cjs/services/feed/index.js +125 -0
- package/lib/cjs/services/feed_object/index.js +660 -0
- package/lib/cjs/services/incubator/index.js +175 -0
- package/lib/cjs/services/insight/index.js +146 -0
- package/lib/cjs/services/legal_page/index.js +152 -0
- package/lib/cjs/services/locality/index.js +62 -0
- package/lib/cjs/services/loyalty/index.js +219 -0
- package/lib/cjs/services/media/index.js +175 -0
- package/lib/cjs/services/moderation/index.js +156 -0
- package/lib/cjs/services/notification/index.js +209 -0
- package/lib/cjs/services/private_message/index.js +236 -0
- package/lib/cjs/services/score/index.js +83 -0
- package/lib/cjs/services/sso/index.js +62 -0
- package/lib/cjs/services/suggestion/index.js +104 -0
- package/lib/cjs/services/tag/index.js +175 -0
- package/lib/cjs/services/user/index.js +995 -9
- package/lib/cjs/services/webhook/index.js +290 -0
- package/lib/cjs/utils/token.js +15 -0
- package/lib/esm/api-services/src/constants/Endpoints.d.ts.map +1 -1
- package/lib/esm/api-services/src/index.d.ts +26 -3
- package/lib/esm/api-services/src/index.d.ts.map +1 -1
- package/lib/esm/api-services/src/services/category/index.d.ts +42 -0
- package/lib/esm/api-services/src/services/category/index.d.ts.map +1 -1
- package/lib/esm/api-services/src/services/comment/index.d.ts +40 -0
- package/lib/esm/api-services/src/services/comment/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/custom_adv/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/custom_adv/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/custom_page/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/custom_page/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/data_portability/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/data_portability/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/dynamic_preference/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/dynamic_preference/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/embed/index.d.ts +31 -0
- package/lib/esm/api-services/src/services/embed/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/feed/index.d.ts +22 -0
- package/lib/esm/api-services/src/services/feed/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/feed_object/index.d.ts +88 -0
- package/lib/esm/api-services/src/services/feed_object/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/incubator/index.d.ts +28 -0
- package/lib/esm/api-services/src/services/incubator/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/insight/index.d.ts +25 -0
- package/lib/esm/api-services/src/services/insight/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/legal_page/index.d.ts +25 -0
- package/lib/esm/api-services/src/services/legal_page/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/locality/index.d.ts +13 -0
- package/lib/esm/api-services/src/services/locality/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/loyalty/index.d.ts +34 -0
- package/lib/esm/api-services/src/services/loyalty/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/media/index.d.ts +28 -0
- package/lib/esm/api-services/src/services/media/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/moderation/index.d.ts +25 -0
- package/lib/esm/api-services/src/services/moderation/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/notification/index.d.ts +34 -0
- package/lib/esm/api-services/src/services/notification/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/private_message/index.d.ts +37 -0
- package/lib/esm/api-services/src/services/private_message/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/score/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/score/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/sso/index.d.ts +13 -0
- package/lib/esm/api-services/src/services/sso/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/suggestion/index.d.ts +19 -0
- package/lib/esm/api-services/src/services/suggestion/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/tag/index.d.ts +28 -0
- package/lib/esm/api-services/src/services/tag/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/user/index.d.ts +132 -0
- package/lib/esm/api-services/src/services/user/index.d.ts.map +1 -1
- package/lib/esm/api-services/src/services/webhook/index.d.ts +43 -0
- package/lib/esm/api-services/src/services/webhook/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/utils/token.d.ts +5 -0
- package/lib/esm/api-services/src/utils/token.d.ts.map +1 -1
- package/lib/esm/constants/Endpoints.js +497 -57
- package/lib/esm/index.js +147 -10
- package/lib/esm/services/category/index.js +317 -3
- package/lib/esm/services/comment/index.js +269 -0
- package/lib/esm/services/custom_adv/index.js +85 -0
- package/lib/esm/services/custom_page/index.js +85 -0
- package/lib/esm/services/data_portability/index.js +83 -0
- package/lib/esm/services/dynamic_preference/index.js +85 -0
- package/lib/esm/services/embed/index.js +198 -0
- package/lib/esm/services/feed/index.js +125 -0
- package/lib/esm/services/feed_object/index.js +660 -0
- package/lib/esm/services/incubator/index.js +175 -0
- package/lib/esm/services/insight/index.js +146 -0
- package/lib/esm/services/legal_page/index.js +152 -0
- package/lib/esm/services/locality/index.js +62 -0
- package/lib/esm/services/loyalty/index.js +219 -0
- package/lib/esm/services/media/index.js +175 -0
- package/lib/esm/services/moderation/index.js +156 -0
- package/lib/esm/services/notification/index.js +209 -0
- package/lib/esm/services/private_message/index.js +236 -0
- package/lib/esm/services/score/index.js +83 -0
- package/lib/esm/services/sso/index.js +62 -0
- package/lib/esm/services/suggestion/index.js +104 -0
- package/lib/esm/services/tag/index.js +175 -0
- package/lib/esm/services/user/index.js +995 -9
- package/lib/esm/services/webhook/index.js +290 -0
- package/lib/esm/utils/src/index.d.ts +8 -3
- package/lib/esm/utils/src/index.d.ts.map +1 -1
- package/lib/esm/utils/src/utils/browser.d.ts +9 -0
- package/lib/esm/utils/src/utils/browser.d.ts.map +1 -0
- package/lib/esm/utils/src/utils/logger.d.ts +11 -0
- package/lib/esm/utils/src/utils/logger.d.ts.map +1 -0
- package/lib/esm/utils/src/utils/object.d.ts +13 -0
- package/lib/esm/utils/src/utils/object.d.ts.map +1 -0
- package/lib/esm/utils/src/utils/string.d.ts +22 -0
- package/lib/esm/utils/src/utils/string.d.ts.map +1 -1
- package/lib/esm/utils/src/utils/url.d.ts +11 -0
- package/lib/esm/utils/src/utils/url.d.ts.map +1 -1
- package/lib/esm/utils/src/utils/websocket.d.ts +177 -0
- package/lib/esm/utils/src/utils/websocket.d.ts.map +1 -0
- package/lib/esm/utils/token.js +15 -0
- package/lib/umd/api-services.js +1 -1
- package/lib/umd/api-services.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.LoyaltyApiClient = void 0;
|
|
5
|
+
|
|
6
|
+
var _client = _interopRequireDefault(require("../../client"));
|
|
7
|
+
|
|
8
|
+
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
class LoyaltyApiClient {
|
|
13
|
+
static getPrizes() {
|
|
14
|
+
return _client.default.request({
|
|
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
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static createPrize() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.CreatePrize.url({}),
|
|
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
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static getSpecificPrize(id) {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.GetSpecificPrize.url({
|
|
50
|
+
id
|
|
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
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static updatePrize(id) {
|
|
67
|
+
return _client.default.request({
|
|
68
|
+
url: _Endpoints.default.UpdatePrize.url({
|
|
69
|
+
id
|
|
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
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static patchPrize(id) {
|
|
86
|
+
return _client.default.request({
|
|
87
|
+
url: _Endpoints.default.PatchPrize.url({
|
|
88
|
+
id
|
|
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
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static getPrizeRequests() {
|
|
105
|
+
return _client.default.request({
|
|
106
|
+
url: _Endpoints.default.GetPrizeRequests.url({}),
|
|
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
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static createPrizeRequest() {
|
|
122
|
+
return _client.default.request({
|
|
123
|
+
url: _Endpoints.default.CreatePrizeRequest.url({}),
|
|
124
|
+
method: _Endpoints.default.CreatePrizeRequest.method
|
|
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);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
static getSpecificPrizeRequest(id) {
|
|
139
|
+
return _client.default.request({
|
|
140
|
+
url: _Endpoints.default.GetSpecificPrizeRequest.url({
|
|
141
|
+
id
|
|
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
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static patchPrizeRequest(id) {
|
|
158
|
+
return _client.default.request({
|
|
159
|
+
url: _Endpoints.default.PatchPrizeRequest.url({
|
|
160
|
+
id
|
|
161
|
+
}),
|
|
162
|
+
method: _Endpoints.default.PatchPrizeRequest.method
|
|
163
|
+
}).then(res => {
|
|
164
|
+
if (res.status >= 300) {
|
|
165
|
+
console.log(`Unable to perform action(Response code: ${res.status}).`);
|
|
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
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
exports.LoyaltyApiClient = LoyaltyApiClient;
|
|
179
|
+
|
|
180
|
+
class LoyaltyService {
|
|
181
|
+
static async getPrizes() {
|
|
182
|
+
return LoyaltyApiClient.getPrizes();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static async createPrize() {
|
|
186
|
+
return LoyaltyApiClient.createPrize();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
static async getSpecificPrize(id) {
|
|
190
|
+
return LoyaltyApiClient.getSpecificPrize(id);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
static async updatePrize(id) {
|
|
194
|
+
return LoyaltyApiClient.updatePrize(id);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
static async patchPrize(id) {
|
|
198
|
+
return LoyaltyApiClient.patchPrize(id);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static async getPrizeRequests() {
|
|
202
|
+
return LoyaltyApiClient.getPrizeRequests();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static async createPrizeRequest() {
|
|
206
|
+
return LoyaltyApiClient.createPrizeRequest();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
static async getSpecificPrizeRequest(id) {
|
|
210
|
+
return LoyaltyApiClient.getSpecificPrizeRequest(id);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static async patchPrizeRequest(id) {
|
|
214
|
+
return LoyaltyApiClient.patchPrizeRequest(id);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
exports.default = LoyaltyService;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.MediaApiClient = void 0;
|
|
5
|
+
|
|
6
|
+
var _client = _interopRequireDefault(require("../../client"));
|
|
7
|
+
|
|
8
|
+
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
class MediaApiClient {
|
|
13
|
+
static chunkUploadMedia() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.ComposerChunkUploadMedia.url({}),
|
|
16
|
+
method: _Endpoints.default.ComposerChunkUploadMedia.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
20
|
+
return Promise.reject(res);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return Promise.resolve(res);
|
|
24
|
+
}).catch(error => {
|
|
25
|
+
console.log('Unable to perform action.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static chunkUploadMediaComplete() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.ComposerChunkUploadMediaComplete.url({}),
|
|
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
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static createMedia() {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.ComposerMediaCreate.url({}),
|
|
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
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static clickMedia(id) {
|
|
65
|
+
return _client.default.request({
|
|
66
|
+
url: _Endpoints.default.MediaClickTracker.url({
|
|
67
|
+
id
|
|
68
|
+
}),
|
|
69
|
+
method: _Endpoints.default.MediaClickTracker.method
|
|
70
|
+
}).then(res => {
|
|
71
|
+
if (res.status >= 300) {
|
|
72
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
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
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static getSpecificMedia(id) {
|
|
84
|
+
return _client.default.request({
|
|
85
|
+
url: _Endpoints.default.GetMedia.url({
|
|
86
|
+
id
|
|
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
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static updateMedia(id) {
|
|
103
|
+
return _client.default.request({
|
|
104
|
+
url: _Endpoints.default.UpdateMedia.url({
|
|
105
|
+
id
|
|
106
|
+
}),
|
|
107
|
+
method: _Endpoints.default.UpdateMedia.method
|
|
108
|
+
}).then(res => {
|
|
109
|
+
if (res.status >= 300) {
|
|
110
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
111
|
+
return Promise.reject(res);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return Promise.resolve(res);
|
|
115
|
+
}).catch(error => {
|
|
116
|
+
console.log('Unable to perform action.');
|
|
117
|
+
return Promise.reject(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static deleteMedia(id) {
|
|
122
|
+
return _client.default.request({
|
|
123
|
+
url: _Endpoints.default.DeleteMedia.url({
|
|
124
|
+
id
|
|
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
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
exports.MediaApiClient = MediaApiClient;
|
|
143
|
+
|
|
144
|
+
class MediaService {
|
|
145
|
+
static async chunkUploadMedia() {
|
|
146
|
+
return MediaApiClient.chunkUploadMedia();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static async chunkUploadMediaComplete() {
|
|
150
|
+
return MediaApiClient.chunkUploadMediaComplete();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static async createMedia() {
|
|
154
|
+
return MediaApiClient.createMedia();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static async clickMedia(id) {
|
|
158
|
+
return MediaApiClient.clickMedia(id);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static async getSpecificMedia(id) {
|
|
162
|
+
return MediaApiClient.getSpecificMedia(id);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static async updateMedia(id) {
|
|
166
|
+
return MediaApiClient.updateMedia(id);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static async deleteMedia(id) {
|
|
170
|
+
return MediaApiClient.deleteMedia(id);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
exports.default = MediaService;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.ModerationApiClient = void 0;
|
|
5
|
+
|
|
6
|
+
var _client = _interopRequireDefault(require("../../client"));
|
|
7
|
+
|
|
8
|
+
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
class ModerationApiClient {
|
|
13
|
+
static getUsersForModeration() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.UsersForModeration.url({}),
|
|
16
|
+
method: _Endpoints.default.UsersForModeration.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to retrieve users (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 users.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static moderateASpecificUser(id) {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.ModerateUser.url({
|
|
33
|
+
id
|
|
34
|
+
}),
|
|
35
|
+
method: _Endpoints.default.ModerateUser.method
|
|
36
|
+
}).then(res => {
|
|
37
|
+
if (res.status >= 300) {
|
|
38
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
39
|
+
return Promise.reject(res);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return Promise.resolve(res);
|
|
43
|
+
}).catch(error => {
|
|
44
|
+
console.log('Unable to perform action.');
|
|
45
|
+
return Promise.reject(error);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static getAllFlaggedContributions() {
|
|
50
|
+
return _client.default.request({
|
|
51
|
+
url: _Endpoints.default.FlaggedContributions.url({}),
|
|
52
|
+
method: _Endpoints.default.FlaggedContributions.method
|
|
53
|
+
}).then(res => {
|
|
54
|
+
if (res.status >= 300) {
|
|
55
|
+
console.log(`Unable to retrieve contributions (Response code: ${res.status}).`);
|
|
56
|
+
return Promise.reject(res);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return Promise.resolve(res);
|
|
60
|
+
}).catch(error => {
|
|
61
|
+
console.log('Unable to retrieve contributions.');
|
|
62
|
+
return Promise.reject(error);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static getSpecificContributionFlag(id, contribution_type) {
|
|
67
|
+
return _client.default.request({
|
|
68
|
+
url: _Endpoints.default.FlagsForSpecificContribution.url({
|
|
69
|
+
id,
|
|
70
|
+
contribution_type
|
|
71
|
+
}),
|
|
72
|
+
method: _Endpoints.default.FlagsForSpecificContribution.method
|
|
73
|
+
}).then(res => {
|
|
74
|
+
if (res.status >= 300) {
|
|
75
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
76
|
+
return Promise.reject(res);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return Promise.resolve(res);
|
|
80
|
+
}).catch(error => {
|
|
81
|
+
console.log('Unable to perform action.');
|
|
82
|
+
return Promise.reject(error);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static moderateAContribution(id) {
|
|
87
|
+
return _client.default.request({
|
|
88
|
+
url: _Endpoints.default.ModerateContribution.url({
|
|
89
|
+
id
|
|
90
|
+
}),
|
|
91
|
+
method: _Endpoints.default.ModerateContribution.method
|
|
92
|
+
}).then(res => {
|
|
93
|
+
if (res.status >= 300) {
|
|
94
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
95
|
+
return Promise.reject(res);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Promise.resolve(res);
|
|
99
|
+
}).catch(error => {
|
|
100
|
+
console.log('Unable to perform action.');
|
|
101
|
+
return Promise.reject(error);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static getContributionModerationStatus(id, contribution_type) {
|
|
106
|
+
return _client.default.request({
|
|
107
|
+
url: _Endpoints.default.ModerateContributionStatus.url({
|
|
108
|
+
id,
|
|
109
|
+
contribution_type
|
|
110
|
+
}),
|
|
111
|
+
method: _Endpoints.default.ModerateContributionStatus.method
|
|
112
|
+
}).then(res => {
|
|
113
|
+
if (res.status >= 300) {
|
|
114
|
+
console.log(`Unable to retrieve moderation status for this contribute (Response code: ${res.status}).`);
|
|
115
|
+
return Promise.reject(res);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return Promise.resolve(res);
|
|
119
|
+
}).catch(error => {
|
|
120
|
+
console.log('Unable to retrieve moderation status for this contribute.');
|
|
121
|
+
return Promise.reject(error);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exports.ModerationApiClient = ModerationApiClient;
|
|
128
|
+
|
|
129
|
+
class ModerationService {
|
|
130
|
+
static async getUsersForModeration() {
|
|
131
|
+
return ModerationApiClient.getUsersForModeration();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static async moderateASpecificUser(id) {
|
|
135
|
+
return ModerationApiClient.moderateASpecificUser(id);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
static async getAllFlaggedContributions() {
|
|
139
|
+
return ModerationApiClient.getAllFlaggedContributions();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static async getSpecificContributionFlag(id, contribution_type) {
|
|
143
|
+
return ModerationApiClient.getSpecificContributionFlag(id, contribution_type);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static async moderateAContribution(id) {
|
|
147
|
+
return ModerationApiClient.moderateAContribution(id);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static async getContributionModerationStatus(id, contribution_type) {
|
|
151
|
+
return ModerationApiClient.getContributionModerationStatus(id, contribution_type);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
exports.default = ModerationService;
|