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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
84 changes: 49 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
28 changes: 14 additions & 14 deletions generated/Api/AppIconBadgesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])
{
Expand All @@ -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])
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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()
];
Expand Down Expand Up @@ -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);
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.11.0/PHP';
protected $userAgent = 'OpenAPI-Generator/1.12.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.11.0' . PHP_EOL;
$report .= ' SDK Package Version: 1.12.0' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;

return $report;
Expand Down
16 changes: 9 additions & 7 deletions generated/Model/ContentStateEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -388,6 +389,7 @@ public function getTypeAllowableValues()
self::TYPE_STATS,
self::TYPE_ALERT,
self::TYPE_TIMER,
self::TYPE_VALUE,
];
}

Expand Down Expand Up @@ -750,7 +752,7 @@ public function setPercentage($percentage)
/**
* Gets value
*
* @return float|null
* @return \ActivitySmith\Generated\Model\LiveActivityValue|null
*/
public function getValue()
{
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
Loading
Loading