mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-07-16 10:03:01 -07:00
Added information about new functions.
Added examples of: 1) makePublic() 2) makePrivate() 3) Error Handling Also updated uploadFile() example to show the new privacy option.
This commit is contained in:
parent
2557aef44f
commit
d22328ffd2
1 changed files with 45 additions and 4 deletions
49
README.md
49
README.md
|
@ -24,9 +24,9 @@ All available options:
|
|||
|
||||
### Uploading/Downloading Files
|
||||
```php
|
||||
$path_to_file = "folder/image.png";
|
||||
$path_to_file = "image.png";
|
||||
|
||||
$space->uploadFile($path_to_file);
|
||||
$space->uploadFile($path_to_file, "public");
|
||||
|
||||
|
||||
|
||||
|
@ -36,14 +36,30 @@ $save_as = "folder/downloaded-image.png";
|
|||
$space->downloadFile($download_file, $save_as);
|
||||
```
|
||||
All available options:
|
||||
###### uploadFile(REQUIRED PATH TO FILE, OPTIONAL NAME TO SAVE FILE AS);
|
||||
###### downloadFile(REQUIRED FILE TO DOWNLOAD, REQUIRED LOCATION TO SAVE FILE);
|
||||
###### uploadFile(REQUIRED PATH TO FILE, OPTIONAL PRIVACY (public|private) OPTIONAL NAME TO SAVE FILE AS);
|
||||
###### downloadFile(REQUIRED FILE TO DOWNLOAD, REQUIRED LOCATION TO SAVE IN);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Changing Privacy Settings
|
||||
```php
|
||||
$file = "image.png";
|
||||
|
||||
$space->makePublic($file);
|
||||
$space->makePrivate($file);
|
||||
|
||||
```
|
||||
All available options:
|
||||
###### makePublic(REQUIRED PATH TO FILE);
|
||||
###### makePrivate(REQUIRED PATH TO FILE);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Creating Temporary Links
|
||||
```php
|
||||
|
@ -160,3 +176,28 @@ $acl = $space->listSpaceACL();
|
|||
$space->PutSpaceACL($new_acl);
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### Handling Errors
|
||||
|
||||
```php
|
||||
try {
|
||||
$space->createSpace("dev");
|
||||
} catch (\Exception $e) {
|
||||
$error = $space->GetError($e);
|
||||
|
||||
//Error management code.
|
||||
echo "<pre>";
|
||||
print_r($error);
|
||||
/*
|
||||
EG:
|
||||
Array (
|
||||
[message] => Bucket already exists
|
||||
[code] => BucketAlreadyExists
|
||||
[type] => client
|
||||
[http_code] => 409
|
||||
)
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue