Skip to content

Commit

Permalink
Make all enum types instantiable (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Jul 25, 2022
1 parent f548062 commit c63ffc6
Show file tree
Hide file tree
Showing 72 changed files with 1,493 additions and 2 deletions.
21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/AsinBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class AsinBadge
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -60,6 +62,25 @@ public static function getAllowableEnumValues()
self::CONTENT_PUBLISHED,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'AsinBadge', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/ColorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class ColorType
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -56,6 +58,25 @@ public static function getAllowableEnumValues()
self::LIGHT,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'ColorType', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/ContentBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class ContentBadge
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -62,6 +64,25 @@ public static function getAllowableEnumValues()
self::STANDARD,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'ContentBadge', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/ContentModuleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class ContentModuleType
{
public $value;

/**
* Possible values of this enum
*/
Expand Down Expand Up @@ -82,6 +84,25 @@ public static function getAllowableEnumValues()
self::THREE_IMAGE_TEXT,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'ContentModuleType', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/ContentStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class ContentStatus
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -60,6 +62,25 @@ public static function getAllowableEnumValues()
self::SUBMITTED,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'ContentStatus', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class ContentType
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -56,6 +58,25 @@ public static function getAllowableEnumValues()
self::EMC,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'ContentType', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/DecoratorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class DecoratorType
{
public $value;

/**
* Possible values of this enum
*/
Expand Down Expand Up @@ -68,6 +70,25 @@ public static function getAllowableEnumValues()
self::STYLE_UNDERLINE,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'DecoratorType', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/AplusContentV20201101/PositionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class PositionType
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -56,6 +58,25 @@ public static function getAllowableEnumValues()
self::RIGHT,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'PositionType', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/EasyShipV20220323/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class Code
{
public $value;

/**
* Possible values of this enum
*/
Expand Down Expand Up @@ -74,6 +76,25 @@ public static function getAllowableEnumValues()
self::INTERNAL_SERVER_ERROR,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'Code', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/EasyShipV20220323/HandoverMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class HandoverMethod
{
public $value;

/**
* Possible values of this enum
*/
Expand All @@ -56,6 +58,25 @@ public static function getAllowableEnumValues()
self::DROPOFF,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'HandoverMethod', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


21 changes: 21 additions & 0 deletions lib/Model/EasyShipV20220323/PackageStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class PackageStatus
{
public $value;

/**
* Possible values of this enum
*/
Expand Down Expand Up @@ -76,6 +78,25 @@ public static function getAllowableEnumValues()
self::OUT_FOR_DELIVERY,
];
}

public function __construct($value)
{
if (is_null($value) || !in_array($value, self::getAllowableEnumValues())) {
throw new \InvalidArgumentException(sprintf("Invalid value for enum 'PackageStatus', must be one of '%s'", implode("', '", self::getAllowableEnumValues())));
}

$this->value = $value;
}

/**
* Convert the enum value to a string.
*
* @return string
*/
public function __toString()
{
return $this->value;
}
}


Loading

0 comments on commit c63ffc6

Please sign in to comment.