@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
@@ -3,543 +3,377 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.FeedObjectApiClient = void 0;
5
5
 
6
- var _client = _interopRequireDefault(require("../../client"));
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 feed objs (discussions-posts-statuses).
14
+ */
12
15
  class FeedObjectApiClient {
13
- static getAllFeedObjects(type) {
14
- return _client.default.request({
15
- url: _Endpoints.default.FeedObjectList.url({
16
- type
17
- }),
18
- method: _Endpoints.default.FeedObjectList.method
19
- }).then(res => {
20
- if (res.status >= 300) {
21
- console.log(`Unable to retrieve feed objects (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 feed objects.');
28
- return Promise.reject(error);
29
- });
30
- }
16
+ /**
17
+ * This endpoint retrieves all feed objs
18
+ * @param type
19
+ * @param params
20
+ */
21
+ static getAllFeedObjects(type, params) {
22
+ const p = new URLSearchParams(params);
23
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectList.url({
24
+ type
25
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectList.method);
26
+ }
27
+ /**
28
+ * This endpoint retrieves all uncommented feed objs
29
+ * @param type
30
+ * @param params
31
+ */
32
+
33
+
34
+ static getUncommentedFeedObjects(type, params) {
35
+ const p = new URLSearchParams(params);
36
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectsUncommented.url({
37
+ type
38
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectsUncommented.method);
39
+ }
40
+ /**
41
+ * This endpoint performs search operation to feed objs
42
+ * @param type
43
+ */
31
44
 
32
- static getUncommentedFeedObjects(type) {
33
- return _client.default.request({
34
- url: _Endpoints.default.FeedObjectsUncommented.url({
35
- type
36
- }),
37
- method: _Endpoints.default.FeedObjectsUncommented.method
38
- }).then(res => {
39
- if (res.status >= 300) {
40
- console.log(`Unable to retrieve uncommented feed object (Response code: ${res.status}).`);
41
- return Promise.reject(res);
42
- }
43
-
44
- return Promise.resolve(res);
45
- }).catch(error => {
46
- console.log('Unable to retrieve uncommented feed object.');
47
- return Promise.reject(error);
48
- });
49
- }
50
45
 
51
46
  static searchFeedObject(type) {
52
- return _client.default.request({
53
- url: _Endpoints.default.SearchFeedObject.url({
54
- type
55
- }),
56
- method: _Endpoints.default.SearchFeedObject.method
57
- }).then(res => {
58
- if (res.status >= 300) {
59
- console.log(`Unable to retrieve feed object (Response code: ${res.status}).`);
60
- return Promise.reject(res);
61
- }
62
-
63
- return Promise.resolve(res);
64
- }).catch(error => {
65
- console.log('Unable to retrieve feed object.');
66
- return Promise.reject(error);
67
- });
47
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.SearchFeedObject.url({
48
+ type
49
+ }), _Endpoints.default.SearchFeedObject.method);
68
50
  }
51
+ /**
52
+ * This endpoint creates a feed obj
53
+ * @param type
54
+ * @param data
55
+ */
69
56
 
70
- static createFeedObject(type) {
71
- return _client.default.request({
72
- url: _Endpoints.default.CreateFeedObject.url({
73
- type
74
- }),
75
- method: _Endpoints.default.CreateFeedObject.method
76
- }).then(res => {
77
- if (res.status >= 300) {
78
- console.log(`Unable to perform action (Response code: ${res.status}).`);
79
- return Promise.reject(res);
80
- }
81
-
82
- return Promise.resolve(res);
83
- }).catch(error => {
84
- console.log('Unable to perform action.');
85
- return Promise.reject(error);
86
- });
57
+
58
+ static createFeedObject(type, data) {
59
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.CreateFeedObject.url({
60
+ type
61
+ }), _Endpoints.default.CreateFeedObject.method, data);
87
62
  }
63
+ /**
64
+ * This endpoint retrieves a specific feed obj using ID
65
+ * @param type
66
+ * @param id
67
+ */
68
+
88
69
 
89
70
  static getSpecificFeedObject(type, id) {
90
- return _client.default.request({
91
- url: _Endpoints.default.FeedObject.url({
92
- type,
93
- id
94
- }),
95
- method: _Endpoints.default.FeedObject.method
96
- }).then(res => {
97
- if (res.status >= 300) {
98
- console.log(`Unable to retrieve feed object (Response code: ${res.status}).`);
99
- return Promise.reject(res);
100
- }
101
-
102
- return Promise.resolve(res);
103
- }).catch(error => {
104
- console.log('Unable to retrieve feed object.');
105
- return Promise.reject(error);
106
- });
71
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.FeedObject.url({
72
+ type,
73
+ id
74
+ }), _Endpoints.default.FeedObject.method);
107
75
  }
76
+ /**
77
+ * This endpoint updates a specific feed obj
78
+ * @param type
79
+ * @param id
80
+ * @param data
81
+ */
108
82
 
109
- static updateFeedObject(type, id) {
110
- return _client.default.request({
111
- url: _Endpoints.default.UpdateFeedObject.url({
112
- id,
113
- type
114
- }),
115
- method: _Endpoints.default.UpdateFeedObject.method
116
- }).then(res => {
117
- if (res.status >= 300) {
118
- console.log(`Unable to perform action (Response code: ${res.status}).`);
119
- return Promise.reject(res);
120
- }
121
-
122
- return Promise.resolve(res);
123
- }).catch(error => {
124
- console.log('Unable to perform action.');
125
- return Promise.reject(error);
126
- });
127
- }
128
83
 
129
- static deleteFeedObject(type, id) {
130
- return _client.default.request({
131
- url: _Endpoints.default.DeleteFeedObject.url({
132
- type,
133
- id
134
- }),
135
- method: _Endpoints.default.DeleteFeedObject.method
136
- }).then(res => {
137
- if (res.status >= 300) {
138
- console.log(`Unable to perform action (Response code: ${res.status}).`);
139
- return Promise.reject(res);
140
- }
141
-
142
- return Promise.resolve(res);
143
- }).catch(error => {
144
- console.log('Unable to perform action.');
145
- return Promise.reject(error);
146
- });
84
+ static updateFeedObject(type, id, data) {
85
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.UpdateFeedObject.url({
86
+ id,
87
+ type
88
+ }), _Endpoints.default.UpdateFeedObject.method, data);
147
89
  }
90
+ /**
91
+ * This endpoint deletes a specific feed obj
92
+ * @param type
93
+ * @param id
94
+ */
148
95
 
149
- static feedObjectContributorsList(type, id) {
150
- return _client.default.request({
151
- url: _Endpoints.default.FeedObjectContributorsList.url({
152
- type,
153
- id
154
- }),
155
- method: _Endpoints.default.FeedObjectContributorsList.method
156
- }).then(res => {
157
- if (res.status >= 300) {
158
- console.log(`Unable to retrieve feed object contributors (Response code: ${res.status}).`);
159
- return Promise.reject(res);
160
- }
161
-
162
- return Promise.resolve(res);
163
- }).catch(error => {
164
- console.log('Unable to retrieve feed object contributors.');
165
- return Promise.reject(error);
166
- });
167
- }
168
96
 
169
- static feedObjectSharesList(type, id) {
170
- return _client.default.request({
171
- url: _Endpoints.default.FeedObjectSharesList.url({
172
- type,
173
- id
174
- }),
175
- method: _Endpoints.default.FeedObjectSharesList.method
176
- }).then(res => {
177
- if (res.status >= 300) {
178
- console.log(`Unable to retrieve feed object shares (Response code: ${res.status}).`);
179
- return Promise.reject(res);
180
- }
181
-
182
- return Promise.resolve(res);
183
- }).catch(error => {
184
- console.log('Unable to retrieve feed object shares.');
185
- return Promise.reject(error);
186
- });
187
- }
97
+ static deleteFeedObject(type, id) {
98
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.DeleteFeedObject.url({
99
+ type,
100
+ id
101
+ }), _Endpoints.default.DeleteFeedObject.method);
102
+ }
103
+ /**
104
+ * This endpoint retrieves all contributors for a specific feed obj
105
+ * @param type
106
+ * @param id
107
+ * @param params
108
+ */
109
+
110
+
111
+ static feedObjectContributorsList(type, id, params) {
112
+ const p = new URLSearchParams(params);
113
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectContributorsList.url({
114
+ type,
115
+ id
116
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectContributorsList.method);
117
+ }
118
+ /**
119
+ * This endpoint retrieves all shares for a specific feed obj
120
+ * @param type
121
+ * @param id
122
+ * @param params
123
+ */
124
+
125
+
126
+ static feedObjectSharesList(type, id, params) {
127
+ const p = new URLSearchParams(params);
128
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectSharesList.url({
129
+ type,
130
+ id
131
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectSharesList.method);
132
+ }
133
+ /**
134
+ * This endpoint retrieves all shares users for a specific feed obj
135
+ * @param type
136
+ * @param id
137
+ * @param params
138
+ */
139
+
140
+
141
+ static feedObjectUserSharesList(type, id, params) {
142
+ const p = new URLSearchParams(params);
143
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectUserSharesList.url({
144
+ type,
145
+ id
146
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectUserSharesList.method);
147
+ }
148
+ /**
149
+ *
150
+ * @param type
151
+ * @param id
152
+ */
188
153
 
189
- static feedObjectUserSharesList(type, id) {
190
- return _client.default.request({
191
- url: _Endpoints.default.FeedObjectUserSharesList.url({
192
- type,
193
- id
194
- }),
195
- method: _Endpoints.default.FeedObjectUserSharesList.method
196
- }).then(res => {
197
- if (res.status >= 300) {
198
- console.log(`Unable to retrieve feed object users shares (Response code: ${res.status}).`);
199
- return Promise.reject(res);
200
- }
201
-
202
- return Promise.resolve(res);
203
- }).catch(error => {
204
- console.log('Unable to retrieve feed object users shares.');
205
- return Promise.reject(error);
206
- });
207
- }
208
154
 
209
155
  static restoreFeedObject(type, id) {
210
- return _client.default.request({
211
- url: _Endpoints.default.RestoreFeedObject.url({
212
- type,
213
- id
214
- }),
215
- method: _Endpoints.default.RestoreFeedObject.method
216
- }).then(res => {
217
- if (res.status >= 300) {
218
- console.log(`Unable to perform action (Response code: ${res.status}).`);
219
- return Promise.reject(res);
220
- }
221
-
222
- return Promise.resolve(res);
223
- }).catch(error => {
224
- console.log('Unable to perform action.');
225
- return Promise.reject(error);
226
- });
156
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.RestoreFeedObject.url({
157
+ type,
158
+ id
159
+ }), _Endpoints.default.RestoreFeedObject.method);
227
160
  }
161
+ /**
162
+ * This endpoint restores a feed obj
163
+ * @param type
164
+ * @param id
165
+ * @param params
166
+ */
228
167
 
229
- static relatedFeedObjects(type, id) {
230
- return _client.default.request({
231
- url: _Endpoints.default.RelatedFeedObjects.url({
232
- type,
233
- id
234
- }),
235
- method: _Endpoints.default.RelatedFeedObjects.method
236
- }).then(res => {
237
- if (res.status >= 300) {
238
- console.log(`Unable to retrieve related feed objects (Response code: ${res.status}).`);
239
- return Promise.reject(res);
240
- }
241
-
242
- return Promise.resolve(res);
243
- }).catch(error => {
244
- console.log('Unable to retrieve related feed objects.');
245
- return Promise.reject(error);
246
- });
168
+
169
+ static relatedFeedObjects(type, id, params) {
170
+ const p = new URLSearchParams(params);
171
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.RelatedFeedObjects.url({
172
+ type,
173
+ id
174
+ })}?${p.toString()}`, _Endpoints.default.RelatedFeedObjects.method);
247
175
  }
176
+ /**
177
+ * This endpoint upvotes a specific feed obj
178
+ * @param type
179
+ * @param id
180
+ */
181
+
248
182
 
249
183
  static voteFeedObject(type, id) {
250
- return _client.default.request({
251
- url: _Endpoints.default.Vote.url({
252
- type,
253
- id
254
- }),
255
- method: _Endpoints.default.Vote.method
256
- }).then(res => {
257
- if (res.status >= 300) {
258
- console.log(`Unable to perform action (Response code: ${res.status}).`);
259
- return Promise.reject(res);
260
- }
261
-
262
- return Promise.resolve(res);
263
- }).catch(error => {
264
- console.log('Unable to perform action.');
265
- return Promise.reject(error);
184
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.Vote.url({
185
+ type,
186
+ id
187
+ }), _Endpoints.default.Vote.method);
188
+ }
189
+ /**
190
+ * This endpoint retrieves all votes for a specific feed obj
191
+ * @param type
192
+ * @param id
193
+ * @param params
194
+ */
195
+
196
+
197
+ static feedObjectVotes(type, id, params) {
198
+ const p = new URLSearchParams(params);
199
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.VotesList.url({
200
+ type,
201
+ id
202
+ })}?${p.toString()}`, _Endpoints.default.VotesList.method);
203
+ }
204
+ /**
205
+ * This endpoint upvotes a specific poll choice in a feed obj
206
+ * @param type It can be only "discussion" or "post".
207
+ * @param id
208
+ * @param choice
209
+ */
210
+
211
+
212
+ static feedObjectPollVote(type, id, choice) {
213
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.PollVote.url({
214
+ type,
215
+ id
216
+ }), _Endpoints.default.PollVote.method, {
217
+ choice: choice
266
218
  });
267
219
  }
220
+ /**
221
+ * This endpoint retrieves all poll votes for a specific feed obj
222
+ * @param type It can be only "discussion" or "post".
223
+ * @param id
224
+ * @param params
225
+ */
268
226
 
269
- static feedObjectVotes(type, id) {
270
- return _client.default.request({
271
- url: _Endpoints.default.VotesList.url({
272
- type,
273
- id
274
- }),
275
- method: _Endpoints.default.VotesList.method
276
- }).then(res => {
277
- if (res.status >= 300) {
278
- console.log(`Unable to retrieve feed object votes (Response code: ${res.status}).`);
279
- return Promise.reject(res);
280
- }
281
-
282
- return Promise.resolve(res);
283
- }).catch(error => {
284
- console.log('Unable to retrieve feed object votes.');
285
- return Promise.reject(error);
286
- });
287
- }
288
227
 
289
- static feedObjectPollVote(type, id) {
290
- return _client.default.request({
291
- url: _Endpoints.default.PollVote.url({
292
- type,
293
- id
294
- }),
295
- method: _Endpoints.default.PollVote.method
296
- }).then(res => {
297
- if (res.status >= 300) {
298
- console.log(`Unable to perform action (Response code: ${res.status}).`);
299
- return Promise.reject(res);
300
- }
301
-
302
- return Promise.resolve(res);
303
- }).catch(error => {
304
- console.log('Unable to perform action.');
305
- return Promise.reject(error);
306
- });
228
+ static feedObjectPollVotesList(type, id, params) {
229
+ const p = new URLSearchParams(params);
230
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.PollVotesList.url({
231
+ type,
232
+ id
233
+ })}?${p.toString()}`, _Endpoints.default.PollVotesList.method);
307
234
  }
235
+ /**
236
+ * This endpoint follows a feed obj
237
+ * @param type
238
+ * @param id
239
+ */
308
240
 
309
- static feedObjectPollVotesList(type, id) {
310
- return _client.default.request({
311
- url: _Endpoints.default.PollVotesList.url({
312
- type,
313
- id
314
- }),
315
- method: _Endpoints.default.PollVotesList.method
316
- }).then(res => {
317
- if (res.status >= 300) {
318
- console.log(`Unable to retrieve poll votes (Response code: ${res.status}).`);
319
- return Promise.reject(res);
320
- }
321
-
322
- return Promise.resolve(res);
323
- }).catch(error => {
324
- console.log('Unable to retrieve poll votes.');
325
- return Promise.reject(error);
326
- });
327
- }
328
241
 
329
242
  static followFeedObject(type, id) {
330
- return _client.default.request({
331
- url: _Endpoints.default.FollowContribution.url({
332
- id
333
- }),
334
- method: _Endpoints.default.FollowContribution.method
335
- }).then(res => {
336
- if (res.status >= 300) {
337
- console.log(`Unable to perform follow action (Response code: ${res.status}).`);
338
- return Promise.reject(res);
339
- }
340
-
341
- return Promise.resolve(res);
342
- }).catch(error => {
343
- console.log('Unable to perform follow action.');
344
- return Promise.reject(error);
345
- });
243
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.FollowContribution.url({
244
+ id
245
+ }), _Endpoints.default.FollowContribution.method);
346
246
  }
247
+ /**
248
+ * This endpoint retrieves all feed objs followed by the authenticated user
249
+ * @param type
250
+ * @param params
251
+ */
347
252
 
348
- static feedObjectFollowingList(type) {
349
- return _client.default.request({
350
- url: _Endpoints.default.FeedObjectFollowingList.url({
351
- type
352
- }),
353
- method: _Endpoints.default.FeedObjectFollowingList.method
354
- }).then(res => {
355
- if (res.status >= 300) {
356
- console.log(`Unable to retrieve feed object followings (Response code: ${res.status}).`);
357
- return Promise.reject(res);
358
- }
359
-
360
- return Promise.resolve(res);
361
- }).catch(error => {
362
- console.log('Unable to retrieve feed object followings.');
363
- return Promise.reject(error);
364
- });
253
+
254
+ static feedObjectFollowingList(type, params) {
255
+ const p = new URLSearchParams(params);
256
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.FeedObjectFollowingList.url({
257
+ type
258
+ })}?${p.toString()}`, _Endpoints.default.FeedObjectFollowingList.method);
365
259
  }
260
+ /**
261
+ * This endpoint returns following = true if the feed obj (identified in path) is followed by the authenticated user
262
+ * @param type
263
+ * @param id
264
+ */
265
+
366
266
 
367
267
  static checkIfFollowingFeedObject(type, id) {
368
- return _client.default.request({
369
- url: _Endpoints.default.CheckIfFollowingFeedObject.url({
370
- type,
371
- id
372
- }),
373
- method: _Endpoints.default.CheckIfFollowingFeedObject.method
374
- }).then(res => {
375
- if (res.status >= 300) {
376
- console.log(`Unable to perform action (Response code: ${res.status}).`);
377
- return Promise.reject(res);
378
- }
379
-
380
- return Promise.resolve(res);
381
- }).catch(error => {
382
- console.log('Unable to perform action.');
383
- return Promise.reject(error);
384
- });
268
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.CheckIfFollowingFeedObject.url({
269
+ type,
270
+ id
271
+ }), _Endpoints.default.CheckIfFollowingFeedObject.method);
385
272
  }
273
+ /**
274
+ * This endpoint suspends the notifications for the selected feed obj
275
+ * @param type
276
+ * @param id
277
+ */
278
+
386
279
 
387
280
  static suspendFeedObject(type, id) {
388
- return _client.default.request({
389
- url: _Endpoints.default.UserSuspendContributionNotification.url({
390
- type,
391
- id
392
- }),
393
- method: _Endpoints.default.UserSuspendContributionNotification.method
394
- }).then(res => {
395
- if (res.status >= 300) {
396
- console.log(`Unable to perform action (Response code: ${res.status}).`);
397
- return Promise.reject(res);
398
- }
399
-
400
- return Promise.resolve(res);
401
- }).catch(error => {
402
- console.log('Unable to perform action.');
403
- return Promise.reject(error);
404
- });
281
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.UserSuspendContributionNotification.url({
282
+ type,
283
+ id
284
+ }), _Endpoints.default.UserSuspendContributionNotification.method);
405
285
  }
286
+ /**
287
+ * This endpoint returns suspended = true if the notifications for the feed obj (identified in path) is suspended by the authenticated user
288
+ * @param type
289
+ * @param id
290
+ */
291
+
406
292
 
407
293
  static checkIfSuspendedFeedObject(type, id) {
408
- return _client.default.request({
409
- url: _Endpoints.default.UserCheckContributionNotificationSuspended.url({
410
- type,
411
- id
412
- }),
413
- method: _Endpoints.default.UserCheckContributionNotificationSuspended.method
414
- }).then(res => {
415
- if (res.status >= 300) {
416
- console.log(`Unable to perform action (Response code: ${res.status}).`);
417
- return Promise.reject(res);
418
- }
419
-
420
- return Promise.resolve(res);
421
- }).catch(error => {
422
- console.log('Unable to perform action.');
423
- return Promise.reject(error);
424
- });
294
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.UserCheckContributionNotificationSuspended.url({
295
+ type,
296
+ id
297
+ }), _Endpoints.default.UserCheckContributionNotificationSuspended.method);
425
298
  }
299
+ /**
300
+ * This endpoint retrieves the list of feed obj which notifications are suspended by the authenticated user
301
+ * @param type
302
+ * @param params
303
+ */
426
304
 
427
- static feedObjectSuspendedList(type) {
428
- return _client.default.request({
429
- url: _Endpoints.default.UserListContributionNotificationSuspended.url({
430
- type
431
- }),
432
- method: _Endpoints.default.UserListContributionNotificationSuspended.method
433
- }).then(res => {
434
- if (res.status >= 300) {
435
- console.log(`Unable to retrieve suspended feed objects (Response code: ${res.status}).`);
436
- return Promise.reject(res);
437
- }
438
-
439
- return Promise.resolve(res);
440
- }).catch(error => {
441
- console.log('Unable to retrieve suspended feed objects.');
442
- return Promise.reject(error);
443
- });
305
+
306
+ static feedObjectSuspendedList(type, params) {
307
+ const p = new URLSearchParams(params);
308
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.UserListContributionNotificationSuspended.url({
309
+ type
310
+ })}?${p.toString()}`, _Endpoints.default.UserListContributionNotificationSuspended.method);
444
311
  }
312
+ /**
313
+ * This endpoint flags a specific feed obj
314
+ * @param type
315
+ * @param id
316
+ * @param flag_type
317
+ */
445
318
 
446
- static flagFeedObject(type, id) {
447
- return _client.default.request({
448
- url: _Endpoints.default.Flag.url({
449
- type,
450
- id
451
- }),
452
- method: _Endpoints.default.Flag.method
453
- }).then(res => {
454
- if (res.status >= 300) {
455
- console.log(`Unable to perform action (Response code: ${res.status}).`);
456
- return Promise.reject(res);
457
- }
458
-
459
- return Promise.resolve(res);
460
- }).catch(error => {
461
- console.log('Unable to perform action.');
462
- return Promise.reject(error);
463
- });
319
+
320
+ static flagFeedObject(type, id, flag_type) {
321
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.Flag.url({
322
+ type,
323
+ id
324
+ }), _Endpoints.default.Flag.method, flag_type);
464
325
  }
326
+ /**
327
+ * Retrieves, if exists, a flag for this contribute created by the authenticated user
328
+ * @param type
329
+ * @param id
330
+ */
331
+
465
332
 
466
333
  static feedObjectFlagStatus(type, id) {
467
- return _client.default.request({
468
- url: _Endpoints.default.FlagStatus.url({
469
- type,
470
- id
471
- }),
472
- method: _Endpoints.default.FlagStatus.method
473
- }).then(res => {
474
- if (res.status >= 300) {
475
- console.log(`Unable to retrieve status (Response code: ${res.status}).`);
476
- return Promise.reject(res);
477
- }
478
-
479
- return Promise.resolve(res);
480
- }).catch(error => {
481
- console.log('Unable to retrieve status.');
482
- return Promise.reject(error);
483
- });
334
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.FlagStatus.url({
335
+ type,
336
+ id
337
+ }), _Endpoints.default.FlagStatus.method);
484
338
  }
