Skip to content

Commit

Permalink
Merge branch 'listMailPackages' into 'master'
Browse files Browse the repository at this point in the history
Add MailPackage api resources

See merge request transip/restapi-php-library!289
  • Loading branch information
Thies Verhave committed Aug 19, 2024
2 parents 73a39ba + 3bd888c commit 07107b4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

6.53.0
---
* Add MailPackage API resources

6.52.4
---
* Return correct results for querying on `resourceIdentifier` for Actions
Expand Down
38 changes: 38 additions & 0 deletions src/Entity/Email/MailPackage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Transip\Api\Library\Entity\Email;

use Transip\Api\Library\Entity\AbstractEntity;

class MailPackage extends AbstractEntity
{
/**
* @var string
*/
public $domain;

/**
* @var string
*/
public $status;

public function getDomain(): string
{
return $this->domain;
}

public function setDomain(string $domain): void
{
$this->domain = $domain;
}

public function getStatus(): string
{
return $this->status;
}

public function setStatus(string $status): void
{
$this->status = $status;
}
}
28 changes: 28 additions & 0 deletions src/Repository/Email/MailPackageRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Transip\Api\Library\Repository\Email;

use Transip\Api\Library\Entity\Email\MailPackage;
use Transip\Api\Library\Repository\ApiRepository;
use Transip\Api\Library\Repository\EmailRepository;

class MailPackageRepository extends ApiRepository
{
protected function getRepositoryResourceNames(): array
{
return [EmailRepository::RESOURCE_NAME];
}

/**
* @return MailPackage[]
*/
public function get(): array
{
$response = $this->httpClient->get($this->getResourceUrl());
$packagesArray = $this->getParameterFromResponse($response, 'packages');

return \array_map(static function (array $packageArray) {
return new MailPackage($packageArray);
}, $packagesArray);
}
}
8 changes: 7 additions & 1 deletion src/TransipAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use Transip\Api\Library\Repository\Email\MailboxRepository;
use Transip\Api\Library\Repository\Email\MailForwardRepository;
use Transip\Api\Library\Repository\Email\MailListRepository;
use Transip\Api\Library\Repository\Email\MailPackageRepository;
use Transip\Api\Library\Repository\Haip\CertificateRepository as HaipCertificateRepository;
use Transip\Api\Library\Repository\Haip\IpAddressRepository as HaipIpAddressRepository;
use Transip\Api\Library\Repository\Haip\PortConfigurationRepository;
Expand Down Expand Up @@ -108,7 +109,7 @@
class TransipAPI
{
public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6";
public const TRANSIP_API_LIBRARY_VERSION = "6.52.4";
public const TRANSIP_API_LIBRARY_VERSION = "6.53.0";
public const TRANSIP_API_DEMO_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw";

/**
Expand Down Expand Up @@ -605,6 +606,11 @@ public function mailLists(): MailListRepository
return new MailListRepository($this->httpClient);
}

public function mailPackages(): MailPackageRepository
{
return new MailPackageRepository($this->httpClient);
}

public function operatingSystemFilter(): OperatingSystemFilterRepository
{
return new OperatingSystemFilterRepository($this->httpClient);
Expand Down

0 comments on commit 07107b4

Please sign in to comment.