dragooon/gci-php-sdk

Google Code-in 任务 API SDK

dev-master 2016-03-29 20:04 UTC

This package is not auto-updated.

Last update: 2024-09-20 18:39:00 UTC


README

此API可用于访问 Google Code-in 的任务API,以请求、更新和修改任务定义

安装

可以通过composer使用 composer require dragooon/gci-php-sdk 或将 dragooon/gci-php-sdk 添加到您的composer依赖项中安装库

示例

这是通过API处理任务的简化示例

$client = new Dragooon\GCI\Client('<api key>');
$taskList = $client->getTasks(2); // Get tasks from second page
foreach ($taskList as $task) {
    echo $task->getId() . ' ' . $task->getName(); // See src/TaskInterface.php for full function list
}
$nextPage = $taskList->getNextPage();

// Get the details of a single task
$id = 123; // Task ID
$task = $client->getTask($id);
echo $task->getDescription();

// Create a new task
$task = new Task([
    'name' => 'Test task',
    'description' => 'Testing a new task',
    'status' => Dragooon\GCI\TaskInterface::STATUS_DRAFTED,
]);
$client->createTask($task);

许可证

MIT许可证(见LICENSE)