Skip to content

Commit 8cd9d5b

Browse files
committed
added API settings endpoints
1 parent e33d833 commit 8cd9d5b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

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)