339
+ /**
340
+ * This endpoint retrieves a list of flags for a specific feed obj
341
+ * @param type
342
+ * @param id
343
+ */
485
344
 
486
- static feedObjectFlagList(type) {
487
- return _client.default.request({
488
- url: _Endpoints.default.FeedObjectFlagList.url({
489
- type
490
- }),
491
- method: _Endpoints.default.FeedObjectFlagList.method
492
- }).then(res => {
493
- if (res.status >= 300) {
494
- console.log(`Unable to retrieve flagged feed objects (Response code: ${res.status}).`);
495
- return Promise.reject(res);
496
- }
497
-
498
- return Promise.resolve(res);
499
- }).catch(error => {
500
- console.log('Unable to retrieve flagged feed objects.');
501
- return Promise.reject(error);
502
- });
345
+
346
+ static feedObjectFlagList(type, id) {
347
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.FeedObjectFlagList.url({
348
+ type,
349
+ id
350
+ }), _Endpoints.default.FeedObjectFlagList.method);
503
351
  }
352
+ /**
353
+ * This endpoint hides the feed obj for the logged user. The feed obj must be in show state
354
+ * @param type
355
+ * @param id
356
+ */
357
+
504
358
 
505
359
  static hideFeedObject(type, id) {
506
- return _client.default.request({
507
- url: _Endpoints.default.HideFeedObject.url({
508
- type,
509
- id
510
- }),
511
- method: _Endpoints.default.HideFeedObject.method
512
- }).then(res => {
513
- if (res.status >= 300) {
514
- console.log(`Unable to perform action (Response code: ${res.status}).`);
515
- return Promise.reject(res);
516
- }
517
-
518
- return Promise.resolve(res);
519
- }).catch(error => {
520
- console.log('Unable to perform action.');
521
- return Promise.reject(error);
522
- });
360
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.HideFeedObject.url({
361
+ type,
362
+ id
363
+ }), _Endpoints.default.HideFeedObject.method);
523
364
  }
