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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<p align="center">
<img
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png"
alt="Live Activity with action button"
width="680"
/>
Expand Down Expand Up @@ -397,6 +397,54 @@ $activitysmith->liveActivities->stream(
);
```

#### Secondary action

<p align="center">
<img
src="https://cdn.activitysmith.com/features/live-activity-secondary-action.png"
alt="Alert Live Activity with primary and secondary action buttons"
width="680"
/>
</p>

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.
Expand Down
4 changes: 2 additions & 2 deletions generated/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion generated/Model/ContentStateEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion generated/Model/ContentStateStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion generated/Model/ContentStateUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion generated/Model/LiveActivityAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 40 additions & 6 deletions generated/Model/LiveActivityEndRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];

/**
Expand All @@ -73,7 +74,8 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial
protected static $openAPIFormats = [
'activityId' => null,
'contentState' => null,
'action' => null
'action' => null,
'secondaryAction' => null
];

/**
Expand All @@ -84,7 +86,8 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial
protected static array $openAPINullables = [
'activityId' => false,
'contentState' => false,
'action' => false
'action' => false,
'secondaryAction' => false
];

/**
Expand Down Expand Up @@ -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'
];

/**
Expand All @@ -186,7 +190,8 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'activityId' => 'setActivityId',
'contentState' => 'setContentState',
'action' => 'setAction'
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction'
];

/**
Expand All @@ -197,7 +202,8 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'activityId' => 'getActivityId',
'contentState' => 'getContentState',
'action' => 'getAction'
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction'
];

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

/**
Expand Down Expand Up @@ -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.
*
Expand Down
34 changes: 34 additions & 0 deletions generated/Model/LiveActivityStartRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];
Expand All @@ -74,6 +75,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri
protected static $openAPIFormats = [
'contentState' => null,
'action' => null,
'secondaryAction' => null,
'alert' => null,
'target' => null
];
Expand All @@ -86,6 +88,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri
protected static array $openAPINullables = [
'contentState' => false,
'action' => false,
'secondaryAction' => false,
'alert' => false,
'target' => false
];
Expand Down Expand Up @@ -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'
];
Expand All @@ -190,6 +194,7 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction',
'alert' => 'setAlert',
'target' => 'setTarget'
];
Expand All @@ -202,6 +207,7 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction',
'alert' => 'getAlert',
'target' => 'getTarget'
];
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
*
Expand Down
Loading