bookin / broscript
BroScript php api sdk
dev-master
2016-09-21 20:37 UTC
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- apimatic/jsonmapper: ~1.0.0
- mashape/unirest-php: ~3.0.1
This package is not auto-updated.
Last update: 2024-09-14 20:04:01 UTC
README
以下部分解释了如何在新的项目中使用BroScript库。
如何测试
此SDK中的单元测试可以使用PHPUnit运行。
- 首先使用composer安装依赖,包括
require-dev
依赖。 - 从命令行运行
vendor\bin\phpunit --verbose
以执行测试。如果您已全局安装PHPUnit,请使用phpunit --verbose
运行测试。
您可以在phpunit.xml
文件中更改PHPUnit测试配置。
初始化
身份验证和初始化
为了设置API客户端的身份验证和初始化,您需要以下信息。
API客户端可以按以下方式初始化。
// Configuration parameters and credentials $userKey = "userKey"; // User Key $scriptKey = "scriptKey"; // Script Key //The singleton instance of the ``` APIController ``` class can be accessed from the API Client. $client = BroScriptClient::getInstance($userKey, $scriptKey);
类参考
控制器列表
cleanHistory
待办:添加方法描述
function cleanHistory($chatId = NULL)
参数
示例用法
$chatId = 'chat_id'; $result = $client->cleanHistory($chatId);
templates
获取模板数组
function templates()
示例用法
$result = $client->templates();
answers
获取答案
function answers( $chatId = NULL, $contact = NULL, $external = NULL, $stopIsNull = false, $repeatIsNull = false)
参数
示例用法
$chatId = 'chat_id'; $contact = array('contact'); $external = array('external'); $stopIsNull = false; $repeatIsNull = false; $result = $client->answers($chatId, $contact, $external, $stopIsNull, $repeatIsNull);