hitmeister/suppliers-api-sdk

0.15.0 2024-09-23 13:15 UTC

This package is auto-updated.

Last update: 2024-09-23 13:18:15 UTC


README

本文档描述了短信供应商API。要使用此API,您应具有api-key和api-username。

此PHP包由Swagger Codegen项目自动生成。

  • API版本:1.11.1 & 2.0.0
  • 包版本:0.15.0
  • 构建包:com.kaufland.swagger.codegen.CustomPhpClientCodegen

API版本

此SDK提供了与v1和v2供应商API(见上述具体版本)通信的方法。默认情况下,使用版本1。要更改它,请使用SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiVersion($apiVersion)来设置API版本(1或2),并确保您使用具有正确命名空间的类来创建请求。使用错误版本的类可能会导致意外的行为。

示例:SMS\Suppliers\Api\InventoryApi用于版本1,而SMS\Suppliers\Api\v2\InventoryApi用于版本2。

此SDK的旧版本实现无需更改即可用于版本1。

要求

PHP 5.5及更高版本

安装与使用

Composer

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

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/hitmeister/suppliers-api-sdk.git"
    }
  ],
  "require": {
    "hitmeister/suppliers-api-sdk": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

    require_once('/path/to/suppliers-api-sdk/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门指南

请遵循安装程序,然后运行以下内容

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

// Configure API key authorization: apiKey
$config = SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_PARAMETER_VALUE');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: apiUsername
$config = SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiKey('api-username', 'YOUR_PARAMETER_VALUE');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-username', 'Bearer');
// Set API version (1 or 2)
$config = SMS\Suppliers\Configuration::getDefaultConfiguration()->setApiVersion(1);

$apiInstance = new SMS\Suppliers\Api\InventoryApi(
    // 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
);
$id = "id_example"; // string | ID of inventory
$body = new \SMS\Suppliers\Model\CreateImportRequest(); // \SMS\Suppliers\Model\CreateImportRequest | Inventory import request which stores all the necessary info

try {
    $apiInstance->createImportRequest($id, $body);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->createImportRequest: ', $e->getMessage(), PHP_EOL;
}

?>

API版本1的文档

端点

所有URI相对于https://sms.kaufland.de/api/v1/supplier

模型

API版本2的文档

端点

所有URI相对于https://sms.kaufland.de/api/v2/supplier

模型

授权文档

apiKey

  • 类型:API密钥
  • API密钥参数名:api-key
  • 位置:HTTP头

apiUsername

  • 类型:API密钥
  • API密钥参数名:api-username
  • 位置:HTTP头

作者

sms.tech@kaufland-online.com