From aceb42159b668a5fd5385e5df284c4b196f6de00 Mon Sep 17 00:00:00 2001 From: activitysmith-bot Date: Sun, 20 Sep 2026 05:20:29 +0000 Subject: [PATCH 1/2] chore: regenerate SDK --- generated/Api/AppIconBadgesApi.php | 28 +- generated/Model/ContentStateEnd.php | 16 +- generated/Model/ContentStateStart.php | 16 +- generated/Model/ContentStateUpdate.php | 16 +- generated/Model/LiveActivityAction.php | 2 +- generated/Model/LiveActivityEndRequest.php | 2 +- generated/Model/LiveActivityStartRequest.php | 2 +- .../Model/LiveActivityStreamDeleteRequest.php | 2 +- generated/Model/LiveActivityStreamRequest.php | 2 +- generated/Model/LiveActivityUpdateRequest.php | 2 +- generated/Model/LiveActivityValue.php | 382 ++++++++++++++++++ generated/Model/RateLimitError.php | 66 +++ .../Model/SendPushNotification429Response.php | 66 +++ generated/Model/StreamContentState.php | 16 +- generated/openapi-source.json | 4 +- 15 files changed, 572 insertions(+), 50 deletions(-) create mode 100644 generated/Model/LiveActivityValue.php diff --git a/generated/Api/AppIconBadgesApi.php b/generated/Api/AppIconBadgesApi.php index b49ac20..2297269 100644 --- a/generated/Api/AppIconBadgesApi.php +++ b/generated/Api/AppIconBadgesApi.php @@ -132,7 +132,7 @@ public function getConfig() * * @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\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError|\ActivitySmith\Generated\Model\RateLimitError + * @return \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\RateLimitError|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError */ public function updateAppIconBadgeCount($appIconBadgeCountUpdateRequest, string $contentType = self::contentTypes['updateAppIconBadgeCount'][0]) { @@ -150,7 +150,7 @@ public function updateAppIconBadgeCount($appIconBadgeCountUpdateRequest, string * * @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\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) + * @return array of \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\RateLimitError|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError, HTTP status code, HTTP response headers (array of strings) */ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequest, string $contentType = self::contentTypes['updateAppIconBadgeCount'][0]) { @@ -300,12 +300,12 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ $response->getStatusCode(), $response->getHeaders() ]; - case 502: - if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' === '\SplFileObject') { + case 429: + if ('\ActivitySmith\Generated\Model\RateLimitError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' !== 'string') { + if ('\ActivitySmith\Generated\Model\RateLimitError' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -323,16 +323,16 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ } return [ - ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', []), + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\RateLimitError', []), $response->getStatusCode(), $response->getHeaders() ]; - case 429: - if ('\ActivitySmith\Generated\Model\RateLimitError' === '\SplFileObject') { + case 502: + if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ActivitySmith\Generated\Model\RateLimitError' !== 'string') { + if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -350,7 +350,7 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ } return [ - ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -418,18 +418,18 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ ); $e->setResponseObject($data); break; - case 502: + case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', + '\ActivitySmith\Generated\Model\RateLimitError', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 429: + case 502: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ActivitySmith\Generated\Model\RateLimitError', + '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', $e->getResponseHeaders() ); $e->setResponseObject($data); diff --git a/generated/Model/ContentStateEnd.php b/generated/Model/ContentStateEnd.php index e3ecb53..6e5717e 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 and stats include a non-empty metrics array. For alert include message. For timer, omit duration_seconds to preserve and freeze the latest timer state. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. 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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer, omit duration_seconds to preserve and freeze the latest timer state. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. 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 @@ -63,7 +63,7 @@ class ContentStateEnd implements ModelInterface, ArrayAccess, \JsonSerializable 'numberOfSteps' => 'int', 'currentStep' => 'int', 'percentage' => 'float', - 'value' => 'float', + 'value' => '\ActivitySmith\Generated\Model\LiveActivityValue', 'upperLimit' => 'float', 'durationSeconds' => 'float', 'countsDown' => 'bool', @@ -343,6 +343,7 @@ public function getModelName() public const TYPE_STATS = 'stats'; public const TYPE_ALERT = 'alert'; public const TYPE_TIMER = 'timer'; + public const TYPE_VALUE = 'value'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -388,6 +389,7 @@ public function getTypeAllowableValues() self::TYPE_STATS, self::TYPE_ALERT, self::TYPE_TIMER, + self::TYPE_VALUE, ]; } @@ -750,7 +752,7 @@ public function setPercentage($percentage) /** * Gets value * - * @return float|null + * @return \ActivitySmith\Generated\Model\LiveActivityValue|null */ public function getValue() { @@ -760,7 +762,7 @@ public function getValue() /** * Sets value * - * @param float|null $value Current progress value. Use with upper_limit for type=progress. + * @param \ActivitySmith\Generated\Model\LiveActivityValue|null $value For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit. * * @return self */ @@ -961,7 +963,7 @@ public function getIcon() /** * Sets icon * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value. * * @return self */ @@ -988,7 +990,7 @@ public function getBadge() /** * Sets badge * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, and segmented_progress. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, segmented_progress, and value. * * @return self */ @@ -1052,7 +1054,7 @@ public function getColor() /** * Sets color * - * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. + * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. * * @return self */ diff --git a/generated/Model/ContentStateStart.php b/generated/Model/ContentStateStart.php index c6972d7..e8d323c 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 and stats include a non-empty metrics array. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. 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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. 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 @@ -63,7 +63,7 @@ class ContentStateStart implements ModelInterface, ArrayAccess, \JsonSerializabl 'numberOfSteps' => 'int', 'currentStep' => 'int', 'percentage' => 'float', - 'value' => 'float', + 'value' => '\ActivitySmith\Generated\Model\LiveActivityValue', 'upperLimit' => 'float', 'durationSeconds' => 'float', 'countsDown' => 'bool', @@ -337,6 +337,7 @@ public function getModelName() public const TYPE_STATS = 'stats'; public const TYPE_ALERT = 'alert'; public const TYPE_TIMER = 'timer'; + public const TYPE_VALUE = 'value'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -382,6 +383,7 @@ public function getTypeAllowableValues() self::TYPE_STATS, self::TYPE_ALERT, self::TYPE_TIMER, + self::TYPE_VALUE, ]; } @@ -742,7 +744,7 @@ public function setPercentage($percentage) /** * Gets value * - * @return float|null + * @return \ActivitySmith\Generated\Model\LiveActivityValue|null */ public function getValue() { @@ -752,7 +754,7 @@ public function getValue() /** * Sets value * - * @param float|null $value Current progress value. Use with upper_limit for type=progress. + * @param \ActivitySmith\Generated\Model\LiveActivityValue|null $value For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit. * * @return self */ @@ -953,7 +955,7 @@ public function getIcon() /** * Sets icon * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value. * * @return self */ @@ -980,7 +982,7 @@ public function getBadge() /** * Sets badge * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, and segmented_progress. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, segmented_progress, and value. * * @return self */ @@ -1044,7 +1046,7 @@ public function getColor() /** * Sets color * - * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. + * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. * * @return self */ diff --git a/generated/Model/ContentStateUpdate.php b/generated/Model/ContentStateUpdate.php index 84c7be3..255995f 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 and stats include a non-empty metrics array. For alert include message. For timer, omit duration_seconds to preserve the current timer window or send duration_seconds to reset the timer from the update request time. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. 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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer, omit duration_seconds to preserve the current timer window or send duration_seconds to reset the timer from the update request time. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. 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 @@ -63,7 +63,7 @@ class ContentStateUpdate implements ModelInterface, ArrayAccess, \JsonSerializab 'numberOfSteps' => 'int', 'currentStep' => 'int', 'percentage' => 'float', - 'value' => 'float', + 'value' => '\ActivitySmith\Generated\Model\LiveActivityValue', 'upperLimit' => 'float', 'durationSeconds' => 'float', 'countsDown' => 'bool', @@ -337,6 +337,7 @@ public function getModelName() public const TYPE_STATS = 'stats'; public const TYPE_ALERT = 'alert'; public const TYPE_TIMER = 'timer'; + public const TYPE_VALUE = 'value'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -382,6 +383,7 @@ public function getTypeAllowableValues() self::TYPE_STATS, self::TYPE_ALERT, self::TYPE_TIMER, + self::TYPE_VALUE, ]; } @@ -739,7 +741,7 @@ public function setPercentage($percentage) /** * Gets value * - * @return float|null + * @return \ActivitySmith\Generated\Model\LiveActivityValue|null */ public function getValue() { @@ -749,7 +751,7 @@ public function getValue() /** * Sets value * - * @param float|null $value Current progress value. Use with upper_limit for type=progress. + * @param \ActivitySmith\Generated\Model\LiveActivityValue|null $value For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit. * * @return self */ @@ -950,7 +952,7 @@ public function getIcon() /** * Sets icon * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value. * * @return self */ @@ -977,7 +979,7 @@ public function getBadge() /** * Sets badge * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, and segmented_progress. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, segmented_progress, and value. * * @return self */ @@ -1041,7 +1043,7 @@ public function getColor() /** * Sets color * - * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. + * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. * * @return self */ diff --git a/generated/Model/LiveActivityAction.php b/generated/Model/LiveActivityAction.php index f21a210..805d286 100644 --- a/generated/Model/LiveActivityAction.php +++ b/generated/Model/LiveActivityAction.php @@ -35,7 +35,7 @@ * LiveActivityAction Class Doc Comment * * @category Class - * @description Optional action button shown in the Live Activity UI. Use action for the primary button, or secondary_action for a secondary button on alert, progress, and segmented_progress Live Activities. + * @description Optional action button shown in the Live Activity UI. Use action for the primary button, or secondary_action for a secondary button on alert, progress, segmented_progress, and value Live Activities. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/generated/Model/LiveActivityEndRequest.php b/generated/Model/LiveActivityEndRequest.php index 6adb132..6ae266d 100644 --- a/generated/Model/LiveActivityEndRequest.php +++ b/generated/Model/LiveActivityEndRequest.php @@ -495,7 +495,7 @@ public function getSecondaryAction() /** * Sets secondaryAction * - * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. * * @return self */ diff --git a/generated/Model/LiveActivityStartRequest.php b/generated/Model/LiveActivityStartRequest.php index 445118c..e160259 100644 --- a/generated/Model/LiveActivityStartRequest.php +++ b/generated/Model/LiveActivityStartRequest.php @@ -437,7 +437,7 @@ public function getSecondaryAction() /** * Sets secondaryAction * - * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. * * @return self */ diff --git a/generated/Model/LiveActivityStreamDeleteRequest.php b/generated/Model/LiveActivityStreamDeleteRequest.php index 3491a9f..72a3851 100644 --- a/generated/Model/LiveActivityStreamDeleteRequest.php +++ b/generated/Model/LiveActivityStreamDeleteRequest.php @@ -454,7 +454,7 @@ public function getSecondaryAction() /** * Sets secondaryAction * - * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. * * @return self */ diff --git a/generated/Model/LiveActivityStreamRequest.php b/generated/Model/LiveActivityStreamRequest.php index 9e7ac2d..ca0d7f1 100644 --- a/generated/Model/LiveActivityStreamRequest.php +++ b/generated/Model/LiveActivityStreamRequest.php @@ -448,7 +448,7 @@ public function getSecondaryAction() /** * Sets secondaryAction * - * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. * * @return self */ diff --git a/generated/Model/LiveActivityUpdateRequest.php b/generated/Model/LiveActivityUpdateRequest.php index 3dc121d..770c6f1 100644 --- a/generated/Model/LiveActivityUpdateRequest.php +++ b/generated/Model/LiveActivityUpdateRequest.php @@ -495,7 +495,7 @@ public function getSecondaryAction() /** * Sets secondaryAction * - * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. * * @return self */ diff --git a/generated/Model/LiveActivityValue.php b/generated/Model/LiveActivityValue.php new file mode 100644 index 0000000..50120b6 --- /dev/null +++ b/generated/Model/LiveActivityValue.php @@ -0,0 +1,382 @@ + + */ +class LiveActivityValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LiveActivityValue'; + + /** + * 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/RateLimitError.php b/generated/Model/RateLimitError.php index 0fda019..a22cdd4 100644 --- a/generated/Model/RateLimitError.php +++ b/generated/Model/RateLimitError.php @@ -57,6 +57,7 @@ class RateLimitError implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'code' => 'string', 'error' => 'string', 'message' => 'string' ]; @@ -69,6 +70,7 @@ class RateLimitError implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'code' => null, 'error' => null, 'message' => null ]; @@ -79,6 +81,7 @@ class RateLimitError implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'code' => false, 'error' => false, 'message' => false ]; @@ -169,6 +172,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'code' => 'code', 'error' => 'error', 'message' => 'message' ]; @@ -179,6 +183,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'code' => 'setCode', 'error' => 'setError', 'message' => 'setMessage' ]; @@ -189,6 +194,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'code' => 'getCode', 'error' => 'getError', 'message' => 'getMessage' ]; @@ -234,6 +240,19 @@ public function getModelName() return self::$openAPIModelName; } + public const CODE_RATE_LIMITED = 'rate_limited'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_RATE_LIMITED, + ]; + } /** * Associative array for storing property values @@ -250,6 +269,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('code', $data ?? [], null); $this->setIfExists('error', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); } @@ -281,6 +301,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + if ($this->container['error'] === null) { $invalidProperties[] = "'error' can't be null"; } @@ -302,6 +331,43 @@ public function valid() } + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + /** * Gets error * diff --git a/generated/Model/SendPushNotification429Response.php b/generated/Model/SendPushNotification429Response.php index 699a703..462769c 100644 --- a/generated/Model/SendPushNotification429Response.php +++ b/generated/Model/SendPushNotification429Response.php @@ -57,6 +57,7 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J * @var string[] */ protected static $openAPITypes = [ + 'code' => 'string', 'error' => 'string', 'message' => 'string', 'limit' => 'int', @@ -73,6 +74,7 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J * @psalm-var array */ protected static $openAPIFormats = [ + 'code' => null, 'error' => null, 'message' => null, 'limit' => null, @@ -87,6 +89,7 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J * @var boolean[] */ protected static array $openAPINullables = [ + 'code' => false, 'error' => false, 'message' => false, 'limit' => false, @@ -181,6 +184,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'code' => 'code', 'error' => 'error', 'message' => 'message', 'limit' => 'limit', @@ -195,6 +199,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'code' => 'setCode', 'error' => 'setError', 'message' => 'setMessage', 'limit' => 'setLimit', @@ -209,6 +214,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'code' => 'getCode', 'error' => 'getError', 'message' => 'getMessage', 'limit' => 'getLimit', @@ -258,6 +264,19 @@ public function getModelName() return self::$openAPIModelName; } + public const CODE_RATE_LIMITED = 'rate_limited'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_RATE_LIMITED, + ]; + } /** * Associative array for storing property values @@ -274,6 +293,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('code', $data ?? [], null); $this->setIfExists('error', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); @@ -309,6 +329,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + if ($this->container['error'] === null) { $invalidProperties[] = "'error' can't be null"; } @@ -336,6 +365,43 @@ public function valid() } + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + /** * Gets error * diff --git a/generated/Model/StreamContentState.php b/generated/Model/StreamContentState.php index feed44e..bc318c8 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, stats, alert, and timer types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window. + * @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, stats, alert, timer, and value types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -63,7 +63,7 @@ class StreamContentState implements ModelInterface, ArrayAccess, \JsonSerializab 'numberOfSteps' => 'int', 'currentStep' => 'int', 'percentage' => 'float', - 'value' => 'float', + 'value' => '\ActivitySmith\Generated\Model\LiveActivityValue', 'upperLimit' => 'float', 'durationSeconds' => 'float', 'countsDown' => 'bool', @@ -349,6 +349,7 @@ public function getModelName() public const TYPE_STATS = 'stats'; public const TYPE_ALERT = 'alert'; public const TYPE_TIMER = 'timer'; + public const TYPE_VALUE = 'value'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -394,6 +395,7 @@ public function getTypeAllowableValues() self::TYPE_STATS, self::TYPE_ALERT, self::TYPE_TIMER, + self::TYPE_VALUE, ]; } @@ -761,7 +763,7 @@ public function setPercentage($percentage) /** * Gets value * - * @return float|null + * @return \ActivitySmith\Generated\Model\LiveActivityValue|null */ public function getValue() { @@ -771,7 +773,7 @@ public function getValue() /** * Sets value * - * @param float|null $value Current progress value. Use with upper_limit for progress. + * @param \ActivitySmith\Generated\Model\LiveActivityValue|null $value For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For progress, a numeric progress value used with upper_limit. * * @return self */ @@ -943,7 +945,7 @@ public function getColor() /** * Sets color * - * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, and timer Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. + * @param string|null $color Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included. * * @return self */ @@ -1119,7 +1121,7 @@ public function getIcon() /** * Sets icon * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and timer. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertIcon|null $icon Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value. * * @return self */ @@ -1146,7 +1148,7 @@ public function getBadge() /** * Sets badge * - * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, and segmented_progress. + * @param \ActivitySmith\Generated\Model\LiveActivityAlertBadge|null $badge Optional badge. Supported by alert, progress, segmented_progress, and value. * * @return self */ diff --git a/generated/openapi-source.json b/generated/openapi-source.json index dc05717..aeeecd6 100644 --- a/generated/openapi-source.json +++ b/generated/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "49ad7b083b50f53bc3d81edb77ca6597845160a2", + "commit": "6832df646de7de8a6aaf0110960c37074b513c48", "path": "openapi.json", - "sha256": "b7e33cd485df8ddc5d7fb7b57b61106fd6f8ff3ffa7cc7bef4ac1ccbbb0cede7" + "sha256": "9ae85ad6127cfa2d50c33261459f5f9e85e011939d01ac4a9d507fa6ed11aa61" } From 999169c5af4c61d7921ef613b2d54dcf258e4081 Mon Sep 17 00:00:00 2001 From: bardonadam Date: Sun, 20 Sep 2026 12:23:16 +0700 Subject: [PATCH 2/2] feat: add Value Live Activities in v1.12.0 --- CHANGELOG.md | 4 ++ README.md | 84 +++++++++++++++++++------------- generated/Configuration.php | 4 +- src/LiveActivities.php | 1 + src/LiveActivityContentState.php | 2 +- src/Version.php | 2 +- tests/ResourcesTest.php | 19 ++++++++ tests/SmokeTest.php | 2 +- 8 files changed, 78 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6bf11e..8e9a429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.12.0 + +Adds the new `value` Live Activity type. + ## 1.11.0 This version adds support for Metadata and iOS deep links, and expands Tags support when updating or ending Live Activities. diff --git a/README.md b/README.md index 205fccc..eceed6e 100644 --- a/README.md +++ b/README.md @@ -141,33 +141,43 @@ $activitysmith->notifications->send( Choose the Live Activity type that matches what you want to show: -![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png) +- ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png) **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature. -**Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion. +- ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png) **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion. -![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) +- ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png) **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint. -**Metrics**: Track two related values with segmented bars, such as CPU and memory. +- ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) **Metrics**: Track two related values with segmented bars, such as CPU and memory. -![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png) +- ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png) **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify. -**Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify. +- ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png) **Progress**: Show percentage progress for jobs that move continuously toward completion. -![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png) +- ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png) **Timer**: Count down from a duration, or count up from 00:00 while a job runs. -**Progress**: Show percentage progress for jobs that move continuously toward completion. - -![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png) +### Start & Update Live Activity -**Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint. +Use a stable `streamKey` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `streamKey` update it. -![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png) +#### Value -**Timer**: Count down from a duration, or count up from 00:00 while a job runs. +![Value Live Activity stream example](https://cdn.activitysmith.com/features/value-live-activity.png) -### Start & Update Live Activity +```php +$activitysmith->liveActivities->stream( + 'revenue-today', + contentState: LiveActivityContentState::make( + title: 'Revenue', + type: 'value', + value: '$1,240', + color: 'green', + icon: LiveActivityAlertIcon::make(symbol: 'dollarsign.circle', color: 'green'), + badge: LiveActivityAlertBadge::make(title: '↑ 18%', color: 'purple'), + ), +); +``` -Use a stable `streamKey` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `streamKey` update it. +Send a string or number in `value`. Strings keep their formatting, including currency symbols, units, and decimal places. #### Stats @@ -192,6 +202,23 @@ $activitysmith->liveActivities->stream( ); ``` +#### Alert + +![Alert Live Activity stream example](https://cdn.activitysmith.com/features/alert-live-activity.png) + +```php +$activitysmith->liveActivities->stream( + 'customer-ops', + contentState: LiveActivityContentState::make( + title: 'Reactivation', + message: 'Lumen came back after 2 weeks', + type: 'alert', + icon: LiveActivityAlertIcon::make(symbol: 'cloud.sun', color: 'yellow'), + badge: LiveActivityAlertBadge::make(title: 'Customer', color: 'magenta'), + ), +); +``` + #### Metrics ![Metrics Live Activity stream example](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) @@ -244,23 +271,6 @@ $activitysmith->liveActivities->stream( ); ``` -#### Alert - -![Alert Live Activity stream example](https://cdn.activitysmith.com/features/alert-live-activity.png) - -```php -$activitysmith->liveActivities->stream( - 'customer-ops', - contentState: LiveActivityContentState::make( - title: 'Reactivation', - message: 'Lumen came back after 2 weeks', - type: 'alert', - icon: LiveActivityAlertIcon::make(symbol: 'cloud.sun', color: 'yellow'), - badge: LiveActivityAlertBadge::make(title: 'Customer', color: 'magenta'), - ), -); -``` - #### Timer ![Timer Live Activity stream example](https://cdn.activitysmith.com/features/timer-live-activity.png) @@ -308,7 +318,7 @@ Add more context to Live Activities with icons and badges. #### Icon -Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`. +Supported Live Activity types: `value`, `stats`, `alert`, `metrics`, `segmented_progress`, `progress`, and `timer`. ![Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen](https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png) @@ -336,7 +346,7 @@ The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one #### Badge -Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities. +Badges are supported by `value`, `alert`, `segmented_progress`, and `progress` Live Activities. ![Progress Live Activity with a badge on the iPhone Lock Screen](https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png) @@ -448,7 +458,7 @@ $activitysmith->liveActivities->stream( Use `secondary_action` when you want a second button beside the primary `action`. -The secondary action button is supported for `alert`, `progress`, and `segmented_progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes. +The secondary action button is supported for `value`, `alert`, `segmented_progress`, and `progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes. ```php $activitysmith->liveActivities->stream( @@ -619,3 +629,7 @@ try { ### [Packagist](https://packagist.org/packages/activitysmith/activitysmith) Install the ActivitySmith PHP SDK from Packagist + +### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-php) + +View the PHP SDK source on GitHub diff --git a/generated/Configuration.php b/generated/Configuration.php index 9d36f48..1313fe2 100644 --- a/generated/Configuration.php +++ b/generated/Configuration.php @@ -100,7 +100,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.11.0/PHP'; + protected $userAgent = 'OpenAPI-Generator/1.12.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.11.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.12.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/src/LiveActivities.php b/src/LiveActivities.php index 47874fd..2d69ec7 100644 --- a/src/LiveActivities.php +++ b/src/LiveActivities.php @@ -14,6 +14,7 @@ final class LiveActivities public const TYPE_STATS = 'stats'; public const TYPE_ALERT = 'alert'; public const TYPE_TIMER = 'timer'; + public const TYPE_VALUE = 'value'; public function __construct(private LiveActivitiesApi $api) { diff --git a/src/LiveActivityContentState.php b/src/LiveActivityContentState.php index 60fae9d..3420caa 100644 --- a/src/LiveActivityContentState.php +++ b/src/LiveActivityContentState.php @@ -21,7 +21,7 @@ public static function make( ?int $numberOfSteps = null, ?int $currentStep = null, int|float|null $percentage = null, - int|float|null $value = null, + string|int|float|null $value = null, int|float|null $upperLimit = null, ?string $color = null, ?string $stepColor = null, diff --git a/src/Version.php b/src/Version.php index f85dda6..0b0026a 100644 --- a/src/Version.php +++ b/src/Version.php @@ -6,7 +6,7 @@ final class Version { - public const VERSION = '1.11.0'; + public const VERSION = '1.12.0'; private function __construct() { diff --git a/tests/ResourcesTest.php b/tests/ResourcesTest.php index 611d979..9bd439e 100644 --- a/tests/ResourcesTest.php +++ b/tests/ResourcesTest.php @@ -27,6 +27,25 @@ final class ResourcesTest extends TestCase { + public function testValuePreservesStringsAndZero(): void + { + foreach (['$1,240', '0007', '', 0, -12.75] as $value) { + $state = LiveActivityContentState::make(title: 'Revenue', type: LiveActivities::TYPE_VALUE, value: $value); + foreach (['start' => 'startLiveActivity', 'update' => 'updateLiveActivity', 'end' => 'endLiveActivity', 'stream' => 'reconcileLiveActivityStream', 'endStream' => 'endLiveActivityStream'] as $method => $apiMethod) { + $api = $this->getMockBuilder(LiveActivitiesApi::class)->disableOriginalConstructor()->onlyMethods([$apiMethod])->getMock(); + $api->expects($this->once())->method($apiMethod)->willReturnCallback(function (...$args) use ($value, $method) { + $request = $args[in_array($method, ['stream', 'endStream']) ? 1 : 0]; + $body = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($request)), true); + $this->assertSame($value, $body['content_state']['value']); + return (object) ['success' => true]; + }); + $resource = new LiveActivities($api); + if (in_array($method, ['stream', 'endStream'])) $resource->$method('revenue', contentState: $state); + else $resource->$method(contentState: $state); + } + } + } + public function testExternalPushURLsAndStreamEndFields(): void { foreach (['http://example.com', 'https://example.com', 'shortcuts://run-shortcut?name=Test', 'spotify://', 'spotify:track:123'] as $url) { diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php index 0e691d2..b0f0933 100644 --- a/tests/SmokeTest.php +++ b/tests/SmokeTest.php @@ -28,6 +28,6 @@ public function testClientConstructsWhenGeneratedCodeIsPresent(): void $this->assertTrue(method_exists($client->liveActivities, 'endStream')); $this->assertNotNull($client->metrics); $this->assertTrue(method_exists($client->metrics, 'update')); - $this->assertSame('1.11.0', Version::VERSION); + $this->assertSame('1.12.0', Version::VERSION); } }