@selfcommunity/api-services 0.1.5 → 0.1.6-alpha.2
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/constants/Endpoints.js +8 -16
- package/lib/cjs/index.js +10 -6
- package/lib/cjs/services/webhook/index.js +122 -207
- package/lib/cjs/types/index.js +12 -0
- package/lib/cjs/types/paginatedResponse.js +3 -0
- package/lib/cjs/types/webhook.js +3 -0
- package/lib/cjs/utils/apiRequest.js +26 -0
- package/lib/esm/api-services/src/constants/Endpoints.d.ts.map +1 -1
- package/lib/esm/api-services/src/index.d.ts +6 -2
- package/lib/esm/api-services/src/index.d.ts.map +1 -1
- package/lib/esm/api-services/src/services/webhook/index.d.ts +89 -32
- package/lib/esm/api-services/src/services/webhook/index.d.ts.map +1 -1
- package/lib/esm/api-services/src/types/index.d.ts +4 -0
- package/lib/esm/api-services/src/types/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/types/paginatedResponse.d.ts +10 -0
- package/lib/esm/api-services/src/types/paginatedResponse.d.ts.map +1 -0
- package/lib/esm/api-services/src/types/webhook.d.ts +32 -0
- package/lib/esm/api-services/src/types/webhook.d.ts.map +1 -0
- package/lib/esm/api-services/src/utils/apiRequest.d.ts +2 -0
- package/lib/esm/api-services/src/utils/apiRequest.d.ts.map +1 -0
- package/lib/esm/constants/Endpoints.js +8 -16
- package/lib/esm/index.js +10 -6
- package/lib/esm/services/webhook/index.js +122 -207
- package/lib/esm/types/index.js +12 -0
- package/lib/esm/types/paginatedResponse.js +3 -0
- package/lib/esm/types/src/index.d.ts +9 -0
- package/lib/esm/types/src/index.d.ts.map +1 -0
- package/lib/esm/types/src/types/auth.d.ts +26 -0
- package/lib/esm/types/src/types/auth.d.ts.map +1 -0
- package/lib/esm/types/src/types/broadcastMessage.d.ts +73 -0
- package/lib/esm/types/src/types/broadcastMessage.d.ts.map +1 -0
- package/lib/esm/types/src/types/category.d.ts +100 -0
- package/lib/esm/types/src/types/category.d.ts.map +1 -0
- package/lib/esm/types/src/types/comment.d.ts +97 -0
- package/lib/esm/types/src/types/comment.d.ts.map +1 -0
- package/lib/esm/types/src/types/customAdv.d.ts +53 -0
- package/lib/esm/types/src/types/customAdv.d.ts.map +1 -0
- package/lib/esm/types/src/types/customNotification.d.ts +28 -0
- package/lib/esm/types/src/types/customNotification.d.ts.map +1 -0
- package/lib/esm/types/src/types/embed.d.ts +33 -0
- package/lib/esm/types/src/types/embed.d.ts.map +1 -0
- package/lib/esm/types/src/types/feed.d.ts +208 -0
- package/lib/esm/types/src/types/feed.d.ts.map +1 -0
- package/lib/esm/types/src/types/incubator.d.ts +53 -0
- package/lib/esm/types/src/types/incubator.d.ts.map +1 -0
- package/lib/esm/types/src/types/index.d.ts +23 -0
- package/lib/esm/types/src/types/index.d.ts.map +1 -0
- package/lib/esm/types/src/types/location.d.ts +61 -0
- package/lib/esm/types/src/types/location.d.ts.map +1 -0
- package/lib/esm/types/src/types/media.d.ts +52 -0
- package/lib/esm/types/src/types/media.d.ts.map +1 -0
- package/lib/esm/types/src/types/notification.d.ts +416 -0
- package/lib/esm/types/src/types/notification.d.ts.map +1 -0
- package/lib/esm/types/src/types/poll.d.ts +77 -0
- package/lib/esm/types/src/types/poll.d.ts.map +1 -0
- package/lib/esm/types/src/types/privateMessage.d.ts +109 -0
- package/lib/esm/types/src/types/privateMessage.d.ts.map +1 -0
- package/lib/esm/types/src/types/prize.d.ts +48 -0
- package/lib/esm/types/src/types/prize.d.ts.map +1 -0
- package/lib/esm/types/src/types/tag.d.ts +47 -0
- package/lib/esm/types/src/types/tag.d.ts.map +1 -0
- package/lib/esm/types/src/types/user.d.ts +231 -0
- package/lib/esm/types/src/types/user.d.ts.map +1 -0
- package/lib/esm/types/src/types/webhook.d.ts +91 -0
- package/lib/esm/types/src/types/webhook.d.ts.map +1 -0
- package/lib/esm/types/webhook.js +3 -0
- package/lib/esm/utils/apiRequest.js +26 -0
- package/lib/umd/api-services.js +1 -1
- package/lib/umd/api-services.js.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/services/dynamic_preference/index.js +0 -85
- package/lib/esm/api-services/src/services/dynamic_preference/index.d.ts +0 -16
- package/lib/esm/api-services/src/services/dynamic_preference/index.d.ts.map +0 -1
- package/lib/esm/services/dynamic_preference/index.js +0 -85
|
@@ -14,6 +14,14 @@ const Endpoints = {
|
|
|
14
14
|
method: 'POST'
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Dynamic Preference Endpoints
|
|
19
|
+
*/
|
|
20
|
+
Preferences: {
|
|
21
|
+
url: (0, _utils.urlReplacer)('/api/v2/dynamic_preference/'),
|
|
22
|
+
method: 'GET'
|
|
23
|
+
},
|
|
24
|
+
|
|
17
25
|
/**
|
|
18
26
|
* SSO Endpoints
|
|
19
27
|
*/
|
|
@@ -26,22 +34,6 @@ const Endpoints = {
|
|
|
26
34
|
method: 'POST'
|
|
27
35
|
},
|
|
28
36
|
|
|
29
|
-
/**
|
|
30
|
-
* Dynamic Preference Endpoints
|
|
31
|
-
*/
|
|
32
|
-
Preferences: {
|
|
33
|
-
url: (0, _utils.urlReplacer)('/api/v2/dynamic_preference/'),
|
|
34
|
-
method: 'GET'
|
|
35
|
-
},
|
|
36
|
-
PreferencesSearch: {
|
|
37
|
-
url: (0, _utils.urlReplacer)('/api/v2/dynamic_preference/search/'),
|
|
38
|
-
method: 'GET'
|
|
39
|
-
},
|
|
40
|
-
SpecificPreference: {
|
|
41
|
-
url: (0, _utils.urlReplacer)('/api/v2/dynamic_preference/$(id)/'),
|
|
42
|
-
method: 'GET'
|
|
43
|
-
},
|
|
44
|
-
|
|
45
37
|
/**
|
|
46
38
|
* Features Endpoints
|
|
47
39
|
* */
|
package/lib/cjs/index.js
CHANGED
|
@@ -22,6 +22,10 @@ var _token = require("./utils/token");
|
|
|
22
22
|
exports.generateJWTToken = _token.generateJWTToken;
|
|
23
23
|
exports.parseJwt = _token.parseJwt;
|
|
24
24
|
|
|
25
|
+
var _apiRequest = require("./utils/apiRequest");
|
|
26
|
+
|
|
27
|
+
exports.apiRequest = _apiRequest.apiRequest;
|
|
28
|
+
|
|
25
29
|
var _category = _interopRequireWildcard(require("./services/category"));
|
|
26
30
|
|
|
27
31
|
exports.CategoryService = _category.default;
|
|
@@ -52,12 +56,6 @@ exports.DataPortabilityService = _data_portability.default;
|
|
|
52
56
|
exports.DataPortabilityApiClient = _data_portability.DataPortabilityApiClient;
|
|
53
57
|
exports.DataPortabilityApiClientInterface = _data_portability.DataPortabilityApiClientInterface;
|
|
54
58
|
|
|
55
|
-
var _dynamic_preference = _interopRequireWildcard(require("./services/dynamic_preference"));
|
|
56
|
-
|
|
57
|
-
exports.DynamicPreferenceService = _dynamic_preference.default;
|
|
58
|
-
exports.DynamicPreferenceApiClient = _dynamic_preference.DynamicPreferenceApiClient;
|
|
59
|
-
exports.DynamicPreferenceApiClientInterface = _dynamic_preference.DynamicPreferenceApiClientInterface;
|
|
60
|
-
|
|
61
59
|
var _embed = _interopRequireWildcard(require("./services/embed"));
|
|
62
60
|
|
|
63
61
|
exports.EmbedService = _embed.default;
|
|
@@ -178,6 +176,12 @@ exports.WebhookService = _webhook.default;
|
|
|
178
176
|
exports.WebhookApiClient = _webhook.WebhookApiClient;
|
|
179
177
|
exports.WebhookApiClientInterface = _webhook.WebhookApiClientInterface;
|
|
180
178
|
|
|
179
|
+
var _types = require("./types");
|
|
180
|
+
|
|
181
|
+
exports.SCPaginatedResponse = _types.SCPaginatedResponse;
|
|
182
|
+
exports.WebhookParamType = _types.WebhookParamType;
|
|
183
|
+
exports.WebhookEventsType = _types.WebhookEventsType;
|
|
184
|
+
|
|
181
185
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
182
186
|
|
|
183
187
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -3,232 +3,147 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.WebhookApiClient = 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 webhooks.
|
|
14
|
+
*/
|
|
12
15
|
class WebhookApiClient {
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves all webhook endpoints
|
|
18
|
+
*/
|
|
13
19
|
static getAllWebhookEndpoints() {
|
|
14
|
-
return
|
|
15
|
-
url: _Endpoints.default.WebhookEndpointsList.url({}),
|
|
16
|
-
method: _Endpoints.default.WebhookEndpointsList.method
|
|
17
|
-
}).then(res => {
|
|
18
|
-
if (res.status >= 300) {
|
|
19
|
-
console.log(`Unable to retrieve webhook endpoints (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 endpoints.');
|
|
26
|
-
return Promise.reject(error);
|
|
27
|
-
});
|
|
20
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookEndpointsList.url({}), _Endpoints.default.WebhookEndpointsList.method);
|
|
28
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* This endpoint retrieves webhook events that can be enabled in the endpoint.
|
|
24
|
+
*/
|
|
25
|
+
|
|
29
26
|
|
|
30
27
|
static getAllWebhookEvents() {
|
|
31
|
-
return
|
|
32
|
-
url: _Endpoints.default.WebhookEventsList.url({}),
|
|
33
|
-
method: _Endpoints.default.WebhookEventsList.method
|
|
34
|
-
}).then(res => {
|
|
35
|
-
if (res.status >= 300) {
|
|
36
|
-
console.log(`Unable to retrieve webhook endpoints events (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 endpoints events.');
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
28
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookEventsList.url({}), _Endpoints.default.WebhookEventsList.method);
|
|
45
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* This endpoint creates a webhook endpoint and connects it to the given webhook events.
|
|
32
|
+
* @param data
|
|
33
|
+
*/
|
|
46
34
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
method: _Endpoints.default.WebhookCreate.method
|
|
51
|
-
}).then(res => {
|
|
52
|
-
if (res.status >= 300) {
|
|
53
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
54
|
-
return Promise.reject(res);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return Promise.resolve(res.data);
|
|
58
|
-
}).catch(error => {
|
|
59
|
-
console.log('Unable to perform action.');
|
|
60
|
-
return Promise.reject(error);
|
|
61
|
-
});
|
|
35
|
+
|
|
36
|
+
static createWebhookEndpoint(data) {
|
|
37
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookCreate.url({}), _Endpoints.default.WebhookCreate.method, data);
|
|
62
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* This endpoint retrieves a specific webhook endpoint using ID.
|
|
41
|
+
* @param id
|
|
42
|
+
*/
|
|
43
|
+
|
|
63
44
|
|
|
64
45
|
static getASpecificWebhookEndpoint(id) {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
method: _Endpoints.default.GetSpecificWebhook.method
|
|
70
|
-
}).then(res => {
|
|
71
|
-
if (res.status >= 300) {
|
|
72
|
-
console.log(`Unable to retrieve webhook (Response code: ${res.status}).`);
|
|
73
|
-
return Promise.reject(res);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return Promise.resolve(res.data);
|
|
77
|
-
}).catch(error => {
|
|
78
|
-
console.log('Unable to retrieve webhook.');
|
|
79
|
-
return Promise.reject(error);
|
|
80
|
-
});
|
|
46
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.GetSpecificWebhook.url({
|
|
47
|
+
id
|
|
48
|
+
}), _Endpoints.default.GetSpecificWebhook.method);
|
|
81
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* This endpoint updates a specific webhook endpoint.
|
|
52
|
+
* @param id
|
|
53
|
+
* @param params
|
|
54
|
+
*/
|
|
82
55
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
method: _Endpoints.default.WebhookUpdate.method
|
|
89
|
-
}).then(res => {
|
|
90
|
-
if (res.status >= 300) {
|
|
91
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
92
|
-
return Promise.reject(res);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return Promise.resolve(res.data);
|
|
96
|
-
}).catch(error => {
|
|
97
|
-
console.log('Unable to perform action.');
|
|
98
|
-
return Promise.reject(error);
|
|
99
|
-
});
|
|
56
|
+
|
|
57
|
+
static updateASpecificWebhookEndpoint(id, params) {
|
|
58
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookUpdate.url({
|
|
59
|
+
id
|
|
60
|
+
}), _Endpoints.default.WebhookUpdate.method, params);
|
|
100
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* This endpoint updates a specific field for a specific webhook endpoint.
|
|
64
|
+
* @param id
|
|
65
|
+
* @param params
|
|
66
|
+
*/
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
method: _Endpoints.default.WebhookPatch.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.data);
|
|
115
|
-
}).catch(error => {
|
|
116
|
-
console.log('Unable to perform action.');
|
|
117
|
-
return Promise.reject(error);
|
|
118
|
-
});
|
|
68
|
+
|
|
69
|
+
static updateASingleWebhookEndpointField(id, params) {
|
|
70
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookPatch.url({
|
|
71
|
+
id
|
|
72
|
+
}), _Endpoints.default.WebhookPatch.method, params);
|
|
119
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* This endpoint deletes a Webhook Endpoint.
|
|
76
|
+
* @param id
|
|
77
|
+
*/
|
|
78
|
+
|
|
120
79
|
|
|
121
80
|
static deleteWebhookEndpoint(id) {
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
method: _Endpoints.default.WebhookDelete.method
|
|
127
|
-
}).then(res => {
|
|
128
|
-
if (res.status >= 300) {
|
|
129
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
130
|
-
return Promise.reject(res);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return Promise.resolve(res.data);
|
|
134
|
-
}).catch(error => {
|
|
135
|
-
console.log('Unable to perform action.');
|
|
136
|
-
return Promise.reject(error);
|
|
137
|
-
});
|
|
81
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookDelete.url({
|
|
82
|
+
id
|
|
83
|
+
}), _Endpoints.default.WebhookDelete.method);
|
|
138
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* This endpoint retrieves the attempts related to this endpoint.
|
|
87
|
+
* @param id
|
|
88
|
+
*/
|
|
89
|
+
|
|
139
90
|
|
|
140
91
|
static getAllWebhookEndpointAttempts(id) {
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
method: _Endpoints.default.WebhookEndpointAttempts.method
|
|
146
|
-
}).then(res => {
|
|
147
|
-
if (res.status >= 300) {
|
|
148
|
-
console.log(`Unable to retrieve webhook endpoint attempts (Response code: ${res.status}).`);
|
|
149
|
-
return Promise.reject(res);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return Promise.resolve(res.data);
|
|
153
|
-
}).catch(error => {
|
|
154
|
-
console.log('Unable to retrieve webhook endpoint attempts.');
|
|
155
|
-
return Promise.reject(error);
|
|
156
|
-
});
|
|
92
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookEndpointAttempts.url({
|
|
93
|
+
id
|
|
94
|
+
}), _Endpoints.default.WebhookEndpointAttempts.method);
|
|
157
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* This endpoint expires the secret associated with this endpoint.
|
|
98
|
+
* @param id
|
|
99
|
+
*/
|
|
158
100
|
|
|
159
|
-
static expireWebhookSigningSecret(id) {
|
|
160
|
-
return _client.default.request({
|
|
161
|
-
url: _Endpoints.default.WebhookExpireSigningSecret.url({
|
|
162
|
-
id
|
|
163
|
-
}),
|
|
164
|
-
method: _Endpoints.default.WebhookExpireSigningSecret.method
|
|
165
|
-
}).then(res => {
|
|
166
|
-
if (res.status >= 300) {
|
|
167
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
168
|
-
return Promise.reject(res);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return Promise.resolve(res.data);
|
|
172
|
-
}).catch(error => {
|
|
173
|
-
console.log('Unable to perform action.');
|
|
174
|
-
return Promise.reject(error);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
101
|
|
|
178
|
-
static
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
102
|
+
static expireWebhookSigningSecret(id) {
|
|
103
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookExpireSigningSecret.url({
|
|
104
|
+
id
|
|
105
|
+
}), _Endpoints.default.WebhookExpireSigningSecret.method);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* This endpoint reveals the secret associated with this endpoint.
|
|
109
|
+
* @param id
|
|
110
|
+
* @param password
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
static revealWebhookSigningSecret(id, password) {
|
|
115
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookRevealSigningSecret.url({
|
|
116
|
+
id
|
|
117
|
+
}), _Endpoints.default.WebhookRevealSigningSecret.method, password ? {
|
|
118
|
+
password: password
|
|
119
|
+
} : null);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* This endpoint resends the event specified as parameter to the endpoint specified by the id parameter.
|
|
123
|
+
* @param id
|
|
124
|
+
* @param event
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
static resendWebhookEndpointEvent(id, event) {
|
|
129
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookResendEndpointEvent.url({
|
|
130
|
+
id
|
|
131
|
+
}), _Endpoints.default.WebhookResendEndpointEvent.method, {
|
|
132
|
+
event: event
|
|
194
133
|
});
|
|
195
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* This endpoint resends the events specified as parameters to the endpoint specified by the id parameter.
|
|
137
|
+
* @param id
|
|
138
|
+
* @param event
|
|
139
|
+
*/
|
|
196
140
|
|
|
197
|
-
static resendWebhookEndpointEvent(id) {
|
|
198
|
-
return _client.default.request({
|
|
199
|
-
url: _Endpoints.default.WebhookResendEndpointEvent.url({
|
|
200
|
-
id
|
|
201
|
-
}),
|
|
202
|
-
method: _Endpoints.default.WebhookResendEndpointEvent.method
|
|
203
|
-
}).then(res => {
|
|
204
|
-
if (res.status >= 300) {
|
|
205
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
206
|
-
return Promise.reject(res);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return Promise.resolve(res.data);
|
|
210
|
-
}).catch(error => {
|
|
211
|
-
console.log('Unable to perform action.');
|
|
212
|
-
return Promise.reject(error);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
141
|
|
|
216
|
-
static resendMultipleWebhookEndpointEvent(id) {
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
method: _Endpoints.default.WebhookResendMultipleEndpointEvent.method
|
|
222
|
-
}).then(res => {
|
|
223
|
-
if (res.status >= 300) {
|
|
224
|
-
console.log(`Unable to perform action (Response code: ${res.status}).`);
|
|
225
|
-
return Promise.reject(res);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return Promise.resolve(res.data);
|
|
229
|
-
}).catch(error => {
|
|
230
|
-
console.log('Unable to perform action.');
|
|
231
|
-
return Promise.reject(error);
|
|
142
|
+
static resendMultipleWebhookEndpointEvent(id, event) {
|
|
143
|
+
return (0, _apiRequest.apiRequest)(_Endpoints.default.WebhookResendMultipleEndpointEvent.url({
|
|
144
|
+
id
|
|
145
|
+
}), _Endpoints.default.WebhookResendMultipleEndpointEvent.method, {
|
|
146
|
+
event: event
|
|
232
147
|
});
|
|
233
148
|
}
|
|
234
149
|
|
|
@@ -245,20 +160,20 @@ class WebhookService {
|
|
|
245
160
|
return WebhookApiClient.getAllWebhookEvents();
|
|
246
161
|
}
|
|
247
162
|
|
|
248
|
-
static async createWebhookEndpoint() {
|
|
249
|
-
return WebhookApiClient.createWebhookEndpoint();
|
|
163
|
+
static async createWebhookEndpoint(params) {
|
|
164
|
+
return WebhookApiClient.createWebhookEndpoint(params);
|
|
250
165
|
}
|
|
251
166
|
|
|
252
167
|
static async getASpecificWebhookEndpoint(id) {
|
|
253
168
|
return WebhookApiClient.getASpecificWebhookEndpoint(id);
|
|
254
169
|
}
|
|
255
170
|
|
|
256
|
-
static async updateASpecificWebhookEndpoint(id) {
|
|
257
|
-
return WebhookApiClient.updateASpecificWebhookEndpoint(id);
|
|
171
|
+
static async updateASpecificWebhookEndpoint(id, params) {
|
|
172
|
+
return WebhookApiClient.updateASpecificWebhookEndpoint(id, params);
|
|
258
173
|
}
|
|
259
174
|
|
|
260
|
-
static async updateASingleWebhookEndpointField(id) {
|
|
261
|
-
return WebhookApiClient.updateASingleWebhookEndpointField(id);
|
|
175
|
+
static async updateASingleWebhookEndpointField(id, params) {
|
|
176
|
+
return WebhookApiClient.updateASingleWebhookEndpointField(id, params);
|
|
262
177
|
}
|
|
263
178
|
|
|
264
179
|
static async deleteWebhookEndpoint(id) {
|
|
@@ -273,16 +188,16 @@ class WebhookService {
|
|
|
273
188
|
return WebhookApiClient.expireWebhookSigningSecret(id);
|
|
274
189
|
}
|
|
275
190
|
|
|
276
|
-
static async revealWebhookSigningSecret(id) {
|
|
277
|
-
return WebhookApiClient.revealWebhookSigningSecret(id);
|
|
191
|
+
static async revealWebhookSigningSecret(id, password) {
|
|
192
|
+
return WebhookApiClient.revealWebhookSigningSecret(id, password);
|
|
278
193
|
}
|
|
279
194
|
|
|
280
|
-
static async resendWebhookEndpointEvent(id) {
|
|
281
|
-
return WebhookApiClient.resendWebhookEndpointEvent(id);
|
|
195
|
+
static async resendWebhookEndpointEvent(id, event) {
|
|
196
|
+
return WebhookApiClient.resendWebhookEndpointEvent(id, event);
|
|
282
197
|
}
|
|
283
198
|
|
|
284
|
-
static async resendMultipleWebhookEndpointEvent(id) {
|
|
285
|
-
return WebhookApiClient.resendMultipleWebhookEndpointEvent(id);
|
|
199
|
+
static async resendMultipleWebhookEndpointEvent(id, event) {
|
|
200
|
+
return WebhookApiClient.resendMultipleWebhookEndpointEvent(id, event);
|
|
286
201
|
}
|
|
287
202
|
|
|
288
203
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _paginatedResponse = require("./paginatedResponse");
|
|
6
|
+
|
|
7
|
+
exports.SCPaginatedResponse = _paginatedResponse.SCPaginatedResponse;
|
|
8
|
+
|
|
9
|
+
var _webhook = require("./webhook");
|
|
10
|
+
|
|
11
|
+
exports.WebhookParamType = _webhook.WebhookParamType;
|
|
12
|
+
exports.WebhookEventsType = _webhook.WebhookEventsType;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.apiRequest = apiRequest;
|
|
5
|
+
|
|
6
|
+
var _client = _interopRequireDefault(require("../client"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
|
|
10
|
+
function apiRequest(url, method, data) {
|
|
11
|
+
return _client.default.request({
|
|
12
|
+
url,
|
|
13
|
+
method,
|
|
14
|
+
data: data != null ? data : null
|
|
15
|
+
}).then(res => {
|
|
16
|
+
if (res.status >= 300) {
|
|
17
|
+
console.log(`Unable to ${method} ${url} (Response code: ${res.status}).`);
|
|
18
|
+
return Promise.reject(res);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return Promise.resolve(res.data);
|
|
22
|
+
}).catch(error => {
|
|
23
|
+
console.log(`Unable to ${method} ${url}`);
|
|
24
|
+
return Promise.reject(error);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoints.d.ts","sourceRoot":"","sources":["../../../../../src/constants/Endpoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Endpoints.d.ts","sourceRoot":"","sources":["../../../../../src/constants/Endpoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CA8/B5C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -11,6 +11,7 @@ import Endpoints, { EndpointType } from './constants/Endpoints';
|
|
|
11
11
|
*/
|
|
12
12
|
import { formatHttpError } from './utils/http';
|
|
13
13
|
import { generateJWTToken, parseJwt } from './utils/token';
|
|
14
|
+
import { apiRequest } from './utils/apiRequest';
|
|
14
15
|
/**
|
|
15
16
|
* Services
|
|
16
17
|
*/
|
|
@@ -19,7 +20,6 @@ import CommentService, { CommentApiClient, CommentApiClientInterface } from './s
|
|
|
19
20
|
import CustomAdvService, { CustomAdvApiClient, CustomAdvApiClientInterface } from './services/custom_adv';
|
|
20
21
|
import CustomPageService, { CustomPageApiClient, CustomPageApiClientInterface } from './services/custom_page';
|
|
21
22
|
import DataPortabilityService, { DataPortabilityApiClient, DataPortabilityApiClientInterface } from './services/data_portability';
|
|
22
|
-
import DynamicPreferenceService, { DynamicPreferenceApiClient, DynamicPreferenceApiClientInterface } from './services/dynamic_preference';
|
|
23
23
|
import EmbedService, { EmbedApiClient, EmbedApiClientInterface } from './services/embed';
|
|
24
24
|
import FeatureService, { FeatureApiClient, FeatureApiClientInterface } from './services/feature';
|
|
25
25
|
import FeedService, { FeedApiClient, FeedApiClientInterface } from './services/feed';
|
|
@@ -40,8 +40,12 @@ import SuggestionService, { SuggestionApiClient, SuggestionApiClientInterface }
|
|
|
40
40
|
import TagService, { TagApiClient, TagApiClientInterface } from './services/tag';
|
|
41
41
|
import UserService, { UserApiClient, UserApiClientInterface } from './services/user';
|
|
42
42
|
import WebhookService, { WebhookApiClient, WebhookApiClientInterface } from './services/webhook';
|
|
43
|
+
/**
|
|
44
|
+
* Types
|
|
45
|
+
*/
|
|
46
|
+
import { SCPaginatedResponse, WebhookParamType, WebhookEventsType } from './types';
|
|
43
47
|
/**
|
|
44
48
|
* Export all
|
|
45
49
|
*/
|
|
46
|
-
export { http, HttpResponse, HttpMethod, formatHttpError, generateJWTToken, parseJwt, Endpoints, EndpointType, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface,
|
|
50
|
+
export { http, HttpResponse, HttpMethod, apiRequest, formatHttpError, generateJWTToken, parseJwt, Endpoints, EndpointType, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface, EmbedService, EmbedApiClient, EmbedApiClientInterface, FeedService, FeedApiClient, FeedApiClientInterface, FeedObjectService, FeedObjectApiClient, FeedObjectApiClientInterface, IncubatorService, IncubatorApiClient, IncubatorApiClientInterface, InsightService, InsightApiClient, InsightApiClientInterface, LegalPageService, LegalPageApiClient, LegalPageApiClientInterface, LocalityService, LocalityApiClient, LocalityApiClientInterface, LoyaltyService, LoyaltyApiClient, LoyaltyApiClientInterface, MediaService, MediaApiClient, MediaApiClientInterface, ModerationService, ModerationApiClient, ModerationApiClientInterface, NotificationService, NotificationApiClient, NotificationApiClientInterface, PrivateMessageService, PrivateMessageApiClient, PrivateMessageApiClientInterface, ScoreService, ScoreApiClient, ScoreApiClientInterface, SSOService, SSOApiClient, SSOApiClientInterface, SuggestionService, SuggestionApiClient, SuggestionApiClientInterface, TagService, TagApiClient, TagApiClientInterface, WebhookService, WebhookApiClient, WebhookApiClientInterface, SCPaginatedResponse, WebhookParamType, WebhookEventsType };
|
|
47
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,IAAI,EAAE,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,OAAO,SAAS,EAAE,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,OAAO,EAAC,e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