Skip to content

Commit

Permalink
add missing params for World Create + increased timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
PlanetHoster-account committed Nov 11, 2020
1 parent e1502c5 commit 5389815
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Adapter/GuzzleHttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GuzzleHttpAdapter implements Adapter {
* @param integer $timeout
* @param string $base_url
*/
public function __construct($api_user, $api_key, $timeout = 10, $base_url = Api::DEFAULT_ENDPOINT, ClientInterface $client = null) {
public function __construct($api_user, $api_key, $timeout = 120, $base_url = Api::DEFAULT_ENDPOINT, ClientInterface $client = null) {
$this->client = $client ?: new Client([
'headers' => [
'X-API-USER' => $api_user,
Expand Down Expand Up @@ -86,6 +86,9 @@ protected function request($method, $uri, $options) {
$this->response = $this->client->request($method, $uri, $options);
} catch (RequestException $e) {
$this->response = $e->getResponse();
if (is_null($this->response)) {
throw $e;
}
$this->handleError();
}
return (string)$this->response->getBody();
Expand Down
6 changes: 5 additions & 1 deletion src/Api/World.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ public function GetAccounts() {
* @param integer $cpu
* @param integer $mem
* @param integer $io
* @param bool $cpanel
* @param bool $litespeed
* @param string $cms
*
* @return stdClass
*/
public function Create($domain, $country, $cpu, $mem, $io, $cms = '') {
public function Create($domain, $country, $cpu, $mem, $io, $cpanel=true, $litespeed=false, $cms = '') {
$content = $this->adapter->post($this->uri('create-account'), [
'domain' => $domain,
'country' => $country,
'cpu' => $cpu,
'mem' => $mem,
'io' => $io,
'cms' => $cms,
'with_cpanel' => $cpanel ? 'true' : 'false',
'ls' => $litespeed ? 'true' : 'false'
]);
return json_decode($content);
}
Expand Down

0 comments on commit 5389815

Please sign in to comment.