@selfcommunity/api-services 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +36 -0
- package/lib/cjs/services/category/index.js +168 -286
- package/lib/cjs/services/comment/index.js +107 -186
- package/lib/cjs/services/custom_adv/index.js +31 -51
- package/lib/cjs/services/custom_page/index.js +32 -52
- package/lib/cjs/services/data_portability/index.js +18 -43
- package/lib/cjs/services/embed/index.js +90 -151
- package/lib/cjs/services/feature/index.js +8 -16
- package/lib/cjs/services/feed/index.js +46 -81
- package/lib/cjs/services/feed_object/index.js +339 -505
- package/lib/cjs/services/incubator/index.js +64 -116
- package/lib/cjs/services/insight/index.js +51 -94
- package/lib/cjs/services/legal_page/index.js +60 -101
- package/lib/cjs/services/locality/index.js +14 -30
- package/lib/cjs/services/loyalty/index.js +92 -154
- package/lib/cjs/services/media/index.js +80 -122
- package/lib/cjs/services/moderation/index.js +65 -103
- package/lib/cjs/services/notification/index.js +67 -136
- package/lib/cjs/services/preference/index.js +25 -51
- package/lib/cjs/services/private_message/index.js +98 -177
- package/lib/cjs/services/score/index.js +22 -46
- package/lib/cjs/services/sso/index.js +17 -32
- package/lib/cjs/services/suggestion/index.js +23 -57
- package/lib/cjs/services/tag/index.js +72 -119
- package/lib/cjs/services/user/index.js +420 -767
- package/lib/cjs/services/webhook/index.js +4 -7
- package/lib/cjs/types/baseParams.js +3 -0
- package/lib/cjs/types/category.js +3 -0
- package/lib/cjs/types/comment.js +3 -0
- package/lib/cjs/types/customAdv.js +3 -0
- package/lib/cjs/types/customPage.js +3 -0
- package/lib/cjs/types/embed.js +3 -0
- package/lib/cjs/types/feed.js +3 -0
- package/lib/cjs/types/feedObject.js +3 -0
- package/lib/cjs/types/incubator.js +3 -0
- package/lib/cjs/types/index.js +91 -1
- package/lib/cjs/types/legalPage.js +3 -0
- package/lib/cjs/types/media.js +29 -0
- package/lib/cjs/types/moderation.js +3 -0
- package/lib/cjs/types/notification.js +3 -0
- package/lib/cjs/types/privateMessage.js +3 -0
- package/lib/cjs/types/prize.js +3 -0
- package/lib/cjs/types/sso.js +3 -0
- package/lib/cjs/types/tag.js +3 -0
- package/lib/cjs/types/user.js +3 -0
- package/lib/cjs/utils/apiRequest.js +2 -1
- package/lib/esm/index.js +36 -0
- package/lib/esm/services/category/index.js +168 -286
- package/lib/esm/services/comment/index.js +107 -186
- package/lib/esm/services/custom_adv/index.js +31 -51
- package/lib/esm/services/custom_page/index.js +32 -52
- package/lib/esm/services/data_portability/index.js +18 -43
- package/lib/esm/services/embed/index.js +90 -151
- package/lib/esm/services/feature/index.js +8 -16
- package/lib/esm/services/feed/index.js +46 -81
- package/lib/esm/services/feed_object/index.js +339 -505
- package/lib/esm/services/incubator/index.js +64 -116
- package/lib/esm/services/insight/index.js +51 -94
- package/lib/esm/services/legal_page/index.js +60 -101
- package/lib/esm/services/locality/index.js +14 -30
- package/lib/esm/services/loyalty/index.js +92 -154
- package/lib/esm/services/media/index.js +80 -122
- package/lib/esm/services/moderation/index.js +65 -103
- package/lib/esm/services/notification/index.js +67 -136
- package/lib/esm/services/preference/index.js +25 -51
- package/lib/esm/services/private_message/index.js +98 -177
- package/lib/esm/services/score/index.js +22 -46
- package/lib/esm/services/sso/index.js +17 -32
- package/lib/esm/services/suggestion/index.js +23 -57
- package/lib/esm/services/tag/index.js +72 -119
- package/lib/esm/services/user/index.js +420 -767
- package/lib/esm/services/webhook/index.js +4 -7
- package/lib/esm/types/baseParams.js +3 -0
- package/lib/esm/types/category.js +3 -0
- package/lib/esm/types/comment.js +3 -0
- package/lib/esm/types/customAdv.js +3 -0
- package/lib/esm/types/customPage.js +3 -0
- package/lib/esm/types/embed.js +3 -0
- package/lib/esm/types/feed.js +3 -0
- package/lib/esm/types/feedObject.js +3 -0
- package/lib/esm/types/incubator.js +3 -0
- package/lib/esm/types/index.js +91 -1
- package/lib/esm/types/legalPage.js +3 -0
- package/lib/esm/types/media.js +29 -0
- package/lib/esm/types/moderation.js +3 -0
- package/lib/esm/types/notification.js +3 -0
- package/lib/esm/types/privateMessage.js +3 -0
- package/lib/esm/types/prize.js +3 -0
- package/lib/esm/types/sso.js +3 -0
- package/lib/esm/types/tag.js +3 -0
- package/lib/esm/types/user.js +3 -0
- package/lib/esm/utils/apiRequest.js +2 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/services/category/index.d.ts +114 -42
- package/lib/types/services/category/index.d.ts.map +1 -1
- package/lib/types/services/comment/index.d.ts +74 -23
- package/lib/types/services/comment/index.d.ts.map +1 -1
- package/lib/types/services/custom_adv/index.d.ts +26 -9
- package/lib/types/services/custom_adv/index.d.ts.map +1 -1
- package/lib/types/services/custom_page/index.d.ts +26 -9
- package/lib/types/services/custom_page/index.d.ts.map +1 -1
- package/lib/types/services/data_portability/index.d.ts +19 -6
- package/lib/types/services/data_portability/index.d.ts.map +1 -1
- package/lib/types/services/embed/index.d.ts +62 -24
- package/lib/types/services/embed/index.d.ts.map +1 -1
- package/lib/types/services/feature/index.d.ts +11 -3
- package/lib/types/services/feature/index.d.ts.map +1 -1
- package/lib/types/services/feed/index.d.ts +37 -15
- package/lib/types/services/feed/index.d.ts.map +1 -1
- package/lib/types/services/feed_object/index.d.ts +229 -81
- package/lib/types/services/feed_object/index.d.ts.map +1 -1
- package/lib/types/services/incubator/index.d.ts +51 -18
- package/lib/types/services/incubator/index.d.ts.map +1 -1
- package/lib/types/services/insight/index.d.ts +44 -18
- package/lib/types/services/insight/index.d.ts.map +1 -1
- package/lib/types/services/legal_page/index.d.ts +46 -18
- package/lib/types/services/legal_page/index.d.ts.map +1 -1
- package/lib/types/services/locality/index.d.ts +17 -6
- package/lib/types/services/locality/index.d.ts.map +1 -1
- package/lib/types/services/loyalty/index.d.ts +70 -27
- package/lib/types/services/loyalty/index.d.ts.map +1 -1
- package/lib/types/services/media/index.d.ts +55 -18
- package/lib/types/services/media/index.d.ts.map +1 -1
- package/lib/types/services/moderation/index.d.ts +51 -18
- package/lib/types/services/moderation/index.d.ts.map +1 -1
- package/lib/types/services/notification/index.d.ts +63 -27
- package/lib/types/services/notification/index.d.ts.map +1 -1
- package/lib/types/services/preference/index.d.ts +28 -9
- package/lib/types/services/preference/index.d.ts.map +1 -1
- package/lib/types/services/private_message/index.d.ts +68 -24
- package/lib/types/services/private_message/index.d.ts.map +1 -1
- package/lib/types/services/score/index.d.ts +24 -9
- package/lib/types/services/score/index.d.ts.map +1 -1
- package/lib/types/services/sso/index.d.ts +18 -6
- package/lib/types/services/sso/index.d.ts.map +1 -1
- package/lib/types/services/suggestion/index.d.ts +29 -12
- package/lib/types/services/suggestion/index.d.ts.map +1 -1
- package/lib/types/services/tag/index.d.ts +57 -21
- package/lib/types/services/tag/index.d.ts.map +1 -1
- package/lib/types/services/user/index.d.ts +313 -114
- package/lib/types/services/user/index.d.ts.map +1 -1
- package/lib/types/services/webhook/index.d.ts +3 -4
- package/lib/types/services/webhook/index.d.ts.map +1 -1
- package/lib/types/tsconfig.build.tsbuildinfo +1 -1
- package/lib/types/types/baseParams.d.ts +23 -0
- package/lib/types/types/baseParams.d.ts.map +1 -0
- package/lib/types/types/category.d.ts +15 -0
- package/lib/types/types/category.d.ts.map +1 -0
- package/lib/types/types/comment.d.ts +51 -0
- package/lib/types/types/comment.d.ts.map +1 -0
- package/lib/types/types/customAdv.d.ts +19 -0
- package/lib/types/types/customAdv.d.ts.map +1 -0
- package/lib/types/types/customPage.d.ts +24 -0
- package/lib/types/types/customPage.d.ts.map +1 -0
- package/lib/types/types/embed.d.ts +26 -0
- package/lib/types/types/embed.d.ts.map +1 -0
- package/lib/types/types/feed.d.ts +11 -0
- package/lib/types/types/feed.d.ts.map +1 -0
- package/lib/types/types/feedObject.d.ts +56 -0
- package/lib/types/types/feedObject.d.ts.map +1 -0
- package/lib/types/types/incubator.d.ts +33 -0
- package/lib/types/types/incubator.d.ts.map +1 -0
- package/lib/types/types/index.d.ts +19 -1
- package/lib/types/types/index.d.ts.map +1 -1
- package/lib/types/types/legalPage.d.ts +19 -0
- package/lib/types/types/legalPage.d.ts.map +1 -0
- package/lib/types/types/media.d.ts +80 -0
- package/lib/types/types/media.d.ts.map +1 -0
- package/lib/types/types/moderation.d.ts +23 -0
- package/lib/types/types/moderation.d.ts.map +1 -0
- package/lib/types/types/notification.d.ts +31 -0
- package/lib/types/types/notification.d.ts.map +1 -0
- package/lib/types/types/privateMessage.d.ts +176 -0
- package/lib/types/types/privateMessage.d.ts.map +1 -0
- package/lib/types/types/prize.d.ts +47 -0
- package/lib/types/types/prize.d.ts.map +1 -0
- package/lib/types/types/sso.d.ts +12 -0
- package/lib/types/types/sso.d.ts.map +1 -0
- package/lib/types/types/tag.d.ts +39 -0
- package/lib/types/types/tag.d.ts.map +1 -0
- package/lib/types/types/user.d.ts +105 -0
- package/lib/types/types/user.d.ts.map +1 -0
- package/lib/types/utils/apiRequest.d.ts +1 -1
- package/lib/types/utils/apiRequest.d.ts.map +1 -1
- package/lib/umd/api-services.js +1 -1
- package/lib/umd/api-services.js.map +1 -1
- package/package.json +4 -4
|
@@ -3,138 +3,86 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.IncubatorApiClient = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _apiRequest = require("../../utils/apiRequest");
|
|
7
7
|
|
|
8
8
|
var _Endpoints = _interopRequireDefault(require("../../constants/Endpoints"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Contains all the endpoints needed to manage incubators.
|
|
14
|
+
*/
|
|
12
15
|
class IncubatorApiClient {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.reject(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to retrieve 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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
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
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
104
|
-
|
|
105
|
-
|
|
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
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}).
|
|
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
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.reject(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return Promise.resolve(res);
|
|
24
|
-
}).catch(error => {
|
|
25
|
-
console.log('Unable to retrieve 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
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
51
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}).
|
|
73
|
-
|
|
74
|
-
|
|
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
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|