Skip to content

Commit

Permalink
update SDK from api-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
rebilly-machine-user authored Oct 25, 2023
1 parent 95687ba commit 5da21f3
Show file tree
Hide file tree
Showing 17 changed files with 1,096 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-news-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add dispute type Rebilly/api-definitions#1646
51 changes: 51 additions & 0 deletions src/Model/CouponRestrictionDiscountPerRedemption.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

class CouponRestrictionDiscountPerRedemption implements CouponRestriction, RedemptionRestriction, JsonSerializable
{
public const REQUIRE_ALL_TAGS_TRUE = 'true';

public const REQUIRE_ALL_TAGS_FALSE = 'false';

private array $fields = [];

public function __construct(array $data = [])
Expand All @@ -38,6 +42,9 @@ public function __construct(array $data = [])
if (array_key_exists('countries', $data)) {
$this->setCountries($data['countries']);
}
if (array_key_exists('tags', $data)) {
$this->setTags($data['tags']);
}
if (array_key_exists('productIds', $data)) {
$this->setProductIds($data['productIds']);
}
Expand All @@ -56,6 +63,9 @@ public function __construct(array $data = [])
if (array_key_exists('time', $data)) {
$this->setTime($data['time']);
}
if (array_key_exists('requireAllTags', $data)) {
$this->setRequireAllTags($data['requireAllTags']);
}
if (array_key_exists('minimumQuantity', $data)) {
$this->setMinimumQuantity($data['minimumQuantity']);
}
Expand Down Expand Up @@ -167,6 +177,29 @@ public function setCountries(array $countries): static
return $this;
}

/**
* @return string[]
*/
public function getTags(): array
{
return $this->fields['tags'];
}

/**
* @param string[] $tags
*/
public function setTags(array $tags): static
{
$tags = array_map(
fn ($value) => $value,
$tags,
);

$this->fields['tags'] = $tags;

return $this;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -287,6 +320,18 @@ public function setTime(DateTimeImmutable|string $time): static
return $this;
}

public function getRequireAllTags(): string
{
return $this->fields['requireAllTags'];
}

public function setRequireAllTags(string $requireAllTags): static
{
$this->fields['requireAllTags'] = $requireAllTags;

return $this;
}

