Skip to content

Commit

Permalink
Merge branch 'defaultDomainContacts' into 'master'
Browse files Browse the repository at this point in the history
Added default domain contacts endpoint

See merge request transip/restapi-php-library!187
  • Loading branch information
Thies Verhave committed Apr 22, 2022
2 parents a3f7aa6 + 6808e2d commit 9717d62
Show file tree
Hide file tree
Showing 3 changed files with 46 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.21.0
-----
* Added default domain contacts endpoint

6.19.0
-----
* Added includes to Domain
Expand Down
35 changes: 35 additions & 0 deletions src/Repository/DomainDefaults/ContactRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Transip\Api\Library\Repository\DomainDefaults;

use Transip\Api\Library\Entity\Domain\WhoisContact;
use Transip\Api\Library\Repository\ApiRepository;

class ContactRepository extends ApiRepository
{
public const RESOURCE_NAME = 'domain-defaults/contacts';

/**
* @return WhoisContact[]
*/
public function getAll(): array
{
$contacts = [];
$response = $this->httpClient->get($this->getResourceUrl());
$contactsArray = $this->getParameterFromResponse($response, 'contacts');

foreach ($contactsArray as $contactArray) {
$contacts[] = new WhoisContact($contactArray);
}

return $contacts;
}

/**
* @param WhoisContact[] $contacts
*/
public function update(array $contacts): void
{
$this->httpClient->put($this->getResourceUrl(), ['contacts' => $contacts]);
}
}
8 changes: 7 additions & 1 deletion src/TransipAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Transip\Api\Library\Repository\Colocation\IpAddressRepository as ColoIpAddressRepository;
use Transip\Api\Library\Repository\Colocation\RemoteHandsRepository as ColoRemoteHandsRepository;
use Transip\Api\Library\Repository\Colocation\AccessRequestRepository as ColoAccessRequestRepository;
use Transip\Api\Library\Repository\DomainDefaults\ContactRepository as DefaultContactRepository;
use Transip\Api\Library\Repository\DomainRepository;
use Transip\Api\Library\Repository\DomainAvailabilityRepository;
use Transip\Api\Library\Repository\Domain\ActionRepository as DomainActionRepository;
Expand Down Expand Up @@ -71,7 +72,7 @@
class TransipAPI
{
public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6";
public const TRANSIP_API_LIBRARY_VERSION = "6.19.0";
public const TRANSIP_API_LIBRARY_VERSION = "6.21.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 @@ -231,6 +232,11 @@ public function domainWhitelabel(): DomainWhitelabelRepository
return new DomainWhitelabelRepository($this->httpClient);
}

public function defaultDomainContacts(): DefaultContactRepository
{
return new DefaultContactRepository($this->httpClient);
}

/**
* @deprecated deprecated since version 6.8.0, use trafficPool instead
*/
Expand Down

0 comments on commit 9717d62

Please sign in to comment.