Skip to content

Commit

Permalink
Merge pull request #12 from flowdee/master
Browse files Browse the repository at this point in the history
added new endpoints
  • Loading branch information
Justinas Pošiūnas authored Nov 10, 2017
2 parents 6b545d9 + 63fdbeb commit 9edfdb8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
36 changes: 36 additions & 0 deletions src/Api/Settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace MailerLiteApi\Api;

use MailerLiteApi\Common\ApiAbstract;

class Settings extends ApiAbstract {

protected $endpoint = 'settings';

/**
* Retrieve double opt in status
*
* @return mixed
*/
public function getDoubleOptin()
{
$endpoint = $this->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'];
}

}
8 changes: 8 additions & 0 deletions src/MailerLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9edfdb8

Please sign in to comment.