1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Guillermoandrae\Highrise\Repositories; |
4
|
|
|
|
5
|
|
|
use Guillermoandrae\Common\CollectionInterface; |
6
|
|
|
|
7
|
|
|
class TasksRepository extends AbstractRelationalRepository |
8
|
|
|
{ |
9
|
|
|
use UnsearchableRepositoryTrait; |
10
|
|
|
|
11
|
|
|
public function findAll(int $offset = 0, int $limit = null): CollectionInterface |
12
|
|
|
{ |
13
|
|
|
$uri = sprintf('/%s/all.xml', $this->getName()); |
14
|
|
|
$results = $this->getAdapter()->request('GET', $uri); |
15
|
|
|
return $this->hydrate($results); |
|
|
|
|
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Returns all upcoming tasks assigned to the authenticated user. |
20
|
|
|
* |
21
|
|
|
* @return CollectionInterface |
22
|
|
|
*/ |
23
|
|
|
public function findUpcoming(): CollectionInterface |
24
|
|
|
{ |
25
|
|
|
$uri = sprintf('/%s/upcoming.xml', $this->getName()); |
26
|
|
|
$results = $this->getAdapter()->request('GET', $uri); |
27
|
|
|
return $this->hydrate($results); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Returns all assigned tasks assigned to the authenticated user. |
32
|
|
|
* |
33
|
|
|
* @return CollectionInterface |
34
|
|
|
*/ |
35
|
|
|
public function findAssigned(): CollectionInterface |
36
|
|
|
{ |
37
|
|
|
$uri = sprintf('/%s/assigned.xml', $this->getName()); |
38
|
|
|
$results = $this->getAdapter()->request('GET', $uri); |
39
|
|
|
return $this->hydrate($results); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Returns all completed tasks assigned to the authenticated user. |
44
|
|
|
* |
45
|
|
|
* @return CollectionInterface |
46
|
|
|
*/ |
47
|
|
|
public function findCompleted(): CollectionInterface |
48
|
|
|
{ |
49
|
|
|
$uri = sprintf('/%s/completed.xml', $this->getName()); |
50
|
|
|
$results = $this->getAdapter()->request('GET', $uri); |
51
|
|
|
return $this->hydrate($results); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Returns all of today's tasks assigned to the authenticated user. |
56
|
|
|
* |
57
|
|
|
* @return CollectionInterface |
58
|
|
|
*/ |
59
|
|
|
public function findToday(): CollectionInterface |
60
|
|
|
{ |
61
|
|
|
$uri = sprintf('/%s/today.xml', $this->getName()); |
62
|
|
|
$results = $this->getAdapter()->request('GET', $uri); |
63
|
|
|
return $this->hydrate($results); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|