swiftyper-node 1.0.8 → 1.0.10
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/SwiftyperResource.js +8 -2
- package/lib/resources/HelpCenter.js +13 -0
- package/lib/resources/HelpCenterArticle.js +23 -0
- package/lib/resources/HelpCenterCategory.js +18 -0
- package/lib/resources/IpUtil.js +13 -0
- package/lib/resources/Translator.js +13 -0
- package/lib/resources/ViesUtil.js +13 -0
- package/lib/resources.js +6 -0
- package/package.json +1 -1
package/lib/SwiftyperResource.js
CHANGED
|
@@ -195,7 +195,9 @@ SwiftyperResource.prototype = {
|
|
|
195
195
|
_makeHeaders(contentLength, method, userSuppliedHeaders) {
|
|
196
196
|
const defaultHeaders = {
|
|
197
197
|
Accept: 'application/json',
|
|
198
|
-
'Content-Type': '
|
|
198
|
+
'Content-Type': method === 'GET'
|
|
199
|
+
? 'application/json'
|
|
200
|
+
: 'application/x-www-form-urlencoded',
|
|
199
201
|
'Content-Length': contentLength,
|
|
200
202
|
};
|
|
201
203
|
|
|
@@ -324,7 +326,11 @@ SwiftyperResource.prototype = {
|
|
|
324
326
|
return callback(error);
|
|
325
327
|
}
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
if (method === 'GET') {
|
|
330
|
+
requestData = JSON.stringify(transformRequestData(data));
|
|
331
|
+
} else {
|
|
332
|
+
requestData = utils.stringifyRequestData(data || {});
|
|
333
|
+
}
|
|
328
334
|
|
|
329
335
|
const headers = this._makeHeaders(
|
|
330
336
|
Buffer.byteLength(requestData, 'utf-8'),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'help-center',
|
|
8
|
+
|
|
9
|
+
configuration: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/configuration',
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'help-center/articles',
|
|
8
|
+
|
|
9
|
+
query: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/query',
|
|
12
|
+
}),
|
|
13
|
+
|
|
14
|
+
popular: swiftyperMethod({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: '/popular',
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
detail: swiftyperMethod({
|
|
20
|
+
method: 'POST',
|
|
21
|
+
path: '/{article_id}',
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'help-center/categories',
|
|
8
|
+
|
|
9
|
+
query: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/query',
|
|
12
|
+
}),
|
|
13
|
+
|
|
14
|
+
detail: swiftyperMethod({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: '/{category_id}',
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'utils/ip',
|
|
8
|
+
|
|
9
|
+
info: swiftyperMethod({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/{ip_address}',
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'utils/translator',
|
|
8
|
+
|
|
9
|
+
translate: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/translate',
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SwiftyperResource = require('../SwiftyperResource');
|
|
4
|
+
const swiftyperMethod = SwiftyperResource.method;
|
|
5
|
+
|
|
6
|
+
module.exports = SwiftyperResource.extend({
|
|
7
|
+
path: 'utils/vies',
|
|
8
|
+
|
|
9
|
+
checkVatNumber: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/check-vat-number',
|
|
12
|
+
}),
|
|
13
|
+
});
|
package/lib/resources.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
HelpCenterCategories: require('./resources/HelpCenterCategory'),
|
|
5
|
+
HelpCenterArticles: require('./resources/HelpCenterArticle'),
|
|
6
|
+
HelpCenter: require('./resources/HelpCenter'),
|
|
4
7
|
Translations: require('./resources/Translation'),
|
|
8
|
+
Translator: require('./resources/Translator'),
|
|
5
9
|
EmailUtil: require('./resources/EmailUtil'),
|
|
10
|
+
IpUtil: require('./resources/IpUtil'),
|
|
11
|
+
ViesUtil: require('./resources/ViesUtil'),
|
|
6
12
|
Business: require('./resources/Business'),
|
|
7
13
|
Phrases: require('./resources/Phrase'),
|
|
8
14
|
Places: require('./resources/Places'),
|