files.com 1.2.178 → 1.2.180
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 +80 -20
- package/_VERSION +1 -1
- package/docs/Errors.md +1 -0
- package/docs/models/User.md +1 -1
- package/lib/Errors.js +676 -664
- package/lib/Files.js +1 -1
- package/lib/models/User.js +1 -1
- package/package.json +1 -1
- package/src/Errors.js +1 -0
- package/src/Files.js +1 -1
- package/src/models/User.js +1 -1
package/README.md
CHANGED
|
@@ -391,6 +391,7 @@ Error
|
|
|
391
391
|
| `BadRequest_InvalidFilterAliasCombinationError`| `BadRequestError` |
|
|
392
392
|
| `BadRequest_InvalidFilterFieldError`| `BadRequestError` |
|
|
393
393
|
| `BadRequest_InvalidFilterParamError`| `BadRequestError` |
|
|
394
|
+
| `BadRequest_InvalidFilterParamFormatError`| `BadRequestError` |
|
|
394
395
|
| `BadRequest_InvalidFilterParamValueError`| `BadRequestError` |
|
|
395
396
|
| `BadRequest_InvalidInputEncodingError`| `BadRequestError` |
|
|
396
397
|
| `BadRequest_InvalidInterfaceError`| `BadRequestError` |
|
|
@@ -545,28 +546,12 @@ Error
|
|
|
545
546
|
| `SiteConfiguration_TrialLockedError`| `SiteConfigurationError` |
|
|
546
547
|
| `SiteConfiguration_UserRequestsEnabledRequiredError`| `SiteConfigurationError` |
|
|
547
548
|
|
|
548
|
-
##
|
|
549
|
-
|
|
550
|
-
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
|
551
|
-
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
|
552
|
-
|
|
553
|
-
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
|
554
|
-
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
|
555
|
-
deeply inspect your submissions for correctness.
|
|
556
|
-
|
|
557
|
-
Eventually we will add more features intended for integration testing, such as the ability to
|
|
558
|
-
intentionally provoke errors.
|
|
559
|
-
|
|
560
|
-
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
|
561
|
-
|
|
562
|
-
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
|
563
|
-
|
|
564
|
-
A README is available on the GitHub link.
|
|
565
|
-
|
|
566
|
-
## File/Folder Operations
|
|
549
|
+
## Examples
|
|
567
550
|
|
|
568
551
|
### Upload
|
|
569
552
|
|
|
553
|
+
#### Upload a File
|
|
554
|
+
|
|
570
555
|
```javascript
|
|
571
556
|
import File from 'files.com/lib/models/File.js';
|
|
572
557
|
import { isBrowser } from 'files.com/lib/utils.js';
|
|
@@ -583,6 +568,16 @@ if (!isBrowser()) {
|
|
|
583
568
|
}
|
|
584
569
|
```
|
|
585
570
|
|
|
571
|
+
#### Create a Folder
|
|
572
|
+
|
|
573
|
+
```javascript
|
|
574
|
+
import Folder from 'files.com/lib/models/Folder.js';
|
|
575
|
+
|
|
576
|
+
await Folder.create('path/to/folder/to/be/created', {
|
|
577
|
+
mkdir_parents: true,
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
586
581
|
### Download
|
|
587
582
|
|
|
588
583
|
#### Get a Downloadable File Object by Path
|
|
@@ -613,10 +608,57 @@ if (!isBrowser()) {
|
|
|
613
608
|
|
|
614
609
|
### List
|
|
615
610
|
|
|
611
|
+
#### List Folder Contents
|
|
612
|
+
|
|
616
613
|
```javascript
|
|
617
614
|
import Folder from 'files.com/lib/models/Folder.js';
|
|
618
615
|
|
|
619
|
-
const
|
|
616
|
+
const items = await Folder.listFor('remote/path/to/folder/');
|
|
617
|
+
for (const item of items) {
|
|
618
|
+
console.log(item.path);
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Copy
|
|
623
|
+
|
|
624
|
+
The copy method works for both files and folders.
|
|
625
|
+
|
|
626
|
+
```javascript
|
|
627
|
+
import File from 'files.com/lib/models/File.js';
|
|
628
|
+
|
|
629
|
+
const file = new File({ path: 'source/path' });
|
|
630
|
+
await file.copy({ destination: 'destination/path' });
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### Move
|
|
634
|
+
|
|
635
|
+
The move method works for both files and folders.
|
|
636
|
+
|
|
637
|
+
```javascript
|
|
638
|
+
import File from 'files.com/lib/models/File.js';
|
|
639
|
+
|
|
640
|
+
const file = new File({ path: 'source/path' });
|
|
641
|
+
await file.move({ destination: 'destination/path' });
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### Delete
|
|
645
|
+
|
|
646
|
+
The delete method works for both files and folders.
|
|
647
|
+
|
|
648
|
+
```javascript
|
|
649
|
+
import File from 'files.com/lib/models/File.js';
|
|
650
|
+
|
|
651
|
+
const file = new File({ path: 'path/to/file/or/folder' });
|
|
652
|
+
await file.delete();
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
In case the folder is not empty, you can use the `recursive` argument:
|
|
656
|
+
|
|
657
|
+
```javascript
|
|
658
|
+
import File from 'files.com/lib/models/File.js';
|
|
659
|
+
|
|
660
|
+
const folder = new File({ path: 'path/to/folder' });
|
|
661
|
+
await folder.delete({ recursive: true });
|
|
620
662
|
```
|
|
621
663
|
|
|
622
664
|
### Comparing Case-Insensitive Files and Paths
|
|
@@ -630,3 +672,21 @@ if (pathNormalizer.same('Fïłèńämê.Txt', 'filename.txt')) {
|
|
|
630
672
|
// the paths are the same
|
|
631
673
|
}
|
|
632
674
|
```
|
|
675
|
+
|
|
676
|
+
## Mock Server
|
|
677
|
+
|
|
678
|
+
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
|
679
|
+
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
|
680
|
+
|
|
681
|
+
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
|
682
|
+
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
|
683
|
+
deeply inspect your submissions for correctness.
|
|
684
|
+
|
|
685
|
+
Eventually we will add more features intended for integration testing, such as the ability to
|
|
686
|
+
intentionally provoke errors.
|
|
687
|
+
|
|
688
|
+
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
|
689
|
+
|
|
690
|
+
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
|
691
|
+
|
|
692
|
+
A README is available on the GitHub link.
|
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.180
|
package/docs/Errors.md
CHANGED
|
@@ -62,6 +62,7 @@ These errors are derived from the error groups listed above.
|
|
|
62
62
|
### BadRequest_InvalidFilterAliasCombinationError
|
|
63
63
|
### BadRequest_InvalidFilterFieldError
|
|
64
64
|
### BadRequest_InvalidFilterParamError
|
|
65
|
+
### BadRequest_InvalidFilterParamFormatError
|
|
65
66
|
### BadRequest_InvalidFilterParamValueError
|
|
66
67
|
### BadRequest_InvalidInputEncodingError
|
|
67
68
|
### BadRequest_InvalidInterfaceError
|
package/docs/models/User.md
CHANGED
|
@@ -167,7 +167,7 @@ await User.list({
|
|
|
167
167
|
|
|
168
168
|
* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
169
169
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
170
|
-
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `
|
|
170
|
+
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `name`, `company`, `password_validity_days`, `ssl_required` or `username`.
|
|
171
171
|
* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `username`, `name`, `email`, `company`, `site_admin`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`. Valid field combinations are `[ not_site_admin, username ]` and `[ company, name ]`.
|
|
172
172
|
* `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
|
|
173
173
|
* `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
|