Skip to content

Commit

Permalink
Add optional client parameter to UploadsDocument::upload()
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Feb 16, 2025
1 parent 4190427 commit a1896a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ $createFeedResponse = $feedsApi->createFeed($createFeedSpec);
$feedId = $createFeedResponse->dto()->feedId;
```

If you are working with feed documents that are too large to fit in memory, you can pass anything that Guzzle can turn into a stream into `FeedDocument::upload()` instead of a string.
If you are working with feed documents that are too large to fit in memory, you can pass anything that Guzzle can turn into a stream into `FeedDocument::upload()` instead of a string. `FeedDocument::upload()` also has an optional `$client` parameter, for passing custom Guzzle clients.


## Downloading a feed result document
Expand Down
5 changes: 3 additions & 2 deletions src/Traits/UploadsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ trait UploadsDocument
public function upload(
string $feedType,
string|StreamInterface|callable|Iterator $data,
?string $charset = null
?string $charset = null,
?Client $client = null
): void {
$client = new Client;
$client = $client ?? new Client;
$response = $client->put($this->url, [
RequestOptions::HEADERS => [
'Content-Type' => static::getContentType($feedType, $charset),
Expand Down

0 comments on commit a1896a7

Please sign in to comment.