Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 89 additions & 23 deletions generated/Model/ActivityMetric.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];

/**
Expand All @@ -72,7 +73,8 @@ class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable
protected static $openAPIFormats = [
'label' => null,
'value' => null,
'unit' => null
'unit' => null,
'color' => null
];

/**
Expand All @@ -83,7 +85,8 @@ class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable
protected static array $openAPINullables = [
'label' => false,
'value' => false,
'unit' => false
'unit' => false,
'color' => false
];

/**
Expand Down Expand Up @@ -174,7 +177,8 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'label' => 'label',
'value' => 'value',
'unit' => 'unit'
'unit' => 'unit',
'color' => 'color'
];

/**
Expand All @@ -185,7 +189,8 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'label' => 'setLabel',
'value' => 'setValue',
'unit' => 'setUnit'
'unit' => 'setUnit',
'color' => 'setColor'
];

/**
Expand All @@ -196,7 +201,8 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'label' => 'getLabel',
'value' => 'getValue',
'unit' => 'getUnit'
'unit' => 'getUnit',
'color' => 'getColor'
];

/**
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -356,7 +393,7 @@ public function setLabel($label)
/**
* Gets value
*
* @return float
* @return \ActivitySmith\Generated\Model\ActivityMetricValue
*/
public function getValue()
{
Expand All @@ -366,7 +403,7 @@ public function getValue()
/**
* Sets value
*
* @param float $value value
* @param \ActivitySmith\Generated\Model\ActivityMetricValue $value value
*
* @return self
*/
Expand All @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down
Loading