mailgun-php/src/Mailgun/Mailgun.php

46 lines
1.1 KiB
PHP
Raw Normal View History

<?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;
class Mailgun{
2013-08-08 04:41:14 +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 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);
}
}
?>