macropage/sdk-ebay-rest-postorder

用于搜索eBay订单取消的API。

v1.02 2024-01-18 19:13 UTC

This package is auto-updated.

Last update: 2024-09-18 20:42:59 UTC


README

用于搜索eBay订单取消的API。

创建方式

docker run --rm -v ${PWD}:/app openapitools/openapi-generator-cli:v7.2.0 generate -i /app/ebay_post_order_api_openpai.json -g php -o /app  --config /app/openapi-config.php.ebay.postorder.json

由于eBay没有提供OpenAPI规范文件,我为自己创建了一个: ebay_post_order_api_openpai.json
因此,如果您需要更多端点,请随意提供带有更新OpenAPI规范文件的PR。

安装与使用

需求

PHP 7.4及更高版本。也应该与PHP 8.0兼容。

Composer

要使用Composer安装绑定,请在composer.json中添加以下内容

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/macropage/sdk-ebay-rest-postorder.git"
    }
  ],
  "require": {
    "macropage/sdk-ebay-rest-postorder": "*@dev"
  }
}

然后运行 composer install

或者

composer require macropage/sdk-ebay-rest-postorder

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/sdk-ebay-rest-postorder/vendor/autoload.php');

入门

请按照 安装和用法 进程进行,然后运行以下操作

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


// @see https://developer.ebay.com/devzone/post-order/concepts/MakingACall.html
$config = new \macropage\SDKs\ebay\rest\postorder\Configuration();
$config->setAccessToken('TOKEN xxxxxxxxxxxxxx');
$config->setMarketplaceId('EBAY_DE');

$apiInstance = new macropage\SDKs\ebay\rest\postorder\Api\CancellationSearchApi(
    // 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
);
$cancelId = 'cancelId_example'; // string
$creationDateRangeFrom = 'creationDateRangeFrom_example'; // string
$creationDateRangeTo = 'creationDateRangeTo_example'; // string
$itemId = 'itemId_example'; // string
$legacyOrderId = 'legacyOrderId_example'; // string
$limit = 'limit_example'; // string
$offset = 'offset_example'; // string
$role = 'role_example'; // string
$sort = 'sort_example'; // string
$transactionId = 'transactionId_example'; // string

try {
    $result = $apiInstance->searchCancellations($cancelId, $creationDateRangeFrom, $creationDateRangeTo, $itemId, $legacyOrderId, $limit, $offset, $role, $sort, $transactionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CancellationSearchApi->searchCancellations: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI都相对于 https://api.ebay.com/post-order/v2

模型

授权

API定义的认证方案

ApiKeyAuth

  • 类型: API密钥
  • API密钥参数名: 授权
  • 位置: HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

此PHP包由OpenAPI Generator项目自动生成

  • API版本: 1.0.0
    • 包版本: 1.9.0
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen