diff --git a/CHANGELOG.md b/CHANGELOG.md index 785750e..463f6d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ CHANGELOG ========= +6.6.3 +----- +* Added support for using your own GuzzleClient and HttpClient + 6.6.2 ----- * Added isDefault property to SshKey diff --git a/src/HttpClient/GuzzleClient.php b/src/HttpClient/GuzzleClient.php index e9691f2..073684d 100644 --- a/src/HttpClient/GuzzleClient.php +++ b/src/HttpClient/GuzzleClient.php @@ -18,9 +18,9 @@ class GuzzleClient extends HttpClient */ private $client; - public function __construct(string $endpoint) + public function __construct(string $endpoint, Client $client = null) { - $this->client = new Client(); + $this->client = $client ?? new Client(); parent::__construct($endpoint); } diff --git a/src/TransipAPI.php b/src/TransipAPI.php index 5bf0089..aca8e9c 100644 --- a/src/TransipAPI.php +++ b/src/TransipAPI.php @@ -58,7 +58,7 @@ class TransipAPI { public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6"; - public const TRANSIP_API_LIBRARY_VERSION = "6.6.2"; + public const TRANSIP_API_LIBRARY_VERSION = "6.6.3"; public const TRANSIP_API_DEMO_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw"; /** @@ -80,7 +80,8 @@ public function __construct( bool $generateWhitelistOnlyTokens = true, string $token = '', string $endpointUrl = '', - AdapterInterface $cache = null + AdapterInterface $cache = null, + GuzzleClient $httpClient = null ) { $endpoint = self::TRANSIP_API_ENDPOINT; @@ -88,7 +89,7 @@ public function __construct( $endpoint = $endpointUrl; } - $this->httpClient = new GuzzleClient($endpoint); + $this->httpClient = $httpClient ?? new GuzzleClient($endpoint); if ($customerLoginName != '') { $this->httpClient->setLogin($customerLoginName);