Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mailgun/mailgun-php
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-mykhailenko committed Jul 14, 2024
2 parents 383e36f + 38af3ad commit 4e98711
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Api/Suppression/Bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
use Mailgun\Api\HttpApi;
use Mailgun\Api\Pagination;
use Mailgun\Assert;
use Mailgun\Exception\InvalidArgumentException;
use Mailgun\Model\Suppression\Bounce\CreateResponse;
use Mailgun\Model\Suppression\Bounce\DeleteResponse;
use Mailgun\Model\Suppression\Bounce\IndexResponse;
use Mailgun\Model\Suppression\Bounce\ShowResponse;
use Psr\Http\Client\ClientExceptionInterface;
use RuntimeException;
use Throwable;

/**
* @see https://documentation.mailgun.com/en/latest/api-suppressions.html#bounces
Expand Down Expand Up @@ -117,4 +120,25 @@ public function deleteAll(string $domain, array $requestHeaders = []): ?DeleteRe

return $this->hydrateResponse($response, DeleteResponse::class);
}

/**
* @param string $domainId
* @param array $bounces
* @param array $requestHeaders
* @return mixed
*/
public function importBouncesList(string $domainId, array $bounces, array $requestHeaders = [])
{
try {
$response = $this->httpPostRaw(
sprintf('/v3/%s/bounces/import', $domainId),
$bounces,
$requestHeaders
);
} catch (Throwable $throwable) {
throw new RuntimeException($throwable->getMessage());
}

return $this->hydrateResponse($response, CreateResponse::class);
}
}

0 comments on commit 4e98711

Please sign in to comment.