files.com 1.2.197 → 1.2.198

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 CHANGED
@@ -79,6 +79,9 @@ access to the entire API. If the user is not an administrator, you will only be
79
79
  that user can access, and no access will be granted to site administration functions in the API.
80
80
 
81
81
  ```javascript title="Example Request"
82
+ import Files from 'files.com/lib/Files';
83
+ import User from 'files.com/lib/models/User';
84
+
82
85
  Files.setApiKey('YOUR_API_KEY');
83
86
 
84
87
  // Alternatively, you can specify the API key on a per-object basis in the second parameter to a model constructor.
@@ -110,6 +113,8 @@ password.
110
113
  This returns a session object that can be used to authenticate SDK method calls.
111
114
 
112
115
  ```javascript title="Example Request"
116
+ import Session from 'files.com/lib/models/Session';
117
+
113
118
  const session = await Session.create({ username: 'motor', password: 'vroom' });
114
119
  ```
115
120
 
@@ -118,6 +123,9 @@ const session = await Session.create({ username: 'motor', password: 'vroom' });
118
123
  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.
119
124
 
120
125
  ```javascript title="Example Request"
126
+ import Files from 'files.com/lib/Files';
127
+ import User from 'files.com/lib/models/User';
128
+
121
129
  // You may set the returned session ID to be used by default for subsequent requests.
122
130
  Files.setSessionId(session.id);
123
131
 
@@ -133,6 +141,8 @@ await User.find(id, params, { session_id: session.id });
133
141
  User sessions can be ended calling the `destroy` method on the `session` object.
134
142
 
135
143
  ```javascript title="Example Request"
144
+ import Session from 'files.com/lib/models/Session';
145
+
136
146
  await Session.destroy();
137
147
  ```
138
148
 
@@ -148,6 +158,8 @@ Setting the base URL for the API is required if your site is configured to disab
148
158
  This can also be set to use a mock server in development or CI.
149
159
 
150
160
  ```javascript title="Example setting"
161
+ import Files from 'files.com/lib/Files';
162
+
151
163
  Files.setBaseUrl("https://MY-SUBDOMAIN.files.com");
152
164
  ```
153
165
 
@@ -162,7 +174,8 @@ Supported values:
162
174
  * LogLevel.DEBUG
163
175
 
164
176
  ```javascript title="Example setting"
165
- import { LogLevel } from 'files.com/lib/Logger.js';
177
+ import Files from 'files.com/lib/Files';
178
+ import { LogLevel } from 'files.com/lib/Logger';
166
179
 
167
180
  Files.setLogLevel(LogLevel.INFO);
168
181
  ```
@@ -172,6 +185,8 @@ Files.setLogLevel(LogLevel.INFO);
172
185
  Enable debug logging of API requests and/or response headers. Both settings default to `false`.
173
186
 
174
187
  ```javascript title="Example setting"
188
+ import Files from 'files.com/lib/Files';
189
+
175
190
  Files.configureDebugging({
176
191
  debugRequest: true,
177
192
  debugResponseHeaders: true,
@@ -181,6 +196,8 @@ Files.configureDebugging({
181
196
  #### Network Settings
182
197
 
183
198
  ```javascript title="Example setting"
