@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,216 +3,137 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.CommentApiClient = void 0;
|
|
5
5
|
|
|
6
|
-
var _client = _interopRequireDefault(require("../../client"));
|
|
7
|
-
|
|
8
6
|
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
7
|
|
|
8
|
+
var _apiRequest = require("../../utils/apiRequest");
|
|
9
|
+
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Contains all the endpoints needed to manage comments.
|
|
14
|
+
*/
|
|
12
15
|
class CommentApiClient {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.reject(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to retrieve comments.');
|
|
26
|
-
return Promise.reject(error);
|
|
27
|
-
});
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves all comments.
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
static getAllComments(params) {
|
|
21
|
+
const p = new URLSearchParams(params);
|
|
22
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.Comments.url({})}?${p.toString()}`, _Endpoints.default.Comments.method);
|
|
28
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint creates a comment.
|
|
26
|
+
* @param data
|
|
27
|
+
*/
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
method: _Endpoints.default.NewComment.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.data);
|
|
41
|
-
}).catch(error => {
|
|
42
|
-
console.log('Unable to perform action.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
29
|
+
|
|
30
|
+
static createComment(data) {
|
|
31
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.NewComment.url({}), _Endpoints.default.NewComment.method, data);
|
|
45
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* This endpoint retrieves a specific comment using ID.
|
|
35
|
+
* @param id
|
|
36
|
+
*/
|
|
37
|
+
|
|
46
38
|
|
|
47
39
|
static getASpecificComment(id) {
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.Comment.url({
|
|
41
|
+
id
|
|
42
|
+
}), _Endpoints.default.Comment.method);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This endpoint updates a specific comment.
|
|
46
|
+
* @param id
|
|
47
|
+
* @param text
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
static updateComment(id, text) {
|
|
52
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.UpdateComment.url({
|
|
53
|
+
id
|
|
54
|
+
}), _Endpoints.default.UpdateComment.method, {
|
|
55
|
+
text: text
|
|
63
56
|
});
|
|
64
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* This endpoint deletes a specific comment using ID.
|
|
60
|
+
* @param id
|
|
61
|
+
*/
|
|
65
62
|
|
|
66
|
-
static updateComment(id) {
|
|
67
|
-
return _client.default.request({
|
|
68
|
-
url: _Endpoints.default.UpdateComment.url({
|
|
69
|
-
id
|
|
70
|
-
}),
|
|
71
|
-
method: _Endpoints.default.UpdateComment.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.data);
|
|
79
|
-
}).catch(error => {
|
|
80
|
-
console.log('Unable to perform action.');
|
|
81
|
-
return Promise.reject(error);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
63
|
|
|
85
64
|
static deleteComment(id) {
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
method: _Endpoints.default.DeleteComment.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.data);
|
|
98
|
-
}).catch(error => {
|
|
99
|
-
console.log('Unable to perform action.');
|
|
100
|
-
return Promise.reject(error);
|
|
101
|
-
});
|
|
65
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.DeleteComment.url({
|
|
66
|
+
id
|
|
67
|
+
}), _Endpoints.default.DeleteComment.method);
|
|
102
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* This endpoint restores a specific comment using ID.
|
|
71
|
+
* @param id
|
|
72
|
+
*/
|
|
73
|
+
|
|
103
74
|
|
|
104
75
|
static restoreComment(id) {
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
method: _Endpoints.default.RestoreComment.method
|
|
110
|
-
}).then(res => {
|
|
111
|
-
if (res.status >= 300) {
|
|
112
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
113
|
-
return Promise.reject(res);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return Promise.resolve(res.data);
|
|
117
|
-
}).catch(error => {
|
|
118
|
-
console.log('Unable to perform action.');
|
|
119
|
-
return Promise.reject(error);
|
|
120
|
-
});
|
|
76
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.RestoreComment.url({
|
|
77
|
+
id
|
|
78
|
+
}), _Endpoints.default.RestoreComment.method);
|
|
121
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* This endpoint retrieves all votes for a specific comment.
|
|
82
|
+
* @param id
|
|
83
|
+
*/
|
|
84
|
+
|
|
122
85
|
|
|
123
86
|
static getSpecificCommentVotesList(id) {
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}),
|
|
128
|
-
method: _Endpoints.default.CommentVotesList.method
|
|
129
|
-
}).then(res => {
|
|
130
|
-
if (res.status >= 300) {
|
|
131
|
-
console.log(`Unable to retrieve votes (Response code: ${res.status}).`);
|
|
132
|
-
return Promise.reject(res);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return Promise.resolve(res.data);
|
|
136
|
-
}).catch(error => {
|
|
137
|
-
console.log('Unable to retrieve votes.');
|
|
138
|
-
return Promise.reject(error);
|
|
139
|
-
});
|
|
87
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CommentVotesList.url({
|
|
88
|
+
id
|
|
89
|
+
}), _Endpoints.default.CommentVotesList.method);
|
|
140
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* This endpoint upvotes a specific comment.
|
|
93
|
+
* @param id
|
|
94
|
+
*/
|
|
95
|
+
|
|
141
96
|
|
|
142
97
|
static upvoteComment(id) {
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}),
|
|
147
|
-
method: _Endpoints.default.CommentVote.method
|
|
148
|
-
}).then(res => {
|
|
149
|
-
if (res.status >= 300) {
|
|
150
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
151
|
-
return Promise.reject(res);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return Promise.resolve(res.data);
|
|
155
|
-
}).catch(error => {
|
|
156
|
-
console.log('Unable to perform action.');
|
|
157
|
-
return Promise.reject(error);
|
|
158
|
-
});
|
|
98
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CommentVote.url({
|
|
99
|
+
id
|
|
100
|
+
}), _Endpoints.default.CommentVote.method);
|
|
159
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* This endpoint retrieves a List of Flags for a Specific Comment.
|
|
104
|
+
* @param id
|
|
105
|
+
*/
|
|
106
|
+
|
|
160
107
|
|
|
161
108
|
static getSpecificCommentFlags(id) {
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
109
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CommentFlagList.url({
|
|
110
|
+
id
|
|
111
|
+
}), _Endpoints.default.CommentFlagList.method);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* This endpoint flags a specific comment.
|
|
115
|
+
* @param id
|
|
116
|
+
* @param flagType
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
static flagComment(id, flagType) {
|
|
121
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.FlagComment.url({
|
|
122
|
+
id
|
|
123
|
+
}), _Endpoints.default.FlagComment.method, {
|
|
124
|
+
flagType: flagType
|
|
177
125
|
});
|
|
178
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* This endpoint retrieves, if exists, a flag for this contribute created by the user logged.
|
|
129
|
+
* @param id
|
|
130
|
+
*/
|
|
179
131
|
|
|
180
|
-
static flagComment(id) {
|
|
181
|
-
return _client.default.request({
|
|
182
|
-
url: _Endpoints.default.FlagComment.url({
|
|
183
|
-
id
|
|
184
|
-
}),
|
|
185
|
-
method: _Endpoints.default.FlagComment.method
|
|
186
|
-
}).then(res => {
|
|
187
|
-
if (res.status >= 300) {
|
|
188
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
189
|
-
return Promise.reject(res);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return Promise.resolve(res.data);
|
|
193
|
-
}).catch(error => {
|
|
194
|
-
console.log('Unable to perform action.');
|
|
195
|
-
return Promise.reject(error);
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
132
|
|
|
199
133
|
static getSpecificCommentFlagStatus(id) {
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}),
|
|
204
|
-
method: _Endpoints.default.CommentFlagStatus.method
|
|
205
|
-
}).then(res => {
|
|
206
|
-
if (res.status >= 300) {
|
|
207
|
-
console.log(`Unable to retrieve flags status (Response code: ${res.status}).`);
|
|
208
|
-
return Promise.reject(res);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return Promise.resolve(res.data);
|
|
212
|
-
}).catch(error => {
|
|
213
|
-
console.log('Unable to retrieve flags status.');
|
|
214
|
-
return Promise.reject(error);
|
|
215
|
-
});
|
|
134
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CommentFlagStatus.url({
|
|
135
|
+
id
|
|
136
|
+
}), _Endpoints.default.CommentFlagStatus.method);
|
|
216
137
|
}
|
|
217
138
|
|
|
218
139
|
}
|
|
@@ -220,20 +141,20 @@ class CommentApiClient {
|
|
|
220
141
|
exports.CommentApiClient = CommentApiClient;
|
|
221
142
|
|
|
222
143
|
class CommentService {
|
|
223
|
-
static async getAllComments() {
|
|
224
|
-
return CommentApiClient.getAllComments();
|
|
144
|
+
static async getAllComments(params) {
|
|
145
|
+
return CommentApiClient.getAllComments(params);
|
|
225
146
|
}
|
|
226
147
|
|
|
227
|
-
static async createComment() {
|
|
228
|
-
return CommentApiClient.createComment();
|
|
148
|
+
static async createComment(data) {
|
|
149
|
+
return CommentApiClient.createComment(data);
|
|
229
150
|
}
|
|
230
151
|
|
|
231
152
|
static async getASpecificComment(id) {
|
|
232
153
|
return CommentApiClient.getASpecificComment(id);
|
|
233
154
|
}
|
|
234
155
|
|
|
235
|
-
static async updateComment(id) {
|
|
236
|
-
return CommentApiClient.updateComment(id);
|
|
156
|
+
static async updateComment(id, text) {
|
|
157
|
+
return CommentApiClient.updateComment(id, text);
|
|
237
158
|
}
|
|
238
159
|
|
|
239
160
|
static async deleteComment(id) {
|
|
@@ -256,8 +177,8 @@ class CommentService {
|
|
|
256
177
|
return CommentApiClient.getSpecificCommentFlags(id);
|
|
257
178
|
}
|
|
258
179
|
|
|
259
|
-
static async flagComment(id) {
|
|
260
|
-
return CommentApiClient.flagComment(id);
|
|
180
|
+
static async flagComment(id, flagType) {
|
|
181
|
+
return CommentApiClient.flagComment(id, flagType);
|
|
261
182
|
}
|
|
262
183
|
|
|
263
184
|
static async getSpecificCommentFlagStatus(id) {
|
|
@@ -3,64 +3,44 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.CustomAdvApiClient = 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 custom advs.
|
|
14
|
+
*/
|
|
12
15
|
class CustomAdvApiClient {
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves a specific custom adv.
|
|
18
|
+
* @param id
|
|
19
|
+
*/
|
|
13
20
|
static getASpecificCustomAdv(id) {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
method: _Endpoints.default.CustomAdv.method
|
|
19
|
-
}).then(res => {
|
|
20
|
-
if (res.status >= 300) {
|
|
21
|
-
console.log(`Unable to retrieve custom adv (Response code: ${res.status}).`);
|
|
22
|
-
return Promise.reject(res);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return Promise.resolve(res);
|
|
26
|
-
}).catch(error => {
|
|
27
|
-
console.log('Unable to retrieve custom adv.');
|
|
28
|
-
return Promise.reject(error);
|
|
29
|
-
});
|
|
21
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CustomAdv.url({
|
|
22
|
+
id
|
|
23
|
+
}), _Endpoints.default.CustomAdv.method);
|
|
30
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* This endpoint retrieves all custom advs.
|
|
27
|
+
* @param params
|
|
28
|
+
*/
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}).then(res => {
|
|
37
|
-
if (res.status >= 300) {
|
|
38
|
-
console.log(`Unable to retrieve custom advs (Response code: ${res.status}).`);
|
|
39
|
-
return Promise.reject(res);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return Promise.resolve(res);
|
|
43
|
-
}).catch(error => {
|
|
44
|
-
console.log('Unable to retrieve custom advs.');
|
|
45
|
-
return Promise.reject(error);
|
|
46
|
-
});
|
|
30
|
+
|
|
31
|
+
static getAllCustomAdv(params) {
|
|
32
|
+
const p = new URLSearchParams(params);
|
|
33
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CustomAdvList.url({})}?${p.toString()}`, _Endpoints.default.CustomAdvList.method);
|
|
47
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* This endpoint performs search of a Custom Adv
|
|
37
|
+
* @param params
|
|
38
|
+
*/
|
|
39
|
+
|
|
48
40
|
|
|
49
|
-
static searchCustomAdv() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
method: _Endpoints.default.CustomAdvSearch.method
|
|
53
|
-
}).then(res => {
|
|
54
|
-
if (res.status >= 300) {
|
|
55
|
-
console.log(`Unable to retrieve custom advs (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 custom advs.');
|
|
62
|
-
return Promise.reject(error);
|
|
63
|
-
});
|
|
41
|
+
static searchCustomAdv(params) {
|
|
42
|
+
const p = new URLSearchParams(params);
|
|
43
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CustomAdvSearch.url({})}?${p.toString()}`, _Endpoints.default.CustomAdvSearch.method);
|
|
64
44
|
}
|
|
65
45
|
|
|
66
46
|
}
|
|
@@ -72,12 +52,12 @@ class CustomAdvService {
|
|
|
72
52
|
return CustomAdvApiClient.getASpecificCustomAdv(id);
|
|
73
53
|
}
|
|
74
54
|
|
|
75
|
-
static async getAllCustomAdv() {
|
|
76
|
-
return CustomAdvApiClient.getAllCustomAdv();
|
|
55
|
+
static async getAllCustomAdv(params) {
|
|
56
|
+
return CustomAdvApiClient.getAllCustomAdv(params);
|
|
77
57
|
}
|
|
78
58
|
|
|
79
|
-
static async searchCustomAdv() {
|
|
80
|
-
return CustomAdvApiClient.searchCustomAdv();
|
|
59
|
+
static async searchCustomAdv(params) {
|
|
60
|
+
return CustomAdvApiClient.searchCustomAdv(params);
|
|
81
61
|
}
|
|
82
62
|
|
|
83
63
|
}
|
|
@@ -3,64 +3,44 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.CustomPageApiClient = void 0;
|
|
5
5
|
|
|
6
|
-
var _client = _interopRequireDefault(require("../../client"));
|
|
7
|
-
|
|
8
6
|
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
7
|
|
|
8
|
+
var _apiRequest = require("../../utils/apiRequest");
|
|
9
|
+
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Contains all the endpoints needed to manage custom pages.
|
|
14
|
+
*/
|
|
12
15
|
class CustomPageApiClient {
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves a specific custom page.
|
|
18
|
+
* @param id
|
|
19
|
+
*/
|
|
13
20
|
static getASpecificCustomPage(id) {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
method: _Endpoints.default.CustomPage.method
|
|
19
|
-
}).then(res => {
|
|
20
|
-
if (res.status >= 300) {
|
|
21
|
-
console.log(`Unable to retrieve custom page (Response code: ${res.status}).`);
|
|
22
|
-
return Promise.reject(res);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return Promise.resolve(res);
|
|
26
|
-
}).catch(error => {
|
|
27
|
-
console.log('Unable to retrieve custom page.');
|
|
28
|
-
return Promise.reject(error);
|
|
29
|
-
});
|
|
21
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CustomPage.url({
|
|
22
|
+
id
|
|
23
|
+
}), _Endpoints.default.CustomPage.method);
|
|
30
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* This endpoint retrieves all custom pages.
|
|
27
|
+
* @param params
|
|
28
|
+
*/
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}).then(res => {
|
|
37
|
-
if (res.status >= 300) {
|
|
38
|
-
console.log(`Unable to retrieve custom pages (Response code: ${res.status}).`);
|
|
39
|
-
return Promise.reject(res);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return Promise.resolve(res);
|
|
43
|
-
}).catch(error => {
|
|
44
|
-
console.log('Unable to retrieve custom pages.');
|
|
45
|
-
return Promise.reject(error);
|
|
46
|
-
});
|
|
30
|
+
|
|
31
|
+
static getAllCustomPages(params) {
|
|
32
|
+
const p = new URLSearchParams(params);
|
|
33
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.GetCustomPages.url({})}?${p.toString()}`, _Endpoints.default.GetCustomPages.method);
|
|
47
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* This endpoint performs search of a Custom Page
|
|
37
|
+
* @param params
|
|
38
|
+
*/
|
|
39
|
+
|
|
48
40
|
|
|
49
|
-
static searchCustomPages() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
method: _Endpoints.default.CustomPageSearch.method
|
|
53
|
-
}).then(res => {
|
|
54
|
-
if (res.status >= 300) {
|
|
55
|
-
console.log(`Unable to retrieve custom pages (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 custom pages.');
|
|
62
|
-
return Promise.reject(error);
|
|
63
|
-
});
|
|
41
|
+
static searchCustomPages(params) {
|
|
42
|
+
const p = new URLSearchParams(params);
|
|
43
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CustomPageSearch.url({})}?${p.toString()}`, _Endpoints.default.CustomPageSearch.method);
|
|
64
44
|
}
|
|
65
45
|
|
|
66
46
|
}
|
|
@@ -72,12 +52,12 @@ class CustomPageService {
|
|
|
72
52
|
return CustomPageApiClient.getASpecificCustomPage(id);
|
|
73
53
|
}
|
|
74
54
|
|
|
75
|
-
static async getAllCustomPages() {
|
|
76
|
-
return CustomPageApiClient.getAllCustomPages();
|
|
55
|
+
static async getAllCustomPages(params) {
|
|
56
|
+
return CustomPageApiClient.getAllCustomPages(params);
|
|
77
57
|
}
|
|
78
58
|
|
|
79
|
-
static async searchCustomPages() {
|
|
80
|
-
return CustomPageApiClient.searchCustomPages();
|
|
59
|
+
static async searchCustomPages(params) {
|
|
60
|
+
return CustomPageApiClient.searchCustomPages(params);
|
|
81
61
|
}
|
|
82
62
|
|
|
83
63
|
}
|
|
@@ -3,62 +3,37 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.DataPortabilityApiClient = 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 data portability.
|
|
14
|
+
*/
|
|
12
15
|
class DataPortabilityApiClient {
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint generates data portability.
|
|
18
|
+
*/
|
|
13
19
|
static generateDataPortability() {
|
|
14
|
-
return
|
|
15
|
-
url: _Endpoints.default.GenerateDataPortability.url({}),
|
|
16
|
-
method: _Endpoints.default.GenerateDataPortability.method
|
|
17
|
-
}).then(res => {
|
|
18
|
-
if (res.status >= 300) {
|
|
19
|
-
console.log(`Unable to generate data (Response code: ${res.status}).`);
|
|
20
|
-
return Promise.reject(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to generate data.');
|
|
26
|
-
return Promise.reject(error);
|
|
27
|
-
});
|
|
20
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GenerateDataPortability.url({}), _Endpoints.default.GenerateDataPortability.method);
|
|
28
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* This endpoint downloads data portability.
|
|
24
|
+
*/
|
|
25
|
+
|
|
29
26
|
|
|
30
27
|
static downloadDataPortability() {
|
|
31
|
-
return
|
|
32
|
-
url: _Endpoints.default.DataPortabilityDownload.url({}),
|
|
33
|
-
method: _Endpoints.default.DataPortabilityDownload.method
|
|
34
|
-
}).then(res => {
|
|
35
|
-
if (res.status >= 300) {
|
|
36
|
-
console.log(`Unable to download data (Response code: ${res.status}).`);
|
|
37
|
-
return Promise.reject(res);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return Promise.resolve(res);
|
|
41
|
-
}).catch(error => {
|
|
42
|
-
console.log('Unable to download data.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
28
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.DataPortabilityDownload.url({}), _Endpoints.default.DataPortabilityDownload.method);
|
|
45
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* This endpoint retrieves data portability status.
|
|
32
|
+
*/
|
|
33
|
+
|
|
46
34
|
|
|
47
35
|
static dataPortabilityStatus() {
|
|
48
|
-
return
|
|
49
|
-
url: _Endpoints.default.DataPortabilityStatus.url({}),
|
|
50
|
-
method: _Endpoints.default.DataPortabilityStatus.method
|
|
51
|
-
}).then(res => {
|
|
52
|
-
if (res.status >= 300) {
|
|
53
|
-
console.log(`Unable to retrieve data status (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 data status.');
|
|
60
|
-
return Promise.reject(error);
|
|
61
|
-
});
|
|
36
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.DataPortabilityStatus.url({}), _Endpoints.default.DataPortabilityStatus.method);
|
|
62
37
|
}
|
|
63
38
|
|
|
64
39
|
}
|