public function getMinimumQuantity(): ?int
{
return $this->fields['minimumQuantity'] ?? null;
Expand Down Expand Up @@ -342,6 +387,9 @@ public function jsonSerialize(): array
if (array_key_exists('countries', $this->fields)) {
$data['countries'] = $this->fields['countries'];
}
if (array_key_exists('tags', $this->fields)) {
$data['tags'] = $this->fields['tags'];
}
if (array_key_exists('productIds', $this->fields)) {
$data['productIds'] = $this->fields['productIds'];
}
Expand All @@ -360,6 +408,9 @@ public function jsonSerialize(): array
if (array_key_exists('time', $this->fields)) {
$data['time'] = $this->fields['time']?->format(DateTimeInterface::RFC3339);
}
if (array_key_exists('requireAllTags', $this->fields)) {
$data['requireAllTags'] = $this->fields['requireAllTags'];
}
if (array_key_exists('minimumQuantity', $this->fields)) {
$data['minimumQuantity'] = $this->fields['minimumQuantity'];
}
Expand Down
51 changes: 51 additions & 0 deletions src/Model/CouponRestrictionExclusiveApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

class CouponRestrictionExclusiveApplication implements CouponRestriction, JsonSerializable
{
public const REQUIRE_ALL_TAGS_TRUE = 'true';

public const REQUIRE_ALL_TAGS_FALSE = 'false';

private array $fields = [];

public function __construct(array $data = [])
Expand All @@ -38,6 +42,9 @@ public function __construct(array $data = [])
if (array_key_exists('countries', $data)) {
$this->setCountries($data['countries']);
}
if (array_key_exists('tags', $data)) {
$this->setTags($data['tags']);
}
if (array_key_exists('productIds', $data)) {
$this->setProductIds($data['productIds']);
}
Expand All @@ -56,6 +63,9 @@ public function __construct(array $data = [])
if (array_key_exists('time', $data)) {
$this->setTime($data['time']);
}
if (array_key_exists('requireAllTags', $data)) {
$this->setRequireAllTags($data['requireAllTags']);
}
if (array_key_exists('minimumQuantity', $data)) {
$this->setMinimumQuantity($data['minimumQuantity']);
}
Expand Down Expand Up @@ -167,6 +177,29 @@ public function setCountries(array $countries): static
return $this;
}

/**
* @return string[]
*/
public function getTags(): array
{
return $this->fields['tags'];
}

/**
* @param string[] $tags
*/
public function setTags(array $tags): static
{
$tags = array_map(
fn ($value) => $value,
$tags,
);

$this->fields['tags'] = $tags;

return $this;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -287,6 +320,18 @@ public function setTime(DateTimeImmutable|string $time): static
return $this;
}

public function getRequireAllTags(): string
{
return $this->fields['requireAllTags'];
}

public function setRequireAllTags(string $requireAllTags): static
{
$this->fields['requireAllTags'] = $requireAllTags;

return $this;
}

public function getMinimumQuantity(): ?int
{
return $this->fields['minimumQuantity'] ?? null;
Expand Down Expand Up @@ -342,6 +387,9 @@ public function jsonSerialize(): array
if (array_key_exists('countries', $this->fields)) {
$data['countries'] = $this->fields['countries'];
}
if (array_key_exists('tags', $this->fields)) {
$data['tags'] = $this->fields['tags'];
}
if (array_key_exists('productIds', $this->fields)) {
$data['productIds'] = $this->fields['productIds'];
}
Expand All @@ -360,6 +408,9 @@ public function jsonSerialize(): array
if (array_key_exists('time', $this->fields)) {
$data['time'] = $this->fields['time']?->format(DateTimeInterface::RFC3339);
}
if (array_key_exists('requireAllTags', $this->fields)) {
$data['requireAllTags'] = $this->fields['requireAllTags'];
}
if (array_key_exists('minimumQuantity', $this->fields)) {
$data['minimumQuantity'] = $this->fields['minimumQuantity'];
}
Expand Down
1 change: 1 addition & 0 deletions src/Model/CouponRestrictionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function from(array $data = []): CouponRestriction
'redemptions-per-customer' => CouponRestrictionRedemptionsPerCustomer::from($data),
'restrict-to-bxgy' => CouponRestrictionRestrictToBxgy::from($data),
'restrict-to-countries' => CouponRestrictionRestrictToCountries::from($data),
'restrict-to-customer-tags' => CouponRestrictionRestrictToCustomerTags::from($data),
'restrict-to-customers' => CouponRestrictionRestrictToCustomers::from($data),
'restrict-to-exclusive-application' => CouponRestrictionExclusiveApplication::from($data),
'restrict-to-invoices' => CouponRestrictionRestrictToInvoices::from($data),
Expand Down
51 changes: 51 additions & 0 deletions src/Model/CouponRestrictionMinimumOrderAmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

class CouponRestrictionMinimumOrderAmount implements CouponRestriction, RedemptionRestriction, JsonSerializable
{
public const REQUIRE_ALL_TAGS_TRUE = 'true';

public const REQUIRE_ALL_TAGS_FALSE = 'false';

private array $fields = [];

public function __construct(array $data = [])
Expand All @@ -41,6 +45,9 @@ public function __construct(array $data = [])
if (array_key_exists('countries', $data)) {
$this->setCountries($data['countries']);
}
if (array_key_exists('tags', $data)) {
$this->setTags($data['tags']);
}
if (array_key_exists('productIds', $data)) {
$this->setProductIds($data['productIds']);
}
Expand All @@ -56,6 +63,9 @@ public function __construct(array $data = [])
if (array_key_exists('time', $data)) {
$this->setTime($data['time']);
}
if (array_key_exists('requireAllTags', $data)) {
$this->setRequireAllTags($data['requireAllTags']);
}
if (array_key_exists('minimumQuantity', $data)) {
$this->setMinimumQuantity($data['minimumQuantity']);
}
Expand Down Expand Up @@ -179,6 +189,29 @@ public function setCountries(array $countries): static
return $this;
}

/**
* @return string[]
*/
public function getTags(): array
{
return $this->fields['tags'];
}

/**
* @param string[] $tags
*/
public function setTags(array $tags): static
{
$tags = array_map(
fn ($value) => $value,
$tags,
);

$this->fields['tags'] = $tags;

return $this;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -287,6 +320,18 @@ public function setTime(DateTimeImmutable|string $time): static
return $this;
}

public function getRequireAllTags(): string
{
return $this->fields['requireAllTags'];
}

public function setRequireAllTags(string $requireAllTags): static
{
$this->fields['requireAllTags'] = $requireAllTags;

return $this;
}

public function getMinimumQuantity(): ?int
{
return $this->fields['minimumQuantity'] ?? null;
Expand Down Expand Up @@ -345,6 +390,9 @@ public function jsonSerialize(): array
if (array_key_exists('countries', $this->fields)) {
$data['countries'] = $this->fields['countries'];
}
if (array_key_exists('tags', $this->fields)) {
$data['tags'] = $this->fields['tags'];
}
if (array_key_exists('productIds', $this->fields)) {
$data['productIds'] = $this->fields['productIds'];
}
Expand All @@ -360,6 +408,9 @@ public function jsonSerialize(): array
if (array_key_exists('time', $this->fields)) {
$data['time'] = $this->fields['time']?->format(DateTimeInterface::RFC3339);
}
if (array_key_exists('requireAllTags', $this->fields)) {
$data['requireAllTags'] = $this->fields['requireAllTags'];
}
if (array_key_exists('minimumQuantity', $this->fields)) {
$data['minimumQuantity'] = $this->fields['minimumQuantity'];
}
Expand Down
Loading

0 comments on commit 5da21f3

Please sign in to comment.