@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,138 +3,86 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.IncubatorApiClient = 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 incubators.
14
+ */
12
15
  class IncubatorApiClient {
13
- static getAllIncubators() {
14
- return _client.default.request({
15
- url: _Endpoints.default.GetAllIncubators.url({}),
16
- method: _Endpoints.default.GetAllIncubators.method
17
- }).then(res => {
18
- if (res.status >= 300) {
19
- console.log(`Unable to retrieve incubators (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 incubators.');
26
- return Promise.reject(error);
27
- });
16
+ /**
17
+ * This endpoint retrieves all incubators.
18
+ * @param params
19
+ */
20
+ static getAllIncubators(params) {
21
+ const p = new URLSearchParams(params);
22
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.GetAllIncubators.url({})}?${p.toString()}`, _Endpoints.default.GetAllIncubators.method);
28
23
  }
24
+ /**
25
+ * This endpoint performs search od Incubators
26
+ * @param params
27
+ */
29
28
 
30
- static searchIncubators() {
31
- return _client.default.request({
32
- url: _Endpoints.default.SearchIncubators.url({}),
33
- method: _Endpoints.default.SearchIncubators.method
34
- }).then(res => {
35
- if (res.status >= 300) {
36
- console.log(`Unable to retrieve incubators (Response code: ${res.status}).`);
37
- return Promise.reject(res);
38
- }
39
-
40
- return Promise.resolve(res);
41
- }).catch(error => {
42
- console.log('Unable to retrieve incubators.');
43
- return Promise.reject(error);
44
- });
29
+
30
+ static searchIncubators(params) {
31
+ const p = new URLSearchParams(params);
32
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.SearchIncubators.url({})}?${p.toString()}`, _Endpoints.default.SearchIncubators.method);
45
33
  }
34
+ /**
35
+ * This endpoint retrieves a specific incubator.
36
+ * @param id
37
+ */
38
+
46
39
 
47
40
  static getSpecificIncubator(id) {
48
- return _client.default.request({
49
- url: _Endpoints.default.GetASpecificIncubator.url({
50
- id
51
- }),
52
- method: _Endpoints.default.GetASpecificIncubator.method
53
- }).then(res => {
54
- if (res.status >= 300) {
55
- console.log(`Unable to retrieve incubator (Response code: ${res.status}).`);
56
- return Promise.reject(res);
57
- }
58
-
59
- return Promise.resolve(res);
60
- }).catch(error => {
61
- console.log('Unable to retrieve incubator.');
62
- return Promise.reject(error);
63
- });
41
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.GetASpecificIncubator.url({
42
+ id
43
+ }), _Endpoints.default.GetASpecificIncubator.method);
64
44
  }
45
+ /**
46
+ * This endpoint creates an incubator.
47
+ * @param data
48
+ */
49
+
65
50
 
66
- static createIncubator() {
67
- return _client.default.request({
68
- url: _Endpoints.default.CreateAnIncubator.url({}),
69
- method: _Endpoints.default.CreateAnIncubator.method
70
- }).then(res => {
71
- if (res.status >= 300) {
72
- console.log(`Unable to perform action (Response code: ${res.status}).`);
73
- return Promise.reject(res);
74
- }
75
-
76
- return Promise.resolve(res);
77
- }).catch(error => {
78
- console.log('Unable to perform action.');
79
- return Promise.reject(error);
80
- });
51
+ static createIncubator(data) {
52
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.CreateAnIncubator.url({}), _Endpoints.default.CreateAnIncubator.method, data);
81
53
  }
54
+ /**
55
+ * This endpoint returns all subscribers of a specific incubator.
56
+ * @param id
57
+ */
58
+
82
59
 
83
60
  static getIncubatorSubscribers(id) {
84
- return _client.default.request({
85
- url: _Endpoints.default.GetIncubatorSubscribers.url({
86
- id
87
- }),
88
- method: _Endpoints.default.GetIncubatorSubscribers.method
89
- }).then(res => {
90
- if (res.status >= 300) {
91
- console.log(`Unable to retrieve incubator subscribers (Response code: ${res.status}).`);
92
- return Promise.reject(res);
93
- }
94
-
95
- return Promise.resolve(res);
96
- }).catch(error => {
97
- console.log('Unable to retrieve incubator subscribers.');
98
- return Promise.reject(error);
99
- });
61
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.GetIncubatorSubscribers.url({
62
+ id
63
+ }), _Endpoints.default.GetIncubatorSubscribers.method);
100
64
  }
65
+ /**
66
+ * This endpoint subscribes to an incubator.
67
+ * @param id
68
+ */
69
+
101
70
 
102
71
  static subscribeToIncubator(id) {
103
- return _client.default.request({
104
- url: _Endpoints.default.SubscribeToIncubator.url({
105
- id
106
- }),
107
- method: _Endpoints.default.SubscribeToIncubator.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
- });
72
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.SubscribeToIncubator.url({
73
+ id
74
+ }), _Endpoints.default.SubscribeToIncubator.method);
119
75
  }
76
+ /**
77
+ * This endpoint returns subscribed = true if the incubator (identified in path) is subscribed by the authenticated user.
78
+ * @param id
79
+ */
80
+
120
81
 
121
82
  static checkIncubatorSubscription(id) {
122
- return _client.default.request({
123
- url: _Endpoints.default.CheckIncubatorSubscription.url({
124
- id
125
- }),
126
- method: _Endpoints.default.CheckIncubatorSubscription.method
127
- }).then(res => {
128
- if (res.status >= 300) {
129
- console.log(`Unable to retrieve result (Response code: ${res.status}).`);
130
- return Promise.reject(res);
131
- }
132
-
133
- return Promise.resolve(res);
134
- }).catch(error => {
135
- console.log('Unable to retrieve result.');
136
- return Promise.reject(error);
137
- });
83
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.CheckIncubatorSubscription.url({
84
+ id
85
+ }), _Endpoints.default.CheckIncubatorSubscription.method);
138
86
  }
139
87
 
140
88
  }
@@ -142,20 +90,20 @@ class IncubatorApiClient {
142
90
  exports.IncubatorApiClient = IncubatorApiClient;
143
91
 
144
92
  class IncubatorService {
145
- static async getAllIncubators() {
146
- return IncubatorApiClient.getAllIncubators();
93
+ static async getAllIncubators(params) {
94
+ return IncubatorApiClient.getAllIncubators(params);
147
95
  }
148
96
 
149
- static async searchIncubators() {
150
- return IncubatorApiClient.searchIncubators();
97
+ static async searchIncubators(params) {
98
+ return IncubatorApiClient.searchIncubators(params);
151
99
  }
152
100
 
153
101
  static async getSpecificIncubator(id) {
154
102
  return IncubatorApiClient.getSpecificIncubator(id);
155
103
  }
156
104
 
157
- static async createIncubator() {
158
- return IncubatorApiClient.createIncubator();
105
+ static async createIncubator(data) {
106
+ return IncubatorApiClient.createIncubator(data);
159
107
  }
160
108
 
161
109
  static async getIncubatorSubscribers(id) {
@@ -3,113 +3,70 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.InsightApiClient = 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 insights.
14
+ */
12
15
  class InsightApiClient {
16
+ /**
17
+ * This endpoint retrieves the best contribution insights list.
18
+ */
13
19
  static getBestContributionInsight() {
14
- return _client.default.request({
15
- url: _Endpoints.default.InsightBestContribution.url({}),
16
- method: _Endpoints.default.InsightBestContribution.method
17
- }).then(res => {
18
- if (res.status >= 300) {
19
- console.log(`Unable to retrieve contribution insights (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 contribution insights.');
26
- return Promise.reject(error);
27
- });
20
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightBestContribution.url({}), _Endpoints.default.InsightBestContribution.method);
28
21
  }
22
+ /**
23
+ * This endpoint retrieves the best embed insights list. The operations of this endpoint is quite complex and returns different result structures based on the parameters passed. For example, pagination (and therefore the use of the offset parameter) is guaranteed only if the metadata and group_by parameter are not passed. If you are passing metadata you MUST pass also group_by. If you pass group_by the result will be not paginated and will contain only user defined custom embeds (not among these: 'sc_vimeo', 'sc_link', 'sc_shared_object').
24
+ */
25
+
29
26
 
30
27
  static getBestEmbedInsight() {
31
- return _client.default.request({
32
- url: _Endpoints.default.InsightBestEmbed.url({}),
33
- method: _Endpoints.default.InsightBestEmbed.method
34
- }).then(res => {
35
- if (res.status >= 300) {
36
- console.log(`Unable to retrieve embed insights. (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 embed insights.');
43
- return Promise.reject(error);
44
- });
28
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightBestEmbed.url({}), _Endpoints.default.InsightBestEmbed.method);
45
29
  }
30
+ /**
31
+ * This endpoint retrieves the best users insights list.
32
+ */
33
+
46
34
 
47
35
  static getBestUsersInsight() {
48
- return _client.default.request({
49
- url: _Endpoints.default.InsightBestUser.url({}),
50
- method: _Endpoints.default.InsightBestUser.method
51
- }).then(res => {
52
- if (res.status >= 300) {
53
- console.log(`Unable to retrieve user insight (Response code: ${res.status}).`);
54
- return Promise.reject(res);
55
- }
56
-
57
- return Promise.resolve(res);
58
- }).catch(error => {
59
- console.log('Unable to retrieve user insight.');
60
- return Promise.reject(error);
61
- });
36
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightBestUser.url({}), _Endpoints.default.InsightBestUser.method);
62
37
  }
38
+ /**
39
+ * This endpoint retrieves a specific contribution's insight counters.
40
+ * @param id
41
+ */
42
+
63
43
 
64
- static getContributionsInsightCounters() {
65
- return _client.default.request({
66
- url: _Endpoints.default.InsightContributionCounter.url({}),
67
- method: _Endpoints.default.InsightContributionCounter.method
68
- }).then(res => {
69
- if (res.status >= 300) {
70
- console.log(`Unable to retrieve contribution counters (Response code: ${res.status}).`);
71
- return Promise.reject(res);
72
- }
73
-
74
- return Promise.resolve(res);
75
- }).catch(error => {
76
- console.log('Unable to retrieve contributions counters.');
77
- return Promise.reject(error);
78
- });
44
+ static getContributionsInsightCounters(id) {
45
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightContributionCounter.url({
46
+ id
47
+ }), _Endpoints.default.InsightContributionCounter.method);
79
48
  }
49
+ /**
50
+ * This endpoint retrieves a specific embed's insight counters.
51
+ * @param id
52
+ */
80
53
 
81
- static getEmbedsInsightCounters() {
82
- return _client.default.request({
83
- url: _Endpoints.default.InsightEmbedCounter.url({}),
84
- method: _Endpoints.default.InsightEmbedCounter.method
85
- }).then(res => {
86
- if (res.status >= 300) {
87
- console.log(`Unable to retrieve embeds counters (Response code: ${res.status}).`);
88
- return Promise.reject(res);
89
- }
90
-
91
- return Promise.resolve(res);
92
- }).catch(error => {
93
- console.log('Unable to retrieve embeds counters.');
94
- return Promise.reject(error);
95
- });
54
+
55
+ static getEmbedsInsightCounters(id) {
56
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightEmbedCounter.url({
57
+ id
58
+ }), _Endpoints.default.InsightEmbedCounter.method);
96
59
  }
60
+ /**
61
+ * This endpoint retrieves a specific user's insight counters.
62
+ * @param id
63
+ */
64
+
97
65
 
98
- static getUsersInsightCounters() {
99
- return _client.default.request({
100
- url: _Endpoints.default.InsightUserCounter.url({}),
101
- method: _Endpoints.default.InsightUserCounter.method
102
- }).then(res => {
103
- if (res.status >= 300) {
104
- console.log(`Unable to retrieve users counters (Response code: ${res.status}).`);
105
- return Promise.reject(res);
106
- }
107
-
108
- return Promise.resolve(res);
109
- }).catch(error => {
110
- console.log('Unable to retrieve users counters.');
111
- return Promise.reject(error);
112
- });
66
+ static getUsersInsightCounters(id) {
67
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.InsightUserCounter.url({
68
+ id
69
+ }), _Endpoints.default.InsightUserCounter.method);
113
70
  }
114
71
 
115
72
  }
@@ -129,16 +86,16 @@ class InsightService {
129
86
  return InsightApiClient.getBestUsersInsight();
130
87
  }
131
88
 
132
- static async getContributionsInsightCounters() {
133
- return InsightApiClient.getContributionsInsightCounters();
89
+ static async getContributionsInsightCounters(id) {
90
+ return InsightApiClient.getContributionsInsightCounters(id);
134
91
  }
135
92
 
136
- static async getEmbedsInsightCounters() {
137
- return InsightApiClient.getEmbedsInsightCounters();
93
+ static async getEmbedsInsightCounters(id) {
94
+ return InsightApiClient.getEmbedsInsightCounters(id);
138
95
  }
139
96
 
140
- static async getUsersInsightCounters() {
141
- return InsightApiClient.getUsersInsightCounters();
97
+ static async getUsersInsightCounters(id) {
98
+ return InsightApiClient.getUsersInsightCounters(id);
142
99
  }
143
100
 
144
101
  }
@@ -3,119 +3,78 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.LegalPageApiClient = 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 legal pages.
14
+ */
12
15
  class LegalPageApiClient {
13
- static getLegalPages() {
14
- return _client.default.request({
15
- url: _Endpoints.default.GetLegalPages.url({}),
16
- method: _Endpoints.default.GetLegalPages.method
17
- }).then(res => {
18
- if (res.status >= 300) {
19
- console.log(`Unable to retrieve legal pages (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 legal pages.');
26
- return Promise.reject(error);
27
- });
16
+ /**
17
+ * This endpoint retrieves all legal pages.
18
+ * @param params
19
+ */
20
+ static getLegalPages(params) {
21
+ const p = new URLSearchParams(params);
22
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.GetLegalPages.url({})}?${p.toString()}`, _Endpoints.default.GetLegalPages.method);
28
23
  }
24
+ /**
25
+ * This endpoint retrieves a specific legal page.
26
+ */
27
+
29
28
 
30
29
  static getSpecificLegalPage(id) {
31
- return _client.default.request({
32
- url: _Endpoints.default.LegalPage.url({
33
- id
34
- }),
35
- method: _Endpoints.default.LegalPage.method
36
- }).then(res => {
37
- if (res.status >= 300) {
38
- console.log(`Unable to retrieve legal page (Response code: ${res.status}).`);
39
- return Promise.reject(res);
40
- }
41
-
42
- return Promise.resolve(res);
43
- }).catch(error => {
44
- console.log('Unable to retrieve legal page.');
45
- return Promise.reject(error);
46
- });
30
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.LegalPage.url({
31
+ id
32
+ }), _Endpoints.default.LegalPage.method);
47
33
  }
34
+ /**
35
+ * This endpoint performs search of a Legal Page.
36
+ * @param params
37
+ */
38
+
48
39
 
49
- static searchLegalPages() {
50
- return _client.default.request({
51
- url: _Endpoints.default.SearchLegalPages.url({}),
52
- method: _Endpoints.default.SearchLegalPages.method
53
- }).then(res => {
54
- if (res.status >= 300) {
55
- console.log(`Unable to retrieve legal pages (Response code: ${res.status}).`);
56
- return Promise.reject(res);
57
- }
58
-
59
- return Promise.resolve(res);
60
- }).catch(error => {
61
- console.log('Unable to retrieve legal pages.');
62
- return Promise.reject(error);
63
- });
40
+ static searchLegalPages(params) {
41
+ const p = new URLSearchParams(params);
42
+ return (0, _apiRequest.apiRequest)(`${_Endpoints.default.SearchLegalPages.url({})}?${p.toString()}`, _Endpoints.default.SearchLegalPages.method);
64
43
  }
44
+ /**
45
+ *
46
+ * @param id
47
+ * @param accept Accept or not accept a legal page, valid values are: ('true', 'on', '1').
48
+ */
65
49
 
66
- static ackLegalPage(id) {
67
- return _client.default.request({
68
- url: _Endpoints.default.AckLegalPage.url({
69
- id
70
- }),
71
- method: _Endpoints.default.AckLegalPage.method
72
- }).then(res => {
73
- if (res.status >= 300) {
74
- console.log(`Unable to perform action (Response code: ${res.status}).`);
75
- return Promise.reject(res);
76
- }
77
-
78
- return Promise.resolve(res);
79
- }).catch(error => {
80
- console.log('Unable to perform action.');
81
- return Promise.reject(error);
82
- });
50
+
51
+ static ackLegalPage(id, accept) {
52
+ var _accept;
53
+
54
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.AckLegalPage.url({
55
+ id
56
+ }), _Endpoints.default.AckLegalPage.method, (_accept = {
57
+ accept: accept
58
+ }) != null ? _accept : null);
83
59
  }
60
+ /**
61
+ * This endpoint retrieves a specific user ack.
62
+ * @param id
63
+ */
64
+
84
65
 
85
66
  static getSpecificUserAck(id) {
86
- return _client.default.request({
87
- url: _Endpoints.default.SpecificUserAck.url({
88
- id
89
- }),
90
- method: _Endpoints.default.SpecificUserAck.method
91
- }).then(res => {
92
- if (res.status >= 300) {
93
- console.log(`Unable to retrieve user ack (Response code: ${res.status}).`);
94
- return Promise.reject(res);
95
- }
96
-
97
- return Promise.resolve(res);
98
- }).catch(error => {
99
- console.log('Unable to retrieve user ack.');
100
- return Promise.reject(error);
101
- });
67
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.SpecificUserAck.url({
68
+ id
69
+ }), _Endpoints.default.SpecificUserAck.method);
102
70
  }
71
+ /**
72
+ * This endpoint retrieves all user acks.
73
+ */
74
+
103
75
 
104
76
  static userAckList() {
105
- return _client.default.request({
106
- url: _Endpoints.default.UserAckList.url({}),
107
- method: _Endpoints.default.UserAckList.method
108
- }).then(res => {
109
- if (res.status >= 300) {
110
- console.log(`Unable to retrieve user acks (Response code: ${res.status}).`);
111
- return Promise.reject(res);
112
- }
113
-
114
- return Promise.resolve(res);
115
- }).catch(error => {
116
- console.log('Unable to retrieve user acks.');
117
- return Promise.reject(error);
118
- });
77
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.UserAckList.url({}), _Endpoints.default.UserAckList.method);
119
78
  }
120
79
 
121
80
  }
@@ -123,20 +82,20 @@ class LegalPageApiClient {
123
82
  exports.LegalPageApiClient = LegalPageApiClient;
124
83
 
125
84
  class LegalPageService {
126
- static async getLegalPages() {
127
- return LegalPageApiClient.getLegalPages();
85
+ static async getLegalPages(params) {
86
+ return LegalPageApiClient.getLegalPages(params);
128
87
  }
129
88
 
130
89
  static async getSpecificLegalPage(id) {
131
90
  return LegalPageApiClient.getSpecificLegalPage(id);
132
91
  }
133
92
 
134
- static async searchLegalPages() {
135
- return LegalPageApiClient.searchLegalPages();
93
+ static async searchLegalPages(params) {
94
+ return LegalPageApiClient.searchLegalPages(params);
136
95
  }
137
96
 
138
- static async ackLegalPage(id) {
139
- return LegalPageApiClient.ackLegalPage(id);
97
+ static async ackLegalPage(id, accept) {
98
+ return LegalPageApiClient.ackLegalPage(id, accept);
140
99
  }
141
100
 
142
101
  static async getSpecificUserAck(id) {
@@ -3,45 +3,29 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.LocalityApiClient = 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 localities.
14
+ */
12
15
  class LocalityApiClient {
16
+ /**
17
+ * This endpoint retrieves the list of available localities.
18
+ */
13
19
  static getLocalities() {
14
- return _client.default.request({
15
- url: _Endpoints.default.GetLocalities.url({}),
16
- method: _Endpoints.default.GetLocalities.method
17
- }).then(res => {
18
- if (res.status >= 300) {
19
- console.log(`Unable to retrieve localities (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 localities.');
26
- return Promise.reject(error);
27
- });
20
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.GetLocalities.url({}), _Endpoints.default.GetLocalities.method);
28
21
  }
22
+ /**
23
+ * This endpoint searches localities
24
+ */
25
+
29
26
 
30
27
  static searchLocalities() {
31
- return _client.default.request({
32
- url: _Endpoints.default.ComposerLocalitySearch.url({}),
33
- method: _Endpoints.default.ComposerLocalitySearch.method
34
- }).then(res => {
35
- if (res.status >= 300) {
36
- console.log(`Unable to retrieve localities (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 localities.');
43
- return Promise.reject(error);
44
- });
28
+ return (0, _apiRequest.apiRequest)(_Endpoints.default.ComposerLocalitySearch.url({}), _Endpoints.default.ComposerLocalitySearch.method);
45
29
  }
46
30
 
47
31
  }