mehr-it / otto-orders-api-client
使用 Swagger 生成的 Otto 订单 API 的 PHP 客户端
3.0.1
2020-12-14 10:30 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-14 18:58:32 UTC
README
本 API 文档描述了所有订单端点 - 版本 3
此 PHP 包由 Swagger Codegen 项目自动生成(Swagger Codegen)
- API 版本:v3
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen
需求
PHP 5.5 及以上版本
安装与使用
Composer
要通过 Composer 安装绑定,请将以下内容添加到 composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/mehr-it/otto-orders-api-client.git"
}
],
"require": {
"mehr-it/otto-orders-api-client": "*@dev"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once('/path/to/./vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请遵循 安装和用法说明,然后运行以下操作
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // 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() ); $sales_order_id = "sales_order_id_example"; // string | The Sales Order Id of the order to cancel $position_item_id = array("position_item_id_example"); // string[] | The ids of the PositionItems to cancel try { $apiInstance->cancelPartnerOrderPositionItems($sales_order_id, $position_item_id); } catch (Exception $e) { echo 'Exception when calling ALLApi->cancelPartnerOrderPositionItems: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // 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() ); $sales_order_id = array("sales_order_id_example"); // string[] | The Sales Order Id of the order to cancel try { $apiInstance->cancelPartnerOrders($sales_order_id); } catch (Exception $e) { echo 'Exception when calling ALLApi->cancelPartnerOrders: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // 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() ); $from_date = "from_date_example"; // string | Defines, which minimum change date the returned order should have. In ISO 8601 format. $from_order_date = "from_order_date_example"; // string | Lower boundary of filter by order date: Only orders newer than the date specified will be returned. In ISO 8601 format. $to_order_date = "to_order_date_example"; // string | Upper boundary of filter by order date: Only orders older than the date specified will be returned. In ISO 8601 format. $fulfillment_status = "fulfillment_status_example"; // string | Defines, which minimum state the returned orders should have.<br>If ANNOUNCED is given, all orders, which have at least one PositionItem in ANNOUNCED state are returned.<br>If PROCESSABLE is given, all orders, which have at least one PositionItem in PROCESSABLE state and none in ANNOUNCED state are returned.<br>If SENT is given, all orders, which have at least one PositionItem in SENT state and none in either ANNOUNCED or PROCESSABLE state are returned.<br>If RETURNED is given, all orders, which have at least one PositionItem in RETURNED state and none in either ANNOUNCED or PROCESSABLE or SENT state are returned.<br>If CANCELLED_BY_PARTNER is given, all orders, which have at least one PositionItem in CANCELLED_BY_PARTNER state are returned.<br>If CANCELLED_BY_MARKETPLACE is given, all orders, which have at least one PositionItem in CANCELLED_BY_MARKETPLACE state are returned.<br>If none is provided, all status will be returned.<br>Several values can be passed via request param array, when multiple values passed, search result will be combination of multiple fulfillmentStatuses - no duplicates will appear.<br>Example: ?fulfillmentStatus=PROCESSABLE&fulfillmentStatus=CANCELLED_BY_MARKETPLACE - will return orders in these 3 fulfillmentStatuses.<br>Alternatively, mode can be passed for a different search type. BUCKET/AT_LEAST_ONE, where BUCKET is default behaviour explained above and AT_LEAST_ONE checks if there is at least 1 PositionItem with passed fulfillmentStatus/fulfillmentStatuses. $limit = 128; // int | The maximum amount of returned orders $order_direction = "ASC"; // string | $order_column_type = "ORDER_LIFECYCLE_DATE"; // string | $mode = "BUCKET"; // string | The search mode. Default search mode is bucket search $nextcursor = "nextcursor_example"; // string | For paging request this cursor is required. If a next cursor is provided, the only other request parameter being considered is 'limit'.<br>Only the cursor string is required, not the whole link to the cursor.<br>Example: nextcursor=eyJmZiI6MTU5NDg5NDQ3MTA1OCwicGlmIjoiNDcxM... $search_term = "search_term_example"; // string | The search term for partial text search. try { $result = $apiInstance->findPartnerOrders($from_date, $from_order_date, $to_order_date, $fulfillment_status, $limit, $order_direction, $order_column_type, $mode, $nextcursor, $search_term); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->findPartnerOrders: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // 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() ); $order_number = "order_number_example"; // string | The Order Number used for searching try { $result = $apiInstance->getPartnerOrderByOrderNumber($order_number); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->getPartnerOrderByOrderNumber: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // 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() ); $sales_order_id = "sales_order_id_example"; // string | The Sales Order Id used for searching try { $result = $apiInstance->getPartnerOrderBySalesOrderId($sales_order_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->getPartnerOrderBySalesOrderId: ', $e->getMessage(), PHP_EOL; } ?>
API 端点文档
所有 URI 都相对于 https://live.api.otto.market
模型文档
授权文档
所有端点均不需要授权。