brandon14/ebay-sdk-php

View on GitHub
src/Buy/Browse/V1/Api/ItemApi.php

Summary

Maintainability
F
2 wks
Test Coverage
<?php

/**
 * This file is part of the trollandtoad/ebay-sdk-php package.
 *
 * MIT License
 *
 * Copyright (c) 2022 Brandon Clothier
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

declare(strict_types=1);

/**
 * ItemApi.
 *
 * PHP version ^7.2 || ^8.0
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */

/**
 * Browse API.
 *
 * <p>The Browse API has the following resources:</p>   <ul> <li><b> item_summary: </b> Lets shoppers search for specific items by keyword, GTIN, category, charity, product, or item aspects and refine the results by using filters, such as aspects, compatibility, and fields values.</li>  <li><b> search_by_image: </b><a href=\"https://developer.ebay.com/api-docs/static/versioning.html#experimental \" target=\"_blank\"><img src=\"/cms/img/docs/experimental-icon.svg\" class=\"legend-icon experimental-icon\" alt=\"Experimental Release\" title=\"Experimental Release\" />&nbsp;(Experimental)</a> Lets shoppers search for specific items by image. You can refine the results by using URI parameters and filters.</li>   <li><b> item: </b> <ul><li>Lets you retrieve the details of a specific item or all the items in an item group, which is an item with variations such as color and size and check if a product is compatible with the specified item, such as if a specific car is compatible with a specific part.</li> <li>Provides a bridge between the eBay legacy APIs, such as <b> Finding</b>, and the RESTful APIs, which use different formats for the item IDs.</li>  </ul> </li>  <li> <b> shopping_cart: </b> <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#experimental \" target=\"_blank\"><img src=\"/cms/img/docs/experimental-icon.svg\" class=\"legend-icon experimental-icon\" alt=\"Experimental Release\" title=\"Experimental Release\" />&nbsp;(Experimental)</a> <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited \" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> Provides the ability for eBay members to see the contents of their eBay cart, and add, remove, and change the quantity of items in their eBay cart.&nbsp;&nbsp;<b> Note: </b> This resource is not available in the eBay API Explorer.</li></ul>       <p>The <b> item_summary</b>, <b> search_by_image</b>, and <b> item</b> resource calls require an <a href=\"/api-docs/static/oauth-client-credentials-grant.html\">Application access token</a>. The <b> shopping_cart</b> resource calls require a <a href=\"/api-docs/static/oauth-authorization-code-grant.html\">User access token</a>.</p>
 *
 * The version of the OpenAPI document: v1.18.0
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 5.4.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace TNT\Ebay\Buy\Browse\V1\Api;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\MultipartStream;
use TNT\Ebay\Buy\Browse\V1\ApiException;
use GuzzleHttp\Exception\GuzzleException;
use TNT\Ebay\Buy\Browse\V1\Configuration;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use TNT\Ebay\Buy\Browse\V1\HeaderSelector;
use TNT\Ebay\Buy\Browse\V1\ObjectSerializer;

/**
 * ItemApi Class Doc Comment.
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */
class ItemApi
{
    /**
     * @var ClientInterface
     */
    protected $client;

    /**
     * @var Configuration
     */
    protected $config;

    /**
     * @var HeaderSelector
     */
    protected $headerSelector;

    /**
     * @var int Host index
     */
    protected $hostIndex;

    /**
     * @param ClientInterface $client
     * @param Configuration   $config
     * @param HeaderSelector  $selector
     * @param int             $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
     */
    public function __construct(
        ClientInterface $client = null,
        Configuration $config = null,
        HeaderSelector $selector = null,
        $hostIndex = 0
    ) {
        $this->client = $client ?: new Client();
        $this->config = $config ?: new Configuration();
        $this->headerSelector = $selector ?: new HeaderSelector();
        $this->hostIndex = $hostIndex;
    }

    /**
     * Set the host index.
     *
     * @param int $hostIndex Host index (required)
     */
    public function setHostIndex($hostIndex): void
    {
        $this->hostIndex = $hostIndex;
    }

    /**
     * Get the host index.
     *
     * @return int Host index
     */
    public function getHostIndex()
    {
        return $this->hostIndex;
    }

    /**
     * @return Configuration
     */
    public function getConfiguration()
    {
        return $this->config;
    }

    /**
     * Operation checkCompatibility.
     *
     * @param string                                             $item_id                 The eBay RESTful identifier of an item (such as a part you want to check). This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string                                             $x_ebay_c_marketplace_id The ID of the eBay marketplace you want to use. &lt;b&gt; Note: &lt;/b&gt; This value is case sensitive.&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;X-EBAY-C-MARKETPLACE-ID &#x3D; EBAY_US&lt;/code&gt;  &lt;br /&gt;&lt;br /&gt; For a list of supported sites see, &lt;a href&#x3D;\&quot;/api-docs/buy/browse/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityPayload $compatibility_payload   compatibility_payload (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse
     */
    public function checkCompatibility($item_id, $x_ebay_c_marketplace_id, $compatibility_payload = null)
    {
        [$response] = $this->checkCompatibilityWithHttpInfo($item_id, $x_ebay_c_marketplace_id, $compatibility_payload);

        return $response;
    }

