bricre / ebay-api-sell-compliance
API client generated from eBay's OpenAPI definition
Requires
- allansun/openapi-runtime: ^2.1
Requires (Dev)
- allansun/openapi-code-generator: ^0.2.5
- allansun/openapi-parser: ^2.1.4
This package is auto-updated.
Last update: 2022-05-04 16:09:08 UTC
README
Code generated from eBay's Swagger file using allansun/openapi-code-generator.
Generated code is well self-documented with proper PHPDoc annotations.
Please refer to eBay's documentation for detailed API behaviour explanation.
Installation
composer require bricre/ebay-api-sell-compliance
You will also need a PSR-7 based client or Symfony's HTTP Foundation based client
So either use Guzzle (or any other PSR-7 compatible clients)
composer require guzzlehttp/guzzle
or Symfony HTTP Client
composer require symfony/http-client
Versioning
Starting from version 1.4.1, this project will match according eBay API's versioning. Should you found a matching version not being available. Please contact the author to generate against correct version.
Usage
First you need to configure OpenAPI\RunTime\Client with required credentials and predefined responses types. You only need to do this once (or create a service in your dependency injection).
<?php use Ebay\Sell\Account\ResponseTypes; use OpenAPI\Runtime\DefaultResponseHandlerStack; use OpenAPI\Runtime\Client; use OpenAPI\Runtime\SimplePsrResponseHandlerStack; Client::configure( new \GuzzleHttp\Client([ 'base_uri' => 'https://api.ebay.com/sell/compliance/v1/', 'headers'=>[ 'Authorization'=> 'Bearer <accessToken>' ] ]), new SimplePsrResponseHandlerStack(new ResponseTypes()) );
Then in your business logic you can call API operations directly
<?php use Ebay\Sell\Account\Api\PaymentsProgram; use Ebay\Sell\Account\Api\Program; $programAPI = new Program(); $programs = $programAPI->getOptedIns(); $paymentsProgramAPI = new PaymentsProgram(); $response = $paymentsProgramAPI->get('marketplace_id','payments_programe_type');
Author
- Allan Sun - Initial work