-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.php
More file actions
63 lines (54 loc) · 1.22 KB
/
Project.php
File metadata and controls
63 lines (54 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Aternos\SpigotApi\Client;
use Aternos\SpigotApi\ApiException;
use Aternos\SpigotApi\Client\List\PaginatedVersionList;
use Aternos\SpigotApi\Model\Resource;
class Project
{
public function __construct(
protected SpigotAPIClient $client,
protected Resource $data
)
{
}
public function getData(): Resource
{
return $this->data;
}
/**
* Get the ID of the project.
*
* @return int
*/
public function getId(): int
{
return intval($this->data->getId());
}
/**
* Get the category of the project.
*
* @return Category
*/
public function getCategory(): Category
{
return Category::from($this->getData()->getCategory()->getId());
}
/**
* Get the author of the project.
*
* @throws ApiException
*/
public function getAuthor(): Author
{
return $this->client->getAuthor($this->data->getAuthor()->getId());
}
/**
* Get a list of versions for this project.
*
* @throws ApiException
*/
public function getVersions(): PaginatedVersionList
{
return $this->client->getProjectVersions($this->getId());
}
}