|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Spinen\ClickUp; |
|
4
|
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
|
6
|
|
|
use Spinen\ClickUp\Exceptions\InvalidRelationshipException; |
|
7
|
|
|
use Spinen\ClickUp\Exceptions\ModelNotFoundException; |
|
8
|
|
|
use Spinen\ClickUp\Exceptions\NoClientException; |
|
9
|
|
|
use Spinen\ClickUp\Support\Model; |
|
10
|
|
|
use Spinen\ClickUp\Support\Relations\ChildOf; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class Field |
|
14
|
|
|
* |
|
15
|
|
|
* @package Spinen\ClickUp |
|
16
|
|
|
* |
|
17
|
|
|
* @property array $type_config |
|
18
|
|
|
* @property boolean $hide_from_guests |
|
19
|
|
|
* @property Carbon $date_created |
|
20
|
|
|
* @property string $id |
|
21
|
|
|
* @property string $name |
|
22
|
|
|
* @property string $type |
|
23
|
|
|
* @property TaskList $list |
|
24
|
|
|
*/ |
|
25
|
|
|
class Field extends Model |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* The attributes that should be cast to native types. |
|
29
|
|
|
* |
|
30
|
|
|
* @var array |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $casts = [ |
|
33
|
|
|
'date_created' => 'datetime:Uv', |
|
34
|
|
|
'hide_from_guest' => 'boolean', |
|
35
|
|
|
'id' => 'string', |
|
36
|
|
|
]; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Is resource nested behind parentModel |
|
40
|
|
|
* |
|
41
|
|
|
* Several of the endpoints are nested behind another model for relationship, but then to |
|
42
|
|
|
* interact with the specific model, then are not nested. This property will know when to |
|
43
|
|
|
* keep the specific model nested. |
|
44
|
|
|
* |
|
45
|
|
|
* @var bool |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $nested = true; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Path to API endpoint. |
|
51
|
|
|
* |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $path = '/field'; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @return ChildOf |
|
58
|
|
|
* @throws InvalidRelationshipException |
|
59
|
|
|
* @throws ModelNotFoundException |
|
60
|
|
|
* @throws NoClientException |
|
61
|
|
|
*/ |
|
62
|
1 |
|
public function list(): ChildOf |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->childOf(TaskList::class); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|