mipxtx/redmine-api

Redmine API 客户端

0.3.13 2019-05-29 10:54 UTC

README

redmine rest api 的 php 实现: https://redmine.ruby-lang.org.cn/projects/redmine/wiki/Rest_api

可以使用 mysql 直接访问以加速多查询

示例

use RedmineApi\Factory;
use RedmineApi\HttpClient;
use RedmineApi\Sql\MysqlClient;

$client = new \RedmineApi\HttpClient(
    "https://redmine.example.com",             // server url
    "bbb09b217bf17a905a16caa4ce7d4a23a3a0036d" // redmine api key
);

$acc = new MysqlClient("example.com", "user", "pass", "dbname"); // mysql client direct access

$factory = new Factory($client, $acc);

$uids = [];
foreach ($factory->getIssues()->findByIds([1, 2, 3]) as $issue) {  // multiget of given issues
    $uids[] = $ussue["author_id"];
}

$users = $factory->getUsers()->findByIds($uids); //finding users for issues

已实现

  • 问题

    • 查找问题
    • 创建问题
    • 更新问题
    • findByIds (mysql)
    • findByConditions (mysql select where/order)
    • findRelations with issue statuses (mysql)
  • 问题关系

    • findFor (issue)
    • 创建关系
  • 用户

    • find (by id)
    • findByLogin
    • findByIds (mysql)
    • findByLogins (mysql)

仅 MySQL

  • 状态

    • findAll - 状态列表
  • 电子邮件

    • findByUserIds
  • 自定义字段

    • getField - 字段可能值
    • getVBalues (by issueIds)
    • updateValues
  • 追踪器

    • findByIds
  • 时间条目

    • find
    • findForMonth