Made file and space existence validation optional

This commit is contained in:
David Wakelin 2021-08-17 12:43:07 +01:00
parent de7d7c7722
commit aa5450538b
5 changed files with 44 additions and 35 deletions

View file

@ -39,18 +39,15 @@ Rather obtain an instance from `\SpacesAPI\Space::list()`, `\SpacesAPI\Spaces::f
**Description**
```php
__construct (\SpacesAPI\Space $space, string $filename, array $info = [])
__construct (\SpacesAPI\Space $space, string $filename, array $info = [], bool $validate = true)
```
**Parameters**
* `(\SpacesAPI\Space) $space` : An instance of `\SpacesAPI\Space`
* `(string) $filename` : The filename of a file
* `(array) $info` : Any information already known about the file (eg content_length, content_type, etc). Default `[]`
* `(bool) $validate` : Check that the file exists. Default `true`
**Return Values**
@ -58,7 +55,7 @@ Rather obtain an instance from `\SpacesAPI\Space::list()`, `\SpacesAPI\Spaces::f
**Throws Exceptions**
`\SpacesAPI\Exceptions\FileDoesntExistException` : If the file doesn't exist
`\SpacesAPI\Exceptions\FileDoesntExistException` : If validation is `true` and the file doesn't exist
<hr />

View file

@ -37,7 +37,7 @@ Rather obtain an instance from `\SpacesAPI\Spaces::space()` or `\SpacesAPI\Space
**Description**
```php
public __construct (\Aws\S3\S3Client $s3, string $name)
public __construct (\Aws\S3\S3Client $s3, string $name, bool $validate = true)
```
Load a space
@ -51,6 +51,8 @@ rather obtain an instance from `\SpacesAPI\Spaces::space()` or `\SpacesAPI\Space
: An authenticated S3Client instance
* `(string) $name`
: Space name
* `(bool) $validate`
: Check that the space exists. Default `true`
**Return Values**
@ -60,7 +62,7 @@ rather obtain an instance from `\SpacesAPI\Spaces::space()` or `\SpacesAPI\Space
**Throws Exceptions**
`\SpacesAPI\Exceptions\SpaceDoesntExistException` : If the space doesn't exist
`\SpacesAPI\Exceptions\SpaceDoesntExistException` : If validation is `true` and the space doesn't exist
<hr />
@ -314,7 +316,7 @@ Is file listing enabled?
**Description**
```php
public listFiles (string $directory, string|null $continuationToken = null)
public listFiles (string $directory = "")
```
List all files in the space (recursively)
@ -325,8 +327,6 @@ List all files in the space (recursively)
* `(string) $directory`
: The directory to list files in. Empty string for root directory
* `(string|null) $continuationToken`
: Used internally to work around request limits (1000 files per request). Leave this value `null`
**Return Values**