@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.
Files changed (188) hide show
  1. package/lib/cjs/index.js +36 -0
  2. package/lib/cjs/services/category/index.js +168 -286
  3. package/lib/cjs/services/comment/index.js +107 -186
  4. package/lib/cjs/services/custom_adv/index.js +31 -51
  5. package/lib/cjs/services/custom_page/index.js +32 -52
  6. package/lib/cjs/services/data_portability/index.js +18 -43
  7. package/lib/cjs/services/embed/index.js +90 -151
  8. package/lib/cjs/services/feature/index.js +8 -16
  9. package/lib/cjs/services/feed/index.js +46 -81
  10. package/lib/cjs/services/feed_object/index.js +339 -505
  11. package/lib/cjs/services/incubator/index.js +64 -116
  12. package/lib/cjs/services/insight/index.js +51 -94
  13. package/lib/cjs/services/legal_page/index.js +60 -101
  14. package/lib/cjs/services/locality/index.js +14 -30
  15. package/lib/cjs/services/loyalty/index.js +92 -154
  16. package/lib/cjs/services/media/index.js +80 -122
  17. package/lib/cjs/services/moderation/index.js +65 -103
  18. package/lib/cjs/services/notification/index.js +67 -136
  19. package/lib/cjs/services/preference/index.js +25 -51
  20. package/lib/cjs/services/private_message/index.js +98 -177
  21. package/lib/cjs/services/score/index.js +22 -46
  22. package/lib/cjs/services/sso/index.js +17 -32
  23. package/lib/cjs/services/suggestion/index.js +23 -57
  24. package/lib/cjs/services/tag/index.js +72 -119
  25. package/lib/cjs/services/user/index.js +420 -767
  26. package/lib/cjs/services/webhook/index.js +4 -7
  27. package/lib/cjs/types/baseParams.js +3 -0
  28. package/lib/cjs/types/category.js +3 -0
  29. package/lib/cjs/types/comment.js +3 -0
  30. package/lib/cjs/types/customAdv.js +3 -0
  31. package/lib/cjs/types/customPage.js +3 -0
  32. package/lib/cjs/types/embed.js +3 -0
  33. package/lib/cjs/types/feed.js +3 -0
  34. package/lib/cjs/types/feedObject.js +3 -0
  35. package/lib/cjs/types/incubator.js +3 -0
  36. package/lib/cjs/types/index.js +91 -1
  37. package/lib/cjs/types/legalPage.js +3 -0
  38. package/lib/cjs/types/media.js +29 -0
  39. package/lib/cjs/types/moderation.js +3 -0
  40. package/lib/cjs/types/notification.js +3 -0
  41. package/lib/cjs/types/privateMessage.js +3 -0
  42. package/lib/cjs/types/prize.js +3 -0
  43. package/lib/cjs/types/sso.js +3 -0
  44. package/lib/cjs/types/tag.js +3 -0
  45. package/lib/cjs/types/user.js +3 -0
  46. package/lib/cjs/utils/apiRequest.js +2 -1
  47. package/lib/esm/index.js +36 -0
  48. package/lib/esm/services/category/index.js +168 -286
  49. package/lib/esm/services/comment/index.js +107 -186
  50. package/lib/esm/services/custom_adv/index.js +31 -51
  51. package/lib/esm/services/custom_page/index.js +32 -52
  52. package/lib/esm/services/data_portability/index.js +18 -43
  53. package/lib/esm/services/embed/index.js +90 -151
  54. package/lib/esm/services/feature/index.js +8 -16
  55. package/lib/esm/services/feed/index.js +46 -81
  56. package/lib/esm/services/feed_object/index.js +339 -505
  57. package/lib/esm/services/incubator/index.js +64 -116
  58. package/lib/esm/services/insight/index.js +51 -94
  59. package/lib/esm/services/legal_page/index.js +60 -101
  60. package/lib/esm/services/locality/index.js +14 -30
  61. package/lib/esm/services/loyalty/index.js +92 -154
  62. package/lib/esm/services/media/index.js +80 -122
  63. package/lib/esm/services/moderation/index.js +65 -103
  64. package/lib/esm/services/notification/index.js +67 -136
  65. package/lib/esm/services/preference/index.js +25 -51
  66. package/lib/esm/services/private_message/index.js +98 -177
  67. package/lib/esm/services/score/index.js +22 -46
  68. package/lib/esm/services/sso/index.js +17 -32
  69. package/lib/esm/services/suggestion/index.js +23 -57
  70. package/lib/esm/services/tag/index.js +72 -119
  71. package/lib/esm/services/user/index.js +420 -767
  72. package/lib/esm/services/webhook/index.js +4 -7
  73. package/lib/esm/types/baseParams.js +3 -0
  74. package/lib/esm/types/category.js +3 -0
  75. package/lib/esm/types/comment.js +3 -0
  76. package/lib/esm/types/customAdv.js +3 -0
  77. package/lib/esm/types/customPage.js +3 -0
  78. package/lib/esm/types/embed.js +3 -0
  79. package/lib/esm/types/feed.js +3 -0
  80. package/lib/esm/types/feedObject.js +3 -0
  81. package/lib/esm/types/incubator.js +3 -0
  82. package/lib/esm/types/index.js +91 -1
  83. package/lib/esm/types/legalPage.js +3 -0
  84. package/lib/esm/types/media.js +29 -0
  85. package/lib/esm/types/moderation.js +3 -0
  86. package/lib/esm/types/notification.js +3 -0
  87. package/lib/esm/types/privateMessage.js +3 -0
  88. package/lib/esm/types/prize.js +3 -0
  89. package/lib/esm/types/sso.js +3 -0
  90. package/lib/esm/types/tag.js +3 -0
  91. package/lib/esm/types/user.js +3 -0
  92. package/lib/esm/utils/apiRequest.js +2 -1
  93. package/lib/types/index.d.ts +2 -2
  94. package/lib/types/index.d.ts.map +1 -1
  95. package/lib/types/services/category/index.d.ts +114 -42
  96. package/lib/types/services/category/index.d.ts.map +1 -1
  97. package/lib/types/services/comment/index.d.ts +74 -23
  98. package/lib/types/services/comment/index.d.ts.map +1 -1
  99. package/lib/types/services/custom_adv/index.d.ts +26 -9
  100. package/lib/types/services/custom_adv/index.d.ts.map +1 -1
  101. package/lib/types/services/custom_page/index.d.ts +26 -9
  102. package/lib/types/services/custom_page/index.d.ts.map +1 -1
  103. package/lib/types/services/data_portability/index.d.ts +19 -6
  104. package/lib/types/services/data_portability/index.d.ts.map +1 -1
  105. package/lib/types/services/embed/index.d.ts +62 -24
  106. package/lib/types/services/embed/index.d.ts.map +1 -1
  107. package/lib/types/services/feature/index.d.ts +11 -3
  108. package/lib/types/services/feature/index.d.ts.map +1 -1
  109. package/lib/types/services/feed/index.d.ts +37 -15
  110. package/lib/types/services/feed/index.d.ts.map +1 -1
  111. package/lib/types/services/feed_object/index.d.ts +229 -81
  112. package/lib/types/services/feed_object/index.d.ts.map +1 -1
  113. package/lib/types/services/incubator/index.d.ts +51 -18
  114. package/lib/types/services/incubator/index.d.ts.map +1 -1
  115. package/lib/types/services/insight/index.d.ts +44 -18
  116. package/lib/types/services/insight/index.d.ts.map +1 -1
  117. package/lib/types/services/legal_page/index.d.ts +46 -18
  118. package/lib/types/services/legal_page/index.d.ts.map +1 -1
  119. package/lib/types/services/locality/index.d.ts +17 -6
  120. package/lib/types/services/locality/index.d.ts.map +1 -1
  121. package/lib/types/services/loyalty/index.d.ts +70 -27
  122. package/lib/types/services/loyalty/index.d.ts.map +1 -1
  123. package/lib/types/services/media/index.d.ts +55 -18
  124. package/lib/types/services/media/index.d.ts.map +1 -1
  125. package/lib/types/services/moderation/index.d.ts +51 -18
  126. package/lib/types/services/moderation/index.d.ts.map +1 -1
  127. package/lib/types/services/notification/index.d.ts +63 -27
  128. package/lib/types/services/notification/index.d.ts.map +1 -1
  129. package/lib/types/services/preference/index.d.ts +28 -9
  130. package/lib/types/services/preference/index.d.ts.map +1 -1
  131. package/lib/types/services/private_message/index.d.ts +68 -24
  132. package/lib/types/services/private_message/index.d.ts.map +1 -1
  133. package/lib/types/services/score/index.d.ts +24 -9
  134. package/lib/types/services/score/index.d.ts.map +1 -1
  135. package/lib/types/services/sso/index.d.ts +18 -6
  136. package/lib/types/services/sso/index.d.ts.map +1 -1
  137. package/lib/types/services/suggestion/index.d.ts +29 -12
  138. package/lib/types/services/suggestion/index.d.ts.map +1 -1
  139. package/lib/types/services/tag/index.d.ts +57 -21
  140. package/lib/types/services/tag/index.d.ts.map +1 -1
  141. package/lib/types/services/user/index.d.ts +313 -114
  142. package/lib/types/services/user/index.d.ts.map +1 -1
  143. package/lib/types/services/webhook/index.d.ts +3 -4
  144. package/lib/types/services/webhook/index.d.ts.map +1 -1
  145. package/lib/types/tsconfig.build.tsbuildinfo +1 -1
  146. package/lib/types/types/baseParams.d.ts +23 -0
  147. package/lib/types/types/baseParams.d.ts.map +1 -0
  148. package/lib/types/types/category.d.ts +15 -0
  149. package/lib/types/types/category.d.ts.map +1 -0
  150. package/lib/types/types/comment.d.ts +51 -0
  151. package/lib/types/types/comment.d.ts.map +1 -0
  152. package/lib/types/types/customAdv.d.ts +19 -0
  153. package/lib/types/types/customAdv.d.ts.map +1 -0
  154. package/lib/types/types/customPage.d.ts +24 -0
  155. package/lib/types/types/customPage.d.ts.map +1 -0
  156. package/lib/types/types/embed.d.ts +26 -0
  157. package/lib/types/types/embed.d.ts.map +1 -0
  158. package/lib/types/types/feed.d.ts +11 -0
  159. package/lib/types/types/feed.d.ts.map +1 -0
  160. package/lib/types/types/feedObject.d.ts +56 -0
  161. package/lib/types/types/feedObject.d.ts.map +1 -0
  162. package/lib/types/types/incubator.d.ts +33 -0
  163. package/lib/types/types/incubator.d.ts.map +1 -0
  164. package/lib/types/types/index.d.ts +19 -1
  165. package/lib/types/types/index.d.ts.map +1 -1
  166. package/lib/types/types/legalPage.d.ts +19 -0
  167. package/lib/types/types/legalPage.d.ts.map +1 -0
  168. package/lib/types/types/media.d.ts +80 -0
  169. package/lib/types/types/media.d.ts.map +1 -0
  170. package/lib/types/types/moderation.d.ts +23 -0
  171. package/lib/types/types/moderation.d.ts.map +1 -0
  172. package/lib/types/types/notification.d.ts +31 -0
  173. package/lib/types/types/notification.d.ts.map +1 -0
  174. package/lib/types/types/privateMessage.d.ts +176 -0
  175. package/lib/types/types/privateMessage.d.ts.map +1 -0
  176. package/lib/types/types/prize.d.ts +47 -0
  177. package/lib/types/types/prize.d.ts.map +1 -0
  178. package/lib/types/types/sso.d.ts +12 -0
  179. package/lib/types/types/sso.d.ts.map +1 -0
  180. package/lib/types/types/tag.d.ts +39 -0
  181. package/lib/types/types/tag.d.ts.map +1 -0
  182. package/lib/types/types/user.d.ts +105 -0
  183. package/lib/types/types/user.d.ts.map +1 -0
  184. package/lib/types/utils/apiRequest.d.ts +1 -1
  185. package/lib/types/utils/apiRequest.d.ts.map +1 -1
  186. package/lib/umd/api-services.js +1 -1
  187. package/lib/umd/api-services.js.map +1 -1
  188. 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
- static getAllCategories() {
14
- return _client.default.request({
15
- url: _Endpoints.default.CategoryList.url({}),
16
- method: _Endpoints.default.CategoryList.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 searchCategory() {
31
- return _client.default.request({
32
- url: _Endpoints.default.SearchCategory.url({}),
33
- method: _Endpoints.default.SearchCategory.method
34
- }).then(res => {
35
- if (res.status >= 300) {
36
- console.log(`Unable to retrieve category (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 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 _client.default.request({
66
- url: _Endpoints.default.Category.url({
67
- id
68
- }),
69
- method: _Endpoints.default.Category.method
70
- }).then(res => {
71
- if (res.status >= 300) {
72
- console.log(`Unable to retrieve category (Response code: ${res.status}).`);
73
- return Promise.reject(res);
74
- }
75
-
76
- return Promise.resolve(res);
77
- }).catch(error => {
78
- console.log('Unable to retrieve category.');
79
- return Promise.reject(error);
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 _client.default.request({
123
- url: _Endpoints.default.DeleteCategory.url({
124
- id
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 _client.default.request({
142
- url: _Endpoints.default.CategoryAudience.url({
143
- id
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 _client.default.request({
161
- url: _Endpoints.default.CategoryFollowers.url({
162
- id
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 _client.default.request({
180
- url: _Endpoints.default.CategoryFeed.url({
181
- id
182
- }),
183
- method: _Endpoints.default.CategoryFeed.method
184
- }).then(res => {
185
- if (res.status >= 300) {
186
- console.log(`Unable to retrieve category feed (Response code: ${res.status}).`);
187
- return Promise.reject(res);
188
- }
189
-
190
- return Promise.resolve(res);
191
- }).catch(error => {
192
- console.log('Unable to retrieve category feed.');
193
- return Promise.reject(error);
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 _client.default.request({
218
- url: _Endpoints.default.CategoryTrendingPeople.url({
219
- id
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 _client.default.request({
237
- url: _Endpoints.default.FollowCategory.url({
238
- id
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 _client.default.request({
256
- url: _Endpoints.default.CheckCategoryIsFollowed.url({
257
- id
258
- }),
259
- method: _Endpoints.default.CheckCategoryIsFollowed.method
260
- }).then(res => {
261
- if (res.status >= 300) {
262
- console.log(`Unable to perform action (Response code: ${res.status}).`);
263
- return Promise.reject(res);
264
- }
265
-
266
- return Promise.resolve(res);
267
- }).catch(error => {
268
- console.log('Unable to perform action.');
269
- return Promise.reject(error);
270
- });
271
- }
272
-
273
- static getFollowedCategories() {
274
- return _client.default.request({
275
- url: _Endpoints.default.CategoriesFollowed.url({}),
276
- method: _Endpoints.default.CategoriesFollowed.method
277
- }).then(res => {
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
  }