bespoke-support / smartwaste
BRE SmartWaste API 库
dev-master
2018-12-08 10:04 UTC
Requires
- php: ^7.1
- ext-json: *
- guzzlehttp/guzzle: ^6
- symfony/console: ^4.2@RC
Requires (Dev)
- symfony/var-exporter: ^4.2@RC
This package is auto-updated.
Last update: 2024-09-08 22:19:07 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)