Skip to content

Commit

Permalink
chore: update SDK from api-definitions (#728)
Browse files Browse the repository at this point in the history
Co-authored-by: rebilly-machine-user <[email protected]>
  • Loading branch information
rebilly-machine-user and rebilly-machine-user authored Nov 23, 2024
1 parent fff8528 commit db1c395
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-dodos-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

fix(api-definitions): Fix some of the inconsistencies of Plan API-defs Rebilly/rebilly#8670
2 changes: 0 additions & 2 deletions src/Model/ConfigurablePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
interface ConfigurablePlan extends JsonSerializable
{
public function getId(): ?string;

public function setId(string $id): static;
}
2 changes: 0 additions & 2 deletions src/Model/FlexiblePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ interface FlexiblePlan extends ConfigurablePlan
{
public function getId(): ?string;

public function setId(null|string $id): static;

public function getName(): string;

public function setName(string $name): static;
Expand Down
14 changes: 7 additions & 7 deletions src/Model/OneTimeSalePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ public function getId(): ?string
return $this->fields['id'] ?? null;
}

public function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

public function getName(): string
{
return $this->fields['name'];
Expand Down Expand Up @@ -322,6 +315,13 @@ public function jsonSerialize(): array
return $data;
}

private function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

private function setCurrencySign(null|string $currencySign): static
{
$this->fields['currencySign'] = $currencySign;
Expand Down
2 changes: 0 additions & 2 deletions src/Model/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ interface Plan extends JsonSerializable
{
public function getId(): ?string;

public function setId(null|string $id): static;

public function getName(): string;

public function setName(string $name): static;
Expand Down
24 changes: 12 additions & 12 deletions src/Model/SubscriptionPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ public function getId(): ?string
return $this->fields['id'] ?? null;
}

public function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

public function getName(): string
{
return $this->fields['name'];
Expand Down Expand Up @@ -253,14 +246,14 @@ public function getIsTrialOnly(): ?bool
return $this->fields['isTrialOnly'] ?? null;
}

public function getRecurringInterval(): SubscriptionPlanRecurringInterval
public function getRecurringInterval(): ?SubscriptionPlanRecurringInterval
{
return $this->fields['recurringInterval'];
return $this->fields['recurringInterval'] ?? null;
}

public function setRecurringInterval(SubscriptionPlanRecurringInterval|array $recurringInterval): static
public function setRecurringInterval(null|SubscriptionPlanRecurringInterval|array $recurringInterval): static
{
if (!($recurringInterval instanceof SubscriptionPlanRecurringInterval)) {
if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionPlanRecurringInterval)) {
$recurringInterval = SubscriptionPlanRecurringInterval::from($recurringInterval);
}

Expand Down Expand Up @@ -381,7 +374,7 @@ public function jsonSerialize(): array
$data['isTrialOnly'] = $this->fields['isTrialOnly'];
}
if (array_key_exists('recurringInterval', $this->fields)) {
$data['recurringInterval'] = $this->fields['recurringInterval']->jsonSerialize();
$data['recurringInterval'] = $this->fields['recurringInterval']?->jsonSerialize();
}
if (array_key_exists('trial', $this->fields)) {
$data['trial'] = $this->fields['trial']?->jsonSerialize();
Expand Down Expand Up @@ -410,6 +403,13 @@ public function jsonSerialize(): array
return $data;
}

private function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

private function setCurrencySign(null|string $currencySign): static
{
$this->fields['currencySign'] = $currencySign;
Expand Down
12 changes: 6 additions & 6 deletions src/Model/SubscriptionPlanRecurringInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ public function setPeriodAnchorInstruction(null|ServicePeriodAnchorInstruction|a
return $this;
}

public function getUnit(): ?string
public function getUnit(): string
{
return $this->fields['unit'] ?? null;
return $this->fields['unit'];
}

public function setUnit(null|string $unit): static
public function setUnit(string $unit): static
{
$this->fields['unit'] = $unit;

return $this;
}

public function getLength(): ?int
public function getLength(): int
{
return $this->fields['length'] ?? null;
return $this->fields['length'];
}

public function setLength(null|int $length): static
public function setLength(int $length): static
{
$this->fields['length'] = $length;

Expand Down
14 changes: 7 additions & 7 deletions src/Model/TrialOnlyPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ public function getId(): ?string
return $this->fields['id'] ?? null;
}

public function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

public function getName(): string
{
return $this->fields['name'];
Expand Down Expand Up @@ -344,6 +337,13 @@ public function jsonSerialize(): array
return $data;
}

private function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

private function setCurrencySign(null|string $currencySign): static
{
$this->fields['currencySign'] = $currencySign;
Expand Down

0 comments on commit db1c395

Please sign in to comment.