From 3d429416b52878e64e0b655b3faf1ce4fee77dc7 Mon Sep 17 00:00:00 2001 From: activitysmith-bot Date: Sat, 9 May 2026 12:15:16 +0000 Subject: [PATCH] chore: regenerate SDK --- generated/Model/ActivityMetric.php | 112 +++++-- generated/Model/ActivityMetricValue.php | 381 ++++++++++++++++++++++++ 2 files changed, 470 insertions(+), 23 deletions(-) create mode 100644 generated/Model/ActivityMetricValue.php diff --git a/generated/Model/ActivityMetric.php b/generated/Model/ActivityMetric.php index cb2b665..1d8c1c6 100644 --- a/generated/Model/ActivityMetric.php +++ b/generated/Model/ActivityMetric.php @@ -58,8 +58,9 @@ class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'label' => 'string', - 'value' => 'float', - 'unit' => 'string' + 'value' => '\ActivitySmith\Generated\Model\ActivityMetricValue', + 'unit' => 'string', + 'color' => 'string' ]; /** @@ -72,7 +73,8 @@ class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'label' => null, 'value' => null, - 'unit' => null + 'unit' => null, + 'color' => null ]; /** @@ -83,7 +85,8 @@ class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'label' => false, 'value' => false, - 'unit' => false + 'unit' => false, + 'color' => false ]; /** @@ -174,7 +177,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'label' => 'label', 'value' => 'value', - 'unit' => 'unit' + 'unit' => 'unit', + 'color' => 'color' ]; /** @@ -185,7 +189,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'label' => 'setLabel', 'value' => 'setValue', - 'unit' => 'setUnit' + 'unit' => 'setUnit', + 'color' => 'setColor' ]; /** @@ -196,7 +201,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'label' => 'getLabel', 'value' => 'getValue', - 'unit' => 'getUnit' + 'unit' => 'getUnit', + 'color' => 'getColor' ]; /** @@ -240,6 +246,35 @@ public function getModelName() return self::$openAPIModelName; } + public const COLOR_LIME = 'lime'; + public const COLOR_GREEN = 'green'; + public const COLOR_CYAN = 'cyan'; + public const COLOR_BLUE = 'blue'; + public const COLOR_PURPLE = 'purple'; + public const COLOR_MAGENTA = 'magenta'; + public const COLOR_RED = 'red'; + public const COLOR_ORANGE = 'orange'; + public const COLOR_YELLOW = 'yellow'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getColorAllowableValues() + { + return [ + self::COLOR_LIME, + self::COLOR_GREEN, + self::COLOR_CYAN, + self::COLOR_BLUE, + self::COLOR_PURPLE, + self::COLOR_MAGENTA, + self::COLOR_RED, + self::COLOR_ORANGE, + self::COLOR_YELLOW, + ]; + } /** * Associative array for storing property values @@ -259,6 +294,7 @@ public function __construct(array $data = null) $this->setIfExists('label', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('color', $data ?? [], null); } /** @@ -298,12 +334,13 @@ public function listInvalidProperties() if ($this->container['value'] === null) { $invalidProperties[] = "'value' can't be null"; } - if (($this->container['value'] > 100)) { - $invalidProperties[] = "invalid value for 'value', must be smaller than or equal to 100."; - } - - if (($this->container['value'] < 0)) { - $invalidProperties[] = "invalid value for 'value', must be bigger than or equal to 0."; + $allowedValues = $this->getColorAllowableValues(); + if (!is_null($this->container['color']) && !in_array($this->container['color'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'color', must be one of '%s'", + $this->container['color'], + implode("', '", $allowedValues) + ); } return $invalidProperties; @@ -356,7 +393,7 @@ public function setLabel($label) /** * Gets value * - * @return float + * @return \ActivitySmith\Generated\Model\ActivityMetricValue */ public function getValue() { @@ -366,7 +403,7 @@ public function getValue() /** * Sets value * - * @param float $value value + * @param \ActivitySmith\Generated\Model\ActivityMetricValue $value value * * @return self */ @@ -375,14 +412,6 @@ public function setValue($value) if (is_null($value)) { throw new \InvalidArgumentException('non-nullable value cannot be null'); } - - if (($value > 100)) { - throw new \InvalidArgumentException('invalid value for $value when calling ActivityMetric., must be smaller than or equal to 100.'); - } - if (($value < 0)) { - throw new \InvalidArgumentException('invalid value for $value when calling ActivityMetric., must be bigger than or equal to 0.'); - } - $this->container['value'] = $value; return $this; @@ -414,6 +443,43 @@ public function setUnit($unit) return $this; } + + /** + * Gets color + * + * @return string|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string|null $color Optional per-metric accent color for metrics and stats activities. + * + * @return self + */ + public function setColor($color) + { + if (is_null($color)) { + throw new \InvalidArgumentException('non-nullable color cannot be null'); + } + $allowedValues = $this->getColorAllowableValues(); + if (!in_array($color, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'color', must be one of '%s'", + $color, + implode("', '", $allowedValues) + ) + ); + } + $this->container['color'] = $color; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/ActivityMetricValue.php b/generated/Model/ActivityMetricValue.php new file mode 100644 index 0000000..17a74be --- /dev/null +++ b/generated/Model/ActivityMetricValue.php @@ -0,0 +1,381 @@ + + */ +class ActivityMetricValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ActivityMetric_value'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + +