brandon14/ebay-sdk-php

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

Summary

Maintainability
F
5 days
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
 */

/**
 * Item Feed Service.
 *
 * <span class=\"tablenote\"><b>Note:</b> This is 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> API available only to select developers approved by business units.</span><br /><br />The Feed API provides the ability to download TSV_GZIP feed files containing eBay items and an hourly snapshot file of the items that have changed within an hour for a specific category, date and marketplace. <p>In addition to the API, there is an open source <a href=\"https://github.com/eBay/FeedSDK \" target=\"_blank\">Feed SDK</a> written in Java that downloads, combines files into a single file when needed, and unzips the entire feed file. It also lets you specify field filters to curate the items in the file.</p>
 *
 * The version of the OpenAPI document: v1_beta.33.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\FeedBeta\V1\Api;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use TNT\Ebay\Buy\FeedBeta\V1\ApiException;
use TNT\Ebay\Buy\FeedBeta\V1\Configuration;
use TNT\Ebay\Buy\FeedBeta\V1\HeaderSelector;
use TNT\Ebay\Buy\FeedBeta\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 getItemFeed.
     *
     * @param string $accept                  The formats that the client accepts for the response.&lt;br /&gt;&lt;br /&gt;A successful call will always return a TSV.GZIP file; however, unsuccessful calls generate errors that are returned in JSON format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default:&lt;/b&gt; &lt;code&gt;application/json,text/tab-separated-values&lt;/code&gt; (required)
     * @param string $x_ebay_c_marketplace_id The ID of the eBay marketplace where the item is hosted. &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/feed/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param string $range                   &lt;a name&#x3D;\&quot;range-header\&quot;&gt;&lt;/a&gt;This header specifies the range in bytes of the chunks of the gzip file being returned. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Format:&lt;/b&gt; &lt;code &gt;bytes&#x3D;&lt;em&gt;startpos&lt;/em&gt;-&lt;em&gt;endpos&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;  For example, the following retrieves the first 10 MBs of the feed file. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;Range bytes&#x3D;0-10485760&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about using this header, see &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-feed.html#retrv-gzip\&quot;&gt;Retrieving a gzip feed file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; 100 MB (10MB in the Sandbox) (required)
     * @param string $feed_scope              Specifies the type of feed file to return. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Values: &lt;/b&gt;   &lt;ul&gt; &lt;li&gt;&lt;b&gt; NEWLY_LISTED&lt;/b&gt; - Returns the daily &lt;b&gt;Item&lt;/b&gt; feed file containing all Good &#39;Til Cancelled items that were listed on the day specified by the &lt;b&gt; date&lt;/b&gt; parameter in the category specified by the &lt;b&gt; category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;NEWLY_LISTED&amp;category_id&#x3D;15032&amp;date&#x3D;20170925&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALL_ACTIVE&lt;/b&gt; - Returns the weekly &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file containing all the Good &#39;Til Cancelled items in the category specified by the &lt;b&gt;category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Bootstrap files are generated every Tuesday and the file is available on Wednesday. However, the exact time the file is available can vary so we recommend you download the Bootstrap file on Thursday. The items in the file are the items that were in the specified category on Sunday.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;ALL_ACTIVE&amp;category_id&#x3D;15032&lt;/code&gt;  &lt;/ul&gt; (required)
     * @param string $category_id             An eBay top-level category ID of the items to be returned in the feed file. &lt;br /&gt; &lt;br /&gt;The list of eBay category IDs changes over time and category IDs are not the same across all the eBay marketplaces. To get a list of the top-level categories for a marketplace, you can use the Taxonomy API &lt;a href&#x3D;\&quot;/api-docs/commerce/taxonomy/resources/category_tree/methods/getCategoryTree\&quot;&gt;getCategoryTree&lt;/a&gt; method. This method retrieves the complete category tree for the marketplace. The top-level categories are identified by the &lt;b&gt;categoryTreeNodeLevel&lt;/b&gt; field. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;For example:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;\&quot;categoryTreeNodeLevel\&quot;: 1&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For details see &lt;a href&#x3D;\&quot;/api-docs/buy/buy-categories.html\&quot;&gt;Get Categories for Buy APIs&lt;/a&gt;. &lt;/li&gt;  &lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;   &lt;b&gt;Restriction:&lt;/b&gt; Must be a top-level (L1) category other than Real Estate. Items listed under Real Estate L1 categories are excluded from all feeds in all marketplaces. (required)
     * @param string $date                    The date of the daily &lt;b&gt;Item&lt;/b&gt; feed file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt;) you want. &lt;p&gt;The &lt;b&gt; date&lt;/b&gt; is required only for the daily &lt;b&gt;Item&lt;/b&gt; feed file. If you specify a date for the &lt;b&gt;Item Bootstrap&lt;/b&gt; file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;ALL_ACTIVE&lt;/code&gt;), the date is ignored and the latest file is returned. The date the &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file was generated is returned in the &lt;b&gt;Last-Modified&lt;/b&gt; response header.&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;The &lt;b&gt; Item&lt;/b&gt; feed files are generated every day and there are 14 daily files available.&lt;/p&gt;  &lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt;Note: &lt;/b&gt;&lt;ul&gt;  &lt;li&gt;The daily &lt;b&gt;Item&lt;/b&gt; feed files are available each day after 9AM MST (US Mountain Standard Time), which is -7 hours UTC time.&lt;/li&gt;    &lt;li&gt;There is a 48 hour latency when generating the &lt;b&gt; Item&lt;/b&gt; feed files. This means you can download the file for July 10th on July 12 after 9AM MST. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: &lt;/b&gt; For categories with a large number of items, the latency can be up to 72 hours.&lt;/li&gt; &lt;/ul&gt;&lt;/span&gt; &lt;p&gt;&lt;b&gt; Format: &lt;/b&gt;&lt;code&gt;yyyyMMdd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Requirements: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt;Required when &lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt; &lt;/li&gt;  &lt;li&gt;Must be within 3-14 days in the past&lt;/li&gt;&lt;/ul&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\FeedBeta\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return \TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse|\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse
     */
    public function getItemFeed($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date = null)
    {
        [$response] = $this->getItemFeedWithHttpInfo($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date);

        return $response;
    }

    /**
     * Operation getItemFeedWithHttpInfo.
     *
     * @param string $accept                  The formats that the client accepts for the response.&lt;br /&gt;&lt;br /&gt;A successful call will always return a TSV.GZIP file; however, unsuccessful calls generate errors that are returned in JSON format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default:&lt;/b&gt; &lt;code&gt;application/json,text/tab-separated-values&lt;/code&gt; (required)
     * @param string $x_ebay_c_marketplace_id The ID of the eBay marketplace where the item is hosted. &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/feed/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param string $range                   &lt;a name&#x3D;\&quot;range-header\&quot;&gt;&lt;/a&gt;This header specifies the range in bytes of the chunks of the gzip file being returned. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Format:&lt;/b&gt; &lt;code &gt;bytes&#x3D;&lt;em&gt;startpos&lt;/em&gt;-&lt;em&gt;endpos&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;  For example, the following retrieves the first 10 MBs of the feed file. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;Range bytes&#x3D;0-10485760&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about using this header, see &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-feed.html#retrv-gzip\&quot;&gt;Retrieving a gzip feed file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; 100 MB (10MB in the Sandbox) (required)
     * @param string $feed_scope              Specifies the type of feed file to return. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Values: &lt;/b&gt;   &lt;ul&gt; &lt;li&gt;&lt;b&gt; NEWLY_LISTED&lt;/b&gt; - Returns the daily &lt;b&gt;Item&lt;/b&gt; feed file containing all Good &#39;Til Cancelled items that were listed on the day specified by the &lt;b&gt; date&lt;/b&gt; parameter in the category specified by the &lt;b&gt; category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;NEWLY_LISTED&amp;category_id&#x3D;15032&amp;date&#x3D;20170925&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALL_ACTIVE&lt;/b&gt; - Returns the weekly &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file containing all the Good &#39;Til Cancelled items in the category specified by the &lt;b&gt;category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Bootstrap files are generated every Tuesday and the file is available on Wednesday. However, the exact time the file is available can vary so we recommend you download the Bootstrap file on Thursday. The items in the file are the items that were in the specified category on Sunday.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;ALL_ACTIVE&amp;category_id&#x3D;15032&lt;/code&gt;  &lt;/ul&gt; (required)
     * @param string $category_id             An eBay top-level category ID of the items to be returned in the feed file. &lt;br /&gt; &lt;br /&gt;The list of eBay category IDs changes over time and category IDs are not the same across all the eBay marketplaces. To get a list of the top-level categories for a marketplace, you can use the Taxonomy API &lt;a href&#x3D;\&quot;/api-docs/commerce/taxonomy/resources/category_tree/methods/getCategoryTree\&quot;&gt;getCategoryTree&lt;/a&gt; method. This method retrieves the complete category tree for the marketplace. The top-level categories are identified by the &lt;b&gt;categoryTreeNodeLevel&lt;/b&gt; field. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;For example:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;\&quot;categoryTreeNodeLevel\&quot;: 1&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For details see &lt;a href&#x3D;\&quot;/api-docs/buy/buy-categories.html\&quot;&gt;Get Categories for Buy APIs&lt;/a&gt;. &lt;/li&gt;  &lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;   &lt;b&gt;Restriction:&lt;/b&gt; Must be a top-level (L1) category other than Real Estate. Items listed under Real Estate L1 categories are excluded from all feeds in all marketplaces. (required)
     * @param string $date                    The date of the daily &lt;b&gt;Item&lt;/b&gt; feed file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt;) you want. &lt;p&gt;The &lt;b&gt; date&lt;/b&gt; is required only for the daily &lt;b&gt;Item&lt;/b&gt; feed file. If you specify a date for the &lt;b&gt;Item Bootstrap&lt;/b&gt; file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;ALL_ACTIVE&lt;/code&gt;), the date is ignored and the latest file is returned. The date the &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file was generated is returned in the &lt;b&gt;Last-Modified&lt;/b&gt; response header.&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;The &lt;b&gt; Item&lt;/b&gt; feed files are generated every day and there are 14 daily files available.&lt;/p&gt;  &lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt;Note: &lt;/b&gt;&lt;ul&gt;  &lt;li&gt;The daily &lt;b&gt;Item&lt;/b&gt; feed files are available each day after 9AM MST (US Mountain Standard Time), which is -7 hours UTC time.&lt;/li&gt;    &lt;li&gt;There is a 48 hour latency when generating the &lt;b&gt; Item&lt;/b&gt; feed files. This means you can download the file for July 10th on July 12 after 9AM MST. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: &lt;/b&gt; For categories with a large number of items, the latency can be up to 72 hours.&lt;/li&gt; &lt;/ul&gt;&lt;/span&gt; &lt;p&gt;&lt;b&gt; Format: &lt;/b&gt;&lt;code&gt;yyyyMMdd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Requirements: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt;Required when &lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt; &lt;/li&gt;  &lt;li&gt;Must be within 3-14 days in the past&lt;/li&gt;&lt;/ul&gt; (optional)
     *
     * @throws \TNT\Ebay\Buy\FeedBeta\V1\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     *
     * @return array of \TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse|\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getItemFeedWithHttpInfo($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date = null)
    {
        $request = $this->getItemFeedRequest($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date);

        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\FeedBeta\V1\Model\ItemResponse' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

                    return [
                        ObjectSerializer::deserialize($content, '\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse', []),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                    ];
                case 206:
                    if ('\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse' === '\SplFileObject') {
                        $content = $response->getBody(); // Stream goes to serializer.
                    } else {
                        $content = (string) $response->getBody();
                    }

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

            $returnType = '\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse';

            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\FeedBeta\V1\Model\ItemResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 206:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getItemFeedAsync.
     *
     * @param string $accept                  The formats that the client accepts for the response.&lt;br /&gt;&lt;br /&gt;A successful call will always return a TSV.GZIP file; however, unsuccessful calls generate errors that are returned in JSON format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default:&lt;/b&gt; &lt;code&gt;application/json,text/tab-separated-values&lt;/code&gt; (required)
     * @param string $x_ebay_c_marketplace_id The ID of the eBay marketplace where the item is hosted. &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/feed/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param string $range                   &lt;a name&#x3D;\&quot;range-header\&quot;&gt;&lt;/a&gt;This header specifies the range in bytes of the chunks of the gzip file being returned. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Format:&lt;/b&gt; &lt;code &gt;bytes&#x3D;&lt;em&gt;startpos&lt;/em&gt;-&lt;em&gt;endpos&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;  For example, the following retrieves the first 10 MBs of the feed file. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;Range bytes&#x3D;0-10485760&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about using this header, see &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-feed.html#retrv-gzip\&quot;&gt;Retrieving a gzip feed file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; 100 MB (10MB in the Sandbox) (required)
     * @param string $feed_scope              Specifies the type of feed file to return. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Values: &lt;/b&gt;   &lt;ul&gt; &lt;li&gt;&lt;b&gt; NEWLY_LISTED&lt;/b&gt; - Returns the daily &lt;b&gt;Item&lt;/b&gt; feed file containing all Good &#39;Til Cancelled items that were listed on the day specified by the &lt;b&gt; date&lt;/b&gt; parameter in the category specified by the &lt;b&gt; category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;NEWLY_LISTED&amp;category_id&#x3D;15032&amp;date&#x3D;20170925&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALL_ACTIVE&lt;/b&gt; - Returns the weekly &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file containing all the Good &#39;Til Cancelled items in the category specified by the &lt;b&gt;category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Bootstrap files are generated every Tuesday and the file is available on Wednesday. However, the exact time the file is available can vary so we recommend you download the Bootstrap file on Thursday. The items in the file are the items that were in the specified category on Sunday.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;ALL_ACTIVE&amp;category_id&#x3D;15032&lt;/code&gt;  &lt;/ul&gt; (required)
     * @param string $category_id             An eBay top-level category ID of the items to be returned in the feed file. &lt;br /&gt; &lt;br /&gt;The list of eBay category IDs changes over time and category IDs are not the same across all the eBay marketplaces. To get a list of the top-level categories for a marketplace, you can use the Taxonomy API &lt;a href&#x3D;\&quot;/api-docs/commerce/taxonomy/resources/category_tree/methods/getCategoryTree\&quot;&gt;getCategoryTree&lt;/a&gt; method. This method retrieves the complete category tree for the marketplace. The top-level categories are identified by the &lt;b&gt;categoryTreeNodeLevel&lt;/b&gt; field. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;For example:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;\&quot;categoryTreeNodeLevel\&quot;: 1&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For details see &lt;a href&#x3D;\&quot;/api-docs/buy/buy-categories.html\&quot;&gt;Get Categories for Buy APIs&lt;/a&gt;. &lt;/li&gt;  &lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;   &lt;b&gt;Restriction:&lt;/b&gt; Must be a top-level (L1) category other than Real Estate. Items listed under Real Estate L1 categories are excluded from all feeds in all marketplaces. (required)
     * @param string $date                    The date of the daily &lt;b&gt;Item&lt;/b&gt; feed file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt;) you want. &lt;p&gt;The &lt;b&gt; date&lt;/b&gt; is required only for the daily &lt;b&gt;Item&lt;/b&gt; feed file. If you specify a date for the &lt;b&gt;Item Bootstrap&lt;/b&gt; file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;ALL_ACTIVE&lt;/code&gt;), the date is ignored and the latest file is returned. The date the &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file was generated is returned in the &lt;b&gt;Last-Modified&lt;/b&gt; response header.&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;The &lt;b&gt; Item&lt;/b&gt; feed files are generated every day and there are 14 daily files available.&lt;/p&gt;  &lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt;Note: &lt;/b&gt;&lt;ul&gt;  &lt;li&gt;The daily &lt;b&gt;Item&lt;/b&gt; feed files are available each day after 9AM MST (US Mountain Standard Time), which is -7 hours UTC time.&lt;/li&gt;    &lt;li&gt;There is a 48 hour latency when generating the &lt;b&gt; Item&lt;/b&gt; feed files. This means you can download the file for July 10th on July 12 after 9AM MST. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: &lt;/b&gt; For categories with a large number of items, the latency can be up to 72 hours.&lt;/li&gt; &lt;/ul&gt;&lt;/span&gt; &lt;p&gt;&lt;b&gt; Format: &lt;/b&gt;&lt;code&gt;yyyyMMdd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Requirements: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt;Required when &lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt; &lt;/li&gt;  &lt;li&gt;Must be within 3-14 days in the past&lt;/li&gt;&lt;/ul&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemFeedAsync($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date = null)
    {
        return $this->getItemFeedAsyncWithHttpInfo($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getItemFeedAsyncWithHttpInfo.
     *
     * @param string $accept                  The formats that the client accepts for the response.&lt;br /&gt;&lt;br /&gt;A successful call will always return a TSV.GZIP file; however, unsuccessful calls generate errors that are returned in JSON format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default:&lt;/b&gt; &lt;code&gt;application/json,text/tab-separated-values&lt;/code&gt; (required)
     * @param string $x_ebay_c_marketplace_id The ID of the eBay marketplace where the item is hosted. &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/feed/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param string $range                   &lt;a name&#x3D;\&quot;range-header\&quot;&gt;&lt;/a&gt;This header specifies the range in bytes of the chunks of the gzip file being returned. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Format:&lt;/b&gt; &lt;code &gt;bytes&#x3D;&lt;em&gt;startpos&lt;/em&gt;-&lt;em&gt;endpos&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;  For example, the following retrieves the first 10 MBs of the feed file. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;Range bytes&#x3D;0-10485760&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about using this header, see &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-feed.html#retrv-gzip\&quot;&gt;Retrieving a gzip feed file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; 100 MB (10MB in the Sandbox) (required)
     * @param string $feed_scope              Specifies the type of feed file to return. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Values: &lt;/b&gt;   &lt;ul&gt; &lt;li&gt;&lt;b&gt; NEWLY_LISTED&lt;/b&gt; - Returns the daily &lt;b&gt;Item&lt;/b&gt; feed file containing all Good &#39;Til Cancelled items that were listed on the day specified by the &lt;b&gt; date&lt;/b&gt; parameter in the category specified by the &lt;b&gt; category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;NEWLY_LISTED&amp;category_id&#x3D;15032&amp;date&#x3D;20170925&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALL_ACTIVE&lt;/b&gt; - Returns the weekly &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file containing all the Good &#39;Til Cancelled items in the category specified by the &lt;b&gt;category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Bootstrap files are generated every Tuesday and the file is available on Wednesday. However, the exact time the file is available can vary so we recommend you download the Bootstrap file on Thursday. The items in the file are the items that were in the specified category on Sunday.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;ALL_ACTIVE&amp;category_id&#x3D;15032&lt;/code&gt;  &lt;/ul&gt; (required)
     * @param string $category_id             An eBay top-level category ID of the items to be returned in the feed file. &lt;br /&gt; &lt;br /&gt;The list of eBay category IDs changes over time and category IDs are not the same across all the eBay marketplaces. To get a list of the top-level categories for a marketplace, you can use the Taxonomy API &lt;a href&#x3D;\&quot;/api-docs/commerce/taxonomy/resources/category_tree/methods/getCategoryTree\&quot;&gt;getCategoryTree&lt;/a&gt; method. This method retrieves the complete category tree for the marketplace. The top-level categories are identified by the &lt;b&gt;categoryTreeNodeLevel&lt;/b&gt; field. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;For example:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;\&quot;categoryTreeNodeLevel\&quot;: 1&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For details see &lt;a href&#x3D;\&quot;/api-docs/buy/buy-categories.html\&quot;&gt;Get Categories for Buy APIs&lt;/a&gt;. &lt;/li&gt;  &lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;   &lt;b&gt;Restriction:&lt;/b&gt; Must be a top-level (L1) category other than Real Estate. Items listed under Real Estate L1 categories are excluded from all feeds in all marketplaces. (required)
     * @param string $date                    The date of the daily &lt;b&gt;Item&lt;/b&gt; feed file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt;) you want. &lt;p&gt;The &lt;b&gt; date&lt;/b&gt; is required only for the daily &lt;b&gt;Item&lt;/b&gt; feed file. If you specify a date for the &lt;b&gt;Item Bootstrap&lt;/b&gt; file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;ALL_ACTIVE&lt;/code&gt;), the date is ignored and the latest file is returned. The date the &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file was generated is returned in the &lt;b&gt;Last-Modified&lt;/b&gt; response header.&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;The &lt;b&gt; Item&lt;/b&gt; feed files are generated every day and there are 14 daily files available.&lt;/p&gt;  &lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt;Note: &lt;/b&gt;&lt;ul&gt;  &lt;li&gt;The daily &lt;b&gt;Item&lt;/b&gt; feed files are available each day after 9AM MST (US Mountain Standard Time), which is -7 hours UTC time.&lt;/li&gt;    &lt;li&gt;There is a 48 hour latency when generating the &lt;b&gt; Item&lt;/b&gt; feed files. This means you can download the file for July 10th on July 12 after 9AM MST. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: &lt;/b&gt; For categories with a large number of items, the latency can be up to 72 hours.&lt;/li&gt; &lt;/ul&gt;&lt;/span&gt; &lt;p&gt;&lt;b&gt; Format: &lt;/b&gt;&lt;code&gt;yyyyMMdd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Requirements: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt;Required when &lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt; &lt;/li&gt;  &lt;li&gt;Must be within 3-14 days in the past&lt;/li&gt;&lt;/ul&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getItemFeedAsyncWithHttpInfo($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date = null)
    {
        $returnType = '\TNT\Ebay\Buy\FeedBeta\V1\Model\ItemResponse';
        $request = $this->getItemFeedRequest($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date);

        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 'getItemFeed'.
     *
     * @param string $accept                  The formats that the client accepts for the response.&lt;br /&gt;&lt;br /&gt;A successful call will always return a TSV.GZIP file; however, unsuccessful calls generate errors that are returned in JSON format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default:&lt;/b&gt; &lt;code&gt;application/json,text/tab-separated-values&lt;/code&gt; (required)
     * @param string $x_ebay_c_marketplace_id The ID of the eBay marketplace where the item is hosted. &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/feed/overview.html#API\&quot;&gt;API Restrictions&lt;/a&gt;. (required)
     * @param string $range                   &lt;a name&#x3D;\&quot;range-header\&quot;&gt;&lt;/a&gt;This header specifies the range in bytes of the chunks of the gzip file being returned. &lt;br /&gt;&lt;br /&gt;&lt;b&gt; Format:&lt;/b&gt; &lt;code &gt;bytes&#x3D;&lt;em&gt;startpos&lt;/em&gt;-&lt;em&gt;endpos&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;  For example, the following retrieves the first 10 MBs of the feed file. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;Range bytes&#x3D;0-10485760&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For more information about using this header, see &lt;a href&#x3D;\&quot;/api-docs/buy/static/api-feed.html#retrv-gzip\&quot;&gt;Retrieving a gzip feed file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; 100 MB (10MB in the Sandbox) (required)
     * @param string $feed_scope              Specifies the type of feed file to return. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Values: &lt;/b&gt;   &lt;ul&gt; &lt;li&gt;&lt;b&gt; NEWLY_LISTED&lt;/b&gt; - Returns the daily &lt;b&gt;Item&lt;/b&gt; feed file containing all Good &#39;Til Cancelled items that were listed on the day specified by the &lt;b&gt; date&lt;/b&gt; parameter in the category specified by the &lt;b&gt; category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;NEWLY_LISTED&amp;category_id&#x3D;15032&amp;date&#x3D;20170925&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALL_ACTIVE&lt;/b&gt; - Returns the weekly &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file containing all the Good &#39;Til Cancelled items in the category specified by the &lt;b&gt;category_id&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class&#x3D;\&quot;tablenote\&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Bootstrap files are generated every Tuesday and the file is available on Wednesday. However, the exact time the file is available can vary so we recommend you download the Bootstrap file on Thursday. The items in the file are the items that were in the specified category on Sunday.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;code&gt;/item?feed_scope&#x3D;ALL_ACTIVE&amp;category_id&#x3D;15032&lt;/code&gt;  &lt;/ul&gt; (required)
     * @param string $category_id             An eBay top-level category ID of the items to be returned in the feed file. &lt;br /&gt; &lt;br /&gt;The list of eBay category IDs changes over time and category IDs are not the same across all the eBay marketplaces. To get a list of the top-level categories for a marketplace, you can use the Taxonomy API &lt;a href&#x3D;\&quot;/api-docs/commerce/taxonomy/resources/category_tree/methods/getCategoryTree\&quot;&gt;getCategoryTree&lt;/a&gt; method. This method retrieves the complete category tree for the marketplace. The top-level categories are identified by the &lt;b&gt;categoryTreeNodeLevel&lt;/b&gt; field. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;For example:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;code&gt;\&quot;categoryTreeNodeLevel\&quot;: 1&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;For details see &lt;a href&#x3D;\&quot;/api-docs/buy/buy-categories.html\&quot;&gt;Get Categories for Buy APIs&lt;/a&gt;. &lt;/li&gt;  &lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;   &lt;b&gt;Restriction:&lt;/b&gt; Must be a top-level (L1) category other than Real Estate. Items listed under Real Estate L1 categories are excluded from all feeds in all marketplaces. (required)
     * @param string $date                    The date of the daily &lt;b&gt;Item&lt;/b&gt; feed file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt;) you want. &lt;p&gt;The &lt;b&gt; date&lt;/b&gt; is required only for the daily &lt;b&gt;Item&lt;/b&gt; feed file. If you specify a date for the &lt;b&gt;Item Bootstrap&lt;/b&gt; file (&lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;ALL_ACTIVE&lt;/code&gt;), the date is ignored and the latest file is returned. The date the &lt;b&gt;Item Bootstrap&lt;/b&gt; feed file was generated is returned in the &lt;b&gt;Last-Modified&lt;/b&gt; response header.&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;The &lt;b&gt; Item&lt;/b&gt; feed files are generated every day and there are 14 daily files available.&lt;/p&gt;  &lt;span class&#x3D;\&quot;tablenote\&quot;&gt; &lt;b&gt;Note: &lt;/b&gt;&lt;ul&gt;  &lt;li&gt;The daily &lt;b&gt;Item&lt;/b&gt; feed files are available each day after 9AM MST (US Mountain Standard Time), which is -7 hours UTC time.&lt;/li&gt;    &lt;li&gt;There is a 48 hour latency when generating the &lt;b&gt; Item&lt;/b&gt; feed files. This means you can download the file for July 10th on July 12 after 9AM MST. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: &lt;/b&gt; For categories with a large number of items, the latency can be up to 72 hours.&lt;/li&gt; &lt;/ul&gt;&lt;/span&gt; &lt;p&gt;&lt;b&gt; Format: &lt;/b&gt;&lt;code&gt;yyyyMMdd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Requirements: &lt;/b&gt; &lt;ul&gt;  &lt;li&gt;Required when &lt;b&gt;feed_scope&lt;/b&gt;&#x3D;&lt;code&gt;NEWLY_LISTED&lt;/code&gt; &lt;/li&gt;  &lt;li&gt;Must be within 3-14 days in the past&lt;/li&gt;&lt;/ul&gt; (optional)
     *
     * @throws \InvalidArgumentException
     *
     * @return \GuzzleHttp\Psr7\Request
     */
    public function getItemFeedRequest($accept, $x_ebay_c_marketplace_id, $range, $feed_scope, $category_id, $date = null)
    {
        // Verify the required parameter 'accept' is set.
        if ($accept === null || (\is_array($accept) && count($accept) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $accept when calling getItemFeed');
        }
        // 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 getItemFeed');
        }
        // Verify the required parameter 'range' is set.
        if ($range === null || (\is_array($range) && count($range) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $range when calling getItemFeed');
        }
        // Verify the required parameter 'feed_scope' is set.
        if ($feed_scope === null || (\is_array($feed_scope) && count($feed_scope) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $feed_scope when calling getItemFeed');
        }
        // Verify the required parameter 'category_id' is set.
        if ($category_id === null || (\is_array($category_id) && count($category_id) === 0)) {
            throw new \InvalidArgumentException('Missing the required parameter $category_id when calling getItemFeed');
        }

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

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

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

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['text/tab-separated-values']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['text/tab-separated-values'],
                []
            );
        }

        // 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();
        }

        $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;
    }
}