-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rene Schmidt
committed
Jan 16, 2016
1 parent
a2b8248
commit 714e158
Showing
2 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,6 +297,48 @@ or | |
print_r($avatarResource->getUserAvatarByEmail('[email protected]')->toArray()); | ||
``` | ||
|
||
### Create and remove shared link | ||
|
||
```php | ||
$libraryResource = new Library($client); | ||
$directoryResource = new Directory($client); | ||
$fileResource = new File($client); | ||
$sharedLinkResource = new SharedLink($client); | ||
|
||
// create share link for a file | ||
$expire = 5; | ||
$shareType = SharedLinkType::SHARE_TYPE_DOWNLOAD; | ||
$p = "/" . basename($newFilename); | ||
$password = 'qwertz123'; | ||
|
||
$shareLinkType = $sharedLinkResource->create($lib, $p, $expire, $shareType, $password); | ||
|
||
// remove shared link | ||
$success = $sharedLinkResource->remove($shareLinkType); | ||
``` | ||
|
||
### Get all starred files, star and unstar file | ||
|
||
```php | ||
$libraryResource = new Library($client); | ||
$starredFileResource = new StarredFile($client); | ||
|
||
// get all starred files | ||
$dirItems = $starredFileResource->getAll(); | ||
|
||
// unstar all starred files | ||
foreach ($dirItems as $dirItem) { | ||
$lib = $libraryResource->getById($dirItem->repo); | ||
$starredFileResource->unstar($lib, $dirItem); | ||
} | ||
|
||
// re-star all files | ||
foreach ($dirItems as $dirItem) { | ||
$lib = $libraryResource->getById($dirItem->repo); | ||
$starredFileResource->star($lib, $dirItem); | ||
} | ||
``` | ||
|
||
### Debugging and how to enable logging of requests and responses | ||
|
||
This example requires monolog. Log entries and Guzzle debug info will be written to stdout. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters