Skip to content

Commit

Permalink
Adding filtering and retry for inbound/outbound messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
atheken committed Aug 3, 2015
1 parent 2d15de2 commit a2ff454
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/Postmark/PostmarkClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,14 @@ function editServer($name = NULL, $color = NULL, $rawEmailEnabled = NULL,
* @param string $fromEmail Filter by sender email address.
* @param string $tag Filter by tag.
* @param string $subject Filter by subject.
* @param string $status The current status for the outbound messages to return defaults to 'sent'
* @param string $fromdate Filter to messages on or after YYYY-MM-DD
* @param string $todate Filter to messages on or before YYYY-MM-DD
* @return DyanamicResponseModel
*/
function getOutboundMessages($count = 100, $offset = 0, $recipient = NULL,
$fromEmail = NULL, $tag = NULL, $subject = NULL) {
$fromEmail = NULL, $tag = NULL, $subject = NULL, $status = NULL,
$fromdate = NULL, $todate = NULL) {

$query = array();
$query["recipient"] = $recipient;
Expand All @@ -290,6 +294,9 @@ function getOutboundMessages($count = 100, $offset = 0, $recipient = NULL,
$query["subject"] = $subject;
$query["count"] = $count;
$query["offset"] = $offset;
$query["status"] = $status;
$query["fromdate"] = $fromdate;
$query["todate"] = $todate;

return new DynamicResponseModel($this->processRestRequest('GET', '/messages/outbound', $query));
}
Expand Down Expand Up @@ -325,10 +332,13 @@ function getOutboundMessageDump($id) {
* @param string $subject Filter by the message subject
* @param string $mailboxHash Filter by the mailboxHash
* @param string $status Filter by status ('blocked' or 'processed')
* @param string $fromdate Filter to messages on or after YYYY-MM-DD
* @param string $todate Filter to messages on or before YYYY-MM-DD
* @return DynamicResponseModel
*/
function getInboundMessages($count = 100, $offset = 0, $recipient = NULL, $fromEmail = NULL,
$tag = NULL, $subject = NULL, $mailboxHash = NULL, $status = NULL) {
$tag = NULL, $subject = NULL, $mailboxHash = NULL, $status = NULL, $fromdate = NULL,
$todate = NULL) {

$query = array();
$query['recipient'] = $recipient;
Expand All @@ -339,6 +349,8 @@ function getInboundMessages($count = 100, $offset = 0, $recipient = NULL, $fromE
$query['count'] = $count;
$query['status'] = $status;
$query['offset'] = $offset;
$query['fromdate'] = $fromdate;
$query['todate'] = $todate;

return new DynamicResponseModel($this->processRestRequest('GET', '/messages/inbound', $query));
}
Expand All @@ -364,6 +376,16 @@ function bypassInboundMessageRules($id) {
return new DynamicResponseModel($this->processRestRequest('PUT', "/messages/inbound/$id/bypass"));
}

/**
* Request that Postmark retry POSTing the specified message to the Server's Inbound Hook.
*
* @param integer $id The ID for a message that we wish retry the inbound hook for.
* @return DynamicResponseModel
*/
function retryInboundMessageHook($id) {
return new DynamicResponseModel($this->processRestRequest('PUT', "/messages/inbound/$id/retry"));
}

/**
* Get statistics for tracked messages, optionally filtering by various open event properties.
*
Expand Down

0 comments on commit a2ff454

Please sign in to comment.