    /**
     * Operation checkCompatibilityWithHttpInfo.
     *
     * @param string                                             $item_id                 The eBay RESTful identifier of an item (such as a part you want to check). This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string                                             $x_ebay_c_marketplace_id The ID of the eBay marketplace you want to use. &lt;b&gt; Note: &lt;/b&gt; This value is case sensitive.&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;X-EBAY-C-MARKETPLACE-ID &#x3D; EBAY_US&lt;/code&gt;  &lt;br /&gt;&lt;br /&gt; For a list of supported sites see, &lt;a href&#x3D;\&quot;/api-docs/buy/browse/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityPayload $compatibility_payload   (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function checkCompatibilityWithHttpInfo($item_id, $x_ebay_c_marketplace_id, $compatibility_payload = null)
    {
        $request = $this->checkCompatibilityRequest($item_id, $x_ebay_c_marketplace_id, $compatibility_payload);

        try {
            $options = $this->createHttpClientOption();

            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null, $e);
            } catch (ConnectException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            } catch (GuzzleException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            }

            $statusCode = $response->getStatusCode();

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
            }

            switch ($statusCode) {
                case 200:
                    if ('\TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
            }

            $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse';

            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); // Stream goes to serializer.
            } else {
                $content = (string) $response->getBody();
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders(),
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation checkCompatibilityAsync.
     *
     * @param string                                             $item_id                 The eBay RESTful identifier of an item (such as a part you want to check). This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string                                             $x_ebay_c_marketplace_id The ID of the eBay marketplace you want to use. &lt;b&gt; Note: &lt;/b&gt; This value is case sensitive.&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;X-EBAY-C-MARKETPLACE-ID &#x3D; EBAY_US&lt;/code&gt;  &lt;br /&gt;&lt;br /&gt; For a list of supported sites see, &lt;a href&#x3D;\&quot;/api-docs/buy/browse/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityPayload $compatibility_payload   (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function checkCompatibilityAsync($item_id, $x_ebay_c_marketplace_id, $compatibility_payload = null)
    {
        return $this->checkCompatibilityAsyncWithHttpInfo($item_id, $x_ebay_c_marketplace_id, $compatibility_payload)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation checkCompatibilityAsyncWithHttpInfo.
     *
     * @param string                                             $item_id                 The eBay RESTful identifier of an item (such as a part you want to check). This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string                                             $x_ebay_c_marketplace_id The ID of the eBay marketplace you want to use. &lt;b&gt; Note: &lt;/b&gt; This value is case sensitive.&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;X-EBAY-C-MARKETPLACE-ID &#x3D; EBAY_US&lt;/code&gt;  &lt;br /&gt;&lt;br /&gt; For a list of supported sites see, &lt;a href&#x3D;\&quot;/api-docs/buy/browse/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityPayload $compatibility_payload   (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function checkCompatibilityAsyncWithHttpInfo($item_id, $x_ebay_c_marketplace_id, $compatibility_payload = null)
    {
        $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\CompatibilityResponse';
        $request = $this->checkCompatibilityRequest($item_id, $x_ebay_c_marketplace_id, $compatibility_payload);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();

                    throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody(), $exception instanceof \Throwable ? $exception : null);
                }
            );
    }

    /**
     * Create request for operation 'checkCompatibility'.
     *
     * @param string                                             $item_id                 The eBay RESTful identifier of an item (such as a part you want to check). This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string                                             $x_ebay_c_marketplace_id The ID of the eBay marketplace you want to use. &lt;b&gt; Note: &lt;/b&gt; This value is case sensitive.&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;X-EBAY-C-MARKETPLACE-ID &#x3D; EBAY_US&lt;/code&gt;  &lt;br /&gt;&lt;br /&gt; For a list of supported sites see, &lt;a href&#x3D;\&quot;/api-docs/buy/browse/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param \TNT\Ebay\Buy\Browse\V1\Model\CompatibilityPayload $compatibility_payload   (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function checkCompatibilityRequest($item_id, $x_ebay_c_marketplace_id, $compatibility_payload = null)
    {
        // Verify the required parameter 'item_id' is set.
        if ($item_id === null || (\is_array($item_id) && count($item_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $item_id when calling checkCompatibility');
        }
        // Verify the required parameter 'x_ebay_c_marketplace_id' is set.
        if ($x_ebay_c_marketplace_id === null || (\is_array($x_ebay_c_marketplace_id) && count($x_ebay_c_marketplace_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $x_ebay_c_marketplace_id when calling checkCompatibility');
        }

        $resourcePath = '/item/{item_id}/check_compatibility';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // header params
        if ($x_ebay_c_marketplace_id !== null) {
            $headerParams['X-EBAY-C-MARKETPLACE-ID'] = ObjectSerializer::toHeaderValue($x_ebay_c_marketplace_id);
        }

        // path params
        if ($item_id !== null) {
            $resourcePath = str_replace(
                '{item_id}',
                ObjectSerializer::toPathValue($item_id),
                $resourcePath
            );
        }

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/json']
            );
        }

        // For model (json/xml)
        if (isset($compatibility_payload)) {
            if ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($compatibility_payload));
            } else {
                $httpBody = $compatibility_payload;
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];

                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem,
                        ];
                    }
                }

                // For HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                // For HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($queryParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }
        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = ObjectSerializer::buildQuery($queryParams);

        return new Request(
            'POST',
            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getItem.
     *
     * @param string $item_id     The eBay RESTful identifier of an item. This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string $fieldgroups This parameter lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item.   &lt;br /&gt; &lt;br /&gt; &lt;b&gt; Valid Values: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; product fields to the response, which describe the product associated with the item. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields.&lt;/li&gt;          &lt;li&gt;&lt;b&gt; COMPACT&lt;/b&gt; -  This returns only the following fields, which let you quickly check if the availability or price of the item has changed, if the item has been revised by the seller, or if an item&#39;s top-rated plus status has changed for items you have stored.  &lt;ul&gt; &lt;li&gt; &lt;b&gt; itemId&lt;/b&gt; - The identifier of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;bidCount&lt;/b&gt; - This integer value indicates the total number of bids that have been placed against an auction item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;currentBidPrice&lt;/b&gt; - This container shows the current highest bid for an auction item. This container will only be returned for auction items.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;eligibleForInlineCheckout&lt;/b&gt; - This parameter returns items based on whether or not the items can be purchased using the Buy &lt;a href&#x3D;\&quot;/api-docs/buy/order/resources/methods\&quot;&gt;Order API&lt;/a&gt;. &lt;ul&gt; &lt;li&gt;If the value of this field is &lt;code&gt;true&lt;/code&gt;, this indicates that the item can be purchased using the &lt;b&gt; Order API&lt;/b&gt;. &lt;/li&gt;  &lt;li&gt;If the value of this field is &lt;code&gt;false&lt;/code&gt;, this indicates that the item cannot be purchased using the &lt;b&gt; Order API&lt;/b&gt; and must be purchased on the eBay site.&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;&lt;b&gt; estimatedAvailabilities&lt;/b&gt; -  Returns the item availability information, which is based on the item&#39;s quantity. &lt;b&gt; Note:&lt;/b&gt; Changes in quantity are not tracked by &lt;b&gt;sellerItemRevision&lt;/b&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemAffiliateWebURL&lt;/b&gt; - The URL of the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the &lt;code&gt;X-EBAY-C-ENDUSERCTX&lt;/code&gt; request header in the method.&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemCreationDate&lt;/b&gt; - This is a timestamp that indicates the date and time an item listing was created.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemEndDate&lt;/b&gt; - This is the scheduled end time of the listing.&lt;/li&gt; &lt;li&gt;&lt;b&gt;ItemWebURL&lt;/b&gt; - The URL of the View Item page of the item. This enables you to include a \&quot;Report Item on eBay\&quot; link that takes the buyer to the View Item page on eBay. From there they can report any issues regarding this item to eBay.&lt;/li&gt; &lt;li&gt;&lt;b&gt;legacyItemId&lt;/b&gt; - The unique identifier of the eBay listing that contains the item. This is the traditional/legacy ID that is often seen in the URL of the listing View Item page.&lt;/li&gt; &lt;li&gt;&lt;b&gt;minimumPriceToBid&lt;/b&gt; - This container shows the minimum bid amount that would be accepted as a qualifying bid in an auction listing. This container will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt;price&lt;/b&gt; - This is tracked by the revision ID but is returned here to enable you to quickly verify the price of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;priorityListing&lt;/b&gt; - This field is returned as &lt;code&gt;true&lt;/code&gt; if the listing is part of a Promoted Listing campaign. Promoted Listings are available to Above Standard and Top Rated sellers with recent sales activity.&lt;/li&gt; &lt;li&gt;&lt;b&gt;reservePriceMet&lt;/b&gt; - This field indicates whether or not an auction&#39;s reserve price (if set by the seller) has been met yet. This field will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt; sellerItemRevision&lt;/b&gt; - An identifier generated/incremented when a seller revises the item. The following are the two types of item revisions:   &lt;ul&gt;  &lt;li&gt;&lt;b&gt; Seller changes&lt;/b&gt;, such as changing the title&lt;/li&gt;  &lt;li&gt;  &lt;b&gt; eBay system changes&lt;/b&gt;, such as changing the quantity when an item is purchased.&lt;/li&gt;  &lt;/ul&gt; This ID is changed &lt;em&gt;only&lt;/em&gt; when the seller makes a change to the item. This means you cannot use this value to determine if the quantity has changed. To check if the quantity has changed, use &lt;b&gt; estimatedAvailabilities.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;&lt;b&gt;shippingOptions&lt;/b&gt; - A container for the cost, carrier, and other details of shipping options.&lt;/li&gt; &lt;li&gt;&lt;b&gt;taxes&lt;/b&gt; - A container for the tax information for the item, such as the tax jurisdiction, the tax percentage, and the tax type.&lt;/li&gt; &lt;li&gt;&lt;b&gt; topRatedBuyingExperience&lt;/b&gt; - A boolean value indicating if this item is a top-rated plus item. A change in the item&#39;s top rated plus standing is not tracked by the revision ID. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.topRatedBuyingExperience\&quot;&gt;topRatedBuyingExperience&lt;/a&gt; for more information.&lt;/li&gt; &lt;li&gt;&lt;b&gt;uniqueBidderCount&lt;/b&gt; - This integer value indicates the number of different eBay users who have placed one or more bids on an auction item. This field is only applicable to auction items.&lt;/li&gt;&lt;/ul&gt;    &lt;b&gt; For Example&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;To check if a stored item&#39;s information is current, do following.  &lt;ol&gt;    &lt;li&gt;Pass in the item ID and set &lt;b&gt; fieldgroups&lt;/b&gt; to COMPACT. &lt;br /&gt; &lt;br /&gt;&lt;code&gt;item/v1|4**********8|0?fieldgroups&#x3D;COMPACT&lt;/code&gt; &lt;/li&gt;     &lt;li&gt;Do one of the following:    &lt;ul&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is returned and you &lt;em&gt;haven&#39;t&lt;/em&gt; stored a revision number for this item, record the number and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;   &lt;li&gt;If the revision number is different from the value you have stored, update the value and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is &lt;em&gt;not&lt;/em&gt; returned or has not changed, where needed, update the item information with the information returned in the response.&lt;/li&gt;  &lt;/ul&gt;  &lt;/li&gt; &lt;/ol&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/ul&gt;    &lt;p&gt;&lt;b&gt; Maximum value: &lt;/b&gt; 1 &lt;br /&gt;If more than one values is specified, the first value will be used. (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\Browse\V1\Model\Item
     */
    public function getItem($item_id, $fieldgroups = null)
    {
        [$response] = $this->getItemWithHttpInfo($item_id, $fieldgroups);

        return $response;
    }

