@@ -8,7 +8,11 @@ however most of them comes with all issues of auto generated code.
8
8
- hardcoded ` guzzlehttp/guzzle ` or ` aws/aws-sdk-php ` dependency
9
9
- legacy code base (7.2)
10
10
- no logger
11
+ - SDK's are oriented around single seller which is not suitable for bigger systems
12
+ - missing or lacking support for ` client_credentials ` grant type
13
+ - not all API covered
11
14
15
+ This API goal is to resolve all above mentioned issues.
12
16
13
17
### Development
14
18
@@ -34,7 +38,10 @@ composer generate
34
38
``` php
35
39
<?php
36
40
37
- use AmazonPHP\SellingPartner\Api\CatalogApi\CatalogItemSDK;
41
+ use AmazonPHP\SellingPartner\Api\AuthorizationSDK;
42
+ use AmazonPHP\SellingPartner\Api\CatalogItemSDK;
43
+ use AmazonPHP\SellingPartner\Marketplace;
44
+ use AmazonPHP\SellingPartner\Regions;
38
45
use Buzz\Client\Curl;
39
46
use AmazonPHP\SellingPartner\Exception\ApiException;
40
47
use AmazonPHP\SellingPartner\OAuth;
@@ -47,23 +54,32 @@ require_once __DIR__ . '/vendor/autoload.php';
47
54
$factory = new Psr17Factory();
48
55
$client = new Curl($factory);
49
56
50
- $catalog = new CatalogItemSDK(
51
- new OAuth(
52
- $client,
53
- new HttpFactory($factory, $factory),
54
- Configuration::forIAMUser(
55
- 'client_id',
56
- 'client_secret',
57
- 'eu-west-1',
58
- 'access_key',
59
- 'secret_key'
60
- ),
61
- 'seller_refresh_token'
57
+ $oauth = new OAuth(
58
+ $client,
59
+ $httpFactory = new HttpFactory($factory, $factory),
60
+ $config = Configuration::forIAMUser(
61
+ 'lwaClientID',
62
+ 'lwaClientID',
63
+ 'awsAccessKey',
64
+ 'awsSecretKey'
62
65
)
63
66
);
64
67
68
+ $accessToken = $oauth->exchangeRefreshToken('seller_oauth_refresh_token');
69
+
70
+ $catalog = new CatalogItemSDK(
71
+ $client,
72
+ new HttpFactory($factory, $factory),
73
+ $config
74
+ );
75
+
65
76
try {
66
- $item = $catalog->getCatalogItem($marketplace_id = 'A1C3SOZRARQ6R3', $asin = 'B07W13KJZC');
77
+ $item = $catalog->getCatalogItem(
78
+ $accessToken,
79
+ Regions::NORTH_AMERICA,
80
+ $marketplaceId = Marketplace::US()->id(),
81
+ $asin = 'B07W13KJZC'
82
+ );
67
83
dump($item);
68
84
} catch (ApiException $exception) {
69
85
dump($exception->getMessage());
0 commit comments