diff --git a/README.md b/README.md index 45e4b2c..48aa3ec 100644 --- a/README.md +++ b/README.md @@ -316,15 +316,15 @@ $activitysmith->liveActivities->endStream( ### Live Activity Action -Live Activities can include one optional action button. +Live Activities can include an action button. - `open_url`: open an HTTPS URL. -- `open_url` with a `shortcuts://run-shortcut?name=...` URL: run a specific iPhone Shortcut, for example to open an app. +- `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app. - `webhook`: trigger a backend GET/POST workflow.

Live Activity with action button @@ -397,6 +397,54 @@ $activitysmith->liveActivities->stream( ); ``` +#### Secondary action + +

+ Alert Live Activity with primary and secondary action buttons +

+ +Use `secondaryAction` 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. + +```php +$activitysmith->liveActivities->stream( + 'agent-approval', + contentState: LiveActivityContentState::make( + title: 'Approval Needed', + message: 'Should I send the follow-up email to Brightlane?', + type: 'alert', + color: 'green', + icon: LiveActivityAlertIcon::make(symbol: 'sparkles', color: 'green'), + badge: LiveActivityAlertBadge::make(title: 'Agent', color: 'green'), + ), + action: LiveActivityAction::make( + title: 'Send', + type: 'webhook', + url: 'https://agent.example.com/live-activity/approve', + method: 'POST', + body: [ + 'approval_id' => 'approval_01JY3J7Q9S0P8M1V5PZK7DR4M2', + 'decision' => 'send', + ], + ), + secondaryAction: LiveActivityAction::make( + title: 'Deny', + type: 'webhook', + url: 'https://agent.example.com/live-activity/deny', + method: 'POST', + body: [ + 'approval_id' => 'approval_01JY3J7Q9S0P8M1V5PZK7DR4M2', + 'decision' => 'deny', + ], + ), +); +``` + ### Icons and Badges Add more context to Live Activities with icons and badges. diff --git a/generated/Configuration.php b/generated/Configuration.php index e32d5f8..68781cd 100644 --- a/generated/Configuration.php +++ b/generated/Configuration.php @@ -100,7 +100,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.5.0/PHP'; + protected $userAgent = 'OpenAPI-Generator/1.8.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.5.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.8.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 31fd9d6..e3ecb53 100644 --- a/generated/Model/ContentStateEnd.php +++ b/generated/Model/ContentStateEnd.php @@ -1052,7 +1052,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 the action button when action is included. + * @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. * * @return self */ diff --git a/generated/Model/ContentStateStart.php b/generated/Model/ContentStateStart.php index 53305a9..c6972d7 100644 --- a/generated/Model/ContentStateStart.php +++ b/generated/Model/ContentStateStart.php @@ -1044,7 +1044,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 the action button when action is included. + * @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. * * @return self */ diff --git a/generated/Model/ContentStateUpdate.php b/generated/Model/ContentStateUpdate.php index 80c2c86..84c7be3 100644 --- a/generated/Model/ContentStateUpdate.php +++ b/generated/Model/ContentStateUpdate.php @@ -1041,7 +1041,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 the action button when action is included. + * @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. * * @return self */ diff --git a/generated/Model/LiveActivityAction.php b/generated/Model/LiveActivityAction.php index d5e5220..ec0aac6 100644 --- a/generated/Model/LiveActivityAction.php +++ b/generated/Model/LiveActivityAction.php @@ -35,7 +35,7 @@ * LiveActivityAction Class Doc Comment * * @category Class - * @description Optional single action button shown in the Live Activity UI. + * @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. * @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 f90d047..c794788 100644 --- a/generated/Model/LiveActivityEndRequest.php +++ b/generated/Model/LiveActivityEndRequest.php @@ -60,7 +60,8 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial protected static $openAPITypes = [ 'activityId' => 'string', 'contentState' => '\ActivitySmith\Generated\Model\ContentStateEnd', - 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction' + 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction' ]; /** @@ -73,7 +74,8 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial protected static $openAPIFormats = [ 'activityId' => null, 'contentState' => null, - 'action' => null + 'action' => null, + 'secondaryAction' => null ]; /** @@ -84,7 +86,8 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial protected static array $openAPINullables = [ 'activityId' => false, 'contentState' => false, - 'action' => false + 'action' => false, + 'secondaryAction' => false ]; /** @@ -175,7 +178,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'activityId' => 'activity_id', 'contentState' => 'content_state', - 'action' => 'action' + 'action' => 'action', + 'secondaryAction' => 'secondary_action' ]; /** @@ -186,7 +190,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'activityId' => 'setActivityId', 'contentState' => 'setContentState', - 'action' => 'setAction' + 'action' => 'setAction', + 'secondaryAction' => 'setSecondaryAction' ]; /** @@ -197,7 +202,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'activityId' => 'getActivityId', 'contentState' => 'getContentState', - 'action' => 'getAction' + 'action' => 'getAction', + 'secondaryAction' => 'getSecondaryAction' ]; /** @@ -260,6 +266,7 @@ public function __construct(array $data = null) $this->setIfExists('activityId', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('secondaryAction', $data ?? [], null); } /** @@ -390,6 +397,33 @@ public function setAction($action) return $this; } + + /** + * Gets secondaryAction + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getSecondaryAction() + { + return $this->container['secondaryAction']; + } + + /** + * Sets secondaryAction + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * + * @return self + */ + public function setSecondaryAction($secondaryAction) + { + if (is_null($secondaryAction)) { + throw new \InvalidArgumentException('non-nullable secondaryAction cannot be null'); + } + $this->container['secondaryAction'] = $secondaryAction; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStartRequest.php b/generated/Model/LiveActivityStartRequest.php index 96ce673..affb67e 100644 --- a/generated/Model/LiveActivityStartRequest.php +++ b/generated/Model/LiveActivityStartRequest.php @@ -60,6 +60,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri protected static $openAPITypes = [ 'contentState' => '\ActivitySmith\Generated\Model\ContentStateStart', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'alert' => '\ActivitySmith\Generated\Model\AlertPayload', 'target' => '\ActivitySmith\Generated\Model\ChannelTarget' ]; @@ -74,6 +75,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri protected static $openAPIFormats = [ 'contentState' => null, 'action' => null, + 'secondaryAction' => null, 'alert' => null, 'target' => null ]; @@ -86,6 +88,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri protected static array $openAPINullables = [ 'contentState' => false, 'action' => false, + 'secondaryAction' => false, 'alert' => false, 'target' => false ]; @@ -178,6 +181,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'contentState' => 'content_state', 'action' => 'action', + 'secondaryAction' => 'secondary_action', 'alert' => 'alert', 'target' => 'target' ]; @@ -190,6 +194,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'contentState' => 'setContentState', 'action' => 'setAction', + 'secondaryAction' => 'setSecondaryAction', 'alert' => 'setAlert', 'target' => 'setTarget' ]; @@ -202,6 +207,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'contentState' => 'getContentState', 'action' => 'getAction', + 'secondaryAction' => 'getSecondaryAction', 'alert' => 'getAlert', 'target' => 'getTarget' ]; @@ -265,6 +271,7 @@ public function __construct(array $data = null) { $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('secondaryAction', $data ?? [], null); $this->setIfExists('alert', $data ?? [], null); $this->setIfExists('target', $data ?? [], null); } @@ -368,6 +375,33 @@ public function setAction($action) return $this; } + /** + * Gets secondaryAction + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getSecondaryAction() + { + return $this->container['secondaryAction']; + } + + /** + * Sets secondaryAction + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * + * @return self + */ + public function setSecondaryAction($secondaryAction) + { + if (is_null($secondaryAction)) { + throw new \InvalidArgumentException('non-nullable secondaryAction cannot be null'); + } + $this->container['secondaryAction'] = $secondaryAction; + + return $this; + } + /** * Gets alert * diff --git a/generated/Model/LiveActivityStreamDeleteRequest.php b/generated/Model/LiveActivityStreamDeleteRequest.php index c8b95c3..b59564c 100644 --- a/generated/Model/LiveActivityStreamDeleteRequest.php +++ b/generated/Model/LiveActivityStreamDeleteRequest.php @@ -60,6 +60,7 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J protected static $openAPITypes = [ 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'alert' => '\ActivitySmith\Generated\Model\AlertPayload' ]; @@ -73,6 +74,7 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J protected static $openAPIFormats = [ 'contentState' => null, 'action' => null, + 'secondaryAction' => null, 'alert' => null ]; @@ -84,6 +86,7 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J protected static array $openAPINullables = [ 'contentState' => false, 'action' => false, + 'secondaryAction' => false, 'alert' => false ]; @@ -175,6 +178,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'contentState' => 'content_state', 'action' => 'action', + 'secondaryAction' => 'secondary_action', 'alert' => 'alert' ]; @@ -186,6 +190,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'contentState' => 'setContentState', 'action' => 'setAction', + 'secondaryAction' => 'setSecondaryAction', 'alert' => 'setAlert' ]; @@ -197,6 +202,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'contentState' => 'getContentState', 'action' => 'getAction', + 'secondaryAction' => 'getSecondaryAction', 'alert' => 'getAlert' ]; @@ -259,6 +265,7 @@ public function __construct(array $data = null) { $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('secondaryAction', $data ?? [], null); $this->setIfExists('alert', $data ?? [], null); } @@ -358,6 +365,33 @@ public function setAction($action) return $this; } + /** + * Gets secondaryAction + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getSecondaryAction() + { + return $this->container['secondaryAction']; + } + + /** + * Sets secondaryAction + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * + * @return self + */ + public function setSecondaryAction($secondaryAction) + { + if (is_null($secondaryAction)) { + throw new \InvalidArgumentException('non-nullable secondaryAction cannot be null'); + } + $this->container['secondaryAction'] = $secondaryAction; + + return $this; + } + /** * Gets alert * diff --git a/generated/Model/LiveActivityStreamRequest.php b/generated/Model/LiveActivityStreamRequest.php index 2545e02..b4546bb 100644 --- a/generated/Model/LiveActivityStreamRequest.php +++ b/generated/Model/LiveActivityStreamRequest.php @@ -60,6 +60,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer protected static $openAPITypes = [ 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'alert' => '\ActivitySmith\Generated\Model\AlertPayload', 'channels' => 'string[]', 'target' => '\ActivitySmith\Generated\Model\ChannelTarget' @@ -75,6 +76,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer protected static $openAPIFormats = [ 'contentState' => null, 'action' => null, + 'secondaryAction' => null, 'alert' => null, 'channels' => null, 'target' => null @@ -88,6 +90,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer protected static array $openAPINullables = [ 'contentState' => false, 'action' => false, + 'secondaryAction' => false, 'alert' => false, 'channels' => false, 'target' => false @@ -181,6 +184,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'contentState' => 'content_state', 'action' => 'action', + 'secondaryAction' => 'secondary_action', 'alert' => 'alert', 'channels' => 'channels', 'target' => 'target' @@ -194,6 +198,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'contentState' => 'setContentState', 'action' => 'setAction', + 'secondaryAction' => 'setSecondaryAction', 'alert' => 'setAlert', 'channels' => 'setChannels', 'target' => 'setTarget' @@ -207,6 +212,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'contentState' => 'getContentState', 'action' => 'getAction', + 'secondaryAction' => 'getSecondaryAction', 'alert' => 'getAlert', 'channels' => 'getChannels', 'target' => 'getTarget' @@ -271,6 +277,7 @@ public function __construct(array $data = null) { $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('secondaryAction', $data ?? [], null); $this->setIfExists('alert', $data ?? [], null); $this->setIfExists('channels', $data ?? [], null); $this->setIfExists('target', $data ?? [], null); @@ -379,6 +386,33 @@ public function setAction($action) return $this; } + /** + * Gets secondaryAction + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getSecondaryAction() + { + return $this->container['secondaryAction']; + } + + /** + * Sets secondaryAction + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * + * @return self + */ + public function setSecondaryAction($secondaryAction) + { + if (is_null($secondaryAction)) { + throw new \InvalidArgumentException('non-nullable secondaryAction cannot be null'); + } + $this->container['secondaryAction'] = $secondaryAction; + + return $this; + } + /** * Gets alert * diff --git a/generated/Model/LiveActivityUpdateRequest.php b/generated/Model/LiveActivityUpdateRequest.php index 4ba916f..3faf158 100644 --- a/generated/Model/LiveActivityUpdateRequest.php +++ b/generated/Model/LiveActivityUpdateRequest.php @@ -60,7 +60,8 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer protected static $openAPITypes = [ 'activityId' => 'string', 'contentState' => '\ActivitySmith\Generated\Model\ContentStateUpdate', - 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction' + 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction' ]; /** @@ -73,7 +74,8 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer protected static $openAPIFormats = [ 'activityId' => null, 'contentState' => null, - 'action' => null + 'action' => null, + 'secondaryAction' => null ]; /** @@ -84,7 +86,8 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer protected static array $openAPINullables = [ 'activityId' => false, 'contentState' => false, - 'action' => false + 'action' => false, + 'secondaryAction' => false ]; /** @@ -175,7 +178,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'activityId' => 'activity_id', 'contentState' => 'content_state', - 'action' => 'action' + 'action' => 'action', + 'secondaryAction' => 'secondary_action' ]; /** @@ -186,7 +190,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'activityId' => 'setActivityId', 'contentState' => 'setContentState', - 'action' => 'setAction' + 'action' => 'setAction', + 'secondaryAction' => 'setSecondaryAction' ]; /** @@ -197,7 +202,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'activityId' => 'getActivityId', 'contentState' => 'getContentState', - 'action' => 'getAction' + 'action' => 'getAction', + 'secondaryAction' => 'getSecondaryAction' ]; /** @@ -260,6 +266,7 @@ public function __construct(array $data = null) $this->setIfExists('activityId', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('secondaryAction', $data ?? [], null); } /** @@ -390,6 +397,33 @@ public function setAction($action) return $this; } + + /** + * Gets secondaryAction + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getSecondaryAction() + { + return $this->container['secondaryAction']; + } + + /** + * Sets secondaryAction + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $secondaryAction Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action. + * + * @return self + */ + public function setSecondaryAction($secondaryAction) + { + if (is_null($secondaryAction)) { + throw new \InvalidArgumentException('non-nullable secondaryAction cannot be null'); + } + $this->container['secondaryAction'] = $secondaryAction; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/StreamContentState.php b/generated/Model/StreamContentState.php index 762d0a5..feed44e 100644 --- a/generated/Model/StreamContentState.php +++ b/generated/Model/StreamContentState.php @@ -943,7 +943,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 the action button when action is included. + * @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. * * @return self */ diff --git a/src/LiveActivities.php b/src/LiveActivities.php index 827b151..b08cb1e 100644 --- a/src/LiveActivities.php +++ b/src/LiveActivities.php @@ -41,7 +41,8 @@ public function start( mixed $target = null, mixed $channels = null, mixed $durationSeconds = null, - mixed $countsDown = null + mixed $countsDown = null, + mixed $secondaryAction = null ): mixed { $request = $this->buildRequest($request, $contentState, [ @@ -63,6 +64,7 @@ public function start( 'step_color' => $stepColor, ], [ 'action' => $action, + 'secondary_action' => $secondaryAction, 'alert' => $alert, 'target' => $target, 'channels' => $channels, @@ -91,7 +93,8 @@ public function update( mixed $stepColor = null, mixed $action = null, mixed $durationSeconds = null, - mixed $countsDown = null + mixed $countsDown = null, + mixed $secondaryAction = null ): mixed { $request = $this->buildRequest($request, $contentState, [ @@ -114,6 +117,7 @@ public function update( ], [ 'activity_id' => $activityId, 'action' => $action, + 'secondary_action' => $secondaryAction, ]); return $this->api->updateLiveActivity($request); @@ -140,7 +144,8 @@ public function end( mixed $autoDismissMinutes = null, mixed $action = null, mixed $durationSeconds = null, - mixed $countsDown = null + mixed $countsDown = null, + mixed $secondaryAction = null ): mixed { $request = $this->buildRequest($request, $contentState, [ @@ -164,6 +169,7 @@ public function end( ], [ 'activity_id' => $activityId, 'action' => $action, + 'secondary_action' => $secondaryAction, ]); return $this->api->endLiveActivity($request); @@ -192,7 +198,8 @@ public function stream( mixed $target = null, mixed $channels = null, mixed $durationSeconds = null, - mixed $countsDown = null + mixed $countsDown = null, + mixed $secondaryAction = null ): mixed { $request = $this->buildRequest($request, $contentState, [ @@ -214,6 +221,7 @@ public function stream( 'step_color' => $stepColor, ], [ 'action' => $action, + 'secondary_action' => $secondaryAction, 'alert' => $alert, 'target' => $target, 'channels' => $channels, @@ -247,7 +255,8 @@ public function endStream( mixed $action = null, mixed $alert = null, mixed $durationSeconds = null, - mixed $countsDown = null + mixed $countsDown = null, + mixed $secondaryAction = null ): mixed { $request = $this->buildRequest($request, $contentState, [ @@ -270,6 +279,7 @@ public function endStream( 'auto_dismiss_minutes' => $autoDismissMinutes, ], [ 'action' => $action, + 'secondary_action' => $secondaryAction, 'alert' => $alert, ]); diff --git a/src/Version.php b/src/Version.php index a2453b9..074439d 100644 --- a/src/Version.php +++ b/src/Version.php @@ -6,7 +6,7 @@ final class Version { - public const VERSION = '1.7.0'; + public const VERSION = '1.8.0'; private function __construct() { diff --git a/tests/ResourcesTest.php b/tests/ResourcesTest.php index 0fa9940..9d6681e 100644 --- a/tests/ResourcesTest.php +++ b/tests/ResourcesTest.php @@ -839,6 +839,11 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void type: 'open_url', url: 'shortcuts://run-shortcut?name=Open%20Dashboard' ); + $secondaryAction = LiveActivityAction::make( + title: 'Deny', + type: 'webhook', + url: 'https://ops.example.com/hooks/server-health/deny' + ); $state = LiveActivityContentState::make( title: 'Server Health', subtitle: 'prod-web-1', @@ -851,6 +856,7 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void $resource->start( contentState: $state, action: $action, + secondaryAction: $secondaryAction, channels: ['ops'] ) ); @@ -861,7 +867,8 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void title: 'Server Health', subtitle: 'prod-web-1', type: LiveActivities::TYPE_METRICS, - metrics: $metrics + metrics: $metrics, + secondaryAction: $secondaryAction ) ); $this->assertSame( @@ -872,7 +879,8 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void subtitle: 'prod-web-1', type: LiveActivities::TYPE_METRICS, metrics: $metrics, - autoDismissMinutes: 2 + autoDismissMinutes: 2, + secondaryAction: $secondaryAction ) ); @@ -887,6 +895,7 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void 'metrics' => $metrics, ], 'action' => $action, + 'secondary_action' => $secondaryAction, 'target' => ['channels' => ['ops']], ], LiveActivitiesApi::contentTypes['startLiveActivity'][0], @@ -905,6 +914,7 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void 'type' => LiveActivities::TYPE_METRICS, 'metrics' => $metrics, ], + 'secondary_action' => $secondaryAction, ], LiveActivitiesApi::contentTypes['updateLiveActivity'][0], ], @@ -923,6 +933,7 @@ public function testLiveActivitiesBuildRequestsFromNamedFields(): void 'metrics' => $metrics, 'auto_dismiss_minutes' => 2, ], + 'secondary_action' => $secondaryAction, ], LiveActivitiesApi::contentTypes['endLiveActivity'][0], ], diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php index 52cd535..95097e2 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.7.0', Version::VERSION); + $this->assertSame('1.8.0', Version::VERSION); } }