swiftyper-node 1.0.4 → 1.0.5
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/Error.js +1 -1
- package/lib/SwiftyperResource.js +3 -2
- package/lib/resources/Fbt.js +13 -0
- package/lib/resources/Phrase.js +23 -0
- package/lib/resources.js +2 -0
- package/package.json +1 -1
package/lib/Error.js
CHANGED
package/lib/SwiftyperResource.js
CHANGED
|
@@ -192,8 +192,9 @@ SwiftyperResource.prototype = {
|
|
|
192
192
|
: this._swiftyper.getMaxNetworkRetries();
|
|
193
193
|
},
|
|
194
194
|
|
|
195
|
-
_makeHeaders(contentLength, method, userSuppliedHeaders) {
|
|
195
|
+
_makeHeaders(auth, contentLength, method, userSuppliedHeaders) {
|
|
196
196
|
const defaultHeaders = {
|
|
197
|
+
'X-Swiftyper-API-Key': auth || this._swiftyper.getApiField('auth'),
|
|
197
198
|
Accept: 'application/json',
|
|
198
199
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
199
200
|
'Content-Length': contentLength,
|
|
@@ -209,7 +210,6 @@ SwiftyperResource.prototype = {
|
|
|
209
210
|
let requestData;
|
|
210
211
|
|
|
211
212
|
data.__req = requests++;
|
|
212
|
-
data.api_key = auth ? auth : this._swiftyper.getApiField('auth');
|
|
213
213
|
|
|
214
214
|
const retryRequest = (requestFn, headers, requestRetries, retryAfter) => {
|
|
215
215
|
return setTimeout(
|
|
@@ -313,6 +313,7 @@ SwiftyperResource.prototype = {
|
|
|
313
313
|
requestData = data;
|
|
314
314
|
|
|
315
315
|
const headers = this._makeHeaders(
|
|
316
|
+
auth,
|
|
316
317
|
requestData.length,
|
|
317
318
|
method,
|
|
318
319
|
options.headers,
|
|
@@ -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: 'intl/fbt',
|
|
8
|
+
|
|
9
|
+
init: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/initialize',
|
|
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: 'intl/phrases',
|
|
8
|
+
|
|
9
|
+
query: swiftyperMethod({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/query',
|
|
12
|
+
}),
|
|
13
|
+
|
|
14
|
+
upload: swiftyperMethod({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: '/upload',
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
raw: swiftyperMethod({
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/raw',
|
|
22
|
+
}),
|
|
23
|
+
});
|
package/lib/resources.js
CHANGED