    /**
     * Operation getItemWithHttpInfo.
     *
     * @param string $item_id     The eBay RESTful identifier of an item. This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string $fieldgroups This parameter lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item.   &lt;br /&gt; &lt;br /&gt; &lt;b&gt; Valid Values: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; product fields to the response, which describe the product associated with the item. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields.&lt;/li&gt;          &lt;li&gt;&lt;b&gt; COMPACT&lt;/b&gt; -  This returns only the following fields, which let you quickly check if the availability or price of the item has changed, if the item has been revised by the seller, or if an item&#39;s top-rated plus status has changed for items you have stored.  &lt;ul&gt; &lt;li&gt; &lt;b&gt; itemId&lt;/b&gt; - The identifier of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;bidCount&lt;/b&gt; - This integer value indicates the total number of bids that have been placed against an auction item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;currentBidPrice&lt;/b&gt; - This container shows the current highest bid for an auction item. This container will only be returned for auction items.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;eligibleForInlineCheckout&lt;/b&gt; - This parameter returns items based on whether or not the items can be purchased using the Buy &lt;a href&#x3D;\&quot;/api-docs/buy/order/resources/methods\&quot;&gt;Order API&lt;/a&gt;. &lt;ul&gt; &lt;li&gt;If the value of this field is &lt;code&gt;true&lt;/code&gt;, this indicates that the item can be purchased using the &lt;b&gt; Order API&lt;/b&gt;. &lt;/li&gt;  &lt;li&gt;If the value of this field is &lt;code&gt;false&lt;/code&gt;, this indicates that the item cannot be purchased using the &lt;b&gt; Order API&lt;/b&gt; and must be purchased on the eBay site.&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;&lt;b&gt; estimatedAvailabilities&lt;/b&gt; -  Returns the item availability information, which is based on the item&#39;s quantity. &lt;b&gt; Note:&lt;/b&gt; Changes in quantity are not tracked by &lt;b&gt;sellerItemRevision&lt;/b&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemAffiliateWebURL&lt;/b&gt; - The URL of the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the &lt;code&gt;X-EBAY-C-ENDUSERCTX&lt;/code&gt; request header in the method.&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemCreationDate&lt;/b&gt; - This is a timestamp that indicates the date and time an item listing was created.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemEndDate&lt;/b&gt; - This is the scheduled end time of the listing.&lt;/li&gt; &lt;li&gt;&lt;b&gt;ItemWebURL&lt;/b&gt; - The URL of the View Item page of the item. This enables you to include a \&quot;Report Item on eBay\&quot; link that takes the buyer to the View Item page on eBay. From there they can report any issues regarding this item to eBay.&lt;/li&gt; &lt;li&gt;&lt;b&gt;legacyItemId&lt;/b&gt; - The unique identifier of the eBay listing that contains the item. This is the traditional/legacy ID that is often seen in the URL of the listing View Item page.&lt;/li&gt; &lt;li&gt;&lt;b&gt;minimumPriceToBid&lt;/b&gt; - This container shows the minimum bid amount that would be accepted as a qualifying bid in an auction listing. This container will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt;price&lt;/b&gt; - This is tracked by the revision ID but is returned here to enable you to quickly verify the price of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;priorityListing&lt;/b&gt; - This field is returned as &lt;code&gt;true&lt;/code&gt; if the listing is part of a Promoted Listing campaign. Promoted Listings are available to Above Standard and Top Rated sellers with recent sales activity.&lt;/li&gt; &lt;li&gt;&lt;b&gt;reservePriceMet&lt;/b&gt; - This field indicates whether or not an auction&#39;s reserve price (if set by the seller) has been met yet. This field will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt; sellerItemRevision&lt;/b&gt; - An identifier generated/incremented when a seller revises the item. The following are the two types of item revisions:   &lt;ul&gt;  &lt;li&gt;&lt;b&gt; Seller changes&lt;/b&gt;, such as changing the title&lt;/li&gt;  &lt;li&gt;  &lt;b&gt; eBay system changes&lt;/b&gt;, such as changing the quantity when an item is purchased.&lt;/li&gt;  &lt;/ul&gt; This ID is changed &lt;em&gt;only&lt;/em&gt; when the seller makes a change to the item. This means you cannot use this value to determine if the quantity has changed. To check if the quantity has changed, use &lt;b&gt; estimatedAvailabilities.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;&lt;b&gt;shippingOptions&lt;/b&gt; - A container for the cost, carrier, and other details of shipping options.&lt;/li&gt; &lt;li&gt;&lt;b&gt;taxes&lt;/b&gt; - A container for the tax information for the item, such as the tax jurisdiction, the tax percentage, and the tax type.&lt;/li&gt; &lt;li&gt;&lt;b&gt; topRatedBuyingExperience&lt;/b&gt; - A boolean value indicating if this item is a top-rated plus item. A change in the item&#39;s top rated plus standing is not tracked by the revision ID. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.topRatedBuyingExperience\&quot;&gt;topRatedBuyingExperience&lt;/a&gt; for more information.&lt;/li&gt; &lt;li&gt;&lt;b&gt;uniqueBidderCount&lt;/b&gt; - This integer value indicates the number of different eBay users who have placed one or more bids on an auction item. This field is only applicable to auction items.&lt;/li&gt;&lt;/ul&gt;    &lt;b&gt; For Example&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;To check if a stored item&#39;s information is current, do following.  &lt;ol&gt;    &lt;li&gt;Pass in the item ID and set &lt;b&gt; fieldgroups&lt;/b&gt; to COMPACT. &lt;br /&gt; &lt;br /&gt;&lt;code&gt;item/v1|4**********8|0?fieldgroups&#x3D;COMPACT&lt;/code&gt; &lt;/li&gt;     &lt;li&gt;Do one of the following:    &lt;ul&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is returned and you &lt;em&gt;haven&#39;t&lt;/em&gt; stored a revision number for this item, record the number and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;   &lt;li&gt;If the revision number is different from the value you have stored, update the value and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is &lt;em&gt;not&lt;/em&gt; returned or has not changed, where needed, update the item information with the information returned in the response.&lt;/li&gt;  &lt;/ul&gt;  &lt;/li&gt; &lt;/ol&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/ul&gt;    &lt;p&gt;&lt;b&gt; Maximum value: &lt;/b&gt; 1 &lt;br /&gt;If more than one values is specified, the first value will be used. (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\Browse\V1\Model\Item, HTTP status code, HTTP response headers (array of strings)
     */
    public function getItemWithHttpInfo($item_id, $fieldgroups = null)
    {
        $request = $this->getItemRequest($item_id, $fieldgroups);

        try {
            $options = $this->createHttpClientOption();

            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null, $e);
            } catch (ConnectException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            } catch (GuzzleException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            }

            $statusCode = $response->getStatusCode();

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
            }

            switch ($statusCode) {
                case 200:
                    if ('\TNT\Ebay\Buy\Browse\V1\Model\Item' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\Browse\V1\Model\Item', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
            }

            $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Item';

            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); // Stream goes to serializer.
            } else {
                $content = (string) $response->getBody();
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders(),
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\Browse\V1\Model\Item',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getItemAsync.
     *
     * @param string $item_id     The eBay RESTful identifier of an item. This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string $fieldgroups This parameter lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item.   &lt;br /&gt; &lt;br /&gt; &lt;b&gt; Valid Values: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; product fields to the response, which describe the product associated with the item. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields.&lt;/li&gt;          &lt;li&gt;&lt;b&gt; COMPACT&lt;/b&gt; -  This returns only the following fields, which let you quickly check if the availability or price of the item has changed, if the item has been revised by the seller, or if an item&#39;s top-rated plus status has changed for items you have stored.  &lt;ul&gt; &lt;li&gt; &lt;b&gt; itemId&lt;/b&gt; - The identifier of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;bidCount&lt;/b&gt; - This integer value indicates the total number of bids that have been placed against an auction item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;currentBidPrice&lt;/b&gt; - This container shows the current highest bid for an auction item. This container will only be returned for auction items.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;eligibleForInlineCheckout&lt;/b&gt; - This parameter returns items based on whether or not the items can be purchased using the Buy &lt;a href&#x3D;\&quot;/api-docs/buy/order/resources/methods\&quot;&gt;Order API&lt;/a&gt;. &lt;ul&gt; &lt;li&gt;If the value of this field is &lt;code&gt;true&lt;/code&gt;, this indicates that the item can be purchased using the &lt;b&gt; Order API&lt;/b&gt;. &lt;/li&gt;  &lt;li&gt;If the value of this field is &lt;code&gt;false&lt;/code&gt;, this indicates that the item cannot be purchased using the &lt;b&gt; Order API&lt;/b&gt; and must be purchased on the eBay site.&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;&lt;b&gt; estimatedAvailabilities&lt;/b&gt; -  Returns the item availability information, which is based on the item&#39;s quantity. &lt;b&gt; Note:&lt;/b&gt; Changes in quantity are not tracked by &lt;b&gt;sellerItemRevision&lt;/b&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemAffiliateWebURL&lt;/b&gt; - The URL of the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the &lt;code&gt;X-EBAY-C-ENDUSERCTX&lt;/code&gt; request header in the method.&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemCreationDate&lt;/b&gt; - This is a timestamp that indicates the date and time an item listing was created.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemEndDate&lt;/b&gt; - This is the scheduled end time of the listing.&lt;/li&gt; &lt;li&gt;&lt;b&gt;ItemWebURL&lt;/b&gt; - The URL of the View Item page of the item. This enables you to include a \&quot;Report Item on eBay\&quot; link that takes the buyer to the View Item page on eBay. From there they can report any issues regarding this item to eBay.&lt;/li&gt; &lt;li&gt;&lt;b&gt;legacyItemId&lt;/b&gt; - The unique identifier of the eBay listing that contains the item. This is the traditional/legacy ID that is often seen in the URL of the listing View Item page.&lt;/li&gt; &lt;li&gt;&lt;b&gt;minimumPriceToBid&lt;/b&gt; - This container shows the minimum bid amount that would be accepted as a qualifying bid in an auction listing. This container will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt;price&lt;/b&gt; - This is tracked by the revision ID but is returned here to enable you to quickly verify the price of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;priorityListing&lt;/b&gt; - This field is returned as &lt;code&gt;true&lt;/code&gt; if the listing is part of a Promoted Listing campaign. Promoted Listings are available to Above Standard and Top Rated sellers with recent sales activity.&lt;/li&gt; &lt;li&gt;&lt;b&gt;reservePriceMet&lt;/b&gt; - This field indicates whether or not an auction&#39;s reserve price (if set by the seller) has been met yet. This field will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt; sellerItemRevision&lt;/b&gt; - An identifier generated/incremented when a seller revises the item. The following are the two types of item revisions:   &lt;ul&gt;  &lt;li&gt;&lt;b&gt; Seller changes&lt;/b&gt;, such as changing the title&lt;/li&gt;  &lt;li&gt;  &lt;b&gt; eBay system changes&lt;/b&gt;, such as changing the quantity when an item is purchased.&lt;/li&gt;  &lt;/ul&gt; This ID is changed &lt;em&gt;only&lt;/em&gt; when the seller makes a change to the item. This means you cannot use this value to determine if the quantity has changed. To check if the quantity has changed, use &lt;b&gt; estimatedAvailabilities.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;&lt;b&gt;shippingOptions&lt;/b&gt; - A container for the cost, carrier, and other details of shipping options.&lt;/li&gt; &lt;li&gt;&lt;b&gt;taxes&lt;/b&gt; - A container for the tax information for the item, such as the tax jurisdiction, the tax percentage, and the tax type.&lt;/li&gt; &lt;li&gt;&lt;b&gt; topRatedBuyingExperience&lt;/b&gt; - A boolean value indicating if this item is a top-rated plus item. A change in the item&#39;s top rated plus standing is not tracked by the revision ID. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.topRatedBuyingExperience\&quot;&gt;topRatedBuyingExperience&lt;/a&gt; for more information.&lt;/li&gt; &lt;li&gt;&lt;b&gt;uniqueBidderCount&lt;/b&gt; - This integer value indicates the number of different eBay users who have placed one or more bids on an auction item. This field is only applicable to auction items.&lt;/li&gt;&lt;/ul&gt;    &lt;b&gt; For Example&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;To check if a stored item&#39;s information is current, do following.  &lt;ol&gt;    &lt;li&gt;Pass in the item ID and set &lt;b&gt; fieldgroups&lt;/b&gt; to COMPACT. &lt;br /&gt; &lt;br /&gt;&lt;code&gt;item/v1|4**********8|0?fieldgroups&#x3D;COMPACT&lt;/code&gt; &lt;/li&gt;     &lt;li&gt;Do one of the following:    &lt;ul&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is returned and you &lt;em&gt;haven&#39;t&lt;/em&gt; stored a revision number for this item, record the number and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;   &lt;li&gt;If the revision number is different from the value you have stored, update the value and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is &lt;em&gt;not&lt;/em&gt; returned or has not changed, where needed, update the item information with the information returned in the response.&lt;/li&gt;  &lt;/ul&gt;  &lt;/li&gt; &lt;/ol&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/ul&gt;    &lt;p&gt;&lt;b&gt; Maximum value: &lt;/b&gt; 1 &lt;br /&gt;If more than one values is specified, the first value will be used. (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemAsync($item_id, $fieldgroups = null)
    {
        return $this->getItemAsyncWithHttpInfo($item_id, $fieldgroups)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getItemAsyncWithHttpInfo.
     *
     * @param string $item_id     The eBay RESTful identifier of an item. This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string $fieldgroups This parameter lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item.   &lt;br /&gt; &lt;br /&gt; &lt;b&gt; Valid Values: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; product fields to the response, which describe the product associated with the item. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields.&lt;/li&gt;          &lt;li&gt;&lt;b&gt; COMPACT&lt;/b&gt; -  This returns only the following fields, which let you quickly check if the availability or price of the item has changed, if the item has been revised by the seller, or if an item&#39;s top-rated plus status has changed for items you have stored.  &lt;ul&gt; &lt;li&gt; &lt;b&gt; itemId&lt;/b&gt; - The identifier of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;bidCount&lt;/b&gt; - This integer value indicates the total number of bids that have been placed against an auction item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;currentBidPrice&lt;/b&gt; - This container shows the current highest bid for an auction item. This container will only be returned for auction items.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;eligibleForInlineCheckout&lt;/b&gt; - This parameter returns items based on whether or not the items can be purchased using the Buy &lt;a href&#x3D;\&quot;/api-docs/buy/order/resources/methods\&quot;&gt;Order API&lt;/a&gt;. &lt;ul&gt; &lt;li&gt;If the value of this field is &lt;code&gt;true&lt;/code&gt;, this indicates that the item can be purchased using the &lt;b&gt; Order API&lt;/b&gt;. &lt;/li&gt;  &lt;li&gt;If the value of this field is &lt;code&gt;false&lt;/code&gt;, this indicates that the item cannot be purchased using the &lt;b&gt; Order API&lt;/b&gt; and must be purchased on the eBay site.&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;&lt;b&gt; estimatedAvailabilities&lt;/b&gt; -  Returns the item availability information, which is based on the item&#39;s quantity. &lt;b&gt; Note:&lt;/b&gt; Changes in quantity are not tracked by &lt;b&gt;sellerItemRevision&lt;/b&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemAffiliateWebURL&lt;/b&gt; - The URL of the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the &lt;code&gt;X-EBAY-C-ENDUSERCTX&lt;/code&gt; request header in the method.&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemCreationDate&lt;/b&gt; - This is a timestamp that indicates the date and time an item listing was created.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemEndDate&lt;/b&gt; - This is the scheduled end time of the listing.&lt;/li&gt; &lt;li&gt;&lt;b&gt;ItemWebURL&lt;/b&gt; - The URL of the View Item page of the item. This enables you to include a \&quot;Report Item on eBay\&quot; link that takes the buyer to the View Item page on eBay. From there they can report any issues regarding this item to eBay.&lt;/li&gt; &lt;li&gt;&lt;b&gt;legacyItemId&lt;/b&gt; - The unique identifier of the eBay listing that contains the item. This is the traditional/legacy ID that is often seen in the URL of the listing View Item page.&lt;/li&gt; &lt;li&gt;&lt;b&gt;minimumPriceToBid&lt;/b&gt; - This container shows the minimum bid amount that would be accepted as a qualifying bid in an auction listing. This container will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt;price&lt;/b&gt; - This is tracked by the revision ID but is returned here to enable you to quickly verify the price of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;priorityListing&lt;/b&gt; - This field is returned as &lt;code&gt;true&lt;/code&gt; if the listing is part of a Promoted Listing campaign. Promoted Listings are available to Above Standard and Top Rated sellers with recent sales activity.&lt;/li&gt; &lt;li&gt;&lt;b&gt;reservePriceMet&lt;/b&gt; - This field indicates whether or not an auction&#39;s reserve price (if set by the seller) has been met yet. This field will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt; sellerItemRevision&lt;/b&gt; - An identifier generated/incremented when a seller revises the item. The following are the two types of item revisions:   &lt;ul&gt;  &lt;li&gt;&lt;b&gt; Seller changes&lt;/b&gt;, such as changing the title&lt;/li&gt;  &lt;li&gt;  &lt;b&gt; eBay system changes&lt;/b&gt;, such as changing the quantity when an item is purchased.&lt;/li&gt;  &lt;/ul&gt; This ID is changed &lt;em&gt;only&lt;/em&gt; when the seller makes a change to the item. This means you cannot use this value to determine if the quantity has changed. To check if the quantity has changed, use &lt;b&gt; estimatedAvailabilities.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;&lt;b&gt;shippingOptions&lt;/b&gt; - A container for the cost, carrier, and other details of shipping options.&lt;/li&gt; &lt;li&gt;&lt;b&gt;taxes&lt;/b&gt; - A container for the tax information for the item, such as the tax jurisdiction, the tax percentage, and the tax type.&lt;/li&gt; &lt;li&gt;&lt;b&gt; topRatedBuyingExperience&lt;/b&gt; - A boolean value indicating if this item is a top-rated plus item. A change in the item&#39;s top rated plus standing is not tracked by the revision ID. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.topRatedBuyingExperience\&quot;&gt;topRatedBuyingExperience&lt;/a&gt; for more information.&lt;/li&gt; &lt;li&gt;&lt;b&gt;uniqueBidderCount&lt;/b&gt; - This integer value indicates the number of different eBay users who have placed one or more bids on an auction item. This field is only applicable to auction items.&lt;/li&gt;&lt;/ul&gt;    &lt;b&gt; For Example&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;To check if a stored item&#39;s information is current, do following.  &lt;ol&gt;    &lt;li&gt;Pass in the item ID and set &lt;b&gt; fieldgroups&lt;/b&gt; to COMPACT. &lt;br /&gt; &lt;br /&gt;&lt;code&gt;item/v1|4**********8|0?fieldgroups&#x3D;COMPACT&lt;/code&gt; &lt;/li&gt;     &lt;li&gt;Do one of the following:    &lt;ul&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is returned and you &lt;em&gt;haven&#39;t&lt;/em&gt; stored a revision number for this item, record the number and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;   &lt;li&gt;If the revision number is different from the value you have stored, update the value and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is &lt;em&gt;not&lt;/em&gt; returned or has not changed, where needed, update the item information with the information returned in the response.&lt;/li&gt;  &lt;/ul&gt;  &lt;/li&gt; &lt;/ol&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/ul&gt;    &lt;p&gt;&lt;b&gt; Maximum value: &lt;/b&gt; 1 &lt;br /&gt;If more than one values is specified, the first value will be used. (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemAsyncWithHttpInfo($item_id, $fieldgroups = null)
    {
        $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Item';
        $request = $this->getItemRequest($item_id, $fieldgroups);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();

                    throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody(), $exception instanceof \Throwable ? $exception : null);
                }
            );
    }

    /**
     * Create request for operation 'getItem'.
     *
     * @param string $item_id     The eBay RESTful identifier of an item. This ID is returned by the &lt;b&gt; Browse&lt;/b&gt; and &lt;b&gt; Feed&lt;/b&gt; API methods.  &lt;br /&gt;&lt;br /&gt; &lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt; &lt;br /&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about item ID for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (required)
     * @param string $fieldgroups This parameter lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item.   &lt;br /&gt; &lt;br /&gt; &lt;b&gt; Valid Values: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; product fields to the response, which describe the product associated with the item. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields.&lt;/li&gt;          &lt;li&gt;&lt;b&gt; COMPACT&lt;/b&gt; -  This returns only the following fields, which let you quickly check if the availability or price of the item has changed, if the item has been revised by the seller, or if an item&#39;s top-rated plus status has changed for items you have stored.  &lt;ul&gt; &lt;li&gt; &lt;b&gt; itemId&lt;/b&gt; - The identifier of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;bidCount&lt;/b&gt; - This integer value indicates the total number of bids that have been placed against an auction item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;currentBidPrice&lt;/b&gt; - This container shows the current highest bid for an auction item. This container will only be returned for auction items.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;eligibleForInlineCheckout&lt;/b&gt; - This parameter returns items based on whether or not the items can be purchased using the Buy &lt;a href&#x3D;\&quot;/api-docs/buy/order/resources/methods\&quot;&gt;Order API&lt;/a&gt;. &lt;ul&gt; &lt;li&gt;If the value of this field is &lt;code&gt;true&lt;/code&gt;, this indicates that the item can be purchased using the &lt;b&gt; Order API&lt;/b&gt;. &lt;/li&gt;  &lt;li&gt;If the value of this field is &lt;code&gt;false&lt;/code&gt;, this indicates that the item cannot be purchased using the &lt;b&gt; Order API&lt;/b&gt; and must be purchased on the eBay site.&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;&lt;b&gt; estimatedAvailabilities&lt;/b&gt; -  Returns the item availability information, which is based on the item&#39;s quantity. &lt;b&gt; Note:&lt;/b&gt; Changes in quantity are not tracked by &lt;b&gt;sellerItemRevision&lt;/b&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemAffiliateWebURL&lt;/b&gt; - The URL of the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the &lt;code&gt;X-EBAY-C-ENDUSERCTX&lt;/code&gt; request header in the method.&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemCreationDate&lt;/b&gt; - This is a timestamp that indicates the date and time an item listing was created.&lt;/li&gt; &lt;li&gt;&lt;b&gt;itemEndDate&lt;/b&gt; - This is the scheduled end time of the listing.&lt;/li&gt; &lt;li&gt;&lt;b&gt;ItemWebURL&lt;/b&gt; - The URL of the View Item page of the item. This enables you to include a \&quot;Report Item on eBay\&quot; link that takes the buyer to the View Item page on eBay. From there they can report any issues regarding this item to eBay.&lt;/li&gt; &lt;li&gt;&lt;b&gt;legacyItemId&lt;/b&gt; - The unique identifier of the eBay listing that contains the item. This is the traditional/legacy ID that is often seen in the URL of the listing View Item page.&lt;/li&gt; &lt;li&gt;&lt;b&gt;minimumPriceToBid&lt;/b&gt; - This container shows the minimum bid amount that would be accepted as a qualifying bid in an auction listing. This container will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt;price&lt;/b&gt; - This is tracked by the revision ID but is returned here to enable you to quickly verify the price of the item.&lt;/li&gt; &lt;li&gt;&lt;b&gt;priorityListing&lt;/b&gt; - This field is returned as &lt;code&gt;true&lt;/code&gt; if the listing is part of a Promoted Listing campaign. Promoted Listings are available to Above Standard and Top Rated sellers with recent sales activity.&lt;/li&gt; &lt;li&gt;&lt;b&gt;reservePriceMet&lt;/b&gt; - This field indicates whether or not an auction&#39;s reserve price (if set by the seller) has been met yet. This field will only be returned for auction items.&lt;/li&gt; &lt;li&gt;&lt;b&gt; sellerItemRevision&lt;/b&gt; - An identifier generated/incremented when a seller revises the item. The following are the two types of item revisions:   &lt;ul&gt;  &lt;li&gt;&lt;b&gt; Seller changes&lt;/b&gt;, such as changing the title&lt;/li&gt;  &lt;li&gt;  &lt;b&gt; eBay system changes&lt;/b&gt;, such as changing the quantity when an item is purchased.&lt;/li&gt;  &lt;/ul&gt; This ID is changed &lt;em&gt;only&lt;/em&gt; when the seller makes a change to the item. This means you cannot use this value to determine if the quantity has changed. To check if the quantity has changed, use &lt;b&gt; estimatedAvailabilities.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;&lt;b&gt;shippingOptions&lt;/b&gt; - A container for the cost, carrier, and other details of shipping options.&lt;/li&gt; &lt;li&gt;&lt;b&gt;taxes&lt;/b&gt; - A container for the tax information for the item, such as the tax jurisdiction, the tax percentage, and the tax type.&lt;/li&gt; &lt;li&gt;&lt;b&gt; topRatedBuyingExperience&lt;/b&gt; - A boolean value indicating if this item is a top-rated plus item. A change in the item&#39;s top rated plus standing is not tracked by the revision ID. See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem#response.topRatedBuyingExperience\&quot;&gt;topRatedBuyingExperience&lt;/a&gt; for more information.&lt;/li&gt; &lt;li&gt;&lt;b&gt;uniqueBidderCount&lt;/b&gt; - This integer value indicates the number of different eBay users who have placed one or more bids on an auction item. This field is only applicable to auction items.&lt;/li&gt;&lt;/ul&gt;    &lt;b&gt; For Example&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;To check if a stored item&#39;s information is current, do following.  &lt;ol&gt;    &lt;li&gt;Pass in the item ID and set &lt;b&gt; fieldgroups&lt;/b&gt; to COMPACT. &lt;br /&gt; &lt;br /&gt;&lt;code&gt;item/v1|4**********8|0?fieldgroups&#x3D;COMPACT&lt;/code&gt; &lt;/li&gt;     &lt;li&gt;Do one of the following:    &lt;ul&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is returned and you &lt;em&gt;haven&#39;t&lt;/em&gt; stored a revision number for this item, record the number and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;   &lt;li&gt;If the revision number is different from the value you have stored, update the value and pass in the item ID in the &lt;b&gt; getItem&lt;/b&gt; method to get the latest information.&lt;/li&gt;     &lt;li&gt;If the &lt;b&gt; sellerItemRevision&lt;/b&gt; field is &lt;em&gt;not&lt;/em&gt; returned or has not changed, where needed, update the item information with the information returned in the response.&lt;/li&gt;  &lt;/ul&gt;  &lt;/li&gt; &lt;/ol&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/ul&gt;    &lt;p&gt;&lt;b&gt; Maximum value: &lt;/b&gt; 1 &lt;br /&gt;If more than one values is specified, the first value will be used. (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function getItemRequest($item_id, $fieldgroups = null)
    {
        // Verify the required parameter 'item_id' is set.
        if ($item_id === null || (\is_array($item_id) && count($item_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $item_id when calling getItem');
        }

        $resourcePath = '/item/{item_id}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $fieldgroups,
            'fieldgroups', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);

        // path params
        if ($item_id !== null) {
            $resourcePath = str_replace(
                '{item_id}',
                ObjectSerializer::toPathValue($item_id),
                $resourcePath
            );
        }

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                []
            );
        }

        // For model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];

                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem,
                        ];
                    }
                }

                // For HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                // For HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($queryParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }
        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = ObjectSerializer::buildQuery($queryParams);

        return new Request(
            'GET',
            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getItemByLegacyId.
     *
     * @param string $legacy_item_id       Specifies either: &lt;ul&gt; &lt;li&gt;The legacy item ID of an item that is &lt;em&gt;not&lt;/em&gt; part of a group. &lt;/li&gt; &lt;li&gt;The legacy item ID of a group, which is the ID of the \&quot;parent\&quot; of the group of items. &lt;br /&gt; &lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt; Note: &lt;/b&gt; If you pass in a group ID, you must also use the &lt;b&gt; legacy_variation_id&lt;/b&gt; field and pass in the legacy ID of the specific item variation (child ID).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; field for a specific item from Finding to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9  &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 (required)
     * @param string $fieldgroups          This field lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item. &lt;b&gt; Note&lt;/b&gt;: In this method, the only value supported is &lt;code&gt;PRODUCT&lt;/code&gt;. &lt;p&gt;&lt;b&gt; Valid Values: &lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; fields to the response, which describe the item&#39;s product.  See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItemByLegacyItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields. &lt;br /&gt;&lt;br /&gt;Code so that your app gracefully handles any future changes to this list. (optional)
     * @param string $legacy_variation_id  Specifies the legacy item ID of a specific item in an item group, such as the red shirt size L. &lt;br /&gt;&lt;br /&gt;Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.     &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_id&lt;/b&gt; (optional)
     * @param string $legacy_variation_sku Specifics the legacy SKU of the item. SKU are item ids created by the seller. &lt;br /&gt;&lt;br /&gt;Legacy SKUs are returned by eBay the  &lt;a href&#x3D;\&quot;https://developer.ebay.com/Devzone/shopping/docs/CallRef/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Shopping API&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; and &lt;b&gt; SKU&lt;/b&gt; fields to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9&amp;amp;legacy_variation_sku&#x3D;V**********M&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_sku&lt;/b&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\Browse\V1\Model\Item
     */
    public function getItemByLegacyId($legacy_item_id, $fieldgroups = null, $legacy_variation_id = null, $legacy_variation_sku = null)
    {
        [$response] = $this->getItemByLegacyIdWithHttpInfo($legacy_item_id, $fieldgroups, $legacy_variation_id, $legacy_variation_sku);

        return $response;
    }

    /**
     * Operation getItemByLegacyIdWithHttpInfo.
     *
     * @param string $legacy_item_id       Specifies either: &lt;ul&gt; &lt;li&gt;The legacy item ID of an item that is &lt;em&gt;not&lt;/em&gt; part of a group. &lt;/li&gt; &lt;li&gt;The legacy item ID of a group, which is the ID of the \&quot;parent\&quot; of the group of items. &lt;br /&gt; &lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt; Note: &lt;/b&gt; If you pass in a group ID, you must also use the &lt;b&gt; legacy_variation_id&lt;/b&gt; field and pass in the legacy ID of the specific item variation (child ID).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; field for a specific item from Finding to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9  &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 (required)
     * @param string $fieldgroups          This field lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item. &lt;b&gt; Note&lt;/b&gt;: In this method, the only value supported is &lt;code&gt;PRODUCT&lt;/code&gt;. &lt;p&gt;&lt;b&gt; Valid Values: &lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; fields to the response, which describe the item&#39;s product.  See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItemByLegacyItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields. &lt;br /&gt;&lt;br /&gt;Code so that your app gracefully handles any future changes to this list. (optional)
     * @param string $legacy_variation_id  Specifies the legacy item ID of a specific item in an item group, such as the red shirt size L. &lt;br /&gt;&lt;br /&gt;Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.     &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_id&lt;/b&gt; (optional)
     * @param string $legacy_variation_sku Specifics the legacy SKU of the item. SKU are item ids created by the seller. &lt;br /&gt;&lt;br /&gt;Legacy SKUs are returned by eBay the  &lt;a href&#x3D;\&quot;https://developer.ebay.com/Devzone/shopping/docs/CallRef/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Shopping API&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; and &lt;b&gt; SKU&lt;/b&gt; fields to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9&amp;amp;legacy_variation_sku&#x3D;V**********M&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_sku&lt;/b&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\Browse\V1\Model\Item, HTTP status code, HTTP response headers (array of strings)
     */
    public function getItemByLegacyIdWithHttpInfo($legacy_item_id, $fieldgroups = null, $legacy_variation_id = null, $legacy_variation_sku = null)
    {
        $request = $this->getItemByLegacyIdRequest($legacy_item_id, $fieldgroups, $legacy_variation_id, $legacy_variation_sku);

        try {
            $options = $this->createHttpClientOption();

            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null, $e);
            } catch (ConnectException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            } catch (GuzzleException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            }

            $statusCode = $response->getStatusCode();

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
            }

            switch ($statusCode) {
                case 200:
                    if ('\TNT\Ebay\Buy\Browse\V1\Model\Item' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\Browse\V1\Model\Item', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
            }

            $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Item';

            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); // Stream goes to serializer.
            } else {
                $content = (string) $response->getBody();
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders(),
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\Browse\V1\Model\Item',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getItemByLegacyIdAsync.
     *
     * @param string $legacy_item_id       Specifies either: &lt;ul&gt; &lt;li&gt;The legacy item ID of an item that is &lt;em&gt;not&lt;/em&gt; part of a group. &lt;/li&gt; &lt;li&gt;The legacy item ID of a group, which is the ID of the \&quot;parent\&quot; of the group of items. &lt;br /&gt; &lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt; Note: &lt;/b&gt; If you pass in a group ID, you must also use the &lt;b&gt; legacy_variation_id&lt;/b&gt; field and pass in the legacy ID of the specific item variation (child ID).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; field for a specific item from Finding to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9  &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 (required)
     * @param string $fieldgroups          This field lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item. &lt;b&gt; Note&lt;/b&gt;: In this method, the only value supported is &lt;code&gt;PRODUCT&lt;/code&gt;. &lt;p&gt;&lt;b&gt; Valid Values: &lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; fields to the response, which describe the item&#39;s product.  See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItemByLegacyItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields. &lt;br /&gt;&lt;br /&gt;Code so that your app gracefully handles any future changes to this list. (optional)
     * @param string $legacy_variation_id  Specifies the legacy item ID of a specific item in an item group, such as the red shirt size L. &lt;br /&gt;&lt;br /&gt;Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.     &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_id&lt;/b&gt; (optional)
     * @param string $legacy_variation_sku Specifics the legacy SKU of the item. SKU are item ids created by the seller. &lt;br /&gt;&lt;br /&gt;Legacy SKUs are returned by eBay the  &lt;a href&#x3D;\&quot;https://developer.ebay.com/Devzone/shopping/docs/CallRef/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Shopping API&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; and &lt;b&gt; SKU&lt;/b&gt; fields to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9&amp;amp;legacy_variation_sku&#x3D;V**********M&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_sku&lt;/b&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemByLegacyIdAsync($legacy_item_id, $fieldgroups = null, $legacy_variation_id = null, $legacy_variation_sku = null)
    {
        return $this->getItemByLegacyIdAsyncWithHttpInfo($legacy_item_id, $fieldgroups, $legacy_variation_id, $legacy_variation_sku)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getItemByLegacyIdAsyncWithHttpInfo.
     *
     * @param string $legacy_item_id       Specifies either: &lt;ul&gt; &lt;li&gt;The legacy item ID of an item that is &lt;em&gt;not&lt;/em&gt; part of a group. &lt;/li&gt; &lt;li&gt;The legacy item ID of a group, which is the ID of the \&quot;parent\&quot; of the group of items. &lt;br /&gt; &lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt; Note: &lt;/b&gt; If you pass in a group ID, you must also use the &lt;b&gt; legacy_variation_id&lt;/b&gt; field and pass in the legacy ID of the specific item variation (child ID).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; field for a specific item from Finding to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9  &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 (required)
     * @param string $fieldgroups          This field lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item. &lt;b&gt; Note&lt;/b&gt;: In this method, the only value supported is &lt;code&gt;PRODUCT&lt;/code&gt;. &lt;p&gt;&lt;b&gt; Valid Values: &lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; fields to the response, which describe the item&#39;s product.  See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItemByLegacyItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields. &lt;br /&gt;&lt;br /&gt;Code so that your app gracefully handles any future changes to this list. (optional)
     * @param string $legacy_variation_id  Specifies the legacy item ID of a specific item in an item group, such as the red shirt size L. &lt;br /&gt;&lt;br /&gt;Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.     &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_id&lt;/b&gt; (optional)
     * @param string $legacy_variation_sku Specifics the legacy SKU of the item. SKU are item ids created by the seller. &lt;br /&gt;&lt;br /&gt;Legacy SKUs are returned by eBay the  &lt;a href&#x3D;\&quot;https://developer.ebay.com/Devzone/shopping/docs/CallRef/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Shopping API&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; and &lt;b&gt; SKU&lt;/b&gt; fields to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9&amp;amp;legacy_variation_sku&#x3D;V**********M&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_sku&lt;/b&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemByLegacyIdAsyncWithHttpInfo($legacy_item_id, $fieldgroups = null, $legacy_variation_id = null, $legacy_variation_sku = null)
    {
        $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Item';
        $request = $this->getItemByLegacyIdRequest($legacy_item_id, $fieldgroups, $legacy_variation_id, $legacy_variation_sku);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();

                    throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody(), $exception instanceof \Throwable ? $exception : null);
                }
            );
    }

    /**
     * Create request for operation 'getItemByLegacyId'.
     *
     * @param string $legacy_item_id       Specifies either: &lt;ul&gt; &lt;li&gt;The legacy item ID of an item that is &lt;em&gt;not&lt;/em&gt; part of a group. &lt;/li&gt; &lt;li&gt;The legacy item ID of a group, which is the ID of the \&quot;parent\&quot; of the group of items. &lt;br /&gt; &lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt; Note: &lt;/b&gt; If you pass in a group ID, you must also use the &lt;b&gt; legacy_variation_id&lt;/b&gt; field and pass in the legacy ID of the specific item variation (child ID).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; field for a specific item from Finding to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9  &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 (required)
     * @param string $fieldgroups          This field lets you control what is returned in the response. If you do not set this field, the method returns all the details of the item. &lt;b&gt; Note&lt;/b&gt;: In this method, the only value supported is &lt;code&gt;PRODUCT&lt;/code&gt;. &lt;p&gt;&lt;b&gt; Valid Values: &lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;b&gt; PRODUCT&lt;/b&gt; - This adds the &lt;code&gt;additionalImages&lt;/code&gt;, &lt;code&gt;additionalProductIdentities&lt;/code&gt;, &lt;code&gt;aspectGroups&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;gtins&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt;, and &lt;code&gt;title&lt;/code&gt; fields to the response, which describe the item&#39;s product.  See &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItemByLegacyItem#response.product\&quot;&gt;Product&lt;/a&gt; for more information about these fields. &lt;br /&gt;&lt;br /&gt;Code so that your app gracefully handles any future changes to this list. (optional)
     * @param string $legacy_variation_id  Specifies the legacy item ID of a specific item in an item group, such as the red shirt size L. &lt;br /&gt;&lt;br /&gt;Legacy ids are returned by APIs, such as the &lt;a href&#x3D;\&quot;https://developer.ebay.com/devzone/finding/callref/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Finding API&lt;/a&gt;.     &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_id&lt;/b&gt; (optional)
     * @param string $legacy_variation_sku Specifics the legacy SKU of the item. SKU are item ids created by the seller. &lt;br /&gt;&lt;br /&gt;Legacy SKUs are returned by eBay the  &lt;a href&#x3D;\&quot;https://developer.ebay.com/Devzone/shopping/docs/CallRef/index.html \&quot; target&#x3D;\&quot;_blank\&quot;&gt;Shopping API&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The following is an example of using the value of the &lt;b&gt; ItemID&lt;/b&gt; and &lt;b&gt; SKU&lt;/b&gt; fields to get the RESTful &lt;b&gt; itemId&lt;/b&gt; value. &lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; browse/v1/item/get_item_by_legacy_id?legacy_item_id&#x3D;1**********9&amp;amp;legacy_variation_sku&#x3D;V**********M&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Maximum: &lt;/b&gt; 1 &lt;br /&gt;&lt;b&gt; Requirement: &lt;/b&gt; You must &lt;b&gt; always&lt;/b&gt; pass in the &lt;b&gt; legacy_item_id &lt;/b&gt; with the &lt;b&gt; legacy_variation_sku&lt;/b&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function getItemByLegacyIdRequest($legacy_item_id, $fieldgroups = null, $legacy_variation_id = null, $legacy_variation_sku = null)
    {
        // Verify the required parameter 'legacy_item_id' is set.
        if ($legacy_item_id === null || (\is_array($legacy_item_id) && count($legacy_item_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $legacy_item_id when calling getItemByLegacyId');
        }

        $resourcePath = '/item/get_item_by_legacy_id';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $fieldgroups,
            'fieldgroups', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);
        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $legacy_item_id,
            'legacy_item_id', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);
        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $legacy_variation_id,
            'legacy_variation_id', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);
        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $legacy_variation_sku,
            'legacy_variation_sku', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                []
            );
        }

        // For model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];

                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem,
                        ];
                    }
                }

                // For HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                // For HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($queryParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }
        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = ObjectSerializer::buildQuery($queryParams);

        return new Request(
            'GET',
            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getItems.
     *
     * @param string $item_ids       A list of item IDs. Item IDs are the eBay RESTful identifier of items. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error. &lt;br&gt;&lt;br&gt; In a request, multiple item_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemIDs: &lt;/b&gt; 20 &lt;br&gt;&lt;br&gt;For more information about item IDs for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (optional)
     * @param string $item_group_ids A list of item group IDs. Item group IDs are the eBay RESTful identifier of item groups. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Group Item ID Format: &lt;/b&gt;&lt;code&gt;############&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;3**********9&lt;/code&gt;&lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error.&lt;br&gt;&lt;br&gt;In a request, multiple item_group_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemGroupIDs: &lt;/b&gt; 10 &lt;br&gt;&lt;br&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\Browse\V1\Model\Items
     */
    public function getItems($item_ids = null, $item_group_ids = null)
    {
        [$response] = $this->getItemsWithHttpInfo($item_ids, $item_group_ids);

        return $response;
    }

    /**
     * Operation getItemsWithHttpInfo.
     *
     * @param string $item_ids       A list of item IDs. Item IDs are the eBay RESTful identifier of items. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error. &lt;br&gt;&lt;br&gt; In a request, multiple item_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemIDs: &lt;/b&gt; 20 &lt;br&gt;&lt;br&gt;For more information about item IDs for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (optional)
     * @param string $item_group_ids A list of item group IDs. Item group IDs are the eBay RESTful identifier of item groups. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Group Item ID Format: &lt;/b&gt;&lt;code&gt;############&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;3**********9&lt;/code&gt;&lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error.&lt;br&gt;&lt;br&gt;In a request, multiple item_group_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemGroupIDs: &lt;/b&gt; 10 &lt;br&gt;&lt;br&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\Browse\V1\Model\Items, HTTP status code, HTTP response headers (array of strings)
     */
    public function getItemsWithHttpInfo($item_ids = null, $item_group_ids = null)
    {
        $request = $this->getItemsRequest($item_ids, $item_group_ids);

        try {
            $options = $this->createHttpClientOption();

            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null, $e);
            } catch (ConnectException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            } catch (GuzzleException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            }

            $statusCode = $response->getStatusCode();

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
            }

            switch ($statusCode) {
                case 200:
                    if ('\TNT\Ebay\Buy\Browse\V1\Model\Items' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\Browse\V1\Model\Items', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
            }

            $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Items';

            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); // Stream goes to serializer.
            } else {
                $content = (string) $response->getBody();
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders(),
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\Browse\V1\Model\Items',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getItemsAsync.
     *
     * @param string $item_ids       A list of item IDs. Item IDs are the eBay RESTful identifier of items. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error. &lt;br&gt;&lt;br&gt; In a request, multiple item_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemIDs: &lt;/b&gt; 20 &lt;br&gt;&lt;br&gt;For more information about item IDs for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (optional)
     * @param string $item_group_ids A list of item group IDs. Item group IDs are the eBay RESTful identifier of item groups. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Group Item ID Format: &lt;/b&gt;&lt;code&gt;############&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;3**********9&lt;/code&gt;&lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error.&lt;br&gt;&lt;br&gt;In a request, multiple item_group_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemGroupIDs: &lt;/b&gt; 10 &lt;br&gt;&lt;br&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemsAsync($item_ids = null, $item_group_ids = null)
    {
        return $this->getItemsAsyncWithHttpInfo($item_ids, $item_group_ids)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getItemsAsyncWithHttpInfo.
     *
     * @param string $item_ids       A list of item IDs. Item IDs are the eBay RESTful identifier of items. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error. &lt;br&gt;&lt;br&gt; In a request, multiple item_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemIDs: &lt;/b&gt; 20 &lt;br&gt;&lt;br&gt;For more information about item IDs for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (optional)
     * @param string $item_group_ids A list of item group IDs. Item group IDs are the eBay RESTful identifier of item groups. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Group Item ID Format: &lt;/b&gt;&lt;code&gt;############&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;3**********9&lt;/code&gt;&lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error.&lt;br&gt;&lt;br&gt;In a request, multiple item_group_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemGroupIDs: &lt;/b&gt; 10 &lt;br&gt;&lt;br&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemsAsyncWithHttpInfo($item_ids = null, $item_group_ids = null)
    {
        $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\Items';
        $request = $this->getItemsRequest($item_ids, $item_group_ids);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();

                    throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody(), $exception instanceof \Throwable ? $exception : null);
                }
            );
    }

    /**
     * Create request for operation 'getItems'.
     *
     * @param string $item_ids       A list of item IDs. Item IDs are the eBay RESTful identifier of items. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Item ID Format: &lt;/b&gt;&lt;code&gt;v1&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;|&lt;code&gt;&lt;i&gt;#&lt;/i&gt;&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;v1|2**********2|0&lt;/code&gt; or &lt;code&gt;v1|1**********2|4**********2&lt;/code&gt; &lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error. &lt;br&gt;&lt;br&gt; In a request, multiple item_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemIDs: &lt;/b&gt; 20 &lt;br&gt;&lt;br&gt;For more information about item IDs for RESTful APIs, see the &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-browse.html#Legacy\&quot;&gt;Legacy API compatibility&lt;/a&gt; section of the &lt;i&gt;Buy APIs Overview&lt;/i&gt;. (optional)
     * @param string $item_group_ids A list of item group IDs. Item group IDs are the eBay RESTful identifier of item groups. &lt;br&gt;&lt;br&gt;&lt;b&gt; RESTful Group Item ID Format: &lt;/b&gt;&lt;code&gt;############&lt;/code&gt;&lt;br&gt;For example: &lt;code&gt;3**********9&lt;/code&gt;&lt;br&gt;&lt;br&gt;In any given request, either item_ids or item_group_ids can be retrieved. Attempting to retrieve both will result in an error.&lt;br&gt;&lt;br&gt;In a request, multiple item_group_ids can be passed as comma separated values.&lt;br&gt;&lt;br&gt;&lt;b&gt; Maximum allowed itemGroupIDs: &lt;/b&gt; 10 &lt;br&gt;&lt;br&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function getItemsRequest($item_ids = null, $item_group_ids = null)
    {
        $resourcePath = '/item/';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $item_ids,
            'item_ids', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);
        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $item_group_ids,
            'item_group_ids', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                []
            );
        }

        // For model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];

                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem,
                        ];
                    }
                }

                // For HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                // For HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($queryParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }
        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = ObjectSerializer::buildQuery($queryParams);

        return new Request(
            'GET',
            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getItemsByItemGroup.
     *
     * @param string $item_group_id Identifier of the item group to return.  An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. &lt;/p&gt; &lt;p&gt;This ID is returned in the &lt;b&gt; itemGroupHref&lt;/b&gt; field of the &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item_summary/methods/search\&quot;&gt;search&lt;/a&gt; and &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem\&quot;&gt;getItem&lt;/a&gt; methods. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; For Example: &lt;/b&gt;&lt;code&gt; https://api.ebay.com/buy/browse/v1/item/get_items_by_item_group?item_group_id&#x3D;3**********6&lt;/code&gt; (required)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\Browse\V1\Model\ItemGroup
     */
    public function getItemsByItemGroup($item_group_id)
    {
        [$response] = $this->getItemsByItemGroupWithHttpInfo($item_group_id);

        return $response;
    }

    /**
     * Operation getItemsByItemGroupWithHttpInfo.
     *
     * @param string $item_group_id Identifier of the item group to return.  An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. &lt;/p&gt; &lt;p&gt;This ID is returned in the &lt;b&gt; itemGroupHref&lt;/b&gt; field of the &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item_summary/methods/search\&quot;&gt;search&lt;/a&gt; and &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem\&quot;&gt;getItem&lt;/a&gt; methods. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; For Example: &lt;/b&gt;&lt;code&gt; https://api.ebay.com/buy/browse/v1/item/get_items_by_item_group?item_group_id&#x3D;3**********6&lt;/code&gt; (required)
     *
     * @throws \TNT\Ebay\Buy\Browse\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\Browse\V1\Model\ItemGroup, HTTP status code, HTTP response headers (array of strings)
     */
    public function getItemsByItemGroupWithHttpInfo($item_group_id)
    {
        $request = $this->getItemsByItemGroupRequest($item_group_id);

        try {
            $options = $this->createHttpClientOption();

            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null, $e);
            } catch (ConnectException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            } catch (GuzzleException $e) {
                throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null, $e);
            }

            $statusCode = $response->getStatusCode();

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
            }

            switch ($statusCode) {
                case 200:
                    if ('\TNT\Ebay\Buy\Browse\V1\Model\ItemGroup' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\Browse\V1\Model\ItemGroup', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
            }

            $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\ItemGroup';

            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); // Stream goes to serializer.
            } else {
                $content = (string) $response->getBody();
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders(),
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\Browse\V1\Model\ItemGroup',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getItemsByItemGroupAsync.
     *
     * @param string $item_group_id Identifier of the item group to return.  An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. &lt;/p&gt; &lt;p&gt;This ID is returned in the &lt;b&gt; itemGroupHref&lt;/b&gt; field of the &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item_summary/methods/search\&quot;&gt;search&lt;/a&gt; and &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem\&quot;&gt;getItem&lt;/a&gt; methods. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; For Example: &lt;/b&gt;&lt;code&gt; https://api.ebay.com/buy/browse/v1/item/get_items_by_item_group?item_group_id&#x3D;3**********6&lt;/code&gt; (required)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemsByItemGroupAsync($item_group_id)
    {
        return $this->getItemsByItemGroupAsyncWithHttpInfo($item_group_id)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getItemsByItemGroupAsyncWithHttpInfo.
     *
     * @param string $item_group_id Identifier of the item group to return.  An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. &lt;/p&gt; &lt;p&gt;This ID is returned in the &lt;b&gt; itemGroupHref&lt;/b&gt; field of the &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item_summary/methods/search\&quot;&gt;search&lt;/a&gt; and &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem\&quot;&gt;getItem&lt;/a&gt; methods. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; For Example: &lt;/b&gt;&lt;code&gt; https://api.ebay.com/buy/browse/v1/item/get_items_by_item_group?item_group_id&#x3D;3**********6&lt;/code&gt; (required)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemsByItemGroupAsyncWithHttpInfo($item_group_id)
    {
        $returnType = '\TNT\Ebay\Buy\Browse\V1\Model\ItemGroup';
        $request = $this->getItemsByItemGroupRequest($item_group_id);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();

                    throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody(), $exception instanceof \Throwable ? $exception : null);
                }
            );
    }

    /**
     * Create request for operation 'getItemsByItemGroup'.
     *
     * @param string $item_group_id Identifier of the item group to return.  An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. &lt;/p&gt; &lt;p&gt;This ID is returned in the &lt;b&gt; itemGroupHref&lt;/b&gt; field of the &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item_summary/methods/search\&quot;&gt;search&lt;/a&gt; and &lt;a href&#x3D;\&quot;/api-docs/buy/browse/resources/item/methods/getItem\&quot;&gt;getItem&lt;/a&gt; methods. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; For Example: &lt;/b&gt;&lt;code&gt; https://api.ebay.com/buy/browse/v1/item/get_items_by_item_group?item_group_id&#x3D;3**********6&lt;/code&gt; (required)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function getItemsByItemGroupRequest($item_group_id)
    {
        // Verify the required parameter 'item_group_id' is set.
        if ($item_group_id === null || (\is_array($item_group_id) && count($item_group_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $item_group_id when calling getItemsByItemGroup');
        }

        $resourcePath = '/item/get_items_by_item_group';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $item_group_id,
            'item_group_id', // param base name
            'string', // openApiType
            'form', // style
            true // explode
        ) ?? []);

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                []
            );
        }

        // For model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];

                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem,
                        ];
                    }
                }

                // For HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                // For HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($queryParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }
        // this endpoint requires OAuth (access token)
        if (! empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = ObjectSerializer::buildQuery($queryParams);

        return new Request(
            'GET',
            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Create http client option.
     *
     * @throws \RuntimeException on file opening failure
     *
     * @return array of http client options
     */
    protected function createHttpClientOption()
    {
        $options = [];

        if ($this->config->getDebug()) {
            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'ab');

            if (! $options[RequestOptions::DEBUG]) {
                throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
            }
        }

        return $options;
    }
}