LKDevelopment / hetzner-cloud-php-sdk

A PHP SDK for the Hetzner Cloud API
MIT License
107 stars 52 forks source link

[Enhancement] Update constructor client #15

Closed Cannonb4ll closed 5 years ago

Cannonb4ll commented 5 years ago
$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient(
    $key,
    'https://api.hetzner.cloud/v1/',
    'ploi.io/1.0.0'
);

If the URL would ever change, I would have to manually change this in my source, because I have a custom agent passed in. Would be nice if there would be 2 additional methods:

Set URL:

$hetznerClient->setApiUrl('http://...')

Set User Agent:

$hetznerClient->setUserAgent('ploi.io/1.0.0')

Client instantiator:

$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient($key);

Total picture:

$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient($key);

$hetznerClient->setApiUrl('http://...');

$hetznerClient->setUserAgent('ploi.io/1.0.0')