files.com 1.2.16 → 1.2.18
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +21 -2
- package/_VERSION +1 -1
- package/docs/models/Site.md +3 -1
- package/lib/Files.js +1 -1
- package/lib/models/Site.js +5 -1
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Site.js +4 -1
package/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
The Files.com JavaScript SDK provides convenient access to the Files.com API from applications written in JavaScript.
|
4
4
|
|
5
|
+
|
5
6
|
## Installation
|
6
7
|
|
7
8
|
To install the package:
|
@@ -12,8 +13,10 @@ or
|
|
12
13
|
|
13
14
|
npm install files.com
|
14
15
|
|
16
|
+
|
15
17
|
## Usage
|
16
18
|
|
19
|
+
|
17
20
|
### Import and initialize
|
18
21
|
|
19
22
|
```js
|
@@ -23,6 +26,7 @@ import Files from "files.com/lib/Files.js";
|
|
23
26
|
Files.setBaseUrl("https://MY-SUBDOMAIN.files.com");
|
24
27
|
```
|
25
28
|
|
29
|
+
|
26
30
|
#### `require()` vs. `import`
|
27
31
|
|
28
32
|
The examples provided in the documentation here use the newer ES6 `import` syntax. To
|
@@ -37,9 +41,11 @@ const User = require("files.com/lib/models/User.js").default;
|
|
37
41
|
const { LogLevel } = require("files.com/lib/Logger.js").default;
|
38
42
|
```
|
39
43
|
|
44
|
+
|
40
45
|
### Authentication
|
41
46
|
|
42
|
-
There are multiple ways to authenticate to the
|
47
|
+
There are multiple ways to authenticate to the Files.com SDK for Javascript.
|
48
|
+
|
43
49
|
|
44
50
|
#### Global API Key
|
45
51
|
|
@@ -47,6 +53,7 @@ You can set an API key globally like this:
|
|
47
53
|
|
48
54
|
Files.setApiKey('my-api-key')
|
49
55
|
|
56
|
+
|
50
57
|
#### Per-Request API Key
|
51
58
|
|
52
59
|
Or, you can pass an API key per-request, in the options object at the end of every method like this:
|
@@ -54,6 +61,7 @@ Or, you can pass an API key per-request, in the options object at the end of eve
|
|
54
61
|
import User from 'files.com/lib/models/User.js'
|
55
62
|
const user = new User(params, { apiKey: 'my-api-key' })
|
56
63
|
|
64
|
+
|
57
65
|
#### User Session
|
58
66
|
|
59
67
|
Or, you can open a user session by calling `Session.create()`
|
@@ -70,10 +78,12 @@ Or, you can pass the session ID per-request, in the options array at the end of
|
|
70
78
|
import User from 'files.com/lib/models/User.js'
|
71
79
|
const user = new User(params, { sessionId: session.id })
|
72
80
|
|
81
|
+
|
73
82
|
### Setting Global Options
|
74
83
|
|
75
84
|
You can set the following global properties using static methods on the `Files` class:
|
76
85
|
|
86
|
+
|
77
87
|
#### Log Level
|
78
88
|
|
79
89
|
import { LogLevel } from 'files.com/lib/Logger.js'
|
@@ -88,6 +98,7 @@ You can set the following global properties using static methods on the `Files`
|
|
88
98
|
LogLevel.DEBUG
|
89
99
|
*/
|
90
100
|
|
101
|
+
|
91
102
|
#### Debugging
|
92
103
|
|
93
104
|
Files.configureDebugging({
|
@@ -98,6 +109,7 @@ You can set the following global properties using static methods on the `Files`
|
|
98
109
|
debugResponseHeaders: false,
|
99
110
|
})
|
100
111
|
|
112
|
+
|
101
113
|
#### Network
|
102
114
|
|
103
115
|
Files.configureNetwork({
|
@@ -117,13 +129,16 @@ You can set the following global properties using static methods on the `Files`
|
|
117
129
|
autoPaginate: true,
|
118
130
|
})
|
119
131
|
|
132
|
+
|
120
133
|
### File Operations
|
121
134
|
|
135
|
+
|
122
136
|
#### List root folder
|
123
137
|
|
124
138
|
import Folder from 'files.com/lib/models/Folder.js'
|
125
139
|
const dirFiles = await Folder.listFor('/')
|
126
140
|
|
141
|
+
|
127
142
|
#### Uploading a file
|
128
143
|
|
129
144
|
import File from 'files.com/lib/models/File.js'
|
@@ -137,6 +152,7 @@ You can set the following global properties using static methods on the `Files`
|
|
137
152
|
await File.uploadFile(destinationFileName, sourceFilePath)
|
138
153
|
}
|
139
154
|
|
155
|
+
|
140
156
|
#### Downloading a file
|
141
157
|
|
142
158
|
##### Get a downloadable file object by path
|
@@ -146,6 +162,7 @@ You can set the following global properties using static methods on the `Files`
|
|
146
162
|
const foundFile = await File.find(remoteFilePath)
|
147
163
|
const downloadableFile = await foundFile.download()
|
148
164
|
|
165
|
+
|
149
166
|
##### Download a file (not available in browser)
|
150
167
|
|
151
168
|
import { isBrowser } from 'files.com/lib/utils.js'
|
@@ -161,6 +178,7 @@ You can set the following global properties using static methods on the `Files`
|
|
161
178
|
const textContent = await downloadableFile.downloadToString()
|
162
179
|
}
|
163
180
|
|
181
|
+
|
164
182
|
#### Comparing Case insensitive files and paths
|
165
183
|
|
166
184
|
For related documentation see [Case Sensitivity Documentation](https://www.files.com/docs/files-and-folders/file-system-semantics/case-sensitivity).
|
@@ -171,13 +189,14 @@ For related documentation see [Case Sensitivity Documentation](https://www.files
|
|
171
189
|
// the paths are the same
|
172
190
|
}
|
173
191
|
|
192
|
+
|
174
193
|
### Additional Object Documentation
|
175
194
|
|
176
195
|
Additional docs are available at <https://developers.files.com>
|
177
196
|
|
197
|
+
|
178
198
|
## Getting Support
|
179
199
|
|
180
200
|
The Files.com team is happy to help with any SDK Integration challenges you may face.
|
181
201
|
|
182
202
|
Just email <support@files.com> and we'll get the process started.
|
183
|
-
|
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.18
|
package/docs/models/Site.md
CHANGED
@@ -137,6 +137,7 @@
|
|
137
137
|
"phone": "555-555-5555",
|
138
138
|
"pin_all_remote_servers_to_site_region": true,
|
139
139
|
"prevent_root_permissions_for_non_site_admins": true,
|
140
|
+
"protocol_access_groups_only": true,
|
140
141
|
"require_2fa": true,
|
141
142
|
"require_2fa_stop_time": "2000-01-01T01:00:00Z",
|
142
143
|
"require_2fa_user_type": "`site_admins`",
|
@@ -377,6 +378,7 @@
|
|
377
378
|
* `phone` (string): Site phone number
|
378
379
|
* `pin_all_remote_servers_to_site_region` (boolean): If true, we will ensure that all internal communications with any remote server are made through the primary region of the site. This setting overrides individual remote server settings.
|
379
380
|
* `prevent_root_permissions_for_non_site_admins` (boolean): If true, we will prevent non-administrators from receiving any permissions directly on the root folder. This is commonly used to prevent the accidental application of permissions.
|
381
|
+
* `protocol_access_groups_only` (boolean): If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
380
382
|
* `require_2fa` (boolean): Require two-factor authentication for all users?
|
381
383
|
* `require_2fa_stop_time` (date-time): If set, requirement for two-factor authentication has been scheduled to end on this date-time.
|
382
384
|
* `require_2fa_user_type` (string): What type of user is required to use two-factor authentication (when require_2fa is set to `true` for this site)?
|
@@ -673,7 +675,7 @@ await Site.update({
|
|
673
675
|
* `sftp_enabled` (boolean): Is SFTP enabled?
|
674
676
|
* `sftp_host_key_type` (string): Sftp Host Key Type
|
675
677
|
* `active_sftp_host_key_id` (int64): Id of the currently selected custom SFTP Host Key
|
676
|
-
* `protocol_access_groups_only` (boolean): If
|
678
|
+
* `protocol_access_groups_only` (boolean): If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
677
679
|
* `bundle_watermark_value` (object): Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
678
680
|
* `group_admins_can_set_user_password` (boolean): Allow group admins set password authentication method
|
679
681
|
* `bundle_recipient_blacklist_free_email_domains` (boolean): Disallow free email domains for Bundle/Inbox recipients?
|
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.2.
|
14
|
+
var version = '1.2.18';
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
17
17
|
var debugRequest = false;
|
package/lib/models/Site.js
CHANGED
@@ -465,6 +465,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
465
465
|
(0, _defineProperty2.default)(this, "getPreventRootPermissionsForNonSiteAdmins", function () {
|
466
466
|
return _this.attributes.prevent_root_permissions_for_non_site_admins;
|
467
467
|
});
|
468
|
+
// boolean # If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
469
|
+
(0, _defineProperty2.default)(this, "getProtocolAccessGroupsOnly", function () {
|
470
|
+
return _this.attributes.protocol_access_groups_only;
|
471
|
+
});
|
468
472
|
// boolean # Require two-factor authentication for all users?
|
469
473
|
(0, _defineProperty2.default)(this, "getRequire2fa", function () {
|
470
474
|
return _this.attributes.require_2fa;
|
@@ -780,7 +784,7 @@ _Site = Site;
|
|
780
784
|
// sftp_enabled - boolean - Is SFTP enabled?
|
781
785
|
// sftp_host_key_type - string - Sftp Host Key Type
|
782
786
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
783
|
-
// protocol_access_groups_only - boolean - If
|
787
|
+
// protocol_access_groups_only - boolean - If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
784
788
|
// bundle_watermark_value - object - Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
785
789
|
// group_admins_can_set_user_password - boolean - Allow group admins set password authentication method
|
786
790
|
// bundle_recipient_blacklist_free_email_domains - boolean - Disallow free email domains for Bundle/Inbox recipients?
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
package/src/models/Site.js
CHANGED
@@ -352,6 +352,9 @@ class Site {
|
|
352
352
|
// boolean # If true, we will prevent non-administrators from receiving any permissions directly on the root folder. This is commonly used to prevent the accidental application of permissions.
|
353
353
|
getPreventRootPermissionsForNonSiteAdmins = () => this.attributes.prevent_root_permissions_for_non_site_admins
|
354
354
|
|
355
|
+
// boolean # If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
356
|
+
getProtocolAccessGroupsOnly = () => this.attributes.protocol_access_groups_only
|
357
|
+
|
355
358
|
// boolean # Require two-factor authentication for all users?
|
356
359
|
getRequire2fa = () => this.attributes.require_2fa
|
357
360
|
|
@@ -582,7 +585,7 @@ class Site {
|
|
582
585
|
// sftp_enabled - boolean - Is SFTP enabled?
|
583
586
|
// sftp_host_key_type - string - Sftp Host Key Type
|
584
587
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
585
|
-
// protocol_access_groups_only - boolean - If
|
588
|
+
// protocol_access_groups_only - boolean - If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
586
589
|
// bundle_watermark_value - object - Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
587
590
|
// group_admins_can_set_user_password - boolean - Allow group admins set password authentication method
|
588
591
|
// bundle_recipient_blacklist_free_email_domains - boolean - Disallow free email domains for Bundle/Inbox recipients?
|