Skip to content

Commit 9edfdb8

Browse files
author
Justinas Pošiūnas
authored
Merge pull request #12 from flowdee/master
added new endpoints
2 parents 6b545d9 + 63fdbeb commit 9edfdb8

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

src/Api/Groups.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ public function getSubscribers($groupId, $type = null, $params = [])
3030
return $response['body'];
3131
}
3232

33+
/**
34+
* Get single subscriber from group
35+
*
36+
* @param $groupId
37+
* @param $subscriber_id
38+
* @return mixed
39+
*/
40+
public function getSubscriber($groupId, $subscriber_id)
41+
{
42+
$endpoint = $this->endpoint . '/' . $groupId . '/subscribers/' . $subscriber_id;
43+
44+
$response = $this->restClient->get($endpoint);
45+
46+
return $response['body'];
47+
}
48+
49+
3350
/**
3451
* Add single subscriber to group
3552
*

src/Api/Settings.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace MailerLiteApi\Api;
4+
5+
use MailerLiteApi\Common\ApiAbstract;
6+
7+
class Settings extends ApiAbstract {
8+
9+
protected $endpoint = 'settings';
10+
11+
/**
12+
* Retrieve double opt in status
13+
*
14+
* @return mixed
15+
*/
16+
public function getDoubleOptin()
17+
{
18+
$endpoint = $this->endpoint . '/double_optin';
19+
20+
$response = $this->restClient->get( $endpoint );
21+
22+
return $response['body'];
23+
}
24+
25+
public function setDoubleOptin( $status ) {
26+
27+
$endpoint = $this->endpoint . '/double_optin';
28+
29+
$params = array_merge($this->prepareParams(), ['enable' => $status] );
30+
31+
$response = $this->restClient->post( $endpoint, $params );
32+
33+
return $response['body'];
34+
}
35+
36+
}

src/MailerLite.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ public function stats()
8181
return new \MailerLiteApi\Api\Stats($this->restClient);
8282
}
8383

84+
/**
85+
* @return \MailerLiteApi\Api\Settings
86+
*/
87+
public function settings()
88+
{
89+
return new \MailerLiteApi\Api\Settings($this->restClient);
90+
}
91+
8492
/**
8593
* @param string $version
8694
* @return string

0 commit comments

Comments
 (0)