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\Model; |
9
|
|
|
use Spinen\ClickUp\Support\Relations\ChildOf; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class Member |
13
|
|
|
* |
14
|
|
|
* @package Spinen\ClickUp |
15
|
|
|
* |
16
|
|
|
* @property integer $id |
17
|
|
|
* @property integer $role |
18
|
|
|
* @property string $color |
19
|
|
|
* @property string $email |
20
|
|
|
* @property string $initials |
21
|
|
|
* @property string $profilePicture |
22
|
|
|
* @property string $username |
23
|
|
|
* @property Task $task |
24
|
|
|
* @property TaskList $list |
25
|
|
|
*/ |
26
|
|
|
class Member extends Model |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* The attributes that should be cast to native types. |
30
|
|
|
* |
31
|
|
|
* @var array |
32
|
|
|
*/ |
33
|
|
|
protected $casts = [ |
34
|
|
|
'id' => 'integer', |
35
|
|
|
'role' => 'integer', |
36
|
|
|
]; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Path to API endpoint. |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $path = '/member'; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return ChildOf |
47
|
|
|
* @throws InvalidRelationshipException |
48
|
|
|
* @throws ModelNotFoundException |
49
|
|
|
* @throws NoClientException |
50
|
|
|
*/ |
51
|
2 |
|
public function list(): ?ChildOf |
52
|
|
|
{ |
53
|
2 |
|
return is_a($this->parentModel, TaskList::class) ? $this->childOf(TaskList::class) : null; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return ChildOf |
58
|
|
|
* @throws InvalidRelationshipException |
59
|
|
|
* @throws ModelNotFoundException |
60
|
|
|
* @throws NoClientException |
61
|
|
|
*/ |
62
|
2 |
|
public function task(): ?ChildOf |
63
|
|
|
{ |
64
|
2 |
|
return is_a($this->parentModel, Task::class) ? $this->childOf(Task::class) : null; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|