From 8cd9d5bc6a7e21b4268f2db61bb2c76f13ba7519 Mon Sep 17 00:00:00 2001 From: flowdee Date: Thu, 9 Nov 2017 17:36:16 +0100 Subject: [PATCH 1/2] added API settings endpoints --- src/Api/Settings.php | 36 ++++++++++++++++++++++++++++++++++++ src/MailerLite.php | 8 ++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/Api/Settings.php diff --git a/src/Api/Settings.php b/src/Api/Settings.php new file mode 100644 index 0000000..88fca74 --- /dev/null +++ b/src/Api/Settings.php @@ -0,0 +1,36 @@ +endpoint . '/double_optin'; + + $response = $this->restClient->get( $endpoint ); + + return $response['body']; + } + + public function setDoubleOptin( $status ) { + + $endpoint = $this->endpoint . '/double_optin'; + + $params = array_merge($this->prepareParams(), ['enable' => $status] ); + + $response = $this->restClient->post( $endpoint, $params ); + + return $response['body']; + } + +} \ No newline at end of file diff --git a/src/MailerLite.php b/src/MailerLite.php index d440af8..b693f37 100644 --- a/src/MailerLite.php +++ b/src/MailerLite.php @@ -81,6 +81,14 @@ public function stats() return new \MailerLiteApi\Api\Stats($this->restClient); } + /** + * @return \MailerLiteApi\Api\Settings + */ + public function settings() + { + return new \MailerLiteApi\Api\Settings($this->restClient); + } + /** * @param string $version * @return string From 63fdbeb16babbf1ace60ae4095f72b7c8f2f018f Mon Sep 17 00:00:00 2001 From: flowdee Date: Thu, 9 Nov 2017 19:38:04 +0100 Subject: [PATCH 2/2] added get single subscriber from group endpoint --- src/Api/Groups.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 337b504..978759d 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -30,6 +30,23 @@ public function getSubscribers($groupId, $type = null, $params = []) return $response['body']; } + /** + * Get single subscriber from group + * + * @param $groupId + * @param $subscriber_id + * @return mixed + */ + public function getSubscriber($groupId, $subscriber_id) + { + $endpoint = $this->endpoint . '/' . $groupId . '/subscribers/' . $subscriber_id; + + $response = $this->restClient->get($endpoint); + + return $response['body']; + } + + /** * Add single subscriber to group *