1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Spinen\ClickUp; |
4
|
|
|
|
5
|
|
|
use Spinen\ClickUp\Exceptions\InvalidRelationshipException; |
6
|
|
|
use Spinen\ClickUp\Exceptions\ModelNotFoundException; |
7
|
|
|
use Spinen\ClickUp\Exceptions\NoClientException; |
8
|
|
|
use Spinen\ClickUp\Support\Collection; |
9
|
|
|
use Spinen\ClickUp\Support\Model; |
10
|
|
|
use Spinen\ClickUp\Support\Relations\ChildOf; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Share |
14
|
|
|
* |
15
|
|
|
* @package Spinen\ClickUp |
16
|
|
|
* |
17
|
|
|
* @property Collection $folders |
18
|
|
|
* @property Collection $lists |
19
|
|
|
* @property Collection $tasks |
20
|
|
|
* @property Team $team |
21
|
|
|
*/ |
22
|
|
|
class Share extends Model |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Path to API endpoint. |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $path = '/share'; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Accessor for Folders. |
33
|
|
|
* |
34
|
|
|
* @param array $folders |
35
|
|
|
* |
36
|
|
|
* @return Collection |
37
|
|
|
* @throws NoClientException |
38
|
|
|
*/ |
39
|
1 |
|
public function getFoldersAttribute(array $folders): Collection |
40
|
|
|
{ |
41
|
1 |
|
return $this->givenMany(Folder::class, $folders); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Accessor for Lists. |
46
|
|
|
* |
47
|
|
|
* @param array $lists |
48
|
|
|
* |
49
|
|
|
* @return Collection |
50
|
|
|
* @throws NoClientException |
51
|
|
|
*/ |
52
|
1 |
|
public function getListsAttribute(array $lists): Collection |
53
|
|
|
{ |
54
|
1 |
|
return $this->givenMany(TaskList::class, $lists); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Accessor for Tasks. |
59
|
|
|
* |
60
|
|
|
* @param array $tasks |
61
|
|
|
* |
62
|
|
|
* @return Collection |
63
|
|
|
* @throws NoClientException |
64
|
|
|
*/ |
65
|
1 |
|
public function getTasksAttribute(array $tasks): Collection |
66
|
|
|
{ |
67
|
1 |
|
return $this->givenMany(Task::class, $tasks); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return ChildOf |
72
|
|
|
* @throws InvalidRelationshipException |
73
|
|
|
* @throws ModelNotFoundException |
74
|
|
|
* @throws NoClientException |
75
|
|
|
*/ |
76
|
1 |
|
public function team(): ChildOf |
77
|
|
|
{ |
78
|
1 |
|
return $this->childOf(Team::class); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|