blucreation/smartwaste

SmartWaste API 库

1.0.0 2021-02-09 11:53 UTC

This package is auto-updated.

Last update: 2024-09-09 22:16:06 UTC


README

SmartWaste 是一种公认的汇总环境数据(包括废物交易)的方法。这个 PHP 库提供了一种使用 API 读取和写入数据的方法,从而节省了手动数据录入。

使用场景

  • BRE 客户将数据提取到他们的内部系统
  • BRE 客户输入数据
  • 废物承包商(承运人)
  • 经纪人代表许多承包商上传

当前 SmartWaste API 版本

1.3.0

获取和创建 API 访问令牌

注意:这并不是您的用户名和密码。

请与 BRE 联系以获取这些凭据。

$credentials = SmartWaste::token('user', 'publicKey', 'privateKey');

可用方法

可以从 SmartWasteAPI::METHOD 或 SmartWaste::api($credentials, METHOD, $params) 调用方法

assignSubcontractorToProject
assignWasteCarrierToProject
assignWasteDestinationToProject
authenticate
authenticateUser
getCompanies
getDefaultCompanies
getLabels
getProject
getProjectPhases
getProjects
getSkipsizes
getSubcontractorsForProject
getTransportOptions
getWasteCarriersForProject
getWasteDestinationsForProject
getWasteItem
getWasteItems
getWasteManagementLocations
getWasteManagementRoutes
getWasteProductTypes
getWorkpackages
saveSubcontractorToCompany
saveSubcontractorToProject
saveWasteCarrierToCompany
saveWasteCarrierToProject
saveWasteDestinationToCompany
saveWasteDestinationToProject
saveWasteItem
updateSubcontractor
updateWasteCarrier
updateWasteDestination
updateWasteItem

查找端点

示例

创建承运人

$ent = new SmartWasteWasteCarrier();

$ent->carrierName = 'ABC Skips';
$ent->postcode = 'AA11 1AA';
$ent->address1 = '1 Main Street';
$ent->addLicence('AA1234AA', '2020-01-01');

$obj = new SaveWasteCarrierToCompany(12345, $ent); // 12345 is your Company ID

$res = SmartWaste::call($credentials, $obj);

// $res = wasteCarrierID (int)

创建目的地(仓库)

$ent = new SmartWasteWasteDestination();

$ent->parentCarrierID = 54321; // ID created during above call

$ent->destinationName = 'ABC Skips';
$ent->postcode = 'AA11 1AA';
$ent->address1 = '1 Main Street';
$ent->addLicence('AA1234AA', '2020-01-01');

$obj = new SaveWasteDestinationToCompany(12345, $ent); // 12345 is your Company ID

$res = SmartWaste::call($credentials, $obj);

// $res = wasteDestinationID (int)

保存废物项目

$ent = new SmartWasteWasteItem();

// convert your waste item data

$obj = new SaveWasteItem(12345, 12345, $ent);

$res = SmartWaste::call($credentials, $obj);

// $res = wasteItemID (int)