bookin/broscript

BroScript php api sdk

dev-master 2016-09-21 20:37 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:04:01 UTC


README

以下部分解释了如何在新的项目中使用BroScript库。

如何测试

此SDK中的单元测试可以使用PHPUnit运行。

  1. 首先使用composer安装依赖,包括require-dev依赖。
  2. 从命令行运行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);

返回控制器列表