Skip to content

Commit

Permalink
v0.2.1
Browse files Browse the repository at this point in the history
Add support for image/file upload
Add missing exceptions to Listing Resource
  • Loading branch information
rhysnhall committed Sep 3, 2021
1 parent a0eace1 commit eec3742
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rhysnhall/etsy-php-sdk",
"version": "0.2",
"version": "0.2.1",
"description": "PHP SDK for Etsy API v3.",
"type": "library",
"keywords": [
Expand Down
7 changes: 6 additions & 1 deletion src/OAuth/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ public function __call($method, $args) {
$uri .= "?".RequestUtil::prepareParameters($args[1]);
}
if(in_array($method, ['post', 'put'])) {
$opts['form_params'] = $args[1] ?? [];
if($file = RequestUtil::prepareFile($args[1] ?? [])) {
$opts['multipart'] = $file;
}
else {
$opts['form_params'] = $args[1] ?? [];
}
}
if($method == 'DELETE' && count($args[1] ?? [])) {
$opts['query'] = $args[1];
Expand Down
1 change: 1 addition & 0 deletions src/Resources/Listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Etsy\Resources;

use Etsy\Resource;
use Etsy\Exception\ApiException;

/**
* Listing resource class. Represents an Etsy listing.
Expand Down

0 comments on commit eec3742

Please sign in to comment.