2013-08-08 03:22:19 +04:00
|
|
|
<?PHP
|
|
|
|
|
|
|
|
namespace Mailgun;
|
|
|
|
|
|
|
|
use Mailgun\Connection\RestClient;
|
2013-08-08 04:41:14 +04:00
|
|
|
|
|
|
|
use Mailgun\Messages\Messages;
|
|
|
|
use Mailgun\Messages\BatchMessage;
|
|
|
|
use Mailgun\Messages\MessageBuilder;
|
2013-08-08 03:22:19 +04:00
|
|
|
|
|
|
|
class Mailgun{
|
2013-08-08 04:41:14 +04:00
|
|
|
|
2013-08-08 03:22:19 +04:00
|
|
|
private $apiKey;
|
|
|
|
protected $workingDomain;
|
|
|
|
protected $restClient;
|
|
|
|
|
2013-08-08 04:41:14 +04:00
|
|
|
public function __construct($apiKey = null, $apiEndpoint = "api.mailgun.net"){
|
|
|
|
$this->restClient = new RestClient($apiKey, $apiEndpoint);
|
2013-08-08 03:22:19 +04:00
|
|
|
}
|
2013-08-08 04:41:14 +04:00
|
|
|
|
|
|
|
public function post($endpointUrl, $postData = array(), $files = array()){
|
|
|
|
return $this->restClient->postRequest($endpointUrl, $postData, $files);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get($endpointUrl, $queryString = array()){
|
|
|
|
return $this->restClient->getRequest($endpointUrl, $queryString);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($endpointUrl){
|
|
|
|
return $this->restClient->getRequest($endpointUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function put($endpointUrl, $putData){
|
|
|
|
return $this->restClient->putRequest($endpointUrl, $putData);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function MessageBuilder(){
|
|
|
|
return new MessageBuilder();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function BatchMessage($autoSend = true){
|
|
|
|
return new BatchMessage($this->restClient, $autoSend);
|
|
|
|
}
|
2013-08-08 03:22:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|