bricre/ebay-api-sell-metadata

This package is abandoned and no longer maintained. The author suggests using the bricre/ebay-sdk-sell-metadata package instead.

API client generated from eBay's OpenAPI definition

1.4.1.1 2021-09-02 00:40 UTC

This package is auto-updated.

Last update: 2022-05-04 16:08:05 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-metadata

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 v1.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/metadata/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