Skip to content

Commit

Permalink
Update generated client
Browse files Browse the repository at this point in the history
  • Loading branch information
mittwald-machine committed May 14, 2024
1 parent 26d0e24 commit ea29e20
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class UpdateSftpUserRequest
'type' => 'string',
],
'password' => [
'maxLength' => 72,
'type' => 'string',
],
'publicKeys' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class UpdateSftpUserRequestBody
'type' => 'string',
],
'password' => [
'maxLength' => 72,
'type' => 'string',
],
'publicKeys' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class UpdateSshUserRequest
'type' => 'string',
],
'password' => [
'maxLength' => 72,
'type' => 'string',
],
'publicKeys' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UpdateSshUserRequestBody
'type' => 'string',
],
'password' => [
'maxLength' => 72,
'type' => 'string',
],
'publicKeys' => [
Expand Down
41 changes: 41 additions & 0 deletions src/Generated/V2/Schemas/Order/ServerOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class ServerOrder
'example' => 'shared.xlarge',
'type' => 'string',
],
'promotionCode' => [
'example' => '123456',
'type' => 'string',
],
'useFreeTrial' => [
'type' => 'boolean',
],
Expand All @@ -62,6 +66,8 @@ class ServerOrder

private string $machineType;

private ?string $promotionCode = null;

private ?bool $useFreeTrial = null;

/**
Expand Down Expand Up @@ -95,6 +101,11 @@ public function getMachineType(): string
return $this->machineType;
}

public function getPromotionCode(): ?string
{
return $this->promotionCode ?? null;
}

public function getUseFreeTrial(): ?bool
{
return $this->useFreeTrial ?? null;
Expand Down Expand Up @@ -159,6 +170,28 @@ public function withMachineType(string $machineType): self
return $clone;
}

public function withPromotionCode(string $promotionCode): self
{
$validator = new Validator();
$validator->validate($promotionCode, static::$schema['properties']['promotionCode']);
if (!$validator->isValid()) {
throw new InvalidArgumentException($validator->getErrors()[0]['message']);
}

$clone = clone $this;
$clone->promotionCode = $promotionCode;

return $clone;
}

public function withoutPromotionCode(): self
{
$clone = clone $this;
unset($clone->promotionCode);

return $clone;
}

public function withUseFreeTrial(bool $useFreeTrial): self
{
$validator = new Validator();
Expand Down Expand Up @@ -200,12 +233,17 @@ public static function buildFromInput(array|object $input, bool $validate = true
$description = $input->{'description'};
$diskspaceInGiB = str_contains((string)($input->{'diskspaceInGiB'}), '.') ? (float)($input->{'diskspaceInGiB'}) : (int)($input->{'diskspaceInGiB'});
$machineType = $input->{'machineType'};
$promotionCode = null;
if (isset($input->{'promotionCode'})) {
$promotionCode = $input->{'promotionCode'};
}
$useFreeTrial = null;
if (isset($input->{'useFreeTrial'})) {
$useFreeTrial = (bool)($input->{'useFreeTrial'});
}

$obj = new self($customerId, $description, $diskspaceInGiB, $machineType);
$obj->promotionCode = $promotionCode;
$obj->useFreeTrial = $useFreeTrial;
return $obj;
}
Expand All @@ -222,6 +260,9 @@ public function toJson(): array
$output['description'] = $this->description;
$output['diskspaceInGiB'] = $this->diskspaceInGiB;
$output['machineType'] = $this->machineType;
if (isset($this->promotionCode)) {
$output['promotionCode'] = $this->promotionCode;
}
if (isset($this->useFreeTrial)) {
$output['useFreeTrial'] = $this->useFreeTrial;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AuthenticationAlternative1
private static array $schema = [
'properties' => [
'password' => [
'maxLength' => 72,
'type' => 'string',
],
],
Expand Down

0 comments on commit ea29e20

Please sign in to comment.