@selfcommunity/api-services 0.1.6-alpha.5 → 0.1.7-alpha.0
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
package/lib/cjs/index.js
CHANGED
|
@@ -181,6 +181,42 @@ var _types = require("./types");
|
|
|
181
181
|
exports.SCPaginatedResponse = _types.SCPaginatedResponse;
|
|
182
182
|
exports.WebhookParamType = _types.WebhookParamType;
|
|
183
183
|
exports.WebhookEventsType = _types.WebhookEventsType;
|
|
184
|
+
exports.SSOSignUpParams = _types.SSOSignUpParams;
|
|
185
|
+
exports.CommentListParams = _types.CommentListParams;
|
|
186
|
+
exports.CommentCreateParams = _types.CommentCreateParams;
|
|
187
|
+
exports.IncubatorCreateParams = _types.IncubatorCreateParams;
|
|
188
|
+
exports.IncubatorSearchParams = _types.IncubatorSearchParams;
|
|
189
|
+
exports.LoyaltyPrizeParams = _types.LoyaltyPrizeParams;
|
|
190
|
+
exports.ModerateContributionParams = _types.ModerateContributionParams;
|
|
191
|
+
exports.CustomNotificationParams = _types.CustomNotificationParams;
|
|
192
|
+
exports.UserAutocompleteParams = _types.UserAutocompleteParams;
|
|
193
|
+
exports.UserScoreParams = _types.UserScoreParams;
|
|
194
|
+
exports.UserSearchParams = _types.UserSearchParams;
|
|
195
|
+
exports.TagParams = _types.TagParams;
|
|
196
|
+
exports.MediaCreateParams = _types.MediaCreateParams;
|
|
197
|
+
exports.MediaTypes = _types.MediaTypes;
|
|
198
|
+
exports.ChunkType = _types.ChunkType;
|
|
199
|
+
exports.ChunkUploadParams = _types.ChunkUploadParams;
|
|
200
|
+
exports.ChunkUploadCompleteParams = _types.ChunkUploadCompleteParams;
|
|
201
|
+
exports.ThreadParams = _types.ThreadParams;
|
|
202
|
+
exports.MessageCreateParams = _types.MessageCreateParams;
|
|
203
|
+
exports.MessageMediaUploadParams = _types.MessageMediaUploadParams;
|
|
204
|
+
exports.MessageThumbnailUploadParams = _types.MessageThumbnailUploadParams;
|
|
205
|
+
exports.MessageChunkUploadDoneParams = _types.MessageChunkUploadDoneParams;
|
|
206
|
+
exports.MessageMediaChunksParams = _types.MessageMediaChunksParams;
|
|
207
|
+
exports.CategoryParams = _types.CategoryParams;
|
|
208
|
+
exports.CustomAdvParams = _types.CustomAdvParams;
|
|
209
|
+
exports.CustomPageParams = _types.CustomPageParams;
|
|
210
|
+
exports.CustomPageSearchParams = _types.CustomPageSearchParams;
|
|
211
|
+
exports.EmbedUpdateParams = _types.EmbedUpdateParams;
|
|
212
|
+
exports.EmbedSearchParams = _types.EmbedSearchParams;
|
|
213
|
+
exports.BaseGetParams = _types.BaseGetParams;
|
|
214
|
+
exports.BaseSearchParams = _types.BaseSearchParams;
|
|
215
|
+
exports.FeedObjGetParams = _types.FeedObjGetParams;
|
|
216
|
+
exports.FeedObjCreateParams = _types.FeedObjCreateParams;
|
|
217
|
+
exports.FeedObjectPollVotesSearch = _types.FeedObjectPollVotesSearch;
|
|
218
|
+
exports.FeedParams = _types.FeedParams;
|
|
219
|
+
exports.LegalPageFilterParams = _types.LegalPageFilterParams;
|
|
184
220
|
|
|
185
221
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
186
222
|
|
|
@@ -3,305 +3,187 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.CategoryApiClient = 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 categories.
|
|
14
|
+
*/
|
|
12
15
|
class CategoryApiClient {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return Promise.resolve(res);
|
|
41
|
-
}).catch(error => {
|
|
42
|
-
console.log('Unable to retrieve category.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static createCategory() {
|
|
48
|
-
return _client.default.request({
|
|
49
|
-
url: _Endpoints.default.CreateCategory.url({}),
|
|
50
|
-
method: _Endpoints.default.CreateCategory.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
|
-
});
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves all categories.
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
static getAllCategories(params) {
|
|
21
|
+
const p = new URLSearchParams(params);
|
|
22
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CategoryList.url({})}?${p.toString()}`, _Endpoints.default.CategoryList.method);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint performs category search.
|
|
26
|
+
* @param params
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
static searchCategory(params) {
|
|
31
|
+
const p = new URLSearchParams(params);
|
|
32
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.SearchCategory.url({})}?${p.toString()}`, _Endpoints.default.SearchCategory.method);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This endpoint creates a category.
|
|
36
|
+
* @param data
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
static createCategory(data) {
|
|
41
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CreateCategory.url({}), _Endpoints.default.CreateCategory.method, data);
|
|
62
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* This endpoint retrieves a specific category.
|
|
45
|
+
* @param id
|
|
46
|
+
*/
|
|
47
|
+
|
|
63
48
|
|
|
64
49
|
static getSpecificCategory(id) {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
static updateASpecificCategory(id) {
|
|
84
|
-
return _client.default.request({
|
|
85
|
-
url: _Endpoints.default.UpdateCategory.url({
|
|
86
|
-
id
|
|
87
|
-
}),
|
|
88
|
-
method: _Endpoints.default.UpdateCategory.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 patchASpecificCategory(id) {
|
|
103
|
-
return _client.default.request({
|
|
104
|
-
url: _Endpoints.default.PatchCategory.url({
|
|
105
|
-
id
|
|
106
|
-
}),
|
|
107
|
-
method: _Endpoints.default.PatchCategory.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
|
-
});
|
|
50
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.Category.url({
|
|
51
|
+
id
|
|
52
|
+
}), _Endpoints.default.Category.method);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This endpoint updates a specific category.
|
|
56
|
+
* @param id
|
|
57
|
+
* @param data
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
static updateASpecificCategory(id, data) {
|
|
62
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.UpdateCategory.url({
|
|
63
|
+
id
|
|
64
|
+
}), _Endpoints.default.UpdateCategory.method, data);
|
|
119
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* This endpoint patches a specific category.
|
|
68
|
+
* @param id
|
|
69
|
+
* @param data
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
static patchASpecificCategory(id, data) {
|
|
74
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.PatchCategory.url({
|
|
75
|
+
id
|
|
76
|
+
}), _Endpoints.default.PatchCategory.method, data);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* This endpoint deletes a specific category identified by {id}.
|
|
80
|
+
* @param id
|
|
81
|
+
*/
|
|
82
|
+
|
|
120
83
|
|
|
121
84
|
static deleteASpecificCategory(id) {
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
method: _Endpoints.default.DeleteCategory.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
|
-
});
|
|
85
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.DeleteCategory.url({
|
|
86
|
+
id
|
|
87
|
+
}), _Endpoints.default.DeleteCategory.method);
|
|
138
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* This endpoint returns the audience of a specific category.
|
|
91
|
+
* @param id
|
|
92
|
+
*/
|
|
93
|
+
|
|
139
94
|
|
|
140
95
|
static getCategoryAudience(id) {
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
method: _Endpoints.default.CategoryAudience.method
|
|
146
|
-
}).then(res => {
|
|
147
|
-
if (res.status >= 300) {
|
|
148
|
-
console.log(`Unable to retrieve category audience (Response code: ${res.status}).`);
|
|
149
|
-
return Promise.reject(res);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return Promise.resolve(res);
|
|
153
|
-
}).catch(error => {
|
|
154
|
-
console.log('Unable to retrieve category audience.');
|
|
155
|
-
return Promise.reject(error);
|
|
156
|
-
});
|
|
96
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CategoryAudience.url({
|
|
97
|
+
id
|
|
98
|
+
}), _Endpoints.default.CategoryAudience.method);
|
|
157
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* This endpoint returns all followers of a specific category.
|
|
102
|
+
* @param id
|
|
103
|
+
*/
|
|
104
|
+
|
|
158
105
|
|
|
159
106
|
static getCategoryFollowers(id) {
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}),
|
|
164
|
-
method: _Endpoints.default.CategoryFollowers.method
|
|
165
|
-
}).then(res => {
|
|
166
|
-
if (res.status >= 300) {
|
|
167
|
-
console.log(`Unable to retrieve category followers (Response code: ${res.status}).`);
|
|
168
|
-
return Promise.reject(res);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return Promise.resolve(res);
|
|
172
|
-
}).catch(error => {
|
|
173
|
-
console.log('Unable to retrieve category followers.');
|
|
174
|
-
return Promise.reject(error);
|
|
175
|
-
});
|
|
107
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CategoryFollowers.url({
|
|
108
|
+
id
|
|
109
|
+
}), _Endpoints.default.CategoryFollowers.method);
|
|
176
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* This endpoint retrieves the category feed.
|
|
113
|
+
* @param id
|
|
114
|
+
*/
|
|
115
|
+
|
|
177
116
|
|
|
178
117
|
static getCategoryFeed(id) {
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
static getCategoryTrendingFeed(id) {
|
|
198
|
-
return _client.default.request({
|
|
199
|
-
url: _Endpoints.default.CategoryTrendingFeed.url({
|
|
200
|
-
id
|
|
201
|
-
}),
|
|
202
|
-
method: _Endpoints.default.CategoryTrendingFeed.method
|
|
203
|
-
}).then(res => {
|
|
204
|
-
if (res.status >= 300) {
|
|
205
|
-
console.log(`Unable to retrieve category trending feed (Response code: ${res.status}).`);
|
|
206
|
-
return Promise.reject(res);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return Promise.resolve(res);
|
|
210
|
-
}).catch(error => {
|
|
211
|
-
console.log('Unable to retrieve category trending feed.');
|
|
212
|
-
return Promise.reject(error);
|
|
213
|
-
});
|
|
118
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CategoryFeed.url({
|
|
119
|
+
id
|
|
120
|
+
}), _Endpoints.default.CategoryFeed.method);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* This endpoint retrieves the category trending feed.
|
|
124
|
+
* @param id
|
|
125
|
+
* @param params
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
static getCategoryTrendingFeed(id, params) {
|
|
130
|
+
const p = new URLSearchParams(params);
|
|
131
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CategoryTrendingFeed.url({
|
|
132
|
+
id
|
|
133
|
+
})}?${p.toString()}`, _Endpoints.default.CategoryTrendingFeed.method);
|
|
214
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* This endpoint returns all trending followers of a specific category during last n days (default 90) .
|
|
137
|
+
* @param id
|
|
138
|
+
*/
|
|
139
|
+
|
|
215
140
|
|
|
216
141
|
static getCategoryTrendingFollowers(id) {
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}),
|
|
221
|
-
method: _Endpoints.default.CategoryTrendingPeople.method
|
|
222
|
-
}).then(res => {
|
|
223
|
-
if (res.status >= 300) {
|
|
224
|
-
console.log(`Unable to retrieve category followers (Response code: ${res.status}).`);
|
|
225
|
-
return Promise.reject(res);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return Promise.resolve(res);
|
|
229
|
-
}).catch(error => {
|
|
230
|
-
console.log('Unable to retrieve category followers.');
|
|
231
|
-
return Promise.reject(error);
|
|
232
|
-
});
|
|
142
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CategoryTrendingPeople.url({
|
|
143
|
+
id
|
|
144
|
+
}), _Endpoints.default.CategoryTrendingPeople.method);
|
|
233
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* This endpoint follows a category.
|
|
148
|
+
* @param id
|
|
149
|
+
*/
|
|
150
|
+
|
|
234
151
|
|
|
235
152
|
static followCategory(id) {
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}),
|
|
240
|
-
method: _Endpoints.default.FollowCategory.method
|
|
241
|
-
}).then(res => {
|
|
242
|
-
if (res.status >= 300) {
|
|
243
|
-
console.log(`Unable to perform follow action (Response code: ${res.status}).`);
|
|
244
|
-
return Promise.reject(res);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return Promise.resolve(res);
|
|
248
|
-
}).catch(error => {
|
|
249
|
-
console.log('Unable to perform follow action.');
|
|
250
|
-
return Promise.reject(error);
|
|
251
|
-
});
|
|
153
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.FollowCategory.url({
|
|
154
|
+
id
|
|
155
|
+
}), _Endpoints.default.FollowCategory.method);
|
|
252
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* This endpoint returns is_followed = true if the category (identified in path) is followed by the authenticated user.
|
|
159
|
+
* @param id
|
|
160
|
+
*/
|
|
161
|
+
|
|
253
162
|
|
|
254
163
|
static checkCategoryIsFollowed(id) {
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}).
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}).
|
|
278
|
-
if (res.status >= 300) {
|
|
279
|
-
console.log(`Unable to retrieve categories followed (Response code: ${res.status}).`);
|
|
280
|
-
return Promise.reject(res);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return Promise.resolve(res);
|
|
284
|
-
}).catch(error => {
|
|
285
|
-
console.log('Unable to retrieve categories followed.');
|
|
286
|
-
return Promise.reject(error);
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
static getPopularCategories() {
|
|
291
|
-
return _client.default.request({
|
|
292
|
-
url: _Endpoints.default.PopularCategories.url({}),
|
|
293
|
-
method: _Endpoints.default.PopularCategories.method
|
|
294
|
-
}).then(res => {
|
|
295
|
-
if (res.status >= 300) {
|
|
296
|
-
console.log(`Unable to retrieve categories (Response code: ${res.status}).`);
|
|
297
|
-
return Promise.reject(res);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return Promise.resolve(res);
|
|
301
|
-
}).catch(error => {
|
|
302
|
-
console.log('Unable to retrieve categories.');
|
|
303
|
-
return Promise.reject(error);
|
|
304
|
-
});
|
|
164
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.CheckCategoryIsFollowed.url({
|
|
165
|
+
id
|
|
166
|
+
}), _Endpoints.default.CheckCategoryIsFollowed.method);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* This endpoint retrieves all followed categories by the user.
|
|
170
|
+
* @param params
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
static getFollowedCategories(params) {
|
|
175
|
+
const p = new URLSearchParams(params);
|
|
176
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.CategoriesFollowed.url({})}?${p.toString()}`, _Endpoints.default.CategoriesFollowed.method);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* This endpoint retrieves all categories ordered by the number of followers (in descending order).
|
|
180
|
+
* @param params
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
static getPopularCategories(params) {
|
|
185
|
+
const p = new URLSearchParams(params);
|
|
186
|
+
return (0, _apiRequest.apiRequest)(`${_Endpoints.default.PopularCategories.url({})}?${p.toString()}`, _Endpoints.default.PopularCategories.method);
|
|
305
187
|
}
|
|
306
188
|
|
|
307
189
|
}
|
|
@@ -309,28 +191,28 @@ class CategoryApiClient {
|
|
|
309
191
|
exports.CategoryApiClient = CategoryApiClient;
|
|
310
192
|
|
|
311
193
|
class CategoryService {
|
|
312
|
-
static async getAllCategories() {
|
|
313
|
-
return CategoryApiClient.getAllCategories();
|
|
194
|
+
static async getAllCategories(params) {
|
|
195
|
+
return CategoryApiClient.getAllCategories(params);
|
|
314
196
|
}
|
|
315
197
|
|
|
316
|
-
static async searchCategory() {
|
|
317
|
-
return CategoryApiClient.searchCategory();
|
|
198
|
+
static async searchCategory(params) {
|
|
199
|
+
return CategoryApiClient.searchCategory(params);
|
|
318
200
|
}
|
|
319
201
|
|
|
320
|
-
static async createCategory() {
|
|
321
|
-
return CategoryApiClient.createCategory();
|
|
202
|
+
static async createCategory(data) {
|
|
203
|
+
return CategoryApiClient.createCategory(data);
|
|
322
204
|
}
|
|
323
205
|
|
|
324
206
|
static async getSpecificCategory(id) {
|
|
325
207
|
return CategoryApiClient.getSpecificCategory(id);
|
|
326
208
|
}
|
|
327
209
|
|
|
328
|
-
static async updateASpecificCategory(id) {
|
|
329
|
-
return CategoryApiClient.updateASpecificCategory(id);
|
|
210
|
+
static async updateASpecificCategory(id, data) {
|
|
211
|
+
return CategoryApiClient.updateASpecificCategory(id, data);
|
|
330
212
|
}
|
|
331
213
|
|
|
332
|
-
static async patchASpecificCategory(id) {
|
|
333
|
-
return CategoryApiClient.patchASpecificCategory(id);
|
|
214
|
+
static async patchASpecificCategory(id, data) {
|
|
215
|
+
return CategoryApiClient.patchASpecificCategory(id, data);
|
|
334
216
|
}
|
|
335
217
|
|
|
336
218
|
static async deleteASpecificCategory(id) {
|
|
@@ -349,8 +231,8 @@ class CategoryService {
|
|
|
349
231
|
return CategoryApiClient.getCategoryFeed(id);
|
|
350
232
|
}
|
|
351
233
|
|
|
352
|
-
static async getCategoryTrendingFeed(id) {
|
|
353
|
-
return CategoryApiClient.getCategoryTrendingFeed(id);
|
|
234
|
+
static async getCategoryTrendingFeed(id, params) {
|
|
235
|
+
return CategoryApiClient.getCategoryTrendingFeed(id, params);
|
|
354
236
|
}
|
|
355
237
|
|
|
356
238
|
static async getCategoryTrendingFollowers(id) {
|
|
@@ -365,12 +247,12 @@ class CategoryService {
|
|
|
365
247
|
return CategoryApiClient.checkCategoryIsFollowed(id);
|
|
366
248
|
}
|
|
367
249
|
|
|
368
|
-
static async getFollowedCategories() {
|
|
369
|
-
return CategoryApiClient.getFollowedCategories();
|
|
250
|
+
static async getFollowedCategories(params) {
|
|
251
|
+
return CategoryApiClient.getFollowedCategories(params);
|
|
370
252
|
}
|
|
371
253
|
|
|
372
|
-
static async getPopularCategories() {
|
|
373
|
-
return CategoryApiClient.getPopularCategories();
|
|
254
|
+
static async getPopularCategories(params) {
|
|
255
|
+
return CategoryApiClient.getPopularCategories(params);
|
|
374
256
|
}
|
|
375
257
|
|
|
376
258
|
}
|