David Terence Sadler edited this page Jun 16, 2016 · 12 revisions

Released 2016-06-04

Below are the updates included in this release.

New Features

Asynchronous Requests

The SDK now support asynchronous requests in your projects. This is done by implementing an Async version of each of the service operations. For example,

// Synchronous request. 
$response = $service->getSingleItem($request);
$item = $result->Item;
print("$item->Title\n");

// Asynchronous request.
$response = $service->getSingleItemAsync($request);
$response->then(function ($result) {
    $item = $result->Item;
    print("$item->Title\n");
  })->otherwise(function ($reason) {
    echo 'Encountered an error: ' . $reason->getMessage();
});

httpOptions configuration option

An array of HTTP options that will be passed to the HTTP client. The SDK supports the following options:

connect_timeout

A float specifying the number of seconds to wait when trying to connect to the API. Use 0 to wait indefinitely.

use DTS\eBaySDK\Finding\Services\FindingService;

$service = new FindingService([
    'apiVersion'  => '1.13.0',
    'globalId'    => 'EBAY-US',
    'httpOptions' => [
        'connect_timeout' => 1.5
    ]
]);

debug

Pass true to instruct the HTTP handler to output debug information to STDOUT. Alternatively pass resource as return from fopen to write to a specific PHP stream. The information provided will vary between HTTP handlers.

delay

The number of milliseconds to delay before sending the request.

proxy

If you are connecting to the API through a proxy pass a string specifying the proxy or pass an array to specify several proxies.

use DTS\eBaySDK\Finding\Services\FindingService;

$service = new FindingService([
    'apiVersion'  => '1.13.0',
    'globalId'    => 'EBAY-US',
    'httpOptions' => [
        'proxy' => 'http://192.168.2.1:10'
    ]
]);

$service = new FindingService([
    'apiVersion'  => '1.13.0',
    'globalId'    => 'EBAY-US',
    'httpOptions' => [
        'proxy' => [
            'http'  => 'tcp://192.168.2.1:10',
            'https' => 'tcp://192.168.2.1:11'
        ]
    ]
]);

timeout

A float specifying the number of seconds to wait for a response from the API. Use 0 to wait indefinitely.

use DTS\eBaySDK\Finding\Services\FindingService;

$service = new FindingService([
    'apiVersion'  => '1.13.0',
    'globalId'    => 'EBAY-US',
    'httpOptions' => [
        'timeout' => 1.5
    ]
]);

verify

Control the SSL certificate verification behavior of the request.

  • Set to true to enable SSL/TLS certificate verification. The SDK will use the default CA bundle provided by the operating system.
  • Set to false to disable verification. You should not do this in production as the SDK will connect to the API using an insecure connection.
  • Pass a string that is the path to the CA bundle to be used by the SDK.

Breaking Changes

Handler Configuration Option Removed

The Handler configuration option has been replaced by a new option called httpHandler. A httpHandler will be expected to accept a Psr\Http\Message\RequestInterface object and an array of httpOptions, and return a GuzzleHttp\Promise\PromiseInterface object that is fulfilled with a Psr\Http\Message\ResponseInterface object or rejected with an exception.

use DTS\eBaySDK\Finding\Services\FindingService;
use GuzzleHttp\Client;

$handler = function (Psr\Http\Message\RequestInterface $request, array $options) {
    $client = new Client();

    return $client->sendAsync($request, $options);
};

$service = new FindingService([
    'apiVersion' => '1.13.0',
    'globalId'   => 'EBAY-US',
    'handler'    => $handler
]);

These changes were necessary so that the SDK could support asynchronous requests.

Method callOperation Renamed.

The protected method \DTS\eBaySDK\Services::BaseService::callOperation has been removed. Code that called this method will now need to call callOperationAsync(...)->wait() instead.

Class Handler Removed.

The class \DTS\eBaySDK\Handler has been renamed to \DTS\eBaySDK\HttpHandler. This change is due to renaming the Handler configuration option to httpHandler.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.