Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De 1258 api bounces endpoint #911

Merged
merged 12 commits into from
Jul 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading