files.com 1.0.345 → 1.0.347
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/README.md +13 -13
- package/_VERSION +1 -1
- package/docs/models/WebhookTest.md +3 -0
- package/lib/Files.js +1 -1
- package/lib/models/WebhookTest.js +8 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/WebhookTest.js +8 -0
package/README.md
CHANGED
@@ -16,7 +16,7 @@ or
|
|
16
16
|
|
17
17
|
### Import and initialize
|
18
18
|
|
19
|
-
import Files from 'files.com/lib/Files'
|
19
|
+
import Files from 'files.com/lib/Files.js'
|
20
20
|
|
21
21
|
// set your subdomain or custom domain
|
22
22
|
Files.setBaseUrl('https://MY-SUBDOMAIN.files.com')
|
@@ -27,11 +27,11 @@ The examples provided in the documentation here use the newer ES6 `import` synta
|
|
27
27
|
instead use the older CommonJS module syntax with `require()`, ensure that `.default`
|
28
28
|
is included. For example:
|
29
29
|
|
30
|
-
const Files = require('files.com/lib/Files').default
|
31
|
-
const User = require('files.com/lib/models/User').default
|
30
|
+
const Files = require('files.com/lib/Files.js').default
|
31
|
+
const User = require('files.com/lib/models/User.js').default
|
32
32
|
|
33
33
|
// destructure to directly assign a named export
|
34
|
-
const { LogLevel } = require('files.com/lib/Logger').default
|
34
|
+
const { LogLevel } = require('files.com/lib/Logger.js').default
|
35
35
|
|
36
36
|
### Authentication
|
37
37
|
|
@@ -47,14 +47,14 @@ You can set an API key globally like this:
|
|
47
47
|
|
48
48
|
Or, you can pass an API key per-request, in the options object at the end of every method like this:
|
49
49
|
|
50
|
-
import User from 'files.com/lib/models/User'
|
50
|
+
import User from 'files.com/lib/models/User.js'
|
51
51
|
const user = new User(params, { apiKey: 'my-api-key' })
|
52
52
|
|
53
53
|
#### User Session
|
54
54
|
|
55
55
|
Or, you can open a user session by calling `Session.create()`
|
56
56
|
|
57
|
-
import Session from 'files.com/lib/models/Session'
|
57
|
+
import Session from 'files.com/lib/models/Session.js'
|
58
58
|
const session = await Session.create({ username, password })
|
59
59
|
|
60
60
|
Then use it globally for all subsequent API calls like this:
|
@@ -63,7 +63,7 @@ Then use it globally for all subsequent API calls like this:
|
|
63
63
|
|
64
64
|
Or, you can pass the session ID per-request, in the options array at the end of every method like this:
|
65
65
|
|
66
|
-
import User from 'files.com/lib/models/User'
|
66
|
+
import User from 'files.com/lib/models/User.js'
|
67
67
|
const user = new User(params, { sessionId: session.id })
|
68
68
|
|
69
69
|
### Setting Global Options
|
@@ -72,7 +72,7 @@ You can set the following global properties using static methods on the `Files`
|
|
72
72
|
|
73
73
|
#### Log Level
|
74
74
|
|
75
|
-
import { LogLevel } from 'files.com/lib/Logger'
|
75
|
+
import { LogLevel } from 'files.com/lib/Logger.js'
|
76
76
|
Files.setLogLevel(LogLevel.INFO)
|
77
77
|
|
78
78
|
/*
|
@@ -117,13 +117,13 @@ You can set the following global properties using static methods on the `Files`
|
|
117
117
|
|
118
118
|
#### List root folder
|
119
119
|
|
120
|
-
import Folder from 'files.com/lib/models/Folder'
|
120
|
+
import Folder from 'files.com/lib/models/Folder.js'
|
121
121
|
const dirFiles = await Folder.listFor('/')
|
122
122
|
|
123
123
|
#### Uploading a file
|
124
124
|
|
125
|
-
import File from 'files.com/lib/models/File'
|
126
|
-
import { isBrowser } from 'files.com/lib/utils'
|
125
|
+
import File from 'files.com/lib/models/File.js'
|
126
|
+
import { isBrowser } from 'files.com/lib/utils.js'
|
127
127
|
|
128
128
|
// uploading raw file data
|
129
129
|
await File.uploadData(destinationFileName, data)
|
@@ -137,14 +137,14 @@ You can set the following global properties using static methods on the `Files`
|
|
137
137
|
|
138
138
|
##### Get a downloadable file object by path
|
139
139
|
|
140
|
-
import File from 'files.com/lib/models/File'
|
140
|
+
import File from 'files.com/lib/models/File.js'
|
141
141
|
|
142
142
|
const foundFile = await File.find(remoteFilePath)
|
143
143
|
const downloadableFile = await foundFile.download()
|
144
144
|
|
145
145
|
##### Download a file (not available in browser)
|
146
146
|
|
147
|
-
import { isBrowser } from 'files.com/lib/utils'
|
147
|
+
import { isBrowser } from 'files.com/lib/utils.js'
|
148
148
|
|
149
149
|
if (!isBrowser()) {
|
150
150
|
// download to a file on disk
|
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.347
|
@@ -26,6 +26,7 @@
|
|
26
26
|
* `file_as_body` (boolean): Send the file data as the request body?
|
27
27
|
* `file_form_field` (string): Send the file data as a named parameter in the request POST body
|
28
28
|
* `action` (string): action for test body
|
29
|
+
* `use_dedicated_ips` (boolean): Use dedicated IPs for sending the webhook?
|
29
30
|
|
30
31
|
---
|
31
32
|
|
@@ -42,6 +43,7 @@ await WebhookTest.create({
|
|
42
43
|
'file_as_body': true,
|
43
44
|
'file_form_field': "upload_file_data",
|
44
45
|
'action': "test",
|
46
|
+
'use_dedicated_ips': true,
|
45
47
|
})
|
46
48
|
```
|
47
49
|
|
@@ -57,3 +59,4 @@ await WebhookTest.create({
|
|
57
59
|
* `file_as_body` (boolean): Send the file data as the request body?
|
58
60
|
* `file_form_field` (string): Send the file data as a named parameter in the request POST body
|
59
61
|
* `action` (string): action for test body
|
62
|
+
* `use_dedicated_ips` (boolean): Use dedicated IPs for sending the webhook?
|
package/lib/Files.js
CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
|
|
11
11
|
var apiKey;
|
12
12
|
var baseUrl = 'https://app.files.com';
|
13
13
|
var sessionId = null;
|
14
|
-
var version = "1.0.
|
14
|
+
var version = "1.0.347";
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
17
17
|
var debugRequest = false;
|
@@ -130,6 +130,13 @@ var WebhookTest = /*#__PURE__*/(0, _createClass2.default)(function WebhookTest()
|
|
130
130
|
(0, _defineProperty2.default)(this, "setAction", function (value) {
|
131
131
|
_this.attributes.action = value;
|
132
132
|
});
|
133
|
+
// boolean # Use dedicated IPs for sending the webhook?
|
134
|
+
(0, _defineProperty2.default)(this, "getUseDedicatedIps", function () {
|
135
|
+
return _this.attributes.use_dedicated_ips;
|
136
|
+
});
|
137
|
+
(0, _defineProperty2.default)(this, "setUseDedicatedIps", function (value) {
|
138
|
+
_this.attributes.use_dedicated_ips = value;
|
139
|
+
});
|
133
140
|
(0, _defineProperty2.default)(this, "save", function () {
|
134
141
|
if (_this.attributes['id']) {
|
135
142
|
throw new errors.NotImplementedError('The WebhookTest object doesn\'t support updates.');
|
@@ -163,6 +170,7 @@ _class = WebhookTest;
|
|
163
170
|
// file_as_body - boolean - Send the file data as the request body?
|
164
171
|
// file_form_field - string - Send the file data as a named parameter in the request POST body
|
165
172
|
// action - string - action for test body
|
173
|
+
// use_dedicated_ips - boolean - Use dedicated IPs for sending the webhook?
|
166
174
|
(0, _defineProperty2.default)(WebhookTest, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
167
175
|
var params,
|
168
176
|
options,
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
@@ -121,6 +121,13 @@ class WebhookTest {
|
|
121
121
|
this.attributes.action = value
|
122
122
|
}
|
123
123
|
|
124
|
+
// boolean # Use dedicated IPs for sending the webhook?
|
125
|
+
getUseDedicatedIps = () => this.attributes.use_dedicated_ips
|
126
|
+
|
127
|
+
setUseDedicatedIps = value => {
|
128
|
+
this.attributes.use_dedicated_ips = value
|
129
|
+
}
|
130
|
+
|
124
131
|
|
125
132
|
save = () => {
|
126
133
|
if (this.attributes['id']) {
|
@@ -142,6 +149,7 @@ class WebhookTest {
|
|
142
149
|
// file_as_body - boolean - Send the file data as the request body?
|
143
150
|
// file_form_field - string - Send the file data as a named parameter in the request POST body
|
144
151
|
// action - string - action for test body
|
152
|
+
// use_dedicated_ips - boolean - Use dedicated IPs for sending the webhook?
|
145
153
|
static create = async (params = {}, options = {}) => {
|
146
154
|
if (!params['url']) {
|
147
155
|
throw new errors.MissingParameterError('Parameter missing: url')
|