diff --git a/generated/Api/LiveActivitiesApi.php b/generated/Api/LiveActivitiesApi.php index fe26edd..5d56f84 100644 --- a/generated/Api/LiveActivitiesApi.php +++ b/generated/Api/LiveActivitiesApi.php @@ -1435,7 +1435,7 @@ public function reconcileLiveActivityStreamRequest($streamKey, $liveActivityStre * * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \ActivitySmith\Generated\Model\LiveActivityStartResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\RateLimitError + * @return \ActivitySmith\Generated\Model\LiveActivityStartResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response */ public function startLiveActivity($liveActivityStartRequest, string $contentType = self::contentTypes['startLiveActivity'][0]) { @@ -1453,7 +1453,7 @@ public function startLiveActivity($liveActivityStartRequest, string $contentType * * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \ActivitySmith\Generated\Model\LiveActivityStartResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) + * @return array of \ActivitySmith\Generated\Model\LiveActivityStartResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response, HTTP status code, HTTP response headers (array of strings) */ public function startLiveActivityWithHttpInfo($liveActivityStartRequest, string $contentType = self::contentTypes['startLiveActivity'][0]) { @@ -1604,11 +1604,11 @@ public function startLiveActivityWithHttpInfo($liveActivityStartRequest, string $response->getHeaders() ]; case 429: - if ('\ActivitySmith\Generated\Model\RateLimitError' === '\SplFileObject') { + if ('\ActivitySmith\Generated\Model\SendPushNotification429Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ActivitySmith\Generated\Model\RateLimitError' !== 'string') { + if ('\ActivitySmith\Generated\Model\SendPushNotification429Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1626,7 +1626,7 @@ public function startLiveActivityWithHttpInfo($liveActivityStartRequest, string } return [ - ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\SendPushNotification429Response', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1697,7 +1697,7 @@ public function startLiveActivityWithHttpInfo($liveActivityStartRequest, string case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ActivitySmith\Generated\Model\RateLimitError', + '\ActivitySmith\Generated\Model\SendPushNotification429Response', $e->getResponseHeaders() ); $e->setResponseObject($data); diff --git a/generated/Api/MetricsApi.php b/generated/Api/MetricsApi.php new file mode 100644 index 0000000..5ece8b7 --- /dev/null +++ b/generated/Api/MetricsApi.php @@ -0,0 +1,587 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation updateMetricValue + * + * Update a widget metric value + * + * @param string $key Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required) + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequest $metricValueUpdateRequest metricValueUpdateRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateMetricValue'] to see the possible values for this operation + * + * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \ActivitySmith\Generated\Model\MetricValueUpdateResponse|\ActivitySmith\Generated\Model\MetricError|\ActivitySmith\Generated\Model\MetricError|\ActivitySmith\Generated\Model\RateLimitError + */ + public function updateMetricValue($key, $metricValueUpdateRequest, string $contentType = self::contentTypes['updateMetricValue'][0]) + { + list($response) = $this->updateMetricValueWithHttpInfo($key, $metricValueUpdateRequest, $contentType); + return $response; + } + + /** + * Operation updateMetricValueWithHttpInfo + * + * Update a widget metric value + * + * @param string $key Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required) + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequest $metricValueUpdateRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateMetricValue'] to see the possible values for this operation + * + * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \ActivitySmith\Generated\Model\MetricValueUpdateResponse|\ActivitySmith\Generated\Model\MetricError|\ActivitySmith\Generated\Model\MetricError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) + */ + public function updateMetricValueWithHttpInfo($key, $metricValueUpdateRequest, string $contentType = self::contentTypes['updateMetricValue'][0]) + { + $request = $this->updateMetricValueRequest($key, $metricValueUpdateRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\ActivitySmith\Generated\Model\MetricValueUpdateResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\MetricValueUpdateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\MetricValueUpdateResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\ActivitySmith\Generated\Model\MetricError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\MetricError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\MetricError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\ActivitySmith\Generated\Model\MetricError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\MetricError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\MetricError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\ActivitySmith\Generated\Model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\RateLimitError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\ActivitySmith\Generated\Model\MetricValueUpdateResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\MetricValueUpdateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\MetricError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\MetricError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateMetricValueAsync + * + * Update a widget metric value + * + * @param string $key Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required) + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequest $metricValueUpdateRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateMetricValue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateMetricValueAsync($key, $metricValueUpdateRequest, string $contentType = self::contentTypes['updateMetricValue'][0]) + { + return $this->updateMetricValueAsyncWithHttpInfo($key, $metricValueUpdateRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateMetricValueAsyncWithHttpInfo + * + * Update a widget metric value + * + * @param string $key Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required) + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequest $metricValueUpdateRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateMetricValue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateMetricValueAsyncWithHttpInfo($key, $metricValueUpdateRequest, string $contentType = self::contentTypes['updateMetricValue'][0]) + { + $returnType = '\ActivitySmith\Generated\Model\MetricValueUpdateResponse'; + $request = $this->updateMetricValueRequest($key, $metricValueUpdateRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateMetricValue' + * + * @param string $key Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required) + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequest $metricValueUpdateRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateMetricValue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateMetricValueRequest($key, $metricValueUpdateRequest, string $contentType = self::contentTypes['updateMetricValue'][0]) + { + + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling updateMetricValue' + ); + } + if (strlen($key) > 64) { + throw new \InvalidArgumentException('invalid length for "$key" when calling MetricsApi.updateMetricValue, must be smaller than or equal to 64.'); + } + if (strlen($key) < 1) { + throw new \InvalidArgumentException('invalid length for "$key" when calling MetricsApi.updateMetricValue, must be bigger than or equal to 1.'); + } + if (!preg_match("/^[a-z0-9][a-z0-9_.-]{0,63}$/", $key)) { + throw new \InvalidArgumentException("invalid value for \"key\" when calling MetricsApi.updateMetricValue, must conform to the pattern /^[a-z0-9][a-z0-9_.-]{0,63}$/."); + } + + // verify the required parameter 'metricValueUpdateRequest' is set + if ($metricValueUpdateRequest === null || (is_array($metricValueUpdateRequest) && count($metricValueUpdateRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $metricValueUpdateRequest when calling updateMetricValue' + ); + } + + + $resourcePath = '/metrics/{key}/value'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($metricValueUpdateRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($metricValueUpdateRequest)); + } else { + $httpBody = $metricValueUpdateRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer (API Key) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/generated/Configuration.php b/generated/Configuration.php index ef29e0f..d12bcb4 100644 --- a/generated/Configuration.php +++ b/generated/Configuration.php @@ -100,7 +100,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.0.0/PHP'; + protected $userAgent = 'OpenAPI-Generator/1.1.0/PHP'; /** * Debug switch (default set to false) @@ -433,7 +433,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 1.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.1.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/generated/Model/ContentStateEnd.php b/generated/Model/ContentStateEnd.php index adfe931..12c9cb6 100644 --- a/generated/Model/ContentStateEnd.php +++ b/generated/Model/ContentStateEnd.php @@ -35,7 +35,7 @@ * ContentStateEnd Class Doc Comment * * @category Class - * @description End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. + * @description End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -304,9 +304,6 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; public const TYPE_METRICS = 'metrics'; - public const TYPE_COUNTER = 'counter'; - public const TYPE_TIMER = 'timer'; - public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -346,9 +343,6 @@ public function getTypeAllowableValues() self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, self::TYPE_METRICS, - self::TYPE_COUNTER, - self::TYPE_TIMER, - self::TYPE_COUNTDOWN, ]; } diff --git a/generated/Model/ContentStateStart.php b/generated/Model/ContentStateStart.php index 1080b91..f4a5fdf 100644 --- a/generated/Model/ContentStateStart.php +++ b/generated/Model/ContentStateStart.php @@ -35,7 +35,7 @@ * ContentStateStart Class Doc Comment * * @category Class - * @description Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. + * @description Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -298,9 +298,6 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; public const TYPE_METRICS = 'metrics'; - public const TYPE_COUNTER = 'counter'; - public const TYPE_TIMER = 'timer'; - public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -340,9 +337,6 @@ public function getTypeAllowableValues() self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, self::TYPE_METRICS, - self::TYPE_COUNTER, - self::TYPE_TIMER, - self::TYPE_COUNTDOWN, ]; } diff --git a/generated/Model/ContentStateUpdate.php b/generated/Model/ContentStateUpdate.php index 6ddf1d2..0d460ec 100644 --- a/generated/Model/ContentStateUpdate.php +++ b/generated/Model/ContentStateUpdate.php @@ -35,7 +35,7 @@ * ContentStateUpdate Class Doc Comment * * @category Class - * @description Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. + * @description Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -298,9 +298,6 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; public const TYPE_METRICS = 'metrics'; - public const TYPE_COUNTER = 'counter'; - public const TYPE_TIMER = 'timer'; - public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -340,9 +337,6 @@ public function getTypeAllowableValues() self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, self::TYPE_METRICS, - self::TYPE_COUNTER, - self::TYPE_TIMER, - self::TYPE_COUNTDOWN, ]; } diff --git a/generated/Model/MetricError.php b/generated/Model/MetricError.php new file mode 100644 index 0000000..b14b7dc --- /dev/null +++ b/generated/Model/MetricError.php @@ -0,0 +1,446 @@ + + */ +class MetricError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MetricError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'message' => false + ]; + + /** + * 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 = [ + 'error' => 'error', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'message' => 'getMessage' + ]; + + /** + * 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) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('message', $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 = []; + + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + 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; + } + + + /** + * Gets error + * + * @return string + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * 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)); + } +} + + diff --git a/generated/Model/MetricFormat.php b/generated/Model/MetricFormat.php new file mode 100644 index 0000000..00fb598 --- /dev/null +++ b/generated/Model/MetricFormat.php @@ -0,0 +1,71 @@ + + */ +class MetricValueUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MetricValueUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => '\ActivitySmith\Generated\Model\MetricValueUpdateRequestValue', + 'timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => false, + 'timestamp' => false + ]; + + /** + * 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 = [ + 'value' => 'value', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'timestamp' => 'getTimestamp' + ]; + + /** + * 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) + { + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $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 = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + 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; + } + + + /** + * Gets value + * + * @return \ActivitySmith\Generated\Model\MetricValueUpdateRequestValue + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param \ActivitySmith\Generated\Model\MetricValueUpdateRequestValue $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets timestamp + * + * @return \DateTime|null + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param \DateTime|null $timestamp Optional ISO timestamp for when the metric value was measured. Defaults to the server receive time. + * + * @return self + */ + public function setTimestamp($timestamp) + { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + /** + * 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)); + } +} + + diff --git a/generated/Model/MetricValueUpdateRequestValue.php b/generated/Model/MetricValueUpdateRequestValue.php new file mode 100644 index 0000000..66ca1ac --- /dev/null +++ b/generated/Model/MetricValueUpdateRequestValue.php @@ -0,0 +1,381 @@ + + */ +class MetricValueUpdateRequestValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MetricValueUpdateRequest_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)); + } +} + + diff --git a/generated/Model/MetricValueUpdateResponse.php b/generated/Model/MetricValueUpdateResponse.php new file mode 100644 index 0000000..d59af85 --- /dev/null +++ b/generated/Model/MetricValueUpdateResponse.php @@ -0,0 +1,412 @@ + + */ +class MetricValueUpdateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MetricValueUpdateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metric' => '\ActivitySmith\Generated\Model\WidgetMetric' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metric' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metric' => false + ]; + + /** + * 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 = [ + 'metric' => 'metric' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metric' => 'setMetric' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metric' => 'getMetric' + ]; + + /** + * 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) + { + $this->setIfExists('metric', $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 = []; + + if ($this->container['metric'] === null) { + $invalidProperties[] = "'metric' can't be null"; + } + 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; + } + + + /** + * Gets metric + * + * @return \ActivitySmith\Generated\Model\WidgetMetric + */ + public function getMetric() + { + return $this->container['metric']; + } + + /** + * Sets metric + * + * @param \ActivitySmith\Generated\Model\WidgetMetric $metric metric + * + * @return self + */ + public function setMetric($metric) + { + if (is_null($metric)) { + throw new \InvalidArgumentException('non-nullable metric cannot be null'); + } + $this->container['metric'] = $metric; + + return $this; + } + /** + * 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)); + } +} + + diff --git a/generated/Model/StreamContentState.php b/generated/Model/StreamContentState.php index 237bbbc..ec7bd87 100644 --- a/generated/Model/StreamContentState.php +++ b/generated/Model/StreamContentState.php @@ -35,7 +35,7 @@ * StreamContentState Class Doc Comment * * @category Class - * @description Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based types. + * @description Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, and metrics types. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -310,9 +310,6 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; public const TYPE_METRICS = 'metrics'; - public const TYPE_COUNTER = 'counter'; - public const TYPE_TIMER = 'timer'; - public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -352,9 +349,6 @@ public function getTypeAllowableValues() self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, self::TYPE_METRICS, - self::TYPE_COUNTER, - self::TYPE_TIMER, - self::TYPE_COUNTDOWN, ]; } @@ -616,7 +610,7 @@ public function getNumberOfSteps() /** * Sets numberOfSteps * - * @param int|null $numberOfSteps Use for segmented_progress, counter, timer, and countdown. + * @param int|null $numberOfSteps Use for segmented_progress. * * @return self */ @@ -648,7 +642,7 @@ public function getCurrentStep() /** * Sets currentStep * - * @param int|null $currentStep Use for segmented_progress, counter, timer, and countdown. + * @param int|null $currentStep Use for segmented_progress. * * @return self */ diff --git a/generated/Model/WidgetMetric.php b/generated/Model/WidgetMetric.php new file mode 100644 index 0000000..fca6f47 --- /dev/null +++ b/generated/Model/WidgetMetric.php @@ -0,0 +1,878 @@ + + */ +class WidgetMetric implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WidgetMetric'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'publicId' => 'string', + 'key' => 'string', + 'label' => 'string', + 'currencyCode' => 'string', + 'unit' => 'string', + 'unitSpacing' => '\ActivitySmith\Generated\Model\MetricUnitSpacing', + 'format' => '\ActivitySmith\Generated\Model\MetricFormat', + 'latestValue' => '\ActivitySmith\Generated\Model\WidgetMetricLatestValue', + 'latestValueAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'publicId' => null, + 'key' => null, + 'label' => null, + 'currencyCode' => null, + 'unit' => null, + 'unitSpacing' => null, + 'format' => null, + 'latestValue' => null, + 'latestValueAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'publicId' => false, + 'key' => false, + 'label' => false, + 'currencyCode' => true, + 'unit' => true, + 'unitSpacing' => false, + 'format' => false, + 'latestValue' => true, + 'latestValueAt' => true, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * 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 = [ + 'publicId' => 'public_id', + 'key' => 'key', + 'label' => 'label', + 'currencyCode' => 'currency_code', + 'unit' => 'unit', + 'unitSpacing' => 'unit_spacing', + 'format' => 'format', + 'latestValue' => 'latest_value', + 'latestValueAt' => 'latest_value_at', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'publicId' => 'setPublicId', + 'key' => 'setKey', + 'label' => 'setLabel', + 'currencyCode' => 'setCurrencyCode', + 'unit' => 'setUnit', + 'unitSpacing' => 'setUnitSpacing', + 'format' => 'setFormat', + 'latestValue' => 'setLatestValue', + 'latestValueAt' => 'setLatestValueAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'publicId' => 'getPublicId', + 'key' => 'getKey', + 'label' => 'getLabel', + 'currencyCode' => 'getCurrencyCode', + 'unit' => 'getUnit', + 'unitSpacing' => 'getUnitSpacing', + 'format' => 'getFormat', + 'latestValue' => 'getLatestValue', + 'latestValueAt' => 'getLatestValueAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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) + { + $this->setIfExists('publicId', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('currencyCode', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('unitSpacing', $data ?? [], null); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('latestValue', $data ?? [], null); + $this->setIfExists('latestValueAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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 = []; + + if ($this->container['publicId'] === null) { + $invalidProperties[] = "'publicId' can't be null"; + } + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + if ((mb_strlen($this->container['key']) > 64)) { + $invalidProperties[] = "invalid value for 'key', the character length must be smaller than or equal to 64."; + } + + if ((mb_strlen($this->container['key']) < 1)) { + $invalidProperties[] = "invalid value for 'key', the character length must be bigger than or equal to 1."; + } + + if (!preg_match("/^[a-z0-9][a-z0-9_.-]{0,63}$/", $this->container['key'])) { + $invalidProperties[] = "invalid value for 'key', must be conform to the pattern /^[a-z0-9][a-z0-9_.-]{0,63}$/."; + } + + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + if ((mb_strlen($this->container['label']) > 80)) { + $invalidProperties[] = "invalid value for 'label', the character length must be smaller than or equal to 80."; + } + + if ((mb_strlen($this->container['label']) < 1)) { + $invalidProperties[] = "invalid value for 'label', the character length must be bigger than or equal to 1."; + } + + if ($this->container['currencyCode'] === null) { + $invalidProperties[] = "'currencyCode' can't be null"; + } + if ((mb_strlen($this->container['currencyCode']) > 3)) { + $invalidProperties[] = "invalid value for 'currencyCode', the character length must be smaller than or equal to 3."; + } + + if ((mb_strlen($this->container['currencyCode']) < 3)) { + $invalidProperties[] = "invalid value for 'currencyCode', the character length must be bigger than or equal to 3."; + } + + if (!preg_match("/^[A-Z]{3}$/", $this->container['currencyCode'])) { + $invalidProperties[] = "invalid value for 'currencyCode', must be conform to the pattern /^[A-Z]{3}$/."; + } + + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + if ((mb_strlen($this->container['unit']) > 16)) { + $invalidProperties[] = "invalid value for 'unit', the character length must be smaller than or equal to 16."; + } + + if ($this->container['unitSpacing'] === null) { + $invalidProperties[] = "'unitSpacing' can't be null"; + } + if ($this->container['format'] === null) { + $invalidProperties[] = "'format' can't be null"; + } + if ($this->container['latestValue'] === null) { + $invalidProperties[] = "'latestValue' can't be null"; + } + if ($this->container['latestValueAt'] === null) { + $invalidProperties[] = "'latestValueAt' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + 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; + } + + + /** + * Gets publicId + * + * @return string + */ + public function getPublicId() + { + return $this->container['publicId']; + } + + /** + * Sets publicId + * + * @param string $publicId publicId + * + * @return self + */ + public function setPublicId($publicId) + { + if (is_null($publicId)) { + throw new \InvalidArgumentException('non-nullable publicId cannot be null'); + } + $this->container['publicId'] = $publicId; + + return $this; + } + + /** + * Gets key + * + * @return string + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + if ((mb_strlen($key) > 64)) { + throw new \InvalidArgumentException('invalid length for $key when calling WidgetMetric., must be smaller than or equal to 64.'); + } + if ((mb_strlen($key) < 1)) { + throw new \InvalidArgumentException('invalid length for $key when calling WidgetMetric., must be bigger than or equal to 1.'); + } + if ((!preg_match("/^[a-z0-9][a-z0-9_.-]{0,63}$/", ObjectSerializer::toString($key)))) { + throw new \InvalidArgumentException("invalid value for \$key when calling WidgetMetric., must conform to the pattern /^[a-z0-9][a-z0-9_.-]{0,63}$/."); + } + + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label label + * + * @return self + */ + public function setLabel($label) + { + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); + } + if ((mb_strlen($label) > 80)) { + throw new \InvalidArgumentException('invalid length for $label when calling WidgetMetric., must be smaller than or equal to 80.'); + } + if ((mb_strlen($label) < 1)) { + throw new \InvalidArgumentException('invalid length for $label when calling WidgetMetric., must be bigger than or equal to 1.'); + } + + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets currencyCode + * + * @return string + */ + public function getCurrencyCode() + { + return $this->container['currencyCode']; + } + + /** + * Sets currencyCode + * + * @param string $currencyCode Present when format is currency. + * + * @return self + */ + public function setCurrencyCode($currencyCode) + { + if (is_null($currencyCode)) { + array_push($this->openAPINullablesSetToNull, 'currencyCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currencyCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($currencyCode) && (mb_strlen($currencyCode) > 3)) { + throw new \InvalidArgumentException('invalid length for $currencyCode when calling WidgetMetric., must be smaller than or equal to 3.'); + } + if (!is_null($currencyCode) && (mb_strlen($currencyCode) < 3)) { + throw new \InvalidArgumentException('invalid length for $currencyCode when calling WidgetMetric., must be bigger than or equal to 3.'); + } + if (!is_null($currencyCode) && (!preg_match("/^[A-Z]{3}$/", ObjectSerializer::toString($currencyCode)))) { + throw new \InvalidArgumentException("invalid value for \$currencyCode when calling WidgetMetric., must conform to the pattern /^[A-Z]{3}$/."); + } + + $this->container['currencyCode'] = $currencyCode; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit Present when format is unit. + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + array_push($this->openAPINullablesSetToNull, 'unit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($unit) && (mb_strlen($unit) > 16)) { + throw new \InvalidArgumentException('invalid length for $unit when calling WidgetMetric., must be smaller than or equal to 16.'); + } + + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets unitSpacing + * + * @return \ActivitySmith\Generated\Model\MetricUnitSpacing + */ + public function getUnitSpacing() + { + return $this->container['unitSpacing']; + } + + /** + * Sets unitSpacing + * + * @param \ActivitySmith\Generated\Model\MetricUnitSpacing $unitSpacing unitSpacing + * + * @return self + */ + public function setUnitSpacing($unitSpacing) + { + if (is_null($unitSpacing)) { + throw new \InvalidArgumentException('non-nullable unitSpacing cannot be null'); + } + $this->container['unitSpacing'] = $unitSpacing; + + return $this; + } + + /** + * Gets format + * + * @return \ActivitySmith\Generated\Model\MetricFormat + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param \ActivitySmith\Generated\Model\MetricFormat $format format + * + * @return self + */ + public function setFormat($format) + { + if (is_null($format)) { + throw new \InvalidArgumentException('non-nullable format cannot be null'); + } + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets latestValue + * + * @return \ActivitySmith\Generated\Model\WidgetMetricLatestValue + */ + public function getLatestValue() + { + return $this->container['latestValue']; + } + + /** + * Sets latestValue + * + * @param \ActivitySmith\Generated\Model\WidgetMetricLatestValue $latestValue latestValue + * + * @return self + */ + public function setLatestValue($latestValue) + { + if (is_null($latestValue)) { + array_push($this->openAPINullablesSetToNull, 'latestValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('latestValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['latestValue'] = $latestValue; + + return $this; + } + + /** + * Gets latestValueAt + * + * @return \DateTime + */ + public function getLatestValueAt() + { + return $this->container['latestValueAt']; + } + + /** + * Sets latestValueAt + * + * @param \DateTime $latestValueAt latestValueAt + * + * @return self + */ + public function setLatestValueAt($latestValueAt) + { + if (is_null($latestValueAt)) { + array_push($this->openAPINullablesSetToNull, 'latestValueAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('latestValueAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['latestValueAt'] = $latestValueAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + /** + * 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)); + } +} + + diff --git a/generated/Model/WidgetMetricLatestValue.php b/generated/Model/WidgetMetricLatestValue.php new file mode 100644 index 0000000..fae9c56 --- /dev/null +++ b/generated/Model/WidgetMetricLatestValue.php @@ -0,0 +1,382 @@ + + */ +class WidgetMetricLatestValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WidgetMetric_latest_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)); + } +} + +