vekkon / postbarcodeclient-php
v1.0.2
2024-02-03 00:26 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
README
数字商业瑞士邮政网 REST API,用于生成地址标签。使用“生成地址标签”请求,将自动测试所选的基本和附加服务/配送说明的组合,无论您是否事先已经这样做。在“生成地址标签”操作中,还会验证邮寄数据(例如,到付金额)。对于“包裹”、“快递”和“解决方案”服务组,邮寄数据将自动传输到DataTransfer。这意味着您将获得与DataTransfer相同的好处。API文档 https://developer.post.ch/en/digital-commerce-api
此PHP包由Swagger Codegen项目自动生成
- API版本:1.2
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen 更多信息请访问 https://www.post.ch/digital-commerce/api
要求
PHP 5.5及更高版本
安装与使用
Composer
要使用Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/git_user_id/git_repo_id.git"
}
],
"require": {
"git_user_id/git_repo_id": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请遵循安装过程,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: ClientCredentials $config = Vekkon\PostBarcodeClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Vekkon\PostBarcodeClient\Api\BarcodeApi( // 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 \Vekkon\PostBarcodeClient\Model\GenerateLabel(); // \Vekkon\PostBarcodeClient\Model\GenerateLabel | try { $result = $apiInstance->generateAddressLabel($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling BarcodeApi->generateAddressLabel: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI都是相对于 https://dcapi.apis.post.ch/barcode/v1
模型文档
- AdditionalData
- BaseRecipient
- Communication
- CustomerAddress
- CustomerLogo
- DispatchInfo
- DynPicType
- ExchangeLabelDefinition
- ExchangeNotification
- GenerateLabel
- GenerateLabelCustomer
- GenerateLabelDefinition
- GenerateLabelResponse
- GenerateSingleBarcodes
- GenerateSingleBarcodesResponse
- IdentCode
- Item
- LabelAddress
- Language
- MessageType
- MessagesType
- Notification
- NotificationType
- Recipient
- ReplacementCustomerDetails
- ReplacementLabelDefinition
- ReplacementLabelResponse
- ReplacementRequest
- ReplacementResponse
- ResponseGenerateLabelDefinition
- ResponseItem
- ReturnInfoType
- ServiceCodeAttributes
- SingleBarcodesDefinition
- SingleBarcodesResponseDefinition
- SingleBarcodesResponseItem
- UNNumbers
- ValidationError
授权文档
ClientCredentials
- 类型:OAuth
- 流程:application
- 授权URL:
- 作用域:
- DCAPI_BARCODE_READ:获取条码标签