Skip to content

Commit

Permalink
update access tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
howyi committed Sep 25, 2018
1 parent e90bada commit c6031dd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $team->spaces()->objects();
// -> \ClickUp\Objects\Space[]

// space by space id
$space = $team->spaces()->getByKey(888);
$space = $team->space(888);
// space by name
$space = $team->spaces()->getByName('spaaaaace');
// -> \ClickUp\Objects\Space
Expand All @@ -51,7 +51,7 @@ $space->projects()->objects();
// -> \ClickUp\Objects\Project[]

// project by project id
$project = $space->projects()->getByKey(11111);
$project = $space->project(11111);
// project by name
$project = $space->projects()->getByName('super cool project');
// -> \ClickUp\Objects\Project
Expand All @@ -61,7 +61,7 @@ $project->taskLists()->objects();
// -> \ClickUp\Objects\TaskList[]

// list by list id
$taskList = $project->taskLists()->getByKey(9999);
$taskList = $project->taskList(9999);
// list by name
$taskList = $project->taskLists()->getByName('T A S K L I S T');
// -> \ClickUp\Objects\TaskList
Expand All @@ -71,7 +71,7 @@ $tasks = $taskList->tasks($teamId)->getCollection()->objects();
// -> \ClickUp\Objects\Task[]

// task by task id
$task = $client->tasks($teamId)->getByTaskId(3333);
$task = $taskList->task(3333);
// -> \ClickUp\Objects\Task
```

Expand Down
2 changes: 1 addition & 1 deletion src/ClickUp/Objects/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function setStatuses(StatusCollection $statuses)
public function createTaskList($body)
{
return $this->client()->post(
"project/$projectId/list",
"project/{$this->id()}/list",
$body
);
}
Expand Down
25 changes: 24 additions & 1 deletion src/ClickUp/Objects/TaskFinderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,37 @@ trait TaskFinderTrait
/**
* @return TaskFinder
*/
public function tasks()
public function taskFinder()
{
return (new TaskFinder(
$this->client(),
$this->teamId()
))->addParams($this->taskFindParams());
}

/**
* @param bool $includeSubTask
* @param bool $includeClosed
* @return TaskCollection
*/
public function tasks($includeSubTask = false, $includeClosed = false)
{
return $this
->taskFinder()
->includeSubTask($includeSubTask)
->includeClosed($includeClosed)
->getCollection();
}

/**
* @param int $taskId
* @return Task
*/
public function task($taskId)
{
return $this->taskFinder()->getByTaskId($taskId);
}

/**
* @return int
*/
Expand Down

0 comments on commit c6031dd

Please sign in to comment.