add tag endpoint
This commit is contained in:
bovenliggende
7a157033f3
commit
7608d39af8
23
src/Entities/Tag.php
Normal file
23
src/Entities/Tag.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace D3\KlicktippPhpClient\Entities;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
|
class Tag extends ArrayCollection
|
||||||
|
{
|
||||||
|
public function getId(): string
|
||||||
|
{
|
||||||
|
return $this->get('tagid');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return $this->get('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
return $this->get('text');
|
||||||
|
}
|
||||||
|
}
|
40
src/Resources/Tag.php
Normal file
40
src/Resources/Tag.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace D3\KlicktippPhpClient\Resources;
|
||||||
|
|
||||||
|
use D3\KlicktippPhpClient\Entities\Tag as TagEntity;
|
||||||
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||||
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
|
||||||
|
class Tag extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws BaseException|GuzzleException
|
||||||
|
*/
|
||||||
|
public function index(): array
|
||||||
|
{
|
||||||
|
return $this->connection->requestAndParse(
|
||||||
|
'GET',
|
||||||
|
'tag',
|
||||||
|
[
|
||||||
|
'query' => $this->getQuery()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws BaseException|GuzzleException
|
||||||
|
*/
|
||||||
|
public function get(string $tagId): TagEntity
|
||||||
|
{
|
||||||
|
$data = $this->connection->requestAndParse(
|
||||||
|
'GET',
|
||||||
|
'tag/'.urlencode(trim($tagId)),
|
||||||
|
[
|
||||||
|
'query' => $this->getQuery()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return new TagEntity($data);
|
||||||
|
}
|
||||||
|
}
|
Laden…
x
Verwijs in nieuw issue
Block a user