Skip to content

Commit 9c31fdc

Browse files
Merge pull request #547 from ans-group/feat/46756/47761
[AB#47761] add Tag entity and TagClient for managing tags
2 parents a3059bc + e2c9109 commit 9c31fdc

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

src/eCloud/Entities/Tag.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud\Entities;
4+
5+
use UKFast\SDK\Entity;
6+
7+
/**
8+
* @property int $id
9+
* @property string $name
10+
* @property string $scope
11+
*/
12+
class Tag extends Entity
13+
{
14+
protected $dates = ['createdAt', 'updatedAt'];
15+
16+
public static $entityMap = [
17+
'id' => 'id',
18+
'name' => 'name',
19+
'scope' => 'scope'
20+
];
21+
}

src/eCloud/TagClient.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\eCloud\Entities\Tag;
6+
use UKFast\SDK\Entities\ClientEntityInterface;
7+
use UKFast\SDK\Traits\PageItems;
8+
9+
class TagClient extends Client implements ClientEntityInterface
10+
{
11+
use PageItems;
12+
13+
protected $collectionPath = 'v2/tags';
14+
15+
public function loadEntity($data)
16+
{
17+
return new Tag(
18+
$this->apiToFriendly($data, $this->getEntityMap())
19+
);
20+
}
21+
22+
public function getEntityMap()
23+
{
24+
return Tag::$entityMap;
25+
}
26+
}

0 commit comments

Comments
 (0)