199
+ import Files from 'files.com/lib/Files';
200
+
184
201
  Files.configureNetwork({
185
202
  // max retries (default: 3)
186
203
  maxNetworkRetries: 3,
@@ -215,7 +232,7 @@ The argument value is a Javascript object that has a property of the resource fi
215
232
  a value of either ```"asc"``` or ```"desc"``` to specify the sort order.
216
233
 
217
234
  ```javascript title="Sort Example"
218
- Files.setApiKey('my-key');
235
+ import User from 'files.com/lib/models/User';
219
236
 
220
237
  // Users, sorted by username in ascending order.
221
238
  const users = await User.list({
@@ -251,7 +268,7 @@ to filter on and a passed in value to use in the filter comparison.
251
268
  | `filter_lteq` | Range | Find resources that have a field value that is less than or equal to the passed in value. (i.e., FIELD_VALUE \<= PASS_IN_VALUE). |
252
269
 
253
270
  ```javascript title="Exact Filter Example"
254
- Files.setApiKey('my-key');
271
+ import User from 'files.com/lib/models/User';
255
272
 
256
273
  // Users who are not site admins.
257
274
  const users = await User.list({
@@ -264,7 +281,7 @@ users.forEach(user => {
264
281
  ```
265
282
 
266
283
  ```javascript title="Range Filter Example"
267
- Files.setApiKey('my-key');
284
+ import User from 'files.com/lib/models/User';
268
285
 
269
286
  // Users who haven't logged in since 2024-01-01.
270
287
  const users = await User.list({
@@ -277,7 +294,7 @@ users.forEach(user => {
277
294
  ```
278
295
 
279
296
  ```javascript title="Pattern Filter Example"
280
- Files.setApiKey('my-key');
297
+ import User from 'files.com/lib/models/User';
281
298
 
282
299
  // Users whose usernames start with 'test'.
283
300
  const users = await User.list({
@@ -290,7 +307,7 @@ users.forEach(user => {
290
307
  ```
291
308
 
292
309
  ```javascript title="Combination Filter with Sort Example"
293
- Files.setApiKey('my-key');
310
+ import User from 'files.com/lib/models/User';
294
311
 
295
312
  // Users whose usernames start with 'test' and are not site admins, sorted by last login date.
296
313
  const users = await User.list({
@@ -322,8 +339,8 @@ Use standard Javascript exception handling to detect and deal with errors. It i
322
339
  catch the general `FilesError` exception as a catch-all.
323
340
 
324
341
  ```javascript title="Example Error Handling"
325
- import Session from 'files.com/lib/models/Session.js';
326
- import * as FilesErrors from 'files.com/lib/Errors.js';
342
+ import Session from 'files.com/lib/models/Session';
343
+ import * as FilesErrors from 'files.com/lib/Errors';
327
344
 
328
345
  try {
329
346
  const session = await Session.create({ username: 'USERNAME', password: 'BADPASSWORD' });
@@ -346,7 +363,7 @@ SDK errors are general errors that occur within the SDK code. These errors gene
346
363
  exception classes inherit from a standard `FilesError` base class.
347
364
 
348
365
  ```javascript title="Example SDK Exception Class Inheritance Structure"
349
- import * as FilesErrors from 'files.com/lib/Errors.js'
366
+ import * as FilesErrors from 'files.com/lib/Errors'
350
367
 
351
368
  FilesErrors.ConfigurationError ->
352
369
  FilesErrors.FilesError ->
@@ -367,8 +384,8 @@ Error
367
384
  API errors are errors returned by the Files.com API. Each exception class inherits from an error group base class.
368
385
  The error group base class indicates a particular type of error.
369
386
 
370
- ```shell title="Example API Exception Class Inheritance Structure"
371
- import * as FilesErrors from 'files.com/lib/Errors.js'
387
+ ```javascript title="Example API Exception Class Inheritance Structure"
388
+ import * as FilesErrors from 'files.com/lib/Errors'
372
389
 
373
390
  FilesErrors.NotAuthorized_FolderAdminPermissionRequiredError ->
374
391
  FilesErrors.NotAuthorizedError ->
@@ -562,7 +579,7 @@ when handling errors related to duplicate file names and when developing tools f
562
579
  synchronization.
563
580
 
564
581
  ```javascript title="Compare Case-Insensitive Files and Paths"
565
- import { pathNormalizer } from 'files.com/lib/utils.js';
582
+ import { pathNormalizer } from 'files.com/lib/utils';
566
583
 
567
584
  if (pathNormalizer.same('Fïłèńämê.Txt', 'filename.txt')) {
568
585
  // the paths are the same
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.197
1
+ 1.2.198
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.197';
14
+ var version = '1.2.198';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.197",
3
+ "version": "1.2.198",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- const version = '1.2.197'
8
+ const version = '1.2.198'
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO