1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Guillermoandrae\Highrise\Resources; |
4
|
|
|
|
5
|
|
|
use Guillermoandrae\Common\CollectionInterface; |
6
|
|
|
|
7
|
|
|
class Tasks extends AbstractResource |
8
|
|
|
{ |
9
|
|
|
use UnsearchableResourceTrait; |
10
|
|
|
|
11
|
1 |
|
public function findAll(array $filters = []): CollectionInterface |
12
|
|
|
{ |
13
|
1 |
|
$uri = sprintf('/%s/all.xml', $this->getName()); |
14
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Returns all upcoming tasks assigned to the authenticated user related to |
19
|
|
|
* a person, company, case, or deal. |
20
|
|
|
* |
21
|
|
|
* @param string $name The name of the resource for which tasks should be |
22
|
|
|
* returned. |
23
|
|
|
* @param mixed $id The resource ID. |
24
|
|
|
* @return CollectionInterface |
25
|
|
|
*/ |
26
|
1 |
|
public function findBy(string $name, $id): CollectionInterface |
27
|
|
|
{ |
28
|
1 |
|
$uri = sprintf('/%s/%s/%s.xml', $name, $id, $this->getName()); |
29
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Returns all upcoming tasks assigned to the authenticated user. |
34
|
|
|
* |
35
|
|
|
* @return CollectionInterface |
36
|
|
|
*/ |
37
|
1 |
|
public function findUpcoming(): CollectionInterface |
38
|
|
|
{ |
39
|
1 |
|
$uri = sprintf('/%s/upcoming.xml', $this->getName()); |
40
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Returns all assigned tasks assigned to the authenticated user. |
45
|
|
|
* |
46
|
|
|
* @return CollectionInterface |
47
|
|
|
*/ |
48
|
1 |
|
public function findAssigned(): CollectionInterface |
49
|
|
|
{ |
50
|
1 |
|
$uri = sprintf('/%s/assigned.xml', $this->getName()); |
51
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Returns all completed tasks assigned to the authenticated user. |
56
|
|
|
* |
57
|
|
|
* @return CollectionInterface |
58
|
|
|
*/ |
59
|
1 |
|
public function findCompleted(): CollectionInterface |
60
|
|
|
{ |
61
|
1 |
|
$uri = sprintf('/%s/completed.xml', $this->getName()); |
62
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns all of today's tasks assigned to the authenticated user. |
67
|
|
|
* |
68
|
|
|
* @return CollectionInterface |
69
|
|
|
*/ |
70
|
1 |
|
public function findToday(): CollectionInterface |
71
|
|
|
{ |
72
|
1 |
|
$uri = sprintf('/%s/today.xml', $this->getName()); |
73
|
1 |
|
return $this->getAdapter()->request('GET', $uri); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|