Releases: jlevers/selling-partner-api
v7.0.2
Changed
- Cache keys for RDTs include the specific refresh token and delegatee (if applicable)
GetAccessTokenRequest
doesn't send unnecessary default headers fromSellingPartnerApi::defaultHeaders()
Added
Endpoint
enum now has::byCountryCode()
and::byRegion()
methods
Full Changelog: v7.0.1...v7.0.2
v7.0.1
Added
- Make user agent configurable (#739)
Fixed
- Try multiple datetime formats during deserialization before throwing an exception (#737, thanks @KhorneHoly!)
- Serialize
getMyFeesEstimates
request properly (#736)
Full Changelog: v7.0.0...v7.0.1
v7.0.0
Changed
- Minimum PHP version of 8.2
- Instead of accessing seller/vendor connector classes with
SellingPartnerApi::make(...$options)->seller()
andSellingPartnerApi::make(...$options)->vendor()
, they are now accessed viaSellingPartnerApi::seller(...$options)
andSellingPartnerApi::vendor(...$options)
- The
authenticationClient
constructor argument is now typedGuzzleHttp\Client
instead ofGuzzleHttp\ClientInterface
for better Saloon interoperation DateTimeInterface
is used for date parameters instead ofDateTime
- Deprecated APIs are removed, and their connector accessor methods throw exceptions
- Non-version-specific API accessor methods (e.g.,
SellerConnector::orders()
) are removed, since they're inevitably going to become out of date
Added
tokenCache
constructor parameter allows the user to define a class that implementsTokenCache
for caching access tokens, which simplifies the end user's caching implementation compared to the old callback-based access token storage mechanism- Latest changes from all OpenAPI models
CONTRIBUTING.md
to make it easier for others to get started making contributions- All autogenerated files have comments warning not to modify them directly
- Some basic tests! What a concept 🙃
Fixed
- Infinite recursion bug on FBA Inbound V2024-03-20 API accessor method
- Boolean query parameters are serialized as
'true'
or'false'
instead of1
or0
- Null attributes are removed before serialization
Thanks @dpash, @KhorneHoly, and @bgarret for your contributions!
Full Changelog: v6.0.6...v7.0.0
v6.0.6
Fixed
- DateTime deserialization (#699, thanks @mickas! fixes #698)
- Add attributes to
AutomatedShippingSettings
that are missing from upstream models - Deserialization of integer 0 was buggy, since I used
0x0
as a default case in a deserializationmatch
. Switched to usingchr(0)
so that 0 can be deserialized properly.
Changed
- Move
composer/semver
andhighsidelabs/saloon-sdk-generator
from regular dependencies to dev dependencies. This involved moving a lot of base classes, traits, and exception classes fromhighsidelabs/saloon-sdk-generator
into the library itself, which is reflected in the code generation process. - SDK is now compatible with Laravel 11
Added
- FBA Inbound API 2024-03-20
- Misc Orders VO API updates
getUserAgent()
method inSellingPartnerApi
class (partial fix for #679)
New Contributors
Full Changelog: v6.0.5...v6.0.6
v6.0.5
Fixed
- Fix
createFeed
example in README (#677, @spire-mike) - Ensure restricted data tokens aren't generated for reports that don't require them (#682, fixed by #671)
--
Full Changelog: v6.0.4...v6.0.5
v6.0.4
Fixed
- Generate query strings like
a=val1,val2
insteada=val1&a=val2
. Amazon often requires, and always accepts (as far as I can tell) comma-separated query string arrays, but often rejects the more standard format we were using before. - Look up cached access tokens and RDTs using refresh tokens as the key, not LWA client ID, because it's possible to have multiple refresh tokens for the same client ID.
Changed
- Add
JSON_UNESCAPED_SLASHES
flag when outputting customized schema files inSchemaVersion
v6.0.3
v6.0.2
Fixed
- Moved
composer/semver
fromrequire
torequire-dev
incomposer.json
- Add
illuminate/support
torequire
incomposer.json
. It was installed with dev dependencies, which means that normal Composer installations weren't working properly. - Got optional commit flow in
library:update-version
working properly. Previously the changes that were supposed to be committed were lost in a stash.
v6.0.1
v6.0.0
Warning
This version of the library is only compatible with PHP >=8.1.
This major release is a complete overhaul of the library. There is basically no code left at all from v5
.
A quick summary of the big changes:
- The code generation process is now contained inside this repository, which should make it much easier for people to contribute. Previously, all code generation happened in a separate, private repository, because it was messy, and publishing the codegen setup in that state would have done more harm than good. Now, anyone can easily generate the code for the library from scratch.
- The entire auth/request/response process is based on Saloon. The actual code generation uses
highsidelabs/saloon-sdk-generator
, which is a fork ofcrescat-io/saloon-sdk-generator
. - The structure and naming conventions of the classes and attributes in this library have been made as similar to the names in Amazon's documentation as possible. As a result, I've removed the
docs/
section entirely, because a) the old documentation was often incomplete and/or misleading, and b) once you have a basic grasp of how this library works now, Amazon's documentation will tell you everything you need to know.
All the functionality of v5
is still present: full API coverage, automatic RDT generation, document upload/download support. The syntax has changed somewhat, but the concepts are the same. It's now easier to access request and response internals, since all requests/responses have all the functionality of any other Saloon request or response.
Upgrade guide
-
The
Configuration
class has been replaced with theSellingPartnerApi
class. This:$config = new SellingPartnerApi\Configuration([ "lwaClientId" => "<LWA client ID>", "lwaClientSecret" => "<LWA client secret>", "lwaRefreshToken" => "<LWA refresh token>", "awsAccessKeyId" => "<AWS access key ID>", "awsSecretAccessKey" => "<AWS secret access key>", // If you're not working in the North American marketplace, change // this to another endpoint from lib/Endpoint.php "endpoint" => SellingPartnerApi\Endpoint::NA, ]);
Now looks like this:
$connector = SellingPartnerApi::make( clientId: 'amzn1.application-oa2-client.asdfqwertyuiop...', clientSecret: 'amzn1.oa2-cs.v1.1234567890asdfghjkl...', refreshToken: 'Atzr|IwEBIA...', endpoint: Endpoint::NA, // Or Endpoint::EU, Endpoint::FE, Endpoint::NA_SANDBOX, etc. );
-
To access a particular API, rather than directly instantiating an API class, like this:
$reportsApi = new ReportsV20210630Api($config); $dfOrdersApi = new VendorDirectFulfillmentOrdersV1Api($config);
Do this:
$reportsApi = $connector()->seller()->reports(); $dfOrdersApi = $connector()->vendor()->directFulfillmentOrders();
-
To call an endpoint:
$response = $reportsApi->getReports( reportTypes: ['GET_MERCHANT_ALL_LISTINGS'], marketplaceIds: ['ATVPDKIKX0DER'], createdAfter: new DateTime('2024-03-01'), ); $json = $response->json(); $reports = $response->dto(); // A structured DTO
What was previously referred to as models are now called DTOs. DTOs are required to make
POST
/PUT
/PATCH
requests, similarly to how models were required for those sorts of create/update operations inv5
. For an example of how to use a DTO to make aPOST
request, see the Working with DTOs section of the README. -
To specify which data elements you want to retrieve when calling restricted endpoints (
getOrder
,getOrders
, andgetOrderItems
), pass an additionaldataElements
parameter toSellingPartnerApi::make()
rather than passing the$data_elements
parameter to the restricted endpoint itself.
Any other questions about upgrading should be answerable using the README, but if you have any questions, feel free to open a discussion :)