diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0118f44..d6bf11e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.11.0
+
+This version adds support for Metadata and iOS deep links, and expands Tags support when updating or ending Live Activities.
+
## 1.10.0
### New Features
diff --git a/README.md b/README.md
index d14098a..205fccc 100644
--- a/README.md
+++ b/README.md
@@ -1,37 +1,19 @@
# ActivitySmith PHP SDK
-The ActivitySmith PHP SDK provides convenient access to the ActivitySmith API from PHP applications.
-
-## Documentation
-
-See [API reference](https://activitysmith.com/docs/api-reference/introduction).
-
-## Table of Contents
-
-- [Installation](#installation)
-- [Setup](#setup)
-- [Push Notifications](#push-notifications)
- - [Send a Push Notification](#send-a-push-notification)
- - [Rich Push Notifications with Media](#rich-push-notifications-with-media)
- - [Actionable Push Notifications](#actionable-push-notifications)
-- [Live Activities](#live-activities)
- - [Start & Update Live Activity](#start--update-live-activity)
- - [End Live Activity](#end-live-activity)
- - [Live Activity Action](#live-activity-action)
- - [Icons and Badges](#icons-and-badges)
- - [Live Activity Colors](#live-activity-colors)
-- [Widgets](#widgets)
-- [App Icon Badge Count](#app-icon-badge-count)
-- [Channels](#channels)
-- [Tags](#tags)
+[Documentation](https://activitysmith.com/docs/sdks/php)
## Installation
-```sh
+Install the ActivitySmith PHP SDK with Composer:
+
+```bash
composer require activitysmith/activitysmith
```
-## Setup
+## Quickstart
+
+1. [Create an API key](https://activitysmith.com/app/keys)
+2. Set `ACTIVITYSMITH_API_KEY` or pass it directly to `ActivitySmith`.
```php
-
-
+Send an immediate notification for a completed task or event.
+
+
```php
$activitysmith->notifications->send(
@@ -67,24 +49,19 @@ $activitysmith->notifications->send(
### Rich Push Notifications with Media
-
-
-
+
```php
$activitysmith->notifications->send(
title: 'Homepage ready',
message: 'Your agent finished the redesign.',
media: 'https://cdn.example.com/output/homepage-v2.png',
- redirection: 'https://github.com/acme/web/pull/482',
);
```
-Send images, videos, or audio with your push notifications, press and hold to preview media directly from the notification, then tap through to open the linked content.
+Attach images, videos, or audio to your Push Notifications. Press and hold the notification to preview the media.
-
-
-
+
What will work:
@@ -93,23 +70,51 @@ What will work:
- direct video file URL: `.mp4`, `.mov`, etc.
- URL that responds with a proper media `Content-Type`, even if the path has no extension
+`media` cannot be combined with `actions`.
+
+### Push Notifications with Redirection
+
+Open a web page, run an iOS Shortcut, or open an app when someone taps the notification. `redirection` supports:
+
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+- **App deep links:** Installed apps or specific content within them
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
+ - **Termius:** `termius://` to open the app
+ - **Claude:** `claude://code` to open the Code tab
+ - **ChatGPT:** `chatgpt://` to open the app
+
+```php
+$activitysmith->notifications->send(
+ title: 'Homepage ready',
+ message: 'Your agent finished the redesign.',
+ redirection: 'https://github.com/acme/web/pull/482',
+);
+```
+
### Actionable Push Notifications
-
-
-
+
+
+`open_url` actions open a web page, run an iOS Shortcut, or open an app when someone taps the button. Supported links:
+
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+- **App deep links:** Installed apps or specific content within them
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
+ - **Termius:** `termius://` to open the app
+ - **Claude:** `claude://code` to open the Code tab
+ - **ChatGPT:** `chatgpt://` to open the app
-Push notification `redirection` and `actions` are optional. Use them to open HTTPS URLs, run a specific iPhone Shortcut with `shortcuts://run-shortcut?name=...`, or trigger backend webhook workflows.
-Webhooks are executed by the ActivitySmith backend.
+Webhooks are executed by the ActivitySmith backend and must use HTTPS.
```php
$activitysmith->notifications->send(
title: 'New subscription 💸',
message: 'Customer upgraded to Pro plan',
- redirection: 'https://crm.example.com/customers/cus_9f3a1d', // Optional
- actions: [ // Optional (max 4)
+ actions: [
PushAction::make(
- title: 'Open CRM Profile',
+ title: 'Open CRM',
type: 'open_url',
url: 'https://crm.example.com/customers/cus_9f3a1d',
),
@@ -134,14 +139,31 @@ $activitysmith->notifications->send(
## Live Activities
-There are six types of Live Activities:
+Choose the Live Activity type that matches what you want to show:
+
+
+
+**Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
+
+
+
+**Metrics**: Track two related values with segmented bars, such as CPU and memory.
+
+
+
+**Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
-- `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
-- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
-- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
-- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
-- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
-- `timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs
+
+
+**Progress**: Show percentage progress for jobs that move continuously toward completion.
+
+
+
+**Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
+
+
+
+**Timer**: Count down from a duration, or count up from 00:00 while a job runs.
### Start & Update Live Activity
@@ -149,13 +171,7 @@ Use a stable `streamKey` to identify the metric, job, deployment, or system you
#### Stats
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -178,13 +194,7 @@ $activitysmith->liveActivities->stream(
#### Metrics
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -203,13 +213,7 @@ $activitysmith->liveActivities->stream(
#### Segmented Progress
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -226,13 +230,7 @@ $activitysmith->liveActivities->stream(
#### Progress
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -248,13 +246,7 @@ $activitysmith->liveActivities->stream(
#### Alert
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -271,13 +263,7 @@ $activitysmith->liveActivities->stream(
#### Timer
-
-
-
+
```php
$activitysmith->liveActivities->stream(
@@ -292,13 +278,13 @@ $activitysmith->liveActivities->stream(
);
```
-For a countdown, send `duration_seconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `duration_seconds` out unless you want to change the timer.
+For a countdown, send `durationSeconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `durationSeconds` out unless you want to change the timer.
-To start at 00:00 and count up, set `counts_down: false` and leave out `duration_seconds`.
+To start at 00:00 and count up, set `countsDown` to `false` and leave out `durationSeconds`.
### End Live Activity
-Call `endStream(...)` with the same `streamKey` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `autoDismissMinutes` to choose a different dismissal time, including `0` for immediate dismissal.
+Call `endStream(...)` with the same `streamKey` to dismiss the Live Activity. You can include final values before it is removed. Set `autoDismissSeconds` to dismiss it after a delay in seconds, or `autoDismissMinutes` for minutes. Use `0` for immediate dismissal. Seconds take precedence if both are set.
```php
$activitysmith->liveActivities->endStream(
@@ -311,29 +297,84 @@ $activitysmith->liveActivities->endStream(
LiveActivityMetric::make(label: 'CPU', value: 7, unit: '%'),
LiveActivityMetric::make(label: 'MEM', value: 38, unit: '%'),
],
- autoDismissMinutes: 2,
+ autoDismissSeconds: 30,
),
);
```
+### Icons and Badges
+
+Add more context to Live Activities with icons and badges.
+
+#### Icon
+
+Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
+
+
+
+```php
+$activitysmith->liveActivities->stream(
+ 'prod-web-1',
+ contentState: LiveActivityContentState::make(
+ title: 'Server Health',
+ subtitle: 'prod-web-1',
+ type: LiveActivities::TYPE_METRICS,
+ icon: LiveActivityAlertIcon::make(symbol: 'server.rack', color: 'blue'),
+ metrics: [
+ LiveActivityMetric::make(label: 'CPU', value: 18, unit: '%'),
+ LiveActivityMetric::make(label: 'MEM', value: 42, unit: '%'),
+ ],
+ ),
+);
+```
+
+The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
+
+- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
+- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
+- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
+
+#### Badge
+
+Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
+
+
+
+```php
+$activitysmith->liveActivities->stream(
+ 'nightly-database-backup',
+ contentState: LiveActivityContentState::make(
+ title: 'Nightly Database Backup',
+ subtitle: 'verify restore',
+ type: LiveActivities::TYPE_PROGRESS,
+ badge: LiveActivityAlertBadge::make(title: 'S3', color: 'cyan'),
+ percentage: 62,
+ ),
+);
+```
+
+### Live Activity Colors
+
+Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
+
+`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
+
### Live Activity Action
-Live Activities can include an action button.
+
-- `open_url`: open an HTTPS URL.
-- `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
-- `webhook`: trigger a backend GET/POST workflow.
+Live Activities can include an action button.
-
-
-
+- `open_url`: Open a web page or run an iOS Shortcut
+- `webhook`: Trigger a backend GET/POST workflow
#### Open URL action
+Open a web page or run an iOS Shortcut when someone taps the button. Supported links:
+
+- **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
+- **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis`
+
```php
$activitysmith->liveActivities->stream(
'prod-web-1',
@@ -349,7 +390,7 @@ $activitysmith->liveActivities->stream(
action: LiveActivityAction::make(
title: 'Dashboard',
type: 'open_url',
- url: 'https://ops.example.com/servers/prod-web-1',
+ url: 'https://status.example.com/servers/prod-web-1',
),
);
```
@@ -358,13 +399,15 @@ $activitysmith->liveActivities->stream(
```php
$activitysmith->liveActivities->stream(
- 'deploy-payments-api',
+ 'prod-web-1',
contentState: LiveActivityContentState::make(
- title: 'Deploying payments-api',
- subtitle: 'Running database migrations',
- type: 'segmented_progress',
- numberOfSteps: 5,
- currentStep: 3,
+ title: 'Server Health',
+ subtitle: 'prod-web-1',
+ type: 'metrics',
+ metrics: [
+ LiveActivityMetric::make(label: 'CPU', value: 76, unit: '%'),
+ LiveActivityMetric::make(label: 'MEM', value: 52, unit: '%'),
+ ],
),
action: LiveActivityAction::make(
title: 'Chat with Jarvis',
@@ -401,15 +444,9 @@ $activitysmith->liveActivities->stream(
#### Secondary action
-
-
-
+
-Use `secondaryAction` when you want a second button beside the primary `action`.
+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.
@@ -447,86 +484,15 @@ $activitysmith->liveActivities->stream(
);
```
-### Icons and Badges
+## Lock Screen Widgets
-Add more context to Live Activities with icons and badges.
+
-#### Icon
+ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the [web app](https://activitysmith.com/app/widgets), then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
-Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
+
-
-
-
-
-```php
-$activitysmith->liveActivities->stream(
- 'prod-web-1',
- contentState: LiveActivityContentState::make(
- title: 'Server Health',
- subtitle: 'prod-web-1',
- type: LiveActivities::TYPE_METRICS,
- icon: LiveActivityAlertIcon::make(symbol: 'server.rack', color: 'blue'),
- metrics: [
- LiveActivityMetric::make(label: 'CPU', value: 18, unit: '%'),
- LiveActivityMetric::make(label: 'MEM', value: 42, unit: '%'),
- ],
- ),
-);
-```
-
-The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
-
-- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
-- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
-- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
-
-#### Badge
-
-Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
-
-
-
-
-
-```php
-$activitysmith->liveActivities->stream(
- 'nightly-database-backup',
- contentState: LiveActivityContentState::make(
- title: 'Nightly Database Backup',
- subtitle: 'verify restore',
- type: LiveActivities::TYPE_PROGRESS,
- badge: LiveActivityAlertBadge::make(title: 'S3', color: 'cyan'),
- percentage: 62,
- ),
-);
-```
-
-### Live Activity Colors
-
-Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
-
-`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
-
-## Widgets
-
-
-
-
-
-ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
-
-
-
-
+Use the metric key to update its value.
```php
$activitysmith->metrics->update('deploy.success_rate', 99.9);
@@ -540,84 +506,116 @@ $activitysmith->metrics->update('prod.status', 'healthy');
## App Icon Badge Count
-
-
-
+
Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
-Set or update the badge value.
+### Set or update the badge value
```php
$activitysmith->badgeCount(8333);
```
-To clear the badge, set its value to 0.
+### Clear the badge
+
+Pass `0` to clear the badge.
```php
$activitysmith->badgeCount(0);
```
-## Channels
-
-Use `channels` to target specific team members or devices
+## Metadata
-### Push Notifications
+Metadata adds extra information to Push Notification and Live Activity details in ActivitySmith. It does not appear in the notification or Live Activity on your device.
```php
$activitysmith->notifications->send(
title: 'New subscription 💸',
message: 'Customer upgraded to Pro plan',
- channels: ['sales', 'customer-success'],
+ metadata: [
+ 'customer_id' => '382',
+ 'plan' => 'Pro',
+ 'amount' => 29,
+ 'trial' => false,
+ ],
+);
+
+$activitysmith->liveActivities->stream(
+ 'customer-import',
+ title: 'Customer Import',
+ type: 'progress',
+ percentage: 60,
+ metadata: [
+ 'job_id' => 'import-382',
+ 'records' => 1200,
+ ],
);
```
-### Live Activities
+Values can be strings, numbers, or booleans. Metadata supports up to 50 entries and 16 KB of JSON, with keys up to 100 characters and strings up to 4,000 characters. Nested objects, arrays, and null values are not supported.
+
+## Tags
+
+Use `tags` to organize and filter your Push Notification and Live Activity history. Tags are created automatically when you first use them.
```php
-$activitysmith->liveActivities->start(
- title: 'Nightly Database Backup',
- subtitle: 'verify restore',
- type: 'progress',
- percentage: 62,
- channels: ['sales', 'customer-success'],
-);
+$activitysmith->notifications->send([
+ 'title' => 'New subscription 💸',
+ 'message' => 'Customer upgraded to Pro plan',
+ 'tags' => ['user:382', 'billing'],
+]);
```
-### App Icon Badge Count
+On Live Activity stream updates and legacy `update` or `end` calls, omit `tags` to keep existing Tags, supply a list to replace them, or pass `tags: []` to clear them.
```php
-$activitysmith->badgeCount(3, channels: ['sales', 'customer-success']);
+$activitysmith->liveActivities->update(
+ activityId: 'YOUR_ACTIVITY_ID',
+ title: 'Customer Import',
+ percentage: 60,
+ tags: [],
+);
```
-## Tags
+## Channels
-Use `tags` to organize and filter your Push Notification and Live Activity history. Tags are created automatically when you first use them.
+Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge Count updates. Omit it for account-wide delivery.
```php
$activitysmith->notifications->send(
title: 'New subscription 💸',
message: 'Customer upgraded to Pro plan',
- tags: ['user:382', 'billing'],
+ channels: ['sales', 'customer-success'],
);
+
+$activitysmith->liveActivities->stream(
+ 'nightly-backup',
+ contentState: LiveActivityContentState::make(
+ title: 'Nightly database backup',
+ type: 'segmented_progress',
+ numberOfSteps: 3,
+ currentStep: 1,
+ ),
+ channels: ['ios-builds'],
+);
+
+$activitysmith->badgeCount(3, channels: ['sales', 'customer-success']);
```
## Error Handling
+Wrap SDK calls with `try/catch`:
+
```php
try {
- $activitysmith->notifications->send(
- title: 'New subscription 💸',
- );
-} catch (Throwable $err) {
- echo 'Request failed: ' . $err->getMessage() . PHP_EOL;
+ $activitysmith->notifications->send(title: 'Hello');
+} catch (\Throwable $error) {
+ echo $error->getMessage();
}
```
-## Requirements
-
-- PHP 8.1+
+## Additional Resources
-## License
+### [Packagist](https://packagist.org/packages/activitysmith/activitysmith)
-MIT
+Install the ActivitySmith PHP SDK from Packagist
diff --git a/generated/Api/AppIconBadgesApi.php b/generated/Api/AppIconBadgesApi.php
index 2260dd3..b49ac20 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\NoRecipientsError|\ActivitySmith\Generated\Model\RateLimitError
+ * @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
*/
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\NoRecipientsError|\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\AppIconBadgeCountUpdateError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings)
*/
public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequest, string $contentType = self::contentTypes['updateAppIconBadgeCount'][0])
{
@@ -273,12 +273,12 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ
$response->getStatusCode(),
$response->getHeaders()
];
- case 404:
- if ('\ActivitySmith\Generated\Model\NoRecipientsError' === '\SplFileObject') {
+ case 422:
+ if ('\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\ActivitySmith\Generated\Model\NoRecipientsError' !== 'string') {
+ if ('\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response' !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
@@ -296,7 +296,34 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ
}
return [
- ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\NoRecipientsError', []),
+ ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 502:
+ if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -383,10 +410,18 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ
);
$e->setResponseObject($data);
break;
- case 404:
+ case 422:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 502:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\ActivitySmith\Generated\Model\NoRecipientsError',
+ '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
diff --git a/generated/Configuration.php b/generated/Configuration.php
index 281c43c..9d36f48 100644
--- a/generated/Configuration.php
+++ b/generated/Configuration.php
@@ -100,7 +100,7 @@ class Configuration
*
* @var string
*/
- protected $userAgent = 'OpenAPI-Generator/1.10.0/PHP';
+ protected $userAgent = 'OpenAPI-Generator/1.11.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.10.0' . PHP_EOL;
+ $report .= ' SDK Package Version: 1.11.0' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
return $report;
diff --git a/generated/Model/AppIconBadgeCountUpdateError.php b/generated/Model/AppIconBadgeCountUpdateError.php
new file mode 100644
index 0000000..f88711a
--- /dev/null
+++ b/generated/Model/AppIconBadgeCountUpdateError.php
@@ -0,0 +1,748 @@
+
+ */
+class AppIconBadgeCountUpdateError implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AppIconBadgeCountUpdateError';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'error' => 'string',
+ 'code' => 'string',
+ 'message' => 'string',
+ 'badge' => 'int',
+ 'devicesTargeted' => 'int',
+ 'devicesUpdated' => 'int',
+ 'usersUpdated' => 'int',
+ 'devicesNotified' => 'int',
+ 'effectiveChannelSlugs' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'error' => null,
+ 'code' => null,
+ 'message' => null,
+ 'badge' => null,
+ 'devicesTargeted' => null,
+ 'devicesUpdated' => null,
+ 'usersUpdated' => null,
+ 'devicesNotified' => null,
+ 'effectiveChannelSlugs' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'error' => false,
+ 'code' => false,
+ 'message' => false,
+ 'badge' => false,
+ 'devicesTargeted' => false,
+ 'devicesUpdated' => false,
+ 'usersUpdated' => false,
+ 'devicesNotified' => false,
+ 'effectiveChannelSlugs' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'error' => 'error',
+ 'code' => 'code',
+ 'message' => 'message',
+ 'badge' => 'badge',
+ 'devicesTargeted' => 'devices_targeted',
+ 'devicesUpdated' => 'devices_updated',
+ 'usersUpdated' => 'users_updated',
+ 'devicesNotified' => 'devices_notified',
+ 'effectiveChannelSlugs' => 'effective_channel_slugs'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'error' => 'setError',
+ 'code' => 'setCode',
+ 'message' => 'setMessage',
+ 'badge' => 'setBadge',
+ 'devicesTargeted' => 'setDevicesTargeted',
+ 'devicesUpdated' => 'setDevicesUpdated',
+ 'usersUpdated' => 'setUsersUpdated',
+ 'devicesNotified' => 'setDevicesNotified',
+ 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'error' => 'getError',
+ 'code' => 'getCode',
+ 'message' => 'getMessage',
+ 'badge' => 'getBadge',
+ 'devicesTargeted' => 'getDevicesTargeted',
+ 'devicesUpdated' => 'getDevicesUpdated',
+ 'usersUpdated' => 'getUsersUpdated',
+ 'devicesNotified' => 'getDevicesNotified',
+ 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs'
+ ];
+
+ /**
+ * 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;
+ }
+
+ public const CODE_DEVICE_DISCONNECTED = 'badge_device_disconnected';
+ public const CODE_UPDATE_FAILED = 'badge_update_failed';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getCodeAllowableValues()
+ {
+ return [
+ self::CODE_DEVICE_DISCONNECTED,
+ self::CODE_UPDATE_FAILED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('error', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('message', $data ?? [], null);
+ $this->setIfExists('badge', $data ?? [], null);
+ $this->setIfExists('devicesTargeted', $data ?? [], null);
+ $this->setIfExists('devicesUpdated', $data ?? [], null);
+ $this->setIfExists('usersUpdated', $data ?? [], null);
+ $this->setIfExists('devicesNotified', $data ?? [], null);
+ $this->setIfExists('effectiveChannelSlugs', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['error'] === null) {
+ $invalidProperties[] = "'error' can't be null";
+ }
+ if ($this->container['code'] === null) {
+ $invalidProperties[] = "'code' can't be null";
+ }
+ $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['message'] === null) {
+ $invalidProperties[] = "'message' can't be null";
+ }
+ if ($this->container['badge'] === null) {
+ $invalidProperties[] = "'badge' can't be null";
+ }
+ if (($this->container['badge'] > 2147483647)) {
+ $invalidProperties[] = "invalid value for 'badge', must be smaller than or equal to 2147483647.";
+ }
+
+ if (($this->container['badge'] < 0)) {
+ $invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0.";
+ }
+
+ if ($this->container['devicesUpdated'] === null) {
+ $invalidProperties[] = "'devicesUpdated' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets error
+ *
+ * @return string
+ */
+ public function getError()
+ {
+ return $this->container['error'];
+ }
+
+ /**
+ * Sets error
+ *
+ * @param string $error error
+ *
+ * @return self
+ */
+ public function setError($error)
+ {
+ if (is_null($error)) {
+ throw new \InvalidArgumentException('non-nullable error cannot be null');
+ }
+ $this->container['error'] = $error;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string $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 message
+ *
+ * @return string
+ */
+ public function getMessage()
+ {
+ return $this->container['message'];
+ }
+
+ /**
+ * Sets message
+ *
+ * @param string $message message
+ *
+ * @return self
+ */
+ public function setMessage($message)
+ {
+ if (is_null($message)) {
+ throw new \InvalidArgumentException('non-nullable message cannot be null');
+ }
+ $this->container['message'] = $message;
+
+ return $this;
+ }
+
+ /**
+ * Gets badge
+ *
+ * @return int
+ */
+ public function getBadge()
+ {
+ return $this->container['badge'];
+ }
+
+ /**
+ * Sets badge
+ *
+ * @param int $badge badge
+ *
+ * @return self
+ */
+ public function setBadge($badge)
+ {
+ if (is_null($badge)) {
+ throw new \InvalidArgumentException('non-nullable badge cannot be null');
+ }
+
+ if (($badge > 2147483647)) {
+ throw new \InvalidArgumentException('invalid value for $badge when calling AppIconBadgeCountUpdateError., must be smaller than or equal to 2147483647.');
+ }
+ if (($badge < 0)) {
+ throw new \InvalidArgumentException('invalid value for $badge when calling AppIconBadgeCountUpdateError., must be bigger than or equal to 0.');
+ }
+
+ $this->container['badge'] = $badge;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesTargeted
+ *
+ * @return int|null
+ */
+ public function getDevicesTargeted()
+ {
+ return $this->container['devicesTargeted'];
+ }
+
+ /**
+ * Sets devicesTargeted
+ *
+ * @param int|null $devicesTargeted devicesTargeted
+ *
+ * @return self
+ */
+ public function setDevicesTargeted($devicesTargeted)
+ {
+ if (is_null($devicesTargeted)) {
+ throw new \InvalidArgumentException('non-nullable devicesTargeted cannot be null');
+ }
+ $this->container['devicesTargeted'] = $devicesTargeted;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesUpdated
+ *
+ * @return int
+ */
+ public function getDevicesUpdated()
+ {
+ return $this->container['devicesUpdated'];
+ }
+
+ /**
+ * Sets devicesUpdated
+ *
+ * @param int $devicesUpdated devicesUpdated
+ *
+ * @return self
+ */
+ public function setDevicesUpdated($devicesUpdated)
+ {
+ if (is_null($devicesUpdated)) {
+ throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null');
+ }
+ $this->container['devicesUpdated'] = $devicesUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets usersUpdated
+ *
+ * @return int|null
+ */
+ public function getUsersUpdated()
+ {
+ return $this->container['usersUpdated'];
+ }
+
+ /**
+ * Sets usersUpdated
+ *
+ * @param int|null $usersUpdated usersUpdated
+ *
+ * @return self
+ */
+ public function setUsersUpdated($usersUpdated)
+ {
+ if (is_null($usersUpdated)) {
+ throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null');
+ }
+ $this->container['usersUpdated'] = $usersUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesNotified
+ *
+ * @return int|null
+ * @deprecated
+ */
+ public function getDevicesNotified()
+ {
+ return $this->container['devicesNotified'];
+ }
+
+ /**
+ * Sets devicesNotified
+ *
+ * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setDevicesNotified($devicesNotified)
+ {
+ if (is_null($devicesNotified)) {
+ throw new \InvalidArgumentException('non-nullable devicesNotified cannot be null');
+ }
+ $this->container['devicesNotified'] = $devicesNotified;
+
+ return $this;
+ }
+
+ /**
+ * Gets effectiveChannelSlugs
+ *
+ * @return string[]|null
+ */
+ public function getEffectiveChannelSlugs()
+ {
+ return $this->container['effectiveChannelSlugs'];
+ }
+
+ /**
+ * Sets effectiveChannelSlugs
+ *
+ * @param string[]|null $effectiveChannelSlugs effectiveChannelSlugs
+ *
+ * @return self
+ */
+ public function setEffectiveChannelSlugs($effectiveChannelSlugs)
+ {
+ if (is_null($effectiveChannelSlugs)) {
+ throw new \InvalidArgumentException('non-nullable effectiveChannelSlugs cannot be null');
+ }
+ $this->container['effectiveChannelSlugs'] = $effectiveChannelSlugs;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/generated/Model/AppIconBadgeCountUpdateResponse.php b/generated/Model/AppIconBadgeCountUpdateResponse.php
index 96a06e4..2a526ac 100644
--- a/generated/Model/AppIconBadgeCountUpdateResponse.php
+++ b/generated/Model/AppIconBadgeCountUpdateResponse.php
@@ -59,6 +59,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J
protected static $openAPITypes = [
'success' => 'bool',
'badge' => 'int',
+ 'devicesUpdated' => 'int',
+ 'usersUpdated' => 'int',
'devicesNotified' => 'int',
'usersNotified' => 'int',
'effectiveChannelSlugs' => 'string[]',
@@ -75,6 +77,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J
protected static $openAPIFormats = [
'success' => null,
'badge' => null,
+ 'devicesUpdated' => null,
+ 'usersUpdated' => null,
'devicesNotified' => null,
'usersNotified' => null,
'effectiveChannelSlugs' => null,
@@ -89,6 +93,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J
protected static array $openAPINullables = [
'success' => false,
'badge' => false,
+ 'devicesUpdated' => false,
+ 'usersUpdated' => false,
'devicesNotified' => false,
'usersNotified' => false,
'effectiveChannelSlugs' => false,
@@ -183,6 +189,8 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'success' => 'success',
'badge' => 'badge',
+ 'devicesUpdated' => 'devices_updated',
+ 'usersUpdated' => 'users_updated',
'devicesNotified' => 'devices_notified',
'usersNotified' => 'users_notified',
'effectiveChannelSlugs' => 'effective_channel_slugs',
@@ -197,6 +205,8 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'success' => 'setSuccess',
'badge' => 'setBadge',
+ 'devicesUpdated' => 'setDevicesUpdated',
+ 'usersUpdated' => 'setUsersUpdated',
'devicesNotified' => 'setDevicesNotified',
'usersNotified' => 'setUsersNotified',
'effectiveChannelSlugs' => 'setEffectiveChannelSlugs',
@@ -211,6 +221,8 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'success' => 'getSuccess',
'badge' => 'getBadge',
+ 'devicesUpdated' => 'getDevicesUpdated',
+ 'usersUpdated' => 'getUsersUpdated',
'devicesNotified' => 'getDevicesNotified',
'usersNotified' => 'getUsersNotified',
'effectiveChannelSlugs' => 'getEffectiveChannelSlugs',
@@ -276,6 +288,8 @@ public function __construct(array $data = null)
{
$this->setIfExists('success', $data ?? [], null);
$this->setIfExists('badge', $data ?? [], null);
+ $this->setIfExists('devicesUpdated', $data ?? [], null);
+ $this->setIfExists('usersUpdated', $data ?? [], null);
$this->setIfExists('devicesNotified', $data ?? [], null);
$this->setIfExists('usersNotified', $data ?? [], null);
$this->setIfExists('effectiveChannelSlugs', $data ?? [], null);
@@ -323,11 +337,11 @@ public function listInvalidProperties()
$invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0.";
}
- if ($this->container['devicesNotified'] === null) {
- $invalidProperties[] = "'devicesNotified' can't be null";
+ if ($this->container['devicesUpdated'] === null) {
+ $invalidProperties[] = "'devicesUpdated' can't be null";
}
- if ($this->container['usersNotified'] === null) {
- $invalidProperties[] = "'usersNotified' can't be null";
+ if ($this->container['usersUpdated'] === null) {
+ $invalidProperties[] = "'usersUpdated' can't be null";
}
if ($this->container['effectiveChannelSlugs'] === null) {
$invalidProperties[] = "'effectiveChannelSlugs' can't be null";
@@ -413,10 +427,65 @@ public function setBadge($badge)
}
/**
- * Gets devicesNotified
+ * Gets devicesUpdated
+ *
+ * @return int
+ */
+ public function getDevicesUpdated()
+ {
+ return $this->container['devicesUpdated'];
+ }
+
+ /**
+ * Sets devicesUpdated
+ *
+ * @param int $devicesUpdated Number of devices whose App Icon Badge Count was updated.
+ *
+ * @return self
+ */
+ public function setDevicesUpdated($devicesUpdated)
+ {
+ if (is_null($devicesUpdated)) {
+ throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null');
+ }
+ $this->container['devicesUpdated'] = $devicesUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets usersUpdated
*
* @return int
*/
+ public function getUsersUpdated()
+ {
+ return $this->container['usersUpdated'];
+ }
+
+ /**
+ * Sets usersUpdated
+ *
+ * @param int $usersUpdated Number of account users with at least one updated device.
+ *
+ * @return self
+ */
+ public function setUsersUpdated($usersUpdated)
+ {
+ if (is_null($usersUpdated)) {
+ throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null');
+ }
+ $this->container['usersUpdated'] = $usersUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesNotified
+ *
+ * @return int|null
+ * @deprecated
+ */
public function getDevicesNotified()
{
return $this->container['devicesNotified'];
@@ -425,9 +494,10 @@ public function getDevicesNotified()
/**
* Sets devicesNotified
*
- * @param int $devicesNotified devicesNotified
+ * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated.
*
* @return self
+ * @deprecated
*/
public function setDevicesNotified($devicesNotified)
{
@@ -442,7 +512,8 @@ public function setDevicesNotified($devicesNotified)
/**
* Gets usersNotified
*
- * @return int
+ * @return int|null
+ * @deprecated
*/
public function getUsersNotified()
{
@@ -452,9 +523,10 @@ public function getUsersNotified()
/**
* Sets usersNotified
*
- * @param int $usersNotified usersNotified
+ * @param int|null $usersNotified Deprecated compatibility alias for users_updated.
*
* @return self
+ * @deprecated
*/
public function setUsersNotified($usersNotified)
{
diff --git a/generated/Model/LiveActivityEndRequest.php b/generated/Model/LiveActivityEndRequest.php
index 217a9df..6adb132 100644
--- a/generated/Model/LiveActivityEndRequest.php
+++ b/generated/Model/LiveActivityEndRequest.php
@@ -58,7 +58,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
'activityId' => 'string',
+ 'tags' => 'string[]',
'contentState' => '\ActivitySmith\Generated\Model\ContentStateEnd',
'action' => '\ActivitySmith\Generated\Model\LiveActivityAction',
'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction'
@@ -72,7 +74,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
'activityId' => null,
+ 'tags' => null,
'contentState' => null,
'action' => null,
'secondaryAction' => null
@@ -84,7 +88,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
'activityId' => false,
+ 'tags' => false,
'contentState' => false,
'action' => false,
'secondaryAction' => false
@@ -176,7 +182,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
'activityId' => 'activity_id',
+ 'tags' => 'tags',
'contentState' => 'content_state',
'action' => 'action',
'secondaryAction' => 'secondary_action'
@@ -188,7 +196,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
'activityId' => 'setActivityId',
+ 'tags' => 'setTags',
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction'
@@ -200,7 +210,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
'activityId' => 'getActivityId',
+ 'tags' => 'getTags',
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction'
@@ -263,7 +275,9 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('activityId', $data ?? [], null);
+ $this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('contentState', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('secondaryAction', $data ?? [], null);
@@ -296,9 +310,17 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
if ($this->container['activityId'] === null) {
$invalidProperties[] = "'activityId' can't be null";
}
+ if (!is_null($this->container['tags']) && (count($this->container['tags']) > 20)) {
+ $invalidProperties[] = "invalid value for 'tags', number of items must be less than or equal to 20.";
+ }
+
if ($this->container['contentState'] === null) {
$invalidProperties[] = "'contentState' can't be null";
}
@@ -317,6 +339,37 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityEndRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
/**
* Gets activityId
*
@@ -344,6 +397,37 @@ public function setActivityId($activityId)
return $this;
}
+ /**
+ * Gets tags
+ *
+ * @return string[]|null
+ */
+ public function getTags()
+ {
+ return $this->container['tags'];
+ }
+
+ /**
+ * Sets tags
+ *
+ * @param string[]|null $tags Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
+ *
+ * @return self
+ */
+ public function setTags($tags)
+ {
+ if (is_null($tags)) {
+ throw new \InvalidArgumentException('non-nullable tags cannot be null');
+ }
+
+ if ((count($tags) > 20)) {
+ throw new \InvalidArgumentException('invalid value for $tags when calling LiveActivityEndRequest., number of items must be less than or equal to 20.');
+ }
+ $this->container['tags'] = $tags;
+
+ return $this;
+ }
+
/**
* Gets contentState
*
diff --git a/generated/Model/LiveActivityLimitError.php b/generated/Model/LiveActivityLimitError.php
index 724cbb3..4e6855e 100644
--- a/generated/Model/LiveActivityLimitError.php
+++ b/generated/Model/LiveActivityLimitError.php
@@ -60,7 +60,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial
'error' => 'string',
'message' => 'string',
'limit' => 'int',
- 'active' => 'int'
+ 'active' => 'int',
+ 'blockedDevices' => 'int',
+ 'targetedDevices' => 'int'
];
/**
@@ -74,7 +76,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial
'error' => null,
'message' => null,
'limit' => null,
- 'active' => null
+ 'active' => null,
+ 'blockedDevices' => null,
+ 'targetedDevices' => null
];
/**
@@ -86,7 +90,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial
'error' => false,
'message' => false,
'limit' => false,
- 'active' => false
+ 'active' => false,
+ 'blockedDevices' => false,
+ 'targetedDevices' => false
];
/**
@@ -178,7 +184,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'error',
'message' => 'message',
'limit' => 'limit',
- 'active' => 'active'
+ 'active' => 'active',
+ 'blockedDevices' => 'blocked_devices',
+ 'targetedDevices' => 'targeted_devices'
];
/**
@@ -190,7 +198,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'setError',
'message' => 'setMessage',
'limit' => 'setLimit',
- 'active' => 'setActive'
+ 'active' => 'setActive',
+ 'blockedDevices' => 'setBlockedDevices',
+ 'targetedDevices' => 'setTargetedDevices'
];
/**
@@ -202,7 +212,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'getError',
'message' => 'getMessage',
'limit' => 'getLimit',
- 'active' => 'getActive'
+ 'active' => 'getActive',
+ 'blockedDevices' => 'getBlockedDevices',
+ 'targetedDevices' => 'getTargetedDevices'
];
/**
@@ -266,6 +278,8 @@ public function __construct(array $data = null)
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('limit', $data ?? [], null);
$this->setIfExists('active', $data ?? [], null);
+ $this->setIfExists('blockedDevices', $data ?? [], null);
+ $this->setIfExists('targetedDevices', $data ?? [], null);
}
/**
@@ -416,7 +430,7 @@ public function getActive()
/**
* Sets active
*
- * @param int $active Current number of active Live Activities.
+ * @param int $active Highest number of active Live Activities among the targeted devices.
*
* @return self
*/
@@ -429,6 +443,60 @@ public function setActive($active)
return $this;
}
+
+ /**
+ * Gets blockedDevices
+ *
+ * @return int|null
+ */
+ public function getBlockedDevices()
+ {
+ return $this->container['blockedDevices'];
+ }
+
+ /**
+ * Sets blockedDevices
+ *
+ * @param int|null $blockedDevices Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity.
+ *
+ * @return self
+ */
+ public function setBlockedDevices($blockedDevices)
+ {
+ if (is_null($blockedDevices)) {
+ throw new \InvalidArgumentException('non-nullable blockedDevices cannot be null');
+ }
+ $this->container['blockedDevices'] = $blockedDevices;
+
+ return $this;
+ }
+
+ /**
+ * Gets targetedDevices
+ *
+ * @return int|null
+ */
+ public function getTargetedDevices()
+ {
+ return $this->container['targetedDevices'];
+ }
+
+ /**
+ * Sets targetedDevices
+ *
+ * @param int|null $targetedDevices Total number of targeted devices. Included only when targeted devices have mixed capacity.
+ *
+ * @return self
+ */
+ public function setTargetedDevices($targetedDevices)
+ {
+ if (is_null($targetedDevices)) {
+ throw new \InvalidArgumentException('non-nullable targetedDevices cannot be null');
+ }
+ $this->container['targetedDevices'] = $targetedDevices;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/generated/Model/LiveActivityStartRequest.php b/generated/Model/LiveActivityStartRequest.php
index ee43938..445118c 100644
--- a/generated/Model/LiveActivityStartRequest.php
+++ b/generated/Model/LiveActivityStartRequest.php
@@ -58,6 +58,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
'contentState' => '\ActivitySmith\Generated\Model\ContentStateStart',
'action' => '\ActivitySmith\Generated\Model\LiveActivityAction',
'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction',
@@ -74,6 +75,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
'contentState' => null,
'action' => null,
'secondaryAction' => null,
@@ -88,6 +90,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
'contentState' => false,
'action' => false,
'secondaryAction' => false,
@@ -182,6 +185,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
'contentState' => 'content_state',
'action' => 'action',
'secondaryAction' => 'secondary_action',
@@ -196,6 +200,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction',
@@ -210,6 +215,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction',
@@ -275,6 +281,7 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('contentState', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('secondaryAction', $data ?? [], null);
@@ -310,6 +317,10 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
if ($this->container['contentState'] === null) {
$invalidProperties[] = "'contentState' can't be null";
}
@@ -328,6 +339,37 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStartRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
/**
* Gets contentState
*
diff --git a/generated/Model/LiveActivityStreamDeleteRequest.php b/generated/Model/LiveActivityStreamDeleteRequest.php
index 39b7c85..3491a9f 100644
--- a/generated/Model/LiveActivityStreamDeleteRequest.php
+++ b/generated/Model/LiveActivityStreamDeleteRequest.php
@@ -58,6 +58,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
+ 'tags' => 'string[]',
'contentState' => '\ActivitySmith\Generated\Model\StreamContentState',
'action' => '\ActivitySmith\Generated\Model\LiveActivityAction',
'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction',
@@ -72,6 +74,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
+ 'tags' => null,
'contentState' => null,
'action' => null,
'secondaryAction' => null,
@@ -84,6 +88,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
+ 'tags' => false,
'contentState' => false,
'action' => false,
'secondaryAction' => false,
@@ -176,6 +182,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
+ 'tags' => 'tags',
'contentState' => 'content_state',
'action' => 'action',
'secondaryAction' => 'secondary_action',
@@ -188,6 +196,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
+ 'tags' => 'setTags',
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction',
@@ -200,6 +210,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
+ 'tags' => 'getTags',
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction',
@@ -263,6 +275,8 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
+ $this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('contentState', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('secondaryAction', $data ?? [], null);
@@ -296,6 +310,10 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
return $invalidProperties;
}
@@ -311,6 +329,64 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStreamDeleteRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
+ /**
+ * Gets tags
+ *
+ * @return string[]|null
+ */
+ public function getTags()
+ {
+ return $this->container['tags'];
+ }
+
+ /**
+ * Sets tags
+ *
+ * @param string[]|null $tags Optional tags to organize and filter notification history.
+ *
+ * @return self
+ */
+ public function setTags($tags)
+ {
+ if (is_null($tags)) {
+ throw new \InvalidArgumentException('non-nullable tags cannot be null');
+ }
+ $this->container['tags'] = $tags;
+
+ return $this;
+ }
+
/**
* Gets contentState
*
diff --git a/generated/Model/LiveActivityStreamRequest.php b/generated/Model/LiveActivityStreamRequest.php
index d31ca9d..9e7ac2d 100644
--- a/generated/Model/LiveActivityStreamRequest.php
+++ b/generated/Model/LiveActivityStreamRequest.php
@@ -58,6 +58,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
'contentState' => '\ActivitySmith\Generated\Model\StreamContentState',
'action' => '\ActivitySmith\Generated\Model\LiveActivityAction',
'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction',
@@ -75,6 +76,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
'contentState' => null,
'action' => null,
'secondaryAction' => null,
@@ -90,6 +92,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
'contentState' => false,
'action' => false,
'secondaryAction' => false,
@@ -185,6 +188,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
'contentState' => 'content_state',
'action' => 'action',
'secondaryAction' => 'secondary_action',
@@ -200,6 +204,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction',
@@ -215,6 +220,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction',
@@ -281,6 +287,7 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('contentState', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('secondaryAction', $data ?? [], null);
@@ -317,6 +324,10 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
if ($this->container['contentState'] === null) {
$invalidProperties[] = "'contentState' can't be null";
}
@@ -339,6 +350,37 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStreamRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
/**
* Gets contentState
*
diff --git a/generated/Model/LiveActivityUpdateRequest.php b/generated/Model/LiveActivityUpdateRequest.php
index b3bfc02..3dc121d 100644
--- a/generated/Model/LiveActivityUpdateRequest.php
+++ b/generated/Model/LiveActivityUpdateRequest.php
@@ -58,7 +58,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
'activityId' => 'string',
+ 'tags' => 'string[]',
'contentState' => '\ActivitySmith\Generated\Model\ContentStateUpdate',
'action' => '\ActivitySmith\Generated\Model\LiveActivityAction',
'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction'
@@ -72,7 +74,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
'activityId' => null,
+ 'tags' => null,
'contentState' => null,
'action' => null,
'secondaryAction' => null
@@ -84,7 +88,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
'activityId' => false,
+ 'tags' => false,
'contentState' => false,
'action' => false,
'secondaryAction' => false
@@ -176,7 +182,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
'activityId' => 'activity_id',
+ 'tags' => 'tags',
'contentState' => 'content_state',
'action' => 'action',
'secondaryAction' => 'secondary_action'
@@ -188,7 +196,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
'activityId' => 'setActivityId',
+ 'tags' => 'setTags',
'contentState' => 'setContentState',
'action' => 'setAction',
'secondaryAction' => 'setSecondaryAction'
@@ -200,7 +210,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
'activityId' => 'getActivityId',
+ 'tags' => 'getTags',
'contentState' => 'getContentState',
'action' => 'getAction',
'secondaryAction' => 'getSecondaryAction'
@@ -263,7 +275,9 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('activityId', $data ?? [], null);
+ $this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('contentState', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('secondaryAction', $data ?? [], null);
@@ -296,9 +310,17 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
if ($this->container['activityId'] === null) {
$invalidProperties[] = "'activityId' can't be null";
}
+ if (!is_null($this->container['tags']) && (count($this->container['tags']) > 20)) {
+ $invalidProperties[] = "invalid value for 'tags', number of items must be less than or equal to 20.";
+ }
+
if ($this->container['contentState'] === null) {
$invalidProperties[] = "'contentState' can't be null";
}
@@ -317,6 +339,37 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityUpdateRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
/**
* Gets activityId
*
@@ -344,6 +397,37 @@ public function setActivityId($activityId)
return $this;
}
+ /**
+ * Gets tags
+ *
+ * @return string[]|null
+ */
+ public function getTags()
+ {
+ return $this->container['tags'];
+ }
+
+ /**
+ * Sets tags
+ *
+ * @param string[]|null $tags Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
+ *
+ * @return self
+ */
+ public function setTags($tags)
+ {
+ if (is_null($tags)) {
+ throw new \InvalidArgumentException('non-nullable tags cannot be null');
+ }
+
+ if ((count($tags) > 20)) {
+ throw new \InvalidArgumentException('invalid value for $tags when calling LiveActivityUpdateRequest., number of items must be less than or equal to 20.');
+ }
+ $this->container['tags'] = $tags;
+
+ return $this;
+ }
+
/**
* Gets contentState
*
diff --git a/generated/Model/MetadataValue.php b/generated/Model/MetadataValue.php
new file mode 100644
index 0000000..8905c94
--- /dev/null
+++ b/generated/Model/MetadataValue.php
@@ -0,0 +1,381 @@
+
+ */
+class MetadataValue implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Metadata_value';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/generated/Model/PushNotificationAction.php b/generated/Model/PushNotificationAction.php
index 6b00712..0ee4f01 100644
--- a/generated/Model/PushNotificationAction.php
+++ b/generated/Model/PushNotificationAction.php
@@ -393,7 +393,7 @@ public function getUrl()
/**
* Sets url
*
- * @param string $url Action URL. For open_url, use an HTTP or HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend.
+ * @param string $url Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend.
*
* @return self
*/
diff --git a/generated/Model/PushNotificationRequest.php b/generated/Model/PushNotificationRequest.php
index c1b401e..95801e9 100644
--- a/generated/Model/PushNotificationRequest.php
+++ b/generated/Model/PushNotificationRequest.php
@@ -57,6 +57,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria
* @var string[]
*/
protected static $openAPITypes = [
+ 'metadata' => 'array',
'title' => 'string',
'message' => 'string',
'subtitle' => 'string',
@@ -78,6 +79,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'metadata' => null,
'title' => null,
'message' => null,
'subtitle' => null,
@@ -97,6 +99,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria
* @var boolean[]
*/
protected static array $openAPINullables = [
+ 'metadata' => false,
'title' => false,
'message' => false,
'subtitle' => false,
@@ -196,6 +199,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'metadata' => 'metadata',
'title' => 'title',
'message' => 'message',
'subtitle' => 'subtitle',
@@ -215,6 +219,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'metadata' => 'setMetadata',
'title' => 'setTitle',
'message' => 'setMessage',
'subtitle' => 'setSubtitle',
@@ -234,6 +239,7 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'metadata' => 'getMetadata',
'title' => 'getTitle',
'message' => 'getMessage',
'subtitle' => 'getSubtitle',
@@ -304,6 +310,7 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('title', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('subtitle', $data ?? [], null);
@@ -344,6 +351,10 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) {
+ $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50.";
+ }
+
if ($this->container['title'] === null) {
$invalidProperties[] = "'title' can't be null";
}
@@ -351,8 +362,12 @@ public function listInvalidProperties()
$invalidProperties[] = "invalid value for 'media', must be conform to the pattern /^https:\/\//.";
}
- if (!is_null($this->container['redirection']) && !preg_match("/^(http|https|shortcuts):\/\//", $this->container['redirection'])) {
- $invalidProperties[] = "invalid value for 'redirection', must be conform to the pattern /^(http|https|shortcuts):\/\//.";
+ if (!is_null($this->container['redirection']) && (mb_strlen($this->container['redirection']) > 2048)) {
+ $invalidProperties[] = "invalid value for 'redirection', the character length must be smaller than or equal to 2048.";
+ }
+
+ if (!is_null($this->container['redirection']) && !preg_match("/^[A-Za-z][A-Za-z0-9+.-]*:/", $this->container['redirection'])) {
+ $invalidProperties[] = "invalid value for 'redirection', must be conform to the pattern /^[A-Za-z][A-Za-z0-9+.-]*:/.";
}
if (!is_null($this->container['actions']) && (count($this->container['actions']) > 4)) {
@@ -374,6 +389,37 @@ public function valid()
}
+ /**
+ * Gets metadata
+ *
+ * @return array|null
+ */
+ public function getMetadata()
+ {
+ return $this->container['metadata'];
+ }
+
+ /**
+ * Sets metadata
+ *
+ * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
+ *
+ * @return self
+ */
+ public function setMetadata($metadata)
+ {
+ if (is_null($metadata)) {
+ throw new \InvalidArgumentException('non-nullable metadata cannot be null');
+ }
+
+ if ((count($metadata) > 50)) {
+ throw new \InvalidArgumentException('invalid value for $metadata when calling PushNotificationRequest., number of items must be less than or equal to 50.');
+ }
+ $this->container['metadata'] = $metadata;
+
+ return $this;
+ }
+
/**
* Gets title
*
@@ -500,7 +546,7 @@ public function getRedirection()
/**
* Sets redirection
*
- * @param string|null $redirection Optional HTTP URL, HTTPS URL, or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided.
+ * @param string|null $redirection Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
*
* @return self
*/
@@ -509,9 +555,11 @@ public function setRedirection($redirection)
if (is_null($redirection)) {
throw new \InvalidArgumentException('non-nullable redirection cannot be null');
}
-
- if ((!preg_match("/^(http|https|shortcuts):\/\//", ObjectSerializer::toString($redirection)))) {
- throw new \InvalidArgumentException("invalid value for \$redirection when calling PushNotificationRequest., must conform to the pattern /^(http|https|shortcuts):\/\//.");
+ if ((mb_strlen($redirection) > 2048)) {
+ throw new \InvalidArgumentException('invalid length for $redirection when calling PushNotificationRequest., must be smaller than or equal to 2048.');
+ }
+ if ((!preg_match("/^[A-Za-z][A-Za-z0-9+.-]*:/", ObjectSerializer::toString($redirection)))) {
+ throw new \InvalidArgumentException("invalid value for \$redirection when calling PushNotificationRequest., must conform to the pattern /^[A-Za-z][A-Za-z0-9+.-]*:/.");
}
$this->container['redirection'] = $redirection;
diff --git a/generated/Model/SendPushNotification429Response.php b/generated/Model/SendPushNotification429Response.php
index e9299ca..699a703 100644
--- a/generated/Model/SendPushNotification429Response.php
+++ b/generated/Model/SendPushNotification429Response.php
@@ -60,7 +60,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J
'error' => 'string',
'message' => 'string',
'limit' => 'int',
- 'active' => 'int'
+ 'active' => 'int',
+ 'blockedDevices' => 'int',
+ 'targetedDevices' => 'int'
];
/**
@@ -74,7 +76,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J
'error' => null,
'message' => null,
'limit' => null,
- 'active' => null
+ 'active' => null,
+ 'blockedDevices' => null,
+ 'targetedDevices' => null
];
/**
@@ -86,7 +90,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J
'error' => false,
'message' => false,
'limit' => false,
- 'active' => false
+ 'active' => false,
+ 'blockedDevices' => false,
+ 'targetedDevices' => false
];
/**
@@ -178,7 +184,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'error',
'message' => 'message',
'limit' => 'limit',
- 'active' => 'active'
+ 'active' => 'active',
+ 'blockedDevices' => 'blocked_devices',
+ 'targetedDevices' => 'targeted_devices'
];
/**
@@ -190,7 +198,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'setError',
'message' => 'setMessage',
'limit' => 'setLimit',
- 'active' => 'setActive'
+ 'active' => 'setActive',
+ 'blockedDevices' => 'setBlockedDevices',
+ 'targetedDevices' => 'setTargetedDevices'
];
/**
@@ -202,7 +212,9 @@ public function isNullableSetToNull(string $property): bool
'error' => 'getError',
'message' => 'getMessage',
'limit' => 'getLimit',
- 'active' => 'getActive'
+ 'active' => 'getActive',
+ 'blockedDevices' => 'getBlockedDevices',
+ 'targetedDevices' => 'getTargetedDevices'
];
/**
@@ -266,6 +278,8 @@ public function __construct(array $data = null)
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('limit', $data ?? [], null);
$this->setIfExists('active', $data ?? [], null);
+ $this->setIfExists('blockedDevices', $data ?? [], null);
+ $this->setIfExists('targetedDevices', $data ?? [], null);
}
/**
@@ -416,7 +430,7 @@ public function getActive()
/**
* Sets active
*
- * @param int $active Current number of active Live Activities.
+ * @param int $active Highest number of active Live Activities among the targeted devices.
*
* @return self
*/
@@ -429,6 +443,60 @@ public function setActive($active)
return $this;
}
+
+ /**
+ * Gets blockedDevices
+ *
+ * @return int|null
+ */
+ public function getBlockedDevices()
+ {
+ return $this->container['blockedDevices'];
+ }
+
+ /**
+ * Sets blockedDevices
+ *
+ * @param int|null $blockedDevices Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity.
+ *
+ * @return self
+ */
+ public function setBlockedDevices($blockedDevices)
+ {
+ if (is_null($blockedDevices)) {
+ throw new \InvalidArgumentException('non-nullable blockedDevices cannot be null');
+ }
+ $this->container['blockedDevices'] = $blockedDevices;
+
+ return $this;
+ }
+
+ /**
+ * Gets targetedDevices
+ *
+ * @return int|null
+ */
+ public function getTargetedDevices()
+ {
+ return $this->container['targetedDevices'];
+ }
+
+ /**
+ * Sets targetedDevices
+ *
+ * @param int|null $targetedDevices Total number of targeted devices. Included only when targeted devices have mixed capacity.
+ *
+ * @return self
+ */
+ public function setTargetedDevices($targetedDevices)
+ {
+ if (is_null($targetedDevices)) {
+ throw new \InvalidArgumentException('non-nullable targetedDevices cannot be null');
+ }
+ $this->container['targetedDevices'] = $targetedDevices;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/generated/Model/UpdateAppIconBadgeCount422Response.php b/generated/Model/UpdateAppIconBadgeCount422Response.php
new file mode 100644
index 0000000..9b314f0
--- /dev/null
+++ b/generated/Model/UpdateAppIconBadgeCount422Response.php
@@ -0,0 +1,748 @@
+
+ */
+class UpdateAppIconBadgeCount422Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'updateAppIconBadgeCount_422_response';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'error' => 'string',
+ 'message' => 'string',
+ 'effectiveChannelSlugs' => 'string[]',
+ 'code' => 'string',
+ 'badge' => 'int',
+ 'devicesTargeted' => 'int',
+ 'devicesUpdated' => 'int',
+ 'usersUpdated' => 'int',
+ 'devicesNotified' => 'int'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'error' => null,
+ 'message' => null,
+ 'effectiveChannelSlugs' => null,
+ 'code' => null,
+ 'badge' => null,
+ 'devicesTargeted' => null,
+ 'devicesUpdated' => null,
+ 'usersUpdated' => null,
+ 'devicesNotified' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'error' => false,
+ 'message' => false,
+ 'effectiveChannelSlugs' => false,
+ 'code' => false,
+ 'badge' => false,
+ 'devicesTargeted' => false,
+ 'devicesUpdated' => false,
+ 'usersUpdated' => false,
+ 'devicesNotified' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'error' => 'error',
+ 'message' => 'message',
+ 'effectiveChannelSlugs' => 'effective_channel_slugs',
+ 'code' => 'code',
+ 'badge' => 'badge',
+ 'devicesTargeted' => 'devices_targeted',
+ 'devicesUpdated' => 'devices_updated',
+ 'usersUpdated' => 'users_updated',
+ 'devicesNotified' => 'devices_notified'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'error' => 'setError',
+ 'message' => 'setMessage',
+ 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs',
+ 'code' => 'setCode',
+ 'badge' => 'setBadge',
+ 'devicesTargeted' => 'setDevicesTargeted',
+ 'devicesUpdated' => 'setDevicesUpdated',
+ 'usersUpdated' => 'setUsersUpdated',
+ 'devicesNotified' => 'setDevicesNotified'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'error' => 'getError',
+ 'message' => 'getMessage',
+ 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs',
+ 'code' => 'getCode',
+ 'badge' => 'getBadge',
+ 'devicesTargeted' => 'getDevicesTargeted',
+ 'devicesUpdated' => 'getDevicesUpdated',
+ 'usersUpdated' => 'getUsersUpdated',
+ 'devicesNotified' => 'getDevicesNotified'
+ ];
+
+ /**
+ * 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;
+ }
+
+ public const CODE_DEVICE_DISCONNECTED = 'badge_device_disconnected';
+ public const CODE_UPDATE_FAILED = 'badge_update_failed';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getCodeAllowableValues()
+ {
+ return [
+ self::CODE_DEVICE_DISCONNECTED,
+ self::CODE_UPDATE_FAILED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('error', $data ?? [], null);
+ $this->setIfExists('message', $data ?? [], null);
+ $this->setIfExists('effectiveChannelSlugs', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('badge', $data ?? [], null);
+ $this->setIfExists('devicesTargeted', $data ?? [], null);
+ $this->setIfExists('devicesUpdated', $data ?? [], null);
+ $this->setIfExists('usersUpdated', $data ?? [], null);
+ $this->setIfExists('devicesNotified', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['error'] === null) {
+ $invalidProperties[] = "'error' can't be null";
+ }
+ if ($this->container['message'] === null) {
+ $invalidProperties[] = "'message' can't be null";
+ }
+ if ($this->container['code'] === null) {
+ $invalidProperties[] = "'code' can't be null";
+ }
+ $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['badge'] === null) {
+ $invalidProperties[] = "'badge' can't be null";
+ }
+ if (($this->container['badge'] > 2147483647)) {
+ $invalidProperties[] = "invalid value for 'badge', must be smaller than or equal to 2147483647.";
+ }
+
+ if (($this->container['badge'] < 0)) {
+ $invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0.";
+ }
+
+ if ($this->container['devicesUpdated'] === null) {
+ $invalidProperties[] = "'devicesUpdated' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets error
+ *
+ * @return string
+ */
+ public function getError()
+ {
+ return $this->container['error'];
+ }
+
+ /**
+ * Sets error
+ *
+ * @param string $error error
+ *
+ * @return self
+ */
+ public function setError($error)
+ {
+ if (is_null($error)) {
+ throw new \InvalidArgumentException('non-nullable error cannot be null');
+ }
+ $this->container['error'] = $error;
+
+ return $this;
+ }
+
+ /**
+ * Gets message
+ *
+ * @return string
+ */
+ public function getMessage()
+ {
+ return $this->container['message'];
+ }
+
+ /**
+ * Sets message
+ *
+ * @param string $message message
+ *
+ * @return self
+ */
+ public function setMessage($message)
+ {
+ if (is_null($message)) {
+ throw new \InvalidArgumentException('non-nullable message cannot be null');
+ }
+ $this->container['message'] = $message;
+
+ return $this;
+ }
+
+ /**
+ * Gets effectiveChannelSlugs
+ *
+ * @return string[]|null
+ */
+ public function getEffectiveChannelSlugs()
+ {
+ return $this->container['effectiveChannelSlugs'];
+ }
+
+ /**
+ * Sets effectiveChannelSlugs
+ *
+ * @param string[]|null $effectiveChannelSlugs effectiveChannelSlugs
+ *
+ * @return self
+ */
+ public function setEffectiveChannelSlugs($effectiveChannelSlugs)
+ {
+ if (is_null($effectiveChannelSlugs)) {
+ throw new \InvalidArgumentException('non-nullable effectiveChannelSlugs cannot be null');
+ }
+ $this->container['effectiveChannelSlugs'] = $effectiveChannelSlugs;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string $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 badge
+ *
+ * @return int
+ */
+ public function getBadge()
+ {
+ return $this->container['badge'];
+ }
+
+ /**
+ * Sets badge
+ *
+ * @param int $badge badge
+ *
+ * @return self
+ */
+ public function setBadge($badge)
+ {
+ if (is_null($badge)) {
+ throw new \InvalidArgumentException('non-nullable badge cannot be null');
+ }
+
+ if (($badge > 2147483647)) {
+ throw new \InvalidArgumentException('invalid value for $badge when calling UpdateAppIconBadgeCount422Response., must be smaller than or equal to 2147483647.');
+ }
+ if (($badge < 0)) {
+ throw new \InvalidArgumentException('invalid value for $badge when calling UpdateAppIconBadgeCount422Response., must be bigger than or equal to 0.');
+ }
+
+ $this->container['badge'] = $badge;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesTargeted
+ *
+ * @return int|null
+ */
+ public function getDevicesTargeted()
+ {
+ return $this->container['devicesTargeted'];
+ }
+
+ /**
+ * Sets devicesTargeted
+ *
+ * @param int|null $devicesTargeted devicesTargeted
+ *
+ * @return self
+ */
+ public function setDevicesTargeted($devicesTargeted)
+ {
+ if (is_null($devicesTargeted)) {
+ throw new \InvalidArgumentException('non-nullable devicesTargeted cannot be null');
+ }
+ $this->container['devicesTargeted'] = $devicesTargeted;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesUpdated
+ *
+ * @return int
+ */
+ public function getDevicesUpdated()
+ {
+ return $this->container['devicesUpdated'];
+ }
+
+ /**
+ * Sets devicesUpdated
+ *
+ * @param int $devicesUpdated devicesUpdated
+ *
+ * @return self
+ */
+ public function setDevicesUpdated($devicesUpdated)
+ {
+ if (is_null($devicesUpdated)) {
+ throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null');
+ }
+ $this->container['devicesUpdated'] = $devicesUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets usersUpdated
+ *
+ * @return int|null
+ */
+ public function getUsersUpdated()
+ {
+ return $this->container['usersUpdated'];
+ }
+
+ /**
+ * Sets usersUpdated
+ *
+ * @param int|null $usersUpdated usersUpdated
+ *
+ * @return self
+ */
+ public function setUsersUpdated($usersUpdated)
+ {
+ if (is_null($usersUpdated)) {
+ throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null');
+ }
+ $this->container['usersUpdated'] = $usersUpdated;
+
+ return $this;
+ }
+
+ /**
+ * Gets devicesNotified
+ *
+ * @return int|null
+ * @deprecated
+ */
+ public function getDevicesNotified()
+ {
+ return $this->container['devicesNotified'];
+ }
+
+ /**
+ * Sets devicesNotified
+ *
+ * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setDevicesNotified($devicesNotified)
+ {
+ if (is_null($devicesNotified)) {
+ throw new \InvalidArgumentException('non-nullable devicesNotified cannot be null');
+ }
+ $this->container['devicesNotified'] = $devicesNotified;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/generated/ObjectSerializer.php b/generated/ObjectSerializer.php
index ac74510..35ceda4 100644
--- a/generated/ObjectSerializer.php
+++ b/generated/ObjectSerializer.php
@@ -77,7 +77,8 @@ public static function sanitizeForSerialization($data, $type = null, $format = n
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
}
- return $data;
+ // OpenAPI string-keyed maps must serialize as JSON objects, including {}.
+ return str_starts_with($type ?? '', 'arraybuildRequest($request, $contentState, [
@@ -70,8 +71,10 @@ public function start(
'target' => $target,
'channels' => $channels,
'tags' => $tags,
+ 'metadata' => $metadata,
]);
+ $request = Metadata::normalizeRequest($request);
return $this->api->startLiveActivity($this->normalizeTargetChannels($request));
}
@@ -96,7 +99,9 @@ public function update(
mixed $action = null,
mixed $durationSeconds = null,
mixed $countsDown = null,
- mixed $secondaryAction = null
+ mixed $secondaryAction = null,
+ ?array $tags = null,
+ array|\stdClass|null $metadata = null
): mixed
{
$request = $this->buildRequest($request, $contentState, [
@@ -118,10 +123,13 @@ public function update(
'step_color' => $stepColor,
], [
'activity_id' => $activityId,
+ 'tags' => $tags,
+ 'metadata' => $metadata,
'action' => $action,
'secondary_action' => $secondaryAction,
]);
+ $request = Metadata::normalizeRequest($request);
return $this->api->updateLiveActivity($request);
}
@@ -147,7 +155,9 @@ public function end(
mixed $action = null,
mixed $durationSeconds = null,
mixed $countsDown = null,
- mixed $secondaryAction = null
+ mixed $secondaryAction = null,
+ ?array $tags = null,
+ array|\stdClass|null $metadata = null
): mixed
{
$request = $this->buildRequest($request, $contentState, [
@@ -170,10 +180,13 @@ public function end(
'auto_dismiss_minutes' => $autoDismissMinutes,
], [
'activity_id' => $activityId,
+ 'tags' => $tags,
+ 'metadata' => $metadata,
'action' => $action,
'secondary_action' => $secondaryAction,
]);
+ $request = Metadata::normalizeRequest($request);
return $this->api->endLiveActivity($request);
}
@@ -202,7 +215,8 @@ public function stream(
mixed $durationSeconds = null,
mixed $countsDown = null,
mixed $secondaryAction = null,
- mixed $tags = null
+ mixed $tags = null,
+ array|\stdClass|null $metadata = null
): mixed
{
$request = $this->buildRequest($request, $contentState, [
@@ -229,8 +243,10 @@ public function stream(
'target' => $target,
'channels' => $channels,
'tags' => $tags,
+ 'metadata' => $metadata,
]);
+ $request = Metadata::normalizeRequest($request);
return $this->api->reconcileLiveActivityStream(
$streamKey,
$this->normalizeTargetChannels($request)
@@ -260,7 +276,9 @@ public function endStream(
mixed $alert = null,
mixed $durationSeconds = null,
mixed $countsDown = null,
- mixed $secondaryAction = null
+ mixed $secondaryAction = null,
+ ?array $tags = null,
+ array|\stdClass|null $metadata = null
): mixed
{
$request = $this->buildRequest($request, $contentState, [
@@ -285,9 +303,11 @@ public function endStream(
'action' => $action,
'secondary_action' => $secondaryAction,
'alert' => $alert,
+ 'tags' => $tags,
+ 'metadata' => $metadata,
]);
- return $this->api->endLiveActivityStream($streamKey, $request);
+ return $this->api->endLiveActivityStream($streamKey, Metadata::normalizeRequest($request));
}
// Backward-compatible aliases.
@@ -296,7 +316,7 @@ public function startLiveActivity(
string $contentType = LiveActivitiesApi::contentTypes['startLiveActivity'][0]
): mixed {
return $this->api->startLiveActivity(
- $this->normalizeTargetChannels($liveActivityStartRequest),
+ Metadata::normalizeRequest($this->normalizeTargetChannels($liveActivityStartRequest)),
$contentType
);
}
@@ -305,14 +325,14 @@ public function updateLiveActivity(
mixed $liveActivityUpdateRequest,
string $contentType = LiveActivitiesApi::contentTypes['updateLiveActivity'][0]
): mixed {
- return $this->api->updateLiveActivity($liveActivityUpdateRequest, $contentType);
+ return $this->api->updateLiveActivity(Metadata::normalizeRequest($liveActivityUpdateRequest), $contentType);
}
public function endLiveActivity(
mixed $liveActivityEndRequest,
string $contentType = LiveActivitiesApi::contentTypes['endLiveActivity'][0]
): mixed {
- return $this->api->endLiveActivity($liveActivityEndRequest, $contentType);
+ return $this->api->endLiveActivity(Metadata::normalizeRequest($liveActivityEndRequest), $contentType);
}
public function reconcileLiveActivityStream(
@@ -322,7 +342,7 @@ public function reconcileLiveActivityStream(
): mixed {
return $this->api->reconcileLiveActivityStream(
$streamKey,
- $this->normalizeTargetChannels($liveActivityStreamRequest),
+ Metadata::normalizeRequest($this->normalizeTargetChannels($liveActivityStreamRequest)),
$contentType
);
}
@@ -334,7 +354,7 @@ public function endLiveActivityStream(
): mixed {
return $this->api->endLiveActivityStream(
$streamKey,
- $liveActivityStreamDeleteRequest,
+ Metadata::normalizeRequest($liveActivityStreamDeleteRequest),
$contentType
);
}
diff --git a/src/Metadata.php b/src/Metadata.php
new file mode 100644
index 0000000..a98bf93
--- /dev/null
+++ b/src/Metadata.php
@@ -0,0 +1,23 @@
+buildRequest(
@@ -44,9 +45,10 @@ public function send(
'target' => $target,
'channels' => $channels,
'tags' => $tags,
+ 'metadata' => $metadata,
]
);
- $normalized = $this->normalizeTargetChannels($request);
+ $normalized = Metadata::normalizeRequest($this->normalizeTargetChannels($request));
$this->assertValidMediaActionsCombination($normalized);
return $this->api->sendPushNotification($normalized);
@@ -64,7 +66,8 @@ public function sendPushNotification(
?array $actions = null,
?array $target = null,
array|string|null $channels = null,
- ?array $tags = null
+ ?array $tags = null,
+ array|\stdClass|null $metadata = null
): mixed {
$pushNotificationRequest = $this->buildRequest(
$pushNotificationRequest,
@@ -78,9 +81,10 @@ public function sendPushNotification(
'target' => $target,
'channels' => $channels,
'tags' => $tags,
+ 'metadata' => $metadata,
]
);
- $normalized = $this->normalizeTargetChannels($pushNotificationRequest);
+ $normalized = Metadata::normalizeRequest($this->normalizeTargetChannels($pushNotificationRequest));
$this->assertValidMediaActionsCombination($normalized);
return $this->api->sendPushNotification(
diff --git a/src/Version.php b/src/Version.php
index d06131d..f85dda6 100644
--- a/src/Version.php
+++ b/src/Version.php
@@ -6,7 +6,7 @@
final class Version
{
- public const VERSION = '1.10.0';
+ public const VERSION = '1.11.0';
private function __construct()
{
diff --git a/tests/ResourcesTest.php b/tests/ResourcesTest.php
index 34a5dad..611d979 100644
--- a/tests/ResourcesTest.php
+++ b/tests/ResourcesTest.php
@@ -27,6 +27,74 @@
final class ResourcesTest extends TestCase
{
+ public function testExternalPushURLsAndStreamEndFields(): void
+ {
+ foreach (['http://example.com', 'https://example.com', 'shortcuts://run-shortcut?name=Test', 'spotify://', 'spotify:track:123'] as $url) {
+ $request = new GeneratedPushNotificationRequest(['title' => 'Job', 'redirection' => $url]);
+ $body = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($request)), true);
+ $this->assertSame($url, $body['redirection']);
+ }
+ foreach ([null, [], ['finished']] as $tags) {
+ $api = $this->getMockBuilder(LiveActivitiesApi::class)->disableOriginalConstructor()->onlyMethods(['endLiveActivityStream'])->getMock();
+ $api->expects($this->once())->method('endLiveActivityStream')->willReturnCallback(function ($key, $request) use ($tags) {
+ $body = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($request)), true);
+ $this->assertSame($tags !== null, array_key_exists('tags', $body));
+ if ($tags !== null) $this->assertSame($tags, $body['tags']);
+ return (object) ['success' => true];
+ });
+ (new LiveActivities($api))->endStream('job', tags: $tags, metadata: []);
+ }
+ }
+
+ public function testMetadataPreservesScalarsAndEmptyObjects(): void
+ {
+ foreach (['send' => 'sendPushNotification', 'start' => 'startLiveActivity', 'update' => 'updateLiveActivity', 'end' => 'endLiveActivity', 'stream' => 'reconcileLiveActivityStream', 'endStream' => 'endLiveActivityStream'] as $method => $apiMethod) {
+ $class = $method === 'send' ? PushNotificationsApi::class : LiveActivitiesApi::class;
+ $api = $this->getMockBuilder($class)->disableOriginalConstructor()->onlyMethods([$apiMethod])->getMock();
+ $captured = [];
+ $api->method($apiMethod)->willReturnCallback(function (...$args) use (&$captured, $method) {
+ $request = $args[in_array($method, ['stream', 'endStream']) ? 1 : 0];
+ $captured[] = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($request)));
+ return (object) ['success' => true];
+ });
+ $resource = $method === 'send' ? new Notifications($api) : new LiveActivities($api);
+ foreach ([null, [], ['order' => '382', 'ready' => false, 'count' => 0, 'empty' => '', 'ratio' => 1.25]] as $metadata) {
+ if (in_array($method, ['stream', 'endStream'])) $resource->$method('job', title: 'Job', metadata: $metadata);
+ else $resource->$method(title: 'Job', metadata: $metadata);
+ $body = end($captured);
+ $this->assertSame($metadata !== null, property_exists($body, 'metadata'));
+ if ($metadata !== null) $this->assertEquals((object) $metadata, $body->metadata);
+ }
+ }
+ $model = new \ActivitySmith\Generated\Model\LiveActivityUpdateRequest(['activityId' => 'a', 'metadata' => [], 'contentState' => ['title' => 'Job']]);
+ $body = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($model)));
+ $this->assertInstanceOf(\stdClass::class, $body->metadata);
+ }
+
+ public function testLegacyTagsSerializeEmptyArraysAndOmitNull(): void
+ {
+ foreach (['update' => 'updateLiveActivity', 'end' => 'endLiveActivity'] as $method => $apiMethod) {
+ $api = $this->getMockBuilder(LiveActivitiesApi::class)->disableOriginalConstructor()->onlyMethods([$apiMethod])->getMock();
+ $captured = [];
+ $api->method($apiMethod)->willReturnCallback(function ($request) use (&$captured) {
+ $captured[] = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($request)), true);
+ return (object) ['success' => true];
+ });
+ $resource = new LiveActivities($api);
+ foreach ([null, ['billing'], []] as $tags) {
+ $resource->$method(activityId: 'activity-1', title: 'Job', tags: $tags);
+ $body = end($captured);
+ $this->assertSame($tags !== null, array_key_exists('tags', $body));
+ if ($tags !== null) $this->assertSame($tags, $body['tags']);
+ $class = $method === 'update' ? \ActivitySmith\Generated\Model\LiveActivityUpdateRequest::class : \ActivitySmith\Generated\Model\LiveActivityEndRequest::class;
+ $model = new $class($body);
+ $serialized = json_decode(json_encode(\ActivitySmith\Generated\ObjectSerializer::sanitizeForSerialization($model)), true);
+ $this->assertSame($tags !== null, array_key_exists('tags', $serialized));
+ if ($tags !== null) $this->assertSame($tags, $serialized['tags']);
+ }
+ }
+ }
+
public function testBadgeCountClearsAndTargetsChannels(): void
{
$client = new ActivitySmith('test');
diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php
index f8cf7af..0e691d2 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.10.0', Version::VERSION);
+ $this->assertSame('1.11.0', Version::VERSION);
}
}