@@ 632-641 (lines=10) @@ | ||
629 | * @throws ClientExceptions |
|
630 | * @throws Exception |
|
631 | */ |
|
632 | public function limitBandwidth($user, $bwlimit) |
|
633 | { |
|
634 | $params = ['user' => $user, 'bwlimit' => intval($bwlimit)]; |
|
635 | $result = $this->client->sendRequest("/json-api/limitbw", "GET", $params); |
|
636 | if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
637 | return $result['data']['bwlimits'][0]; |
|
638 | } |
|
639 | ||
640 | return null; |
|
641 | } |
|
642 | ||
643 | ||
644 | /** |
|
@@ 1101-1112 (lines=12) @@ | ||
1098 | * @throws ClientExceptions |
|
1099 | * @throws Exception |
|
1100 | */ |
|
1101 | public function changePlan($username, $plan) |
|
1102 | { |
|
1103 | $params = ['user' => $username, 'pkg' => $plan]; |
|
1104 | ||
1105 | $result = $this->client->sendRequest('/json-api/changepackage', 'GET', $params); |
|
1106 | ||
1107 | if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
1108 | throw new ClientExceptions($result['metadata']['reason']); |
|
1109 | } |
|
1110 | ||
1111 | return $result; |
|
1112 | } |
|
1113 | } |
|
1114 |