From 7e730485a013089593b8f4fa869ac4c9a2e6d1a5 Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Thu, 8 Dec 2016 14:23:49 -0200 Subject: [PATCH 1/6] Added ability to retreive and add tags --- src/GetResponseAPI3.class.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/GetResponseAPI3.class.php b/src/GetResponseAPI3.class.php index 2782e2f..52dc052 100644 --- a/src/GetResponseAPI3.class.php +++ b/src/GetResponseAPI3.class.php @@ -327,6 +327,40 @@ 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); + } + /** * Curl run request * From 2ac9c5a976c6c743311852dfb0be27881f1ed4f4 Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Fri, 9 Dec 2016 09:02:45 -0200 Subject: [PATCH 2/6] Added delete tag method --- src/GetResponseAPI3.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GetResponseAPI3.class.php b/src/GetResponseAPI3.class.php index 52dc052..b6c9e89 100644 --- a/src/GetResponseAPI3.class.php +++ b/src/GetResponseAPI3.class.php @@ -361,6 +361,17 @@ public function addTag($params) return $this->call('tags', 'POST', $params); } + /** + * add single contact into your campaign + * + * @param $params + * @return mixed + */ + public function deleteTag($id, $params) + { + return $this->call('tags/' . $id, 'DELETE', $params); + } + /** * Curl run request * From 1fd58634d8fe573f2a8d3f7af0a2599d833d7a6a Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Fri, 9 Dec 2016 09:21:33 -0200 Subject: [PATCH 3/6] Fixed deleteTag method --- src/GetResponseAPI3.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GetResponseAPI3.class.php b/src/GetResponseAPI3.class.php index b6c9e89..ce22f20 100644 --- a/src/GetResponseAPI3.class.php +++ b/src/GetResponseAPI3.class.php @@ -367,7 +367,7 @@ public function addTag($params) * @param $params * @return mixed */ - public function deleteTag($id, $params) + public function deleteTag($id, $params = array()) { return $this->call('tags/' . $id, 'DELETE', $params); } From 91671ac56396a2dfd7576c99bcb40f3d8d57f540 Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Fri, 9 Dec 2016 09:22:37 -0200 Subject: [PATCH 4/6] Added updateTag method --- src/GetResponseAPI3.class.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/GetResponseAPI3.class.php b/src/GetResponseAPI3.class.php index ce22f20..e314609 100644 --- a/src/GetResponseAPI3.class.php +++ b/src/GetResponseAPI3.class.php @@ -361,15 +361,28 @@ 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($id, $params = array()) + public function deleteTag($tag_id, $params = array()) { - return $this->call('tags/' . $id, 'DELETE', $params); + return $this->call('tags/' . $tag_id, 'DELETE', $params); } /** From 9fc7ff120c9e5e8e7645b099bef5a00691a8e53c Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Fri, 9 Dec 2016 09:24:07 -0200 Subject: [PATCH 5/6] Updated readme --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index fb0edaf..781473b 100644 --- a/README.md +++ b/README.md @@ -91,5 +91,29 @@ List old web forms $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); +``` + From 2ae8bceb55d45a6d1c7dd1827f3b72d395ef147d Mon Sep 17 00:00:00 2001 From: Luis Dalmolin Date: Fri, 9 Dec 2016 09:24:34 -0200 Subject: [PATCH 6/6] Fixed readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 781473b..1cc45c0 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ List old web forms ```php $result = $getresponse->getWebForms(); ``` - +-- List all tags ```php $result = $getresponse->getTags();