|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Vansteen\Sendinblue |
|
5
|
|
|
* @author Thomas Van Steenwinckel <[email protected]> |
|
6
|
|
|
* @link https://github.com/vansteen/laravel-sendinblue |
|
7
|
|
|
* @license https://github.com/vansteen/laravel-sendinblue/blob/master/license.md (MIT License) |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Vansteen\Sendinblue; |
|
14
|
|
|
|
|
15
|
|
|
use SendinBlue\Client\Configuration; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Wrapper for the Sendinblue's Configuration class. |
|
19
|
|
|
* |
|
20
|
|
|
* @category Class |
|
21
|
|
|
* @author Thomas Van Steenwinckel |
|
22
|
|
|
* @link https://github.com/vansteen/sendinblue |
|
23
|
|
|
*/ |
|
24
|
|
|
class Sendinblue |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* An instance of the Sendinblue's Configuration class. |
|
28
|
|
|
* @var \SendinBlue\Client\Configuration |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $configuration; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Constructor. |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct() |
|
36
|
|
|
{ |
|
37
|
|
|
$apikey = config('sendinblue.apikey'); |
|
38
|
|
|
$partnerkey = config('sendinblue.partnerkey'); |
|
39
|
|
|
|
|
40
|
|
|
// Configure API key authorization: api-key |
|
41
|
|
|
$this->configuration = Configuration::getDefaultConfiguration()->setApiKey('api-key', $apikey); |
|
42
|
|
|
|
|
43
|
|
|
if ($partnerkey) { |
|
44
|
|
|
// (Optional) The partner key should be passed in the request headers as |
|
45
|
|
|
// partner-key along with api-key pair for successful authentication of partner. |
|
46
|
|
|
$this->configuration->setApiKey('partner-key', $partnerkey); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Gets the default configuration instance. |
|
52
|
|
|
* |
|
53
|
|
|
* @return \SendinBlue\Client\Configuration |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getConfiguration() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->configuration; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Sets the detault configuration instance. |
|
62
|
|
|
* |
|
63
|
|
|
* @param \SendinBlue\Client\Configuration $configuration An instance of the Configuration Object |
|
64
|
|
|
*/ |
|
65
|
|
|
public function setConfiguration(Configuration $configuration) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->configuration = $configuration; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|