365
+ /**
366
+ * This endpoint retrieves if the the feed obj has been hidden by the authenticated user (hidden = true)
367
+ * @param type
368
+ * @param id
369
+ */
370
+
524
371
 
525
372
  static feedObjectHideStatus(type, id) {
526
- return _client.default.request({
527
- url: _Endpoints.default.FeedObjectHideStatus.url({
528
- type,
529
- id
530
- }),
531
- method: _Endpoints.default.FeedObjectHideStatus.method
532
- }).then(res => {
533
- if (res.status >= 300) {
534
- console.log(`Unable to retrieve status (Response code: ${res.status}).`);
535
- return Promise.reject(res);
536
- }
537
-
538
- return Promise.resolve(res);
539
- }).catch(error => {
540
- console.log('Unable to retrieve status.');
541
- return Promise.reject(error);
542
- });
373
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.FeedObjectHideStatus.url({
374
+ type,
375
+ id
376
+ }), _Endpoints.default.FeedObjectHideStatus.method);
543
377
  }
544
378
 
545
379
  }
@@ -547,76 +381,76 @@ class FeedObjectApiClient {
547
381
  exports.FeedObjectApiClient = FeedObjectApiClient;
548
382
 
549
383
  class FeedObjectService {
550
- static async getAllFeedObjects(type) {
551
- return FeedObjectApiClient.getAllFeedObjects(type);
384
+ static async getAllFeedObjects(type, params) {
385
+ return FeedObjectApiClient.getAllFeedObjects(type, params);
552
386
  }
553
387
 
554
- static async getUncommentedFeedObjects(type) {
555
- return FeedObjectApiClient.getUncommentedFeedObjects(type);
388
+ static async getUncommentedFeedObjects(type, params) {
389
+ return FeedObjectApiClient.getUncommentedFeedObjects(type, params);
556
390
  }
557
391
 
558
392
  static async searchFeedObject(type) {
559
393
  return FeedObjectApiClient.searchFeedObject(type);
560
394
  }
561
395
 
562
- static async createFeedObject(type) {
563
- return FeedObjectApiClient.createFeedObject(type);
396
+ static async createFeedObject(type, data) {
397
+ return FeedObjectApiClient.createFeedObject(type, data);
564
398
  }
565
399
 
566
400
  static async getSpecificFeedObject(type, id) {
567
401
  return FeedObjectApiClient.getSpecificFeedObject(type, id);
568
402
  }
569
403
 
570
- static async updateFeedObject(type, id) {
571
- return FeedObjectApiClient.updateFeedObject(type, id);
404
+ static async updateFeedObject(type, id, data) {
405
+ return FeedObjectApiClient.updateFeedObject(type, id, data);
572
406
  }
573
407
 
574
408
  static async deleteFeedObject(type, id) {
575
409
  return FeedObjectApiClient.deleteFeedObject(type, id);
576
410
  }
577
411
 
578
- static async feedObjectContributorsList(type, id) {
579
- return FeedObjectApiClient.feedObjectContributorsList(type, id);
412
+ static async feedObjectContributorsList(type, id, params) {
413
+ return FeedObjectApiClient.feedObjectContributorsList(type, id, params);
580
414
  }
581
415
 
582
- static async feedObjectSharesList(type, id) {
583
- return FeedObjectApiClient.feedObjectSharesList(type, id);
416
+ static async feedObjectSharesList(type, id, params) {
417
+ return FeedObjectApiClient.feedObjectSharesList(type, id, params);
584
418
  }
585
419
 
586
- static async feedObjectUserSharesList(type, id) {
587
- return FeedObjectApiClient.feedObjectUserSharesList(type, id);
420
+ static async feedObjectUserSharesList(type, id, params) {
421
+ return FeedObjectApiClient.feedObjectUserSharesList(type, id, params);
588
422
  }
589
423
 
590
424
  static async restoreFeedObject(type, id) {
591
425
  return FeedObjectApiClient.restoreFeedObject(type, id);
592
426
  }
593
427
 
594
- static async relatedFeedObjects(type, id) {
595
- return FeedObjectApiClient.relatedFeedObjects(type, id);
428
+ static async relatedFeedObjects(type, id, params) {
429
+ return FeedObjectApiClient.relatedFeedObjects(type, id, params);
596
430
  }
597
431
 
598
432
  static async voteFeedObject(type, id) {
599
433
  return FeedObjectApiClient.voteFeedObject(type, id);
600
434
  }
601
435
 
602
- static async feedObjectVotes(type, id) {
603
- return FeedObjectApiClient.feedObjectVotes(type, id);
436
+ static async feedObjectVotes(type, id, params) {
437
+ return FeedObjectApiClient.feedObjectVotes(type, id, params);
604
438
  }
605
439
 
606
- static async feedObjectPollVote(type, id) {
607
- return FeedObjectApiClient.feedObjectPollVote(type, id);
440
+ static async feedObjectPollVote(type, id, choice) {
441
+ return FeedObjectApiClient.feedObjectPollVote(type, id, choice);
608
442
  }
609
443
 
610
- static async feedObjectPollVotesList(type, id) {
611
- return FeedObjectApiClient.feedObjectPollVotesList(type, id);
444
+ static async feedObjectPollVotesList(type, id, params) {
445
+ return FeedObjectApiClient.feedObjectPollVotesList(type, id, params);
612
446
  }
613
447
 
614
448
  static async followFeedObject(type, id) {
615
449
  return FeedObjectApiClient.followFeedObject(type, id);
616
450
  }
617
451
 
618
- static async feedObjectFollowingList(type) {
619
- return FeedObjectApiClient.feedObjectFollowingList(type);
452
+ static async feedObjectFollowingList(type, params) {
453
+ return FeedObjectApiClient.feedObjectFollowingList(type, params);
620
454
  }
621
455
 
622
456
  static async checkIfFollowingFeedObject(type, id) {
@@ -631,16 +465,16 @@ class FeedObjectService {
631
465
  return FeedObjectApiClient.checkIfSuspendedFeedObject(type, id);
632
466
  }
633
467
 
634
- static async feedObjectSuspendedList(type) {
635
- return FeedObjectApiClient.feedObjectSuspendedList(type);
468
+ static async feedObjectSuspendedList(type, params) {
469
+ return FeedObjectApiClient.feedObjectSuspendedList(type, params);
636
470
  }
637
471
 
638
- static async flagFeedObject(type, id) {
639
- return FeedObjectApiClient.flagFeedObject(type, id);
472
+ static async flagFeedObject(type, id, flag_type) {
473
+ return FeedObjectApiClient.flagFeedObject(type, id, flag_type);
640
474
  }
641
475
 
642
- static async feedObjectFlagList(type) {
643
- return FeedObjectApiClient.feedObjectFlagList(type);
476
+ static async feedObjectFlagList(type, id) {
477
+ return FeedObjectApiClient.feedObjectFlagList(type, id);
644
478
  }
645
479
 
646
480
  static async feedObjectFlagStatus(type, id) {