files.com 1.2.121 → 1.2.123
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 +14 -14
- package/_VERSION +1 -1
- package/docs/models/Site.md +2 -0
- package/lib/Files.js +1 -1
- package/lib/models/Site.js +4 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Site.js +3 -0
package/README.md
CHANGED
@@ -13,7 +13,7 @@ The JavaScript SDK uses the Files.com RESTful APIs via the HTTPS protocol (port
|
|
13
13
|
|
14
14
|
### JavaScript is a Core Focus at Files.com
|
15
15
|
|
16
|
-
This SDK is used internally by
|
16
|
+
This SDK is used internally by several Files.com integrations that we maintain, and we work hard to ensure that it is always up to date and performant.
|
17
17
|
|
18
18
|
It is also a very popular choice for Files.com customers looking to integrate with Files.com.
|
19
19
|
|
@@ -33,7 +33,7 @@ npm install files.com
|
|
33
33
|
|
34
34
|
### Usage
|
35
35
|
|
36
|
-
#### Import and
|
36
|
+
#### Import and Initialize
|
37
37
|
|
38
38
|
```js
|
39
39
|
import Files from "files.com/lib/Files.js";
|
@@ -100,7 +100,7 @@ session times out, simply create a new session and resume where you left off. Th
|
|
100
100
|
automatically handled by SDKs because we do not want to store password information in memory without
|
101
101
|
your explicit consent.
|
102
102
|
|
103
|
-
#### Logging
|
103
|
+
#### Logging In
|
104
104
|
|
105
105
|
To create a session, the `create` method is called on the `Session` object with the user's username and
|
106
106
|
password.
|
@@ -111,7 +111,7 @@ This returns a session object that can be used to authenticate SDK method calls.
|
|
111
111
|
const session = await Session.create({ username: 'motor', password: 'vroom' })
|
112
112
|
```
|
113
113
|
|
114
|
-
#### Using a
|
114
|
+
#### Using a Session
|
115
115
|
|
116
116
|
Once a session has been created, you can store the session globally, use the session per object, or use the session per request to authenticate SDK operations.
|
117
117
|
|
@@ -126,7 +126,7 @@ const user = new User(params, { session_id: session.id })
|
|
126
126
|
await User.find(id, params, { session_id: session.id })
|
127
127
|
```
|
128
128
|
|
129
|
-
#### Logging
|
129
|
+
#### Logging Out
|
130
130
|
|
131
131
|
User sessions can be ended calling the `destroy` method on the `session` object.
|
132
132
|
|
@@ -136,7 +136,7 @@ await Session.destroy()
|
|
136
136
|
|
137
137
|
## Configuration
|
138
138
|
|
139
|
-
### Configuration
|
139
|
+
### Configuration Options
|
140
140
|
|
141
141
|
#### Base URL
|
142
142
|
|
@@ -147,7 +147,7 @@ This can also be set to use a mock server in development or CI.
|
|
147
147
|
Files.setBaseUrl("https://MY-SUBDOMAIN.files.com");
|
148
148
|
```
|
149
149
|
|
150
|
-
#### Log
|
150
|
+
#### Log Level
|
151
151
|
|
152
152
|
Supported values:
|
153
153
|
|
@@ -173,7 +173,7 @@ Files.configureDebugging({
|
|
173
173
|
})
|
174
174
|
```
|
175
175
|
|
176
|
-
#### Network
|
176
|
+
#### Network Settings
|
177
177
|
|
178
178
|
```javascript title="Example setting"
|
179
179
|
Files.configureNetwork({
|
@@ -443,14 +443,14 @@ Error
|
|
443
443
|
|
444
444
|
### File Operations
|
445
445
|
|
446
|
-
#### List
|
446
|
+
#### List Root Folder
|
447
447
|
|
448
448
|
```javascript
|
449
449
|
import Folder from 'files.com/lib/models/Folder.js'
|
450
450
|
const dirFiles = await Folder.listFor('/')
|
451
451
|
```
|
452
452
|
|
453
|
-
#### Uploading a
|
453
|
+
#### Uploading a File
|
454
454
|
|
455
455
|
```javascript
|
456
456
|
import File from 'files.com/lib/models/File.js'
|
@@ -465,9 +465,9 @@ if (!isBrowser()) {
|
|
465
465
|
}
|
466
466
|
```
|
467
467
|
|
468
|
-
#### Downloading a
|
468
|
+
#### Downloading a File
|
469
469
|
|
470
|
-
##### Get a
|
470
|
+
##### Get a Downloadable File Object by Path
|
471
471
|
|
472
472
|
```javascript
|
473
473
|
import File from 'files.com/lib/models/File.js'
|
@@ -476,7 +476,7 @@ const foundFile = await File.find(remoteFilePath)
|
|
476
476
|
const downloadableFile = await foundFile.download()
|
477
477
|
```
|
478
478
|
|
479
|
-
##### Download a
|
479
|
+
##### Download a File (not available in browser)
|
480
480
|
|
481
481
|
```javascript
|
482
482
|
import { isBrowser } from 'files.com/lib/utils.js'
|
@@ -493,7 +493,7 @@ if (!isBrowser()) {
|
|
493
493
|
}
|
494
494
|
```
|
495
495
|
|
496
|
-
#### Comparing Case
|
496
|
+
#### Comparing Case-Insensitive Files and Paths
|
497
497
|
|
498
498
|
For related documentation see [Case Sensitivity Documentation](https://www.files.com/docs/files-and-folders/file-system-semantics/case-sensitivity).
|
499
499
|
|
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.123
|
package/docs/models/Site.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
```
|
6
6
|
{
|
7
|
+
"id": 1,
|
7
8
|
"name": "My Site",
|
8
9
|
"additional_text_file_types": [
|
9
10
|
"example"
|
@@ -285,6 +286,7 @@
|
|
285
286
|
}
|
286
287
|
```
|
287
288
|
|
289
|
+
* `id` (int64): Site Id
|
288
290
|
* `name` (string): Site name
|
289
291
|
* `additional_text_file_types` (array(string)): Additional extensions that are considered text files
|
290
292
|
* `allowed_2fa_method_sms` (boolean): Is SMS two factor authentication allowed?
|
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.123';
|
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
@@ -33,6 +33,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
33
33
|
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
34
34
|
return !!_this.attributes.id;
|
35
35
|
});
|
36
|
+
// int64 # Site Id
|
37
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
38
|
+
return _this.attributes.id;
|
39
|
+
});
|
36
40
|
// string # Site name
|
37
41
|
(0, _defineProperty2.default)(this, "getName", function () {
|
38
42
|
return _this.attributes.name;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED