@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,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.NotificationApiClient = 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 NotificationApiClient {
|
|
13
|
+
static listUserNotification() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.UserNotificationList.url({}),
|
|
16
|
+
method: _Endpoints.default.UserNotificationList.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to retrieve results (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 results.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static markReadNotification() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.UserMarkReadNotification.url({}),
|
|
33
|
+
method: _Endpoints.default.UserMarkReadNotification.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 getUnseenNotification() {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.UserUnseenNotificationCount.url({}),
|
|
50
|
+
method: _Endpoints.default.UserUnseenNotificationCount.method
|
|
51
|
+
}).then(res => {
|
|
52
|
+
if (res.status >= 300) {
|
|
53
|
+
console.log(`Unable to retrieve results (Response code: ${res.status}).`);
|
|
54
|
+
return Promise.reject(res);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return Promise.resolve(res);
|
|
58
|
+
}).catch(error => {
|
|
59
|
+
console.log('Unable to retrieve results.');
|
|
60
|
+
return Promise.reject(error);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static createCustomNotification() {
|
|
65
|
+
return _client.default.request({
|
|
66
|
+
url: _Endpoints.default.CreateCustomNotification.url({}),
|
|
67
|
+
method: _Endpoints.default.CreateCustomNotification.method
|
|
68
|
+
}).then(res => {
|
|
69
|
+
if (res.status >= 300) {
|
|
70
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
71
|
+
return Promise.reject(res);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Promise.resolve(res);
|
|
75
|
+
}).catch(error => {
|
|
76
|
+
console.log('Unable to perform action.');
|
|
77
|
+
return Promise.reject(error);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static listBroadcastMessages() {
|
|
82
|
+
return _client.default.request({
|
|
83
|
+
url: _Endpoints.default.BroadcastMessagesList.url({}),
|
|
84
|
+
method: _Endpoints.default.BroadcastMessagesList.method
|
|
85
|
+
}).then(res => {
|
|
86
|
+
if (res.status >= 300) {
|
|
87
|
+
console.log(`Unable to retrieve results (Response code: ${res.status}).`);
|
|
88
|
+
return Promise.reject(res);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return Promise.resolve(res);
|
|
92
|
+
}).catch(error => {
|
|
93
|
+
console.log('Unable to retrieve results.');
|
|
94
|
+
return Promise.reject(error);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static listBroadcastMessagesUnseenCount() {
|
|
99
|
+
return _client.default.request({
|
|
100
|
+
url: _Endpoints.default.BroadcastMessagesUnseenCount.url({}),
|
|
101
|
+
method: _Endpoints.default.BroadcastMessagesUnseenCount.method
|
|
102
|
+
}).then(res => {
|
|
103
|
+
if (res.status >= 300) {
|
|
104
|
+
console.log(`Unable to retrieve results (Response code: ${res.status}).`);
|
|
105
|
+
return Promise.reject(res);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return Promise.resolve(res);
|
|
109
|
+
}).catch(error => {
|
|
110
|
+
console.log('Unable to retrieve results.');
|
|
111
|
+
return Promise.reject(error);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static listBroadcastMessagesUndisposedCount() {
|
|
116
|
+
return _client.default.request({
|
|
117
|
+
url: _Endpoints.default.BroadcastMessagesUndisposedCount.url({}),
|
|
118
|
+
method: _Endpoints.default.BroadcastMessagesUndisposedCount.method
|
|
119
|
+
}).then(res => {
|
|
120
|
+
if (res.status >= 300) {
|
|
121
|
+
console.log(`Unable to retrieve results (Response code: ${res.status}).`);
|
|
122
|
+
return Promise.reject(res);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return Promise.resolve(res);
|
|
126
|
+
}).catch(error => {
|
|
127
|
+
console.log('Unable to retrieve results.');
|
|
128
|
+
return Promise.reject(error);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static markReadBroadcastMessages() {
|
|
133
|
+
return _client.default.request({
|
|
134
|
+
url: _Endpoints.default.BroadcastMessagesMarkRead.url({}),
|
|
135
|
+
method: _Endpoints.default.BroadcastMessagesMarkRead.method
|
|
136
|
+
}).then(res => {
|
|
137
|
+
if (res.status >= 300) {
|
|
138
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
139
|
+
return Promise.reject(res);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return Promise.resolve(res);
|
|
143
|
+
}).catch(error => {
|
|
144
|
+
console.log('Unable to perform action.');
|
|
145
|
+
return Promise.reject(error);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static disposeBroadcastMessages() {
|
|
150
|
+
return _client.default.request({
|
|
151
|
+
url: _Endpoints.default.BroadcastMessagesDispose.url({}),
|
|
152
|
+
method: _Endpoints.default.BroadcastMessagesDispose.method
|
|
153
|
+
}).then(res => {
|
|
154
|
+
if (res.status >= 300) {
|
|
155
|
+
console.log(`Unable to retrieve results (Response code: ${res.status}).`);
|
|
156
|
+
return Promise.reject(res);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return Promise.resolve(res);
|
|
160
|
+
}).catch(error => {
|
|
161
|
+
console.log('Unable to retrieve results.');
|
|
162
|
+
return Promise.reject(error);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
exports.NotificationApiClient = NotificationApiClient;
|
|
169
|
+
|
|
170
|
+
class NotificationService {
|
|
171
|
+
static async listUserNotification() {
|
|
172
|
+
return NotificationApiClient.listUserNotification();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static async markReadNotification() {
|
|
176
|
+
return NotificationApiClient.markReadNotification();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static async getUnseenNotification() {
|
|
180
|
+
return NotificationApiClient.getUnseenNotification();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static async createCustomNotification() {
|
|
184
|
+
return NotificationApiClient.createCustomNotification();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
static async listBroadcastMessages() {
|
|
188
|
+
return NotificationApiClient.listBroadcastMessages();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static async listBroadcastMessagesUnseenCount() {
|
|
192
|
+
return NotificationApiClient.listBroadcastMessagesUnseenCount();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
static async listBroadcastMessagesUndisposedCount() {
|
|
196
|
+
return NotificationApiClient.listBroadcastMessagesUndisposedCount();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
static async disposeBroadcastMessages() {
|
|
200
|
+
return NotificationApiClient.disposeBroadcastMessages();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
static async markReadBroadcastMessages() {
|
|
204
|
+
return NotificationApiClient.markReadBroadcastMessages();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
exports.default = NotificationService;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.PrivateMessageApiClient = 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 PrivateMessageApiClient {
|
|
13
|
+
static getAllSnippets() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.GetSnippets.url({}),
|
|
16
|
+
method: _Endpoints.default.GetSnippets.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to retrieve results (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 results.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getAThread() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.GetAThread.url({}),
|
|
33
|
+
method: _Endpoints.default.GetAThread.method
|
|
34
|
+
}).then(res => {
|
|
35
|
+
if (res.status >= 300) {
|
|
36
|
+
console.log(`Unable to retrieve thread (Response code: ${res.status}).`);
|
|
37
|
+
return Promise.reject(res);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return Promise.resolve(res);
|
|
41
|
+
}).catch(error => {
|
|
42
|
+
console.log('Unable to retrieve thread.');
|
|
43
|
+
return Promise.reject(error);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static getASingleMessage(id) {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.GetASingleMessage.url({
|
|
50
|
+
id
|
|
51
|
+
}),
|
|
52
|
+
method: _Endpoints.default.GetASingleMessage.method
|
|
53
|
+
}).then(res => {
|
|
54
|
+
if (res.status >= 300) {
|
|
55
|
+
console.log(`Unable to retrieve message (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 message.');
|
|
62
|
+
return Promise.reject(error);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static sendAMessage() {
|
|
67
|
+
return _client.default.request({
|
|
68
|
+
url: _Endpoints.default.SendMessage.url({}),
|
|
69
|
+
method: _Endpoints.default.SendMessage.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 deleteAMessage(id) {
|
|
84
|
+
return _client.default.request({
|
|
85
|
+
url: _Endpoints.default.DeleteASingleMessage.url({
|
|
86
|
+
id
|
|
87
|
+
}),
|
|
88
|
+
method: _Endpoints.default.DeleteASingleMessage.method
|
|
89
|
+
}).then(res => {
|
|
90
|
+
if (res.status >= 300) {
|
|
91
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
92
|
+
return Promise.reject(res);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return Promise.resolve(res);
|
|
96
|
+
}).catch(error => {
|
|
97
|
+
console.log('Unable to perform action.');
|
|
98
|
+
return Promise.reject(error);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static deleteAThread(id) {
|
|
103
|
+
return _client.default.request({
|
|
104
|
+
url: _Endpoints.default.DeleteAThread.url({
|
|
105
|
+
id
|
|
106
|
+
}),
|
|
107
|
+
method: _Endpoints.default.DeleteAThread.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 perform action.');
|
|
117
|
+
return Promise.reject(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static uploadMedia() {
|
|
122
|
+
return _client.default.request({
|
|
123
|
+
url: _Endpoints.default.PrivateMessageUploadMedia.url({}),
|
|
124
|
+
method: _Endpoints.default.PrivateMessageUploadMedia.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 uploadThumbnail() {
|
|
139
|
+
return _client.default.request({
|
|
140
|
+
url: _Endpoints.default.PrivateMessageUploadThumbnail.url({}),
|
|
141
|
+
method: _Endpoints.default.PrivateMessageUploadThumbnail.method
|
|
142
|
+
}).then(res => {
|
|
143
|
+
if (res.status >= 300) {
|
|
144
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
145
|
+
return Promise.reject(res);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return Promise.resolve(res);
|
|
149
|
+
}).catch(error => {
|
|
150
|
+
console.log('Unable to perform action.');
|
|
151
|
+
return Promise.reject(error);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static uploadMediaInChunks() {
|
|
156
|
+
return _client.default.request({
|
|
157
|
+
url: _Endpoints.default.PrivateMessageUploadMediaInChunks.url({}),
|
|
158
|
+
method: _Endpoints.default.PrivateMessageUploadMediaInChunks.method
|
|
159
|
+
}).then(res => {
|
|
160
|
+
if (res.status >= 300) {
|
|
161
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
162
|
+
return Promise.reject(res);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return Promise.resolve(res);
|
|
166
|
+
}).catch(error => {
|
|
167
|
+
console.log('Unable to perform action.');
|
|
168
|
+
return Promise.reject(error);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static chunkUploadDone() {
|
|
173
|
+
return _client.default.request({
|
|
174
|
+
url: _Endpoints.default.PrivateMessageChunkUploadDone.url({}),
|
|
175
|
+
method: _Endpoints.default.PrivateMessageChunkUploadDone.method
|
|
176
|
+
}).then(res => {
|
|
177
|
+
if (res.status >= 300) {
|
|
178
|
+
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
179
|
+
return Promise.reject(res);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return Promise.resolve(res);
|
|
183
|
+
}).catch(error => {
|
|
184
|
+
console.log('Unable to perform action.');
|
|
185
|
+
return Promise.reject(error);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
exports.PrivateMessageApiClient = PrivateMessageApiClient;
|
|
192
|
+
|
|
193
|
+
class PrivateMessageService {
|
|
194
|
+
static async getAllSnippets() {
|
|
195
|
+
return PrivateMessageApiClient.getAllSnippets();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static async getAThread() {
|
|
199
|
+
return PrivateMessageApiClient.getAThread();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
static async getASingleMessage(id) {
|
|
203
|
+
return PrivateMessageApiClient.getASingleMessage(id);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
static async sendAMessage() {
|
|
207
|
+
return PrivateMessageApiClient.sendAMessage();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static async deleteAMessage(id) {
|
|
211
|
+
return PrivateMessageApiClient.deleteAMessage(id);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static async deleteAThread(id) {
|
|
215
|
+
return PrivateMessageApiClient.deleteAThread(id);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
static async uploadMedia() {
|
|
219
|
+
return PrivateMessageApiClient.uploadMedia();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
static async uploadThumbnail() {
|
|
223
|
+
return PrivateMessageApiClient.uploadThumbnail();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static async uploadMediaInChunks() {
|
|
227
|
+
return PrivateMessageApiClient.uploadMediaInChunks();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
static async chunkUploadDone() {
|
|
231
|
+
return PrivateMessageApiClient.chunkUploadDone();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
exports.default = PrivateMessageService;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.ScoreApiClient = 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 ScoreApiClient {
|
|
13
|
+
static getAllScores() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.ScoresList.url({}),
|
|
16
|
+
method: _Endpoints.default.ScoresList.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to retrieve scores (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 scores.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static searchScore() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.SearchScore.url({}),
|
|
33
|
+
method: _Endpoints.default.SearchScore.method
|
|
34
|
+
}).then(res => {
|
|
35
|
+
if (res.status >= 300) {
|
|
36
|
+
console.log(`Unable to retrieve score (Response code: ${res.status}).`);
|
|
37
|
+
return Promise.reject(res);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return Promise.resolve(res);
|
|
41
|
+
}).catch(error => {
|
|
42
|
+
console.log('Unable to retrieve score.');
|
|
43
|
+
return Promise.reject(error);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static addScore() {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.AddScore.url({}),
|
|
50
|
+
method: _Endpoints.default.AddScore.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
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.ScoreApiClient = ScoreApiClient;
|
|
67
|
+
|
|
68
|
+
class ScoreService {
|
|
69
|
+
static async getAllScores() {
|
|
70
|
+
return ScoreApiClient.getAllScores();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static async searchScore() {
|
|
74
|
+
return ScoreApiClient.searchScore();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static async addScore() {
|
|
78
|
+
return ScoreApiClient.addScore();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.default = ScoreService;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.SSOApiClient = 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 SSOApiClient {
|
|
13
|
+
static SignIn() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.SignIn.url({}),
|
|
16
|
+
method: _Endpoints.default.SignIn.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 SignUp() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.SignUp.url({}),
|
|
33
|
+
method: _Endpoints.default.SignUp.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
|
+
}
|
|
48
|
+
|
|
49
|
+
exports.SSOApiClient = SSOApiClient;
|
|
50
|
+
|
|
51
|
+
class SSOService {
|
|
52
|
+
static async SignIn() {
|
|
53
|
+
return SSOApiClient.SignIn();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static async SignUp() {
|
|
57
|
+
return SSOApiClient.SignUp();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
exports.default = SSOService;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.SuggestionApiClient = 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 SuggestionApiClient {
|
|
13
|
+
static getCategorySuggestion() {
|
|
14
|
+
return _client.default.request({
|
|
15
|
+
url: _Endpoints.default.CategoriesSuggestion.url({}),
|
|
16
|
+
method: _Endpoints.default.CategoriesSuggestion.method
|
|
17
|
+
}).then(res => {
|
|
18
|
+
if (res.status >= 300) {
|
|
19
|
+
console.log(`Unable to retrieve categories (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 categories.');
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getIncubatorSuggestion() {
|
|
31
|
+
return _client.default.request({
|
|
32
|
+
url: _Endpoints.default.GetIncubatorSuggestion.url({}),
|
|
33
|
+
method: _Endpoints.default.GetIncubatorSuggestion.method
|
|
34
|
+
}).then(res => {
|
|
35
|
+
if (res.status >= 300) {
|
|
36
|
+
console.log(`Unable to retrieve incubators (Response code: ${res.status}).`);
|
|
37
|
+
return Promise.reject(res);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return Promise.resolve(res);
|
|
41
|
+
}).catch(error => {
|
|
42
|
+
console.log('Unable to retrieve incubators.');
|
|
43
|
+
return Promise.reject(error);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static getPollSuggestion() {
|
|
48
|
+
return _client.default.request({
|
|
49
|
+
url: _Endpoints.default.PollSuggestion.url({}),
|
|
50
|
+
method: _Endpoints.default.PollSuggestion.method
|
|
51
|
+
}).then(res => {
|
|
52
|
+
if (res.status >= 300) {
|
|
53
|
+
console.log(`Unable to retrieve polls (Response code: ${res.status}).`);
|
|
54
|
+
return Promise.reject(res);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return Promise.resolve(res);
|
|
58
|
+
}).catch(error => {
|
|
59
|
+
console.log('Unable to retrieve polls.');
|
|
60
|
+
return Promise.reject(error);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static getUserSuggestion() {
|
|
65
|
+
return _client.default.request({
|
|
66
|
+
url: _Endpoints.default.UserSuggestion.url({}),
|
|
67
|
+
method: _Endpoints.default.UserSuggestion.method
|
|
68
|
+
}).then(res => {
|
|
69
|
+
if (res.status >= 300) {
|
|
70
|
+
console.log(`Unable to retrieve users (Response code: ${res.status}).`);
|
|
71
|
+
return Promise.reject(res);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Promise.resolve(res);
|
|
75
|
+
}).catch(error => {
|
|
76
|
+
console.log('Unable to retrieve users.');
|
|
77
|
+
return Promise.reject(error);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.SuggestionApiClient = SuggestionApiClient;
|
|
84
|
+
|
|
85
|
+
class SuggestionService {
|
|
86
|
+
static async getCategorySuggestion() {
|
|
87
|
+
return SuggestionApiClient.getCategorySuggestion();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static async getIncubatorSuggestion() {
|
|
91
|
+
return SuggestionApiClient.getIncubatorSuggestion();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static async getPollSuggestion() {
|
|
95
|
+
return SuggestionApiClient.getPollSuggestion();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static async getUserSuggestion() {
|
|
99
|
+
return SuggestionApiClient.getUserSuggestion();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
exports.default = SuggestionService;
|