From 7608d39af8cc7b6ae39b948f396adb676dcd5c70 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Fri, 20 Dec 2024 23:46:30 +0100 Subject: [PATCH] add tag endpoint --- src/Entities/Tag.php | 23 +++++++++++++++++++++++ src/Resources/Tag.php | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/Entities/Tag.php create mode 100644 src/Resources/Tag.php diff --git a/src/Entities/Tag.php b/src/Entities/Tag.php new file mode 100644 index 0000000..0a53926 --- /dev/null +++ b/src/Entities/Tag.php @@ -0,0 +1,23 @@ +get('tagid'); + } + + public function getName(): string + { + return $this->get('name'); + } + + public function getText(): string + { + return $this->get('text'); + } +} \ No newline at end of file diff --git a/src/Resources/Tag.php b/src/Resources/Tag.php new file mode 100644 index 0000000..d4d1d1a --- /dev/null +++ b/src/Resources/Tag.php @@ -0,0 +1,40 @@ +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); + } +}