files.com 1.2.17 → 1.2.18
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 +21 -2
- package/_VERSION +1 -1
- package/lib/Files.js +1 -1
- package/package.json +1 -1
- package/src/Files.js +1 -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/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/package.json
CHANGED
package/src/Files.js
CHANGED