mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-18 05:43:15 +03:00
fix
This commit is contained in:
parent
c24a92822c
commit
8c5c99a356
@ -34,8 +34,9 @@ class EmailValidationV4 extends HttpApi
|
||||
* Addresses are validated based off defined checks.
|
||||
*
|
||||
* @param string $address An email address to validate. Maximum: 512 characters.
|
||||
* @param bool $providerLookup
|
||||
*
|
||||
* @return ValidateResponse|ResponseInterface
|
||||
*
|
||||
* @throws Exception Thrown when we don't catch a Client or Server side Exception
|
||||
*/
|
||||
public function validate(string $address, bool $providerLookup = true)
|
||||
@ -53,9 +54,10 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listId
|
||||
* @param $filePath - file path or file content
|
||||
* @param mixed $filePath - file path or file content
|
||||
*
|
||||
* @return mixed|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createBulkJob(string $listId, $filePath)
|
||||
@ -81,10 +83,7 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
* @param array $filePath ['fileContent' => 'content'] or ['filePath' => '/foo/bar']
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function prepareFile(string $fieldName, array $filePath): array
|
||||
{
|
||||
@ -118,7 +117,6 @@ class EmailValidationV4 extends HttpApi
|
||||
|
||||
/**
|
||||
* Close open resources.
|
||||
* @param array $params
|
||||
*/
|
||||
private function closeResources(array $params): void
|
||||
{
|
||||
@ -130,8 +128,8 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listId
|
||||
* @return DeleteBulkJobResponse|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function deleteBulkJob(string $listId)
|
||||
@ -144,8 +142,8 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listId
|
||||
* @return GetBulkJobResponse|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getBulkJob(string $listId)
|
||||
@ -158,8 +156,8 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
* @return GetBulkJobsResponse|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getBulkJobs(int $limit = 500)
|
||||
@ -187,9 +185,8 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $previewId
|
||||
* @param $filePath
|
||||
* @return mixed|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createBulkPreview(string $previewId, $filePath)
|
||||
@ -215,8 +212,8 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $previewId
|
||||
* @return mixed|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getBulkPreview(string $previewId)
|
||||
@ -229,7 +226,6 @@ class EmailValidationV4 extends HttpApi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $previewId
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteBulkPreview(string $previewId)
|
||||
@ -238,12 +234,12 @@ class EmailValidationV4 extends HttpApi
|
||||
|
||||
$response = $this->httpDelete(sprintf('/v4/address/validate/preview/%s', $previewId));
|
||||
|
||||
return $response->getStatusCode() === 204;
|
||||
return 204 === $response->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $previewId
|
||||
* @return mixed|ResponseInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function promoteBulkPreview(string $previewId)
|
||||
|
@ -39,17 +39,11 @@ final class CreateBulkJobResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
|
@ -39,17 +39,11 @@ final class CreateBulkPreviewResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
|
@ -33,9 +33,6 @@ final class DeleteBulkJobResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
|
@ -51,17 +51,11 @@ final class GetBulkJobsResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTotal(): int
|
||||
{
|
||||
return $this->total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getJobs(): array
|
||||
{
|
||||
return $this->jobs;
|
||||
|
@ -18,7 +18,7 @@ final class GetBulkPreviewResponse implements ApiResponse
|
||||
/**
|
||||
* @var Preview
|
||||
*/
|
||||
private $preview = [];
|
||||
private $preview;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@ -32,9 +32,6 @@ final class GetBulkPreviewResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Preview
|
||||
*/
|
||||
public function getPreview(): Preview
|
||||
{
|
||||
return $this->preview;
|
||||
|
@ -41,9 +41,6 @@ final class GetBulkPreviewsResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPreviews(): array
|
||||
{
|
||||
return $this->previews;
|
||||
|
@ -51,7 +51,7 @@ class Job implements ApiResponse
|
||||
*/
|
||||
private $summary;
|
||||
|
||||
private function __construct()
|
||||
final private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
@ -70,57 +70,36 @@ class Job implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DateTimeImmutable|null
|
||||
*/
|
||||
public function getCreatedAt(): ?DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JobDownloadUrl
|
||||
*/
|
||||
public function getDownloadUrl(): JobDownloadUrl
|
||||
{
|
||||
return $this->downloadUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getQuantity(): int
|
||||
{
|
||||
return $this->quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRecordsProcessed(): int
|
||||
{
|
||||
return $this->recordsProcessed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSummary(): Summary
|
||||
{
|
||||
return $this->summary;
|
||||
|
@ -46,7 +46,7 @@ class Preview implements ApiResponse
|
||||
*/
|
||||
private $summary;
|
||||
|
||||
private function __construct()
|
||||
final private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
@ -58,55 +58,37 @@ class Preview implements ApiResponse
|
||||
$model->valid = $data['valid'] ?? null;
|
||||
$model->status = $data['status'] ?? null;
|
||||
$model->quantity = $data['quantity'] ?? null;
|
||||
$model->createdAt = isset($data['created_at']) ? DateTimeImmutable::createFromFormat('U', (string)($data['created_at'])) : null;
|
||||
$model->createdAt = isset($data['created_at']) ? DateTimeImmutable::createFromFormat('U', (string) ($data['created_at'])) : null;
|
||||
$model->summary = Summary::create($data['summary']);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isValid(): ?bool
|
||||
{
|
||||
return $this->valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getQuantity(): int
|
||||
{
|
||||
return $this->quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DateTimeImmutable|null
|
||||
*/
|
||||
public function getCreatedAt(): ?DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSummary(): Summary
|
||||
{
|
||||
return $this->summary;
|
||||
|
@ -33,9 +33,6 @@ final class PromoteBulkPreviewResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
|
@ -39,17 +39,11 @@ final class Summary implements ApiResponse
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SummaryResult
|
||||
*/
|
||||
public function getResult(): SummaryResult
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SummaryRisk
|
||||
*/
|
||||
public function getRisk(): SummaryRisk
|
||||
{
|
||||
return $this->risk;
|
||||
|
@ -56,41 +56,26 @@ final class SummaryResult implements ApiResponse
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDeliverable(): int
|
||||
{
|
||||
return $this->deliverable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDoNotSend(): int
|
||||
{
|
||||
return $this->doNotSend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUndeliverable(): int
|
||||
{
|
||||
return $this->undeliverable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCatchAll(): int
|
||||
{
|
||||
return $this->catchAll;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUnknown(): int
|
||||
{
|
||||
return $this->unknown;
|
||||
|
@ -51,33 +51,21 @@ final class SummaryRisk implements ApiResponse
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHigh(): int
|
||||
{
|
||||
return $this->high;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLow(): int
|
||||
{
|
||||
return $this->low;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMedium(): int
|
||||
{
|
||||
return $this->medium;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUnknown(): int
|
||||
{
|
||||
return $this->unknown;
|
||||
|
@ -74,65 +74,41 @@ final class ValidateResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAddress(): ?string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDidYouMean(): ?string
|
||||
{
|
||||
return $this->didYouMean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisposableAddress(): bool
|
||||
{
|
||||
return $this->isDisposableAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isRoleAddress(): bool
|
||||
{
|
||||
return $this->isRoleAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getReason(): array
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getResult(): ?string
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRisk(): ?string
|
||||
{
|
||||
return $this->risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRootAddress(): ?string
|
||||
{
|
||||
return $this->rootAddress;
|
||||
|
@ -11,9 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Mailgun\Tests\Model\Event;
|
||||
|
||||
use Mailgun\Model\EmailValidationV4\Job;
|
||||
use Mailgun\Model\EmailValidationV4\JobDownloadUrl;
|
||||
use Mailgun\Model\EmailValidationV4\Summary;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
class JobDownloadUrlTest extends BaseModelTest
|
||||
|
@ -11,8 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Mailgun\Tests\Model\Event;
|
||||
|
||||
use Mailgun\Model\EmailValidationV4\Job;
|
||||
use Mailgun\Model\EmailValidationV4\JobDownloadUrl;
|
||||
use Mailgun\Model\EmailValidationV4\Preview;
|
||||
use Mailgun\Model\EmailValidationV4\Summary;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
@ -11,11 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Mailgun\Tests\Model\Event;
|
||||
|
||||
use Mailgun\Model\EmailValidationV4\Job;
|
||||
use Mailgun\Model\EmailValidationV4\JobDownloadUrl;
|
||||
use Mailgun\Model\EmailValidationV4\Summary;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryResult;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryRisk;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
class SummaryResultTest extends BaseModelTest
|
||||
|
@ -11,10 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Mailgun\Tests\Model\Event;
|
||||
|
||||
use Mailgun\Model\EmailValidationV4\Job;
|
||||
use Mailgun\Model\EmailValidationV4\JobDownloadUrl;
|
||||
use Mailgun\Model\EmailValidationV4\Summary;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryResult;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryRisk;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
|
@ -11,8 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Mailgun\Tests\Model\Event;
|
||||
|
||||
use Mailgun\Model\EmailValidationV4\Job;
|
||||
use Mailgun\Model\EmailValidationV4\JobDownloadUrl;
|
||||
use Mailgun\Model\EmailValidationV4\Summary;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryResult;
|
||||
use Mailgun\Model\EmailValidationV4\SummaryRisk;
|
||||
|
Loading…
x
Reference in New Issue
Block a user