fiteco-group/kimai-client

Kimai V2 PHP API客户端。

0.2.2 2021-08-05 20:07 UTC

This package is auto-updated.

Last update: 2024-09-06 02:58:52 UTC


README

Kimai 2时间跟踪软件的JSON API。更多关于其使用的详细信息,请参阅API文档,然后下载Swagger文件以导入,例如在Postman中。请注意:它尚未被认为是稳定的,并且可能发生BC中断,尤其是在使用代码生成时。JSON属性的顺序没有保证。

安装与使用

需求

PHP 7.2及更高版本。

Composer

要使用Composer安装绑定,请在composer.json中添加以下内容

{
  "require": {
    "fiteco-group/kimai-client": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/vendor/autoload.php');

入门

请遵循安装程序,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure host on which Kimai is running
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setHost('https://kimai.RememberToSetMe.com');

// Configure API key authorization: apiToken
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKey('X-AUTH-TOKEN', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-AUTH-TOKEN', 'Bearer');

// Configure API key authorization: apiUser
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKey('X-AUTH-USER', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-AUTH-USER', 'Bearer');


$apiInstance = new Fiteco\KimaiClient\Api\ActivityApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project = 'project_example'; // string | Project ID to filter activities
$projects = 'projects_example'; // string | Comma separated list of project IDs to filter activities
$visible = 'visible_example'; // string | Visibility status to filter activities. Allowed values: 1=visible, 2=hidden, 3=all (default: 1)
$globals = 'globals_example'; // string | Use if you want to fetch only global activities. Allowed values: true (default: false)
$globalsFirst = 'globalsFirst_example'; // string | Deprecated parameter, value is not used any more
$orderBy = 'orderBy_example'; // string | The field by which results will be ordered. Allowed values: id, name, project (default: name)
$order = 'order_example'; // string | The result order. Allowed values: ASC, DESC (default: ASC)
$term = 'term_example'; // string | Free search term

try {
    $result = $apiInstance->apiActivitiesGet($project, $projects, $visible, $globals, $globalsFirst, $orderBy, $order, $term);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ActivityApi->apiActivitiesGet: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI相对于Kimai安装。

模型

授权

apiToken

  • 类型:API密钥
  • API密钥参数名称:X-AUTH-TOKEN
  • 位置:HTTP头

apiUser

  • 类型:API密钥
  • API密钥参数名称:X-AUTH-USER
  • 位置:HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

此PHP包由OpenAPI Generator项目自动生成

  • API版本:0.6
  • 构建包:org.openapitools.codegen.languages.PhpClientCodegen