diff --git a/README.md b/README.md index fb0edaf..1cc45c0 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,30 @@ List old web forms ```php $result = $getresponse->getWebForms(); ``` +-- +List all tags +```php +$result = $getresponse->getTags(); +``` + +Add a tag +```php +$result = $getresponse->addTag([ + 'name' => 'yourtagname' +]); +``` + +Update a tag +```php +$result = $getresponse->updateTag($tag_id, [ + 'name' => 'yourtagname' +]); +``` + +Delete a tag +```php +$result = $getresponse->deleteTag($tag_id); +``` diff --git a/src/GetResponseAPI3.class.php b/src/GetResponseAPI3.class.php index 2782e2f..e314609 100644 --- a/src/GetResponseAPI3.class.php +++ b/src/GetResponseAPI3.class.php @@ -327,6 +327,64 @@ public function getForms($params = array()) return $this->call('forms?' . $this->setParams($params)); } + /** + * retrieve all tags + * @param array $params + * + * @return mixed + */ + public function getTags($params = array()) + { + return $this->call('tags?' . $this->setParams($params)); + } + + /** + * retrieve specific tag + * + * @param $id + * @param array $params + * @return mixed + */ + public function getTag($id, $params = array()) + { + return $this->call('tags/' . $id . '?' . $this->setParams($params)); + } + + /** + * add single contact into your campaign + * + * @param $params + * @return mixed + */ + public function addTag($params) + { + return $this->call('tags', 'POST', $params); + } + + /** + * updating a tag + * @param $tag_id + * @param array $params + * + * @return mixed + */ + public function updateTag($tag_id, $params = array()) + { + return $this->call('tags/' . $tag_id, 'POST', $params); + } + + /** + * add single contact into your campaign + * + * @param $tag_id + * @param $params + * @return mixed + */ + public function deleteTag($tag_id, $params = array()) + { + return $this->call('tags/' . $tag_id, 'DELETE', $params); + } + /** * Curl run request *