Skip to content

Commit

Permalink
Added get getContentVersionBody and getAttachmentBody (#347)
Browse files Browse the repository at this point in the history
* Added get getContentVersionBody and getAttachmentBody

Based on code provided in issue #179

* Readme and facade update
  • Loading branch information
danielpetrica authored Sep 1, 2024
1 parent 4a229c9 commit 7e82097
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 119 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,16 @@ Forrest::put('/services/data/v20.0/endpoint', ['my'=>'param']);
Forrest::patch('/services/data/v20.0/endpoint', ['my'=>'param']);
Forrest::delete('/services/data/v20.0/endpoint');
```
### Get file body from ContentVersion and Attachment
You can use the Forrest::getContentVersionBody() and Forrest::getAttachmentBody() to retrieve the content of the
uploaded files. They return a streamed response, so it may be a bit cumbersome to use if now used to streams.
Bellow you can find an example to retrieve the content of a uploaded content version.

```php
# example
$data = Forrest::getContentVersionBody($version->Id);
$content = $data->getBody()->getContents();
```

### Raw response output

Expand Down
Loading

0 comments on commit 7e82097

Please sign in to comment.