christian71-stack/ebay-inventory-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

christian71-stack/ebay-inventory-api

Composer 安装命令:

composer require christian71-stack/ebay-inventory-api

包简介

README 文档

README

The Inventory API is used to create and manage inventory, and then to publish and manage this inventory on an eBay marketplace. There are also methods in this API that will convert eligible, active eBay listings into the Inventory API model.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.18.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 8.2 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/christian71-stack/ebay-sell-inventory-php-client.git"
    }
  ],
  "require": {
    "christian71-stack/ebay-sell-inventory-php-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Ebay\Sell\Inventory\Model\BulkInventoryItem(); // \Ebay\Sell\Inventory\Model\BulkInventoryItem | Details of the inventories with sku and locale
$content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br>For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
$content_language = "content_language_example"; // string | This header sets the natural language that will be used in the field values of the request payload. For example, the value passed in this header should be <code>en-US</code> for English or <code>de-DE</code> for German.<br><br>For more information on the Content-Language header, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.

try {
    $result = $apiInstance->bulkCreateOrReplaceInventoryItem($body, $content_type, $content_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->bulkCreateOrReplaceInventoryItem: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Ebay\Sell\Inventory\Model\BulkGetInventoryItem(); // \Ebay\Sell\Inventory\Model\BulkGetInventoryItem | Details of the inventories with sku and locale
$content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br>For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.

try {
    $result = $apiInstance->bulkGetInventoryItem($body, $content_type);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->bulkGetInventoryItem: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Ebay\Sell\Inventory\Model\BulkPriceQuantity(); // \Ebay\Sell\Inventory\Model\BulkPriceQuantity | Price and allocation details for the given SKU and Marketplace
$content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br>For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.

try {
    $result = $apiInstance->bulkUpdatePriceQuantity($body, $content_type);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->bulkUpdatePriceQuantity: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Ebay\Sell\Inventory\Model\InventoryItem(); // \Ebay\Sell\Inventory\Model\InventoryItem | Details of the inventory item record.
$content_language = "content_language_example"; // string | This header sets the natural language that will be used in the field values of the request payload. For example, the value passed in this header should be <code>en-US</code> for English or <code>de-DE</code> for German.<br><br>For more information on the Content-Language header, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
$content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br>For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
$sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value for the inventory item being created or updated. SKU values must be unique across the seller's inventory. <br><br><strong>Max length</strong>: 50

try {
    $result = $apiInstance->createOrReplaceInventoryItem($body, $content_language, $content_type, $sku);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->createOrReplaceInventoryItem: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value of the product whose inventory item record you wish to delete.<br><br>Use the <a href=\"/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems\" target=\"_blank \">getInventoryItems</a> method to retrieve SKU values.<br><br><strong>Max length</strong>: 50

try {
    $apiInstance->deleteInventoryItem($sku);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->deleteInventoryItem: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value of the product whose inventory item record you wish to retrieve.<br><br>Use the <a href=\"/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems\" target=\"_blank \">getInventoryItems</a> method to retrieve SKU values.<br><br><strong>Max length</strong>: 50

try {
    $result = $apiInstance->getInventoryItem($sku);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->getInventoryItem: ', $e->getMessage(), PHP_EOL;
}

// Configure OAuth2 access token for authorization: api_auth
$config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$limit = "limit_example"; // string | The value passed in this query parameter sets the maximum number of records to return per page of data. Although this field is a string, the value passed in this field should be an integer from <code>1</code> to <code>200</code>.<br><br><strong>Min:</strong> 1<br><br><strong>Max:</strong> 200<br><br><b>Default:</b> 25
$offset = "offset_example"; // string | The value passed in this query parameter sets the page number to retrieve. The first page of records has a value of <code>0</code>, the second page of records has a value of <code>1</code>, and so on. If this query parameter is not set, its value defaults to <code>0</code>, and the first page of records is returned.

try {
    $result = $apiInstance->getInventoryItems($limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryItemApi->getInventoryItems: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://api.ebay.com{basePath}

Class Method HTTP request Description
InventoryItemApi bulkCreateOrReplaceInventoryItem POST /bulk_create_or_replace_inventory_item
InventoryItemApi bulkGetInventoryItem POST /bulk_get_inventory_item
InventoryItemApi bulkUpdatePriceQuantity POST /bulk_update_price_quantity
InventoryItemApi createOrReplaceInventoryItem PUT /inventory_item/{sku}
InventoryItemApi deleteInventoryItem DELETE /inventory_item/{sku}
InventoryItemApi getInventoryItem GET /inventory_item/{sku}
InventoryItemApi getInventoryItems GET /inventory_item
InventoryItemGroupApi createOrReplaceInventoryItemGroup PUT /inventory_item_group/{inventoryItemGroupKey}
InventoryItemGroupApi deleteInventoryItemGroup DELETE /inventory_item_group/{inventoryItemGroupKey}
InventoryItemGroupApi getInventoryItemGroup GET /inventory_item_group/{inventoryItemGroupKey}
ListingApi bulkMigrateListing POST /bulk_migrate_listing
ListingApi createOrReplaceSkuLocationMapping PUT /listing/{listingId}/sku/{sku}/locations
ListingApi deleteSkuLocationMapping DELETE /listing/{listingId}/sku/{sku}/locations
ListingApi getSkuLocationMapping GET /listing/{listingId}/sku/{sku}/locations
LocationApi createInventoryLocation POST /location/{merchantLocationKey}
LocationApi deleteInventoryLocation DELETE /location/{merchantLocationKey}
LocationApi disableInventoryLocation POST /location/{merchantLocationKey}/disable
LocationApi enableInventoryLocation POST /location/{merchantLocationKey}/enable
LocationApi getInventoryLocation GET /location/{merchantLocationKey}
LocationApi getInventoryLocations GET /location
LocationApi updateInventoryLocation POST /location/{merchantLocationKey}/update_location_details
OfferApi bulkCreateOffer POST /bulk_create_offer
OfferApi bulkPublishOffer POST /bulk_publish_offer
OfferApi createOffer POST /offer
OfferApi deleteOffer DELETE /offer/{offerId}
OfferApi getListingFees POST /offer/get_listing_fees
OfferApi getOffer GET /offer/{offerId}
OfferApi getOffers GET /offer
OfferApi publishOffer POST /offer/{offerId}/publish
OfferApi publishOfferByInventoryItemGroup POST /offer/publish_by_inventory_item_group
OfferApi updateOffer PUT /offer/{offerId}
OfferApi withdrawOffer POST /offer/{offerId}/withdraw
OfferApi withdrawOfferByInventoryItemGroup POST /offer/withdraw_by_inventory_item_group
ProductCompatibilityApi createOrReplaceProductCompatibility PUT /inventory_item/{sku}/product_compatibility
ProductCompatibilityApi deleteProductCompatibility DELETE /inventory_item/{sku}/product_compatibility
ProductCompatibilityApi getProductCompatibility GET /inventory_item/{sku}/product_compatibility

Documentation For Models

Documentation For Authorization

api_auth

Author

christian71-stack/ebay-inventory-api 适用场景与选型建议

christian71-stack/ebay-inventory-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 12 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「rest」 「api」 「sdk」 「swagger」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 christian71-stack/ebay-inventory-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 christian71-stack/ebay-inventory-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 christian71-stack/ebay-inventory-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-12-21