makarenko / worksnaps-bundle

该包提供与Worksnaps API协同工作的能力。

dev-master 2016-09-04 21:55 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:25:59 UTC


README

SensioLabsInsight

安装Bundle

composer require makarenko/worksnaps-bundle

启用Bundle

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Umbrella\WorksnapsBundle\WorksnapsBundle(),
        );

        // ...
    }

    // ...
}

配置Bundle

# app/config/config.yml
worksnaps:
    api_key: "YOUR API KEY HERE"

在代码中工作

项目API

获取所有项目

$allProjects = $this->get('umbrella.worksnaps')->getProjects();

通过ID获取项目

$project = $this->get('umbrella.worksnaps')->getProject( $projectId );

======

任务API

获取项目中的任务

$tasks = $this->get('umbrella.worksnaps')->getTasks( $projectId );

获取任务

$task = $this->get('umbrella.worksnaps')->getTask( $projectId, $taskId );

======

用户分配API

从项目中获取用户

$users = $this->get('umbrella.worksnaps')->getUsersFromProject( $projectId );

从项目中获取用户

$user = $this->get('umbrella.worksnaps')->getUserFromProject( $projectId, $userId );

======

用户账户API

获取我的用户

$myUser = $this->get('umbrella.worksnaps')->getMyUser();

获取用户

$users = $this->get('umbrella.worksnaps')->getUsers();

获取用户

$user = $this->get('umbrella.worksnaps')->getUser( $userId );

======

任务分配API

获取项目中的任务分配

$tasksInProject = $this->get('umbrella.worksnaps')->getTasksFromProject( $projectId );

获取项目中的任务分配

$taskInProject = $this->get('umbrella.worksnaps')->getTaskFromProject( $projectId, $taskId );

======

时间条目API

获取指定项目中的时间条目

$timeEntries = $this->get('umbrella.worksnaps')->getTimeEntries( $projectId, array( $userId ), $fromTimestamp, $toTimestamp );

获取指定用户在指定项目中的时间条目

$timeEntriesForUser = $this->get('umbrella.worksnaps')->getTimeEntriesForUser( $projectId, $userId, $fromTimestamp, $toTimestamp );

获取时间条目完整分辨率截图的URL

$fullUrl = $this->get('umbrella.worksnaps')->getScreenshot( $projectId, $timeEntryId );

获取时间条目

$timeEntry = $this->get('umbrella.worksnaps')->getTimeEntry( $projectId, $timeEntryId );

======

报告API

$report = $this->get('umbrella.worksnaps')->getReport( $projectId, $fromTimestamp, $toTimestamp, [ $userId ] );