From 34715e2868e1ff9d5c4ea0046a964b94df9b7ba4 Mon Sep 17 00:00:00 2001 From: activitysmith-bot Date: Mon, 12 Oct 2026 03:56:31 +0000 Subject: [PATCH 1/4] chore: regenerate SDK --- generated/Api/PushNotificationsApi.php | 581 +++++++++++++ .../Model/AppIconBadgeCountUpdateResponse.php | 114 ++- generated/Model/LiveActivityEndResponse.php | 223 ++++- generated/Model/LiveActivityStartResponse.php | 114 ++- .../LiveActivityStreamDeleteResponse.php | 182 +++- .../Model/LiveActivityStreamPutResponse.php | 182 +++- .../Model/LiveActivityUpdateResponse.php | 250 +++++- .../Model/PushNotificationReplaceRequest.php | 802 ++++++++++++++++++ .../Model/PushNotificationReplaceResponse.php | 623 ++++++++++++++ generated/Model/PushNotificationResponse.php | 216 ++++- generated/openapi-source.json | 4 +- 11 files changed, 3247 insertions(+), 44 deletions(-) create mode 100644 generated/Model/PushNotificationReplaceRequest.php create mode 100644 generated/Model/PushNotificationReplaceResponse.php diff --git a/generated/Api/PushNotificationsApi.php b/generated/Api/PushNotificationsApi.php index e8d3ecb..2af0edd 100644 --- a/generated/Api/PushNotificationsApi.php +++ b/generated/Api/PushNotificationsApi.php @@ -71,6 +71,9 @@ class PushNotificationsApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'replacePushNotification' => [ + 'application/json', + ], 'sendPushNotification' => [ 'application/json', ], @@ -122,6 +125,584 @@ public function getConfig() return $this->config; } + /** + * Operation replacePushNotification + * + * Replace a push notification + * + * @param string $notificationId The `notification_id` returned when the Push Notification was sent. (required) + * @param \ActivitySmith\Generated\Model\PushNotificationReplaceRequest $pushNotificationReplaceRequest pushNotificationReplaceRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replacePushNotification'] to see the possible values for this operation + * + * @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\PushNotificationReplaceResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\BillingBlockedError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response + */ + public function replacePushNotification($notificationId, $pushNotificationReplaceRequest, string $contentType = self::contentTypes['replacePushNotification'][0]) + { + list($response) = $this->replacePushNotificationWithHttpInfo($notificationId, $pushNotificationReplaceRequest, $contentType); + return $response; + } + + /** + * Operation replacePushNotificationWithHttpInfo + * + * Replace a push notification + * + * @param string $notificationId The `notification_id` returned when the Push Notification was sent. (required) + * @param \ActivitySmith\Generated\Model\PushNotificationReplaceRequest $pushNotificationReplaceRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replacePushNotification'] to see the possible values for this operation + * + * @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\PushNotificationReplaceResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\BillingBlockedError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response, HTTP status code, HTTP response headers (array of strings) + */ + public function replacePushNotificationWithHttpInfo($notificationId, $pushNotificationReplaceRequest, string $contentType = self::contentTypes['replacePushNotification'][0]) + { + $request = $this->replacePushNotificationRequest($notificationId, $pushNotificationReplaceRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\ActivitySmith\Generated\Model\PushNotificationReplaceResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\PushNotificationReplaceResponse' !== '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\PushNotificationReplaceResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\ActivitySmith\Generated\Model\BadRequestError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\BadRequestError' !== '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\BadRequestError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\ActivitySmith\Generated\Model\BillingBlockedError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\BillingBlockedError' !== '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\BillingBlockedError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\ActivitySmith\Generated\Model\ForbiddenError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\ForbiddenError' !== '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\ForbiddenError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\ActivitySmith\Generated\Model\NotFoundError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\NotFoundError' !== '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\NotFoundError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\ActivitySmith\Generated\Model\NotFoundError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\NotFoundError' !== '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\NotFoundError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\ActivitySmith\Generated\Model\NoRecipientsError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\NoRecipientsError' !== '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\NoRecipientsError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\ActivitySmith\Generated\Model\SendPushNotification429Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\SendPushNotification429Response' !== '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\SendPushNotification429Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\ActivitySmith\Generated\Model\PushNotificationReplaceResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== '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, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\PushNotificationReplaceResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\BadRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\BillingBlockedError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\ForbiddenError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\NotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\NotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\NoRecipientsError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\SendPushNotification429Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation replacePushNotificationAsync + * + * Replace a push notification + * + * @param string $notificationId The `notification_id` returned when the Push Notification was sent. (required) + * @param \ActivitySmith\Generated\Model\PushNotificationReplaceRequest $pushNotificationReplaceRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replacePushNotification'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replacePushNotificationAsync($notificationId, $pushNotificationReplaceRequest, string $contentType = self::contentTypes['replacePushNotification'][0]) + { + return $this->replacePushNotificationAsyncWithHttpInfo($notificationId, $pushNotificationReplaceRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation replacePushNotificationAsyncWithHttpInfo + * + * Replace a push notification + * + * @param string $notificationId The `notification_id` returned when the Push Notification was sent. (required) + * @param \ActivitySmith\Generated\Model\PushNotificationReplaceRequest $pushNotificationReplaceRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replacePushNotification'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replacePushNotificationAsyncWithHttpInfo($notificationId, $pushNotificationReplaceRequest, string $contentType = self::contentTypes['replacePushNotification'][0]) + { + $returnType = '\ActivitySmith\Generated\Model\PushNotificationReplaceResponse'; + $request = $this->replacePushNotificationRequest($notificationId, $pushNotificationReplaceRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'replacePushNotification' + * + * @param string $notificationId The `notification_id` returned when the Push Notification was sent. (required) + * @param \ActivitySmith\Generated\Model\PushNotificationReplaceRequest $pushNotificationReplaceRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replacePushNotification'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function replacePushNotificationRequest($notificationId, $pushNotificationReplaceRequest, string $contentType = self::contentTypes['replacePushNotification'][0]) + { + + // verify the required parameter 'notificationId' is set + if ($notificationId === null || (is_array($notificationId) && count($notificationId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $notificationId when calling replacePushNotification' + ); + } + if (strlen($notificationId) < 1) { + throw new \InvalidArgumentException('invalid length for "$notificationId" when calling PushNotificationsApi.replacePushNotification, must be bigger than or equal to 1.'); + } + + // verify the required parameter 'pushNotificationReplaceRequest' is set + if ($pushNotificationReplaceRequest === null || (is_array($pushNotificationReplaceRequest) && count($pushNotificationReplaceRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pushNotificationReplaceRequest when calling replacePushNotification' + ); + } + + + $resourcePath = '/push-notification/{notification_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($notificationId !== null) { + $resourcePath = str_replace( + '{' . 'notification_id' . '}', + ObjectSerializer::toPathValue($notificationId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($pushNotificationReplaceRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pushNotificationReplaceRequest)); + } else { + $httpBody = $pushNotificationReplaceRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer (API Key) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation sendPushNotification * diff --git a/generated/Model/AppIconBadgeCountUpdateResponse.php b/generated/Model/AppIconBadgeCountUpdateResponse.php index 2a526ac..022db8d 100644 --- a/generated/Model/AppIconBadgeCountUpdateResponse.php +++ b/generated/Model/AppIconBadgeCountUpdateResponse.php @@ -64,7 +64,10 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J 'devicesNotified' => 'int', 'usersNotified' => 'int', 'effectiveChannelSlugs' => 'string[]', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'devicesTargeted' => 'int', + 'devicesDeactivated' => 'int', + 'devicesUnregistered' => 'int' ]; /** @@ -82,7 +85,10 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J 'devicesNotified' => null, 'usersNotified' => null, 'effectiveChannelSlugs' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'devicesTargeted' => null, + 'devicesDeactivated' => null, + 'devicesUnregistered' => null ]; /** @@ -98,7 +104,10 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J 'devicesNotified' => false, 'usersNotified' => false, 'effectiveChannelSlugs' => false, - 'timestamp' => false + 'timestamp' => false, + 'devicesTargeted' => false, + 'devicesDeactivated' => false, + 'devicesUnregistered' => false ]; /** @@ -194,7 +203,10 @@ public function isNullableSetToNull(string $property): bool 'devicesNotified' => 'devices_notified', 'usersNotified' => 'users_notified', 'effectiveChannelSlugs' => 'effective_channel_slugs', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'devicesTargeted' => 'devices_targeted', + 'devicesDeactivated' => 'devices_deactivated', + 'devicesUnregistered' => 'devices_unregistered' ]; /** @@ -210,7 +222,10 @@ public function isNullableSetToNull(string $property): bool 'devicesNotified' => 'setDevicesNotified', 'usersNotified' => 'setUsersNotified', 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'devicesTargeted' => 'setDevicesTargeted', + 'devicesDeactivated' => 'setDevicesDeactivated', + 'devicesUnregistered' => 'setDevicesUnregistered' ]; /** @@ -226,7 +241,10 @@ public function isNullableSetToNull(string $property): bool 'devicesNotified' => 'getDevicesNotified', 'usersNotified' => 'getUsersNotified', 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'devicesTargeted' => 'getDevicesTargeted', + 'devicesDeactivated' => 'getDevicesDeactivated', + 'devicesUnregistered' => 'getDevicesUnregistered' ]; /** @@ -294,6 +312,9 @@ public function __construct(array $data = null) $this->setIfExists('usersNotified', $data ?? [], null); $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('devicesTargeted', $data ?? [], null); + $this->setIfExists('devicesDeactivated', $data ?? [], null); + $this->setIfExists('devicesUnregistered', $data ?? [], null); } /** @@ -591,6 +612,87 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets devicesTargeted + * + * @return int|null + */ + public function getDevicesTargeted() + { + return $this->container['devicesTargeted']; + } + + /** + * Sets devicesTargeted + * + * @param int|null $devicesTargeted Number of device tokens targeted. + * + * @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 devicesDeactivated + * + * @return int|null + */ + public function getDevicesDeactivated() + { + return $this->container['devicesDeactivated']; + } + + /** + * Sets devicesDeactivated + * + * @param int|null $devicesDeactivated Number of device tokens deactivated because APNs reported them unregistered. + * + * @return self + */ + public function setDevicesDeactivated($devicesDeactivated) + { + if (is_null($devicesDeactivated)) { + throw new \InvalidArgumentException('non-nullable devicesDeactivated cannot be null'); + } + $this->container['devicesDeactivated'] = $devicesDeactivated; + + return $this; + } + + /** + * Gets devicesUnregistered + * + * @return int|null + */ + public function getDevicesUnregistered() + { + return $this->container['devicesUnregistered']; + } + + /** + * Sets devicesUnregistered + * + * @param int|null $devicesUnregistered Number of targeted device tokens APNs reported as unregistered. + * + * @return self + */ + public function setDevicesUnregistered($devicesUnregistered) + { + if (is_null($devicesUnregistered)) { + throw new \InvalidArgumentException('non-nullable devicesUnregistered cannot be null'); + } + $this->container['devicesUnregistered'] = $devicesUnregistered; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityEndResponse.php b/generated/Model/LiveActivityEndResponse.php index 5529391..9b8d9a5 100644 --- a/generated/Model/LiveActivityEndResponse.php +++ b/generated/Model/LiveActivityEndResponse.php @@ -62,7 +62,13 @@ class LiveActivityEndResponse implements ModelInterface, ArrayAccess, \JsonSeria 'activityId' => 'string', 'devicesQueued' => 'int', 'devicesNotified' => 'int', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'ignored' => 'bool', + 'message' => 'string', + 'endReason' => 'string', + 'forcedCompletion' => 'bool', + 'warning' => 'string', + 'errors' => 'string[]' ]; /** @@ -77,7 +83,13 @@ class LiveActivityEndResponse implements ModelInterface, ArrayAccess, \JsonSeria 'activityId' => null, 'devicesQueued' => null, 'devicesNotified' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'ignored' => null, + 'message' => null, + 'endReason' => null, + 'forcedCompletion' => null, + 'warning' => null, + 'errors' => null ]; /** @@ -90,7 +102,13 @@ class LiveActivityEndResponse implements ModelInterface, ArrayAccess, \JsonSeria 'activityId' => false, 'devicesQueued' => false, 'devicesNotified' => false, - 'timestamp' => false + 'timestamp' => false, + 'ignored' => false, + 'message' => false, + 'endReason' => true, + 'forcedCompletion' => false, + 'warning' => false, + 'errors' => false ]; /** @@ -183,7 +201,13 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'activity_id', 'devicesQueued' => 'devices_queued', 'devicesNotified' => 'devices_notified', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'ignored' => 'ignored', + 'message' => 'message', + 'endReason' => 'end_reason', + 'forcedCompletion' => 'forced_completion', + 'warning' => 'warning', + 'errors' => 'errors' ]; /** @@ -196,7 +220,13 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'setActivityId', 'devicesQueued' => 'setDevicesQueued', 'devicesNotified' => 'setDevicesNotified', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'ignored' => 'setIgnored', + 'message' => 'setMessage', + 'endReason' => 'setEndReason', + 'forcedCompletion' => 'setForcedCompletion', + 'warning' => 'setWarning', + 'errors' => 'setErrors' ]; /** @@ -209,7 +239,13 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'getActivityId', 'devicesQueued' => 'getDevicesQueued', 'devicesNotified' => 'getDevicesNotified', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'ignored' => 'getIgnored', + 'message' => 'getMessage', + 'endReason' => 'getEndReason', + 'forcedCompletion' => 'getForcedCompletion', + 'warning' => 'getWarning', + 'errors' => 'getErrors' ]; /** @@ -274,6 +310,12 @@ public function __construct(array $data = null) $this->setIfExists('devicesQueued', $data ?? [], null); $this->setIfExists('devicesNotified', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('ignored', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('endReason', $data ?? [], null); + $this->setIfExists('forcedCompletion', $data ?? [], null); + $this->setIfExists('warning', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); } /** @@ -461,6 +503,175 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets ignored + * + * @return bool|null + */ + public function getIgnored() + { + return $this->container['ignored']; + } + + /** + * Sets ignored + * + * @param bool|null $ignored True when the Live Activity had already ended and the request had no effect. + * + * @return self + */ + public function setIgnored($ignored) + { + if (is_null($ignored)) { + throw new \InvalidArgumentException('non-nullable ignored cannot be null'); + } + $this->container['ignored'] = $ignored; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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 endReason + * + * @return string|null + */ + public function getEndReason() + { + return $this->container['endReason']; + } + + /** + * Sets endReason + * + * @param string|null $endReason endReason + * + * @return self + */ + public function setEndReason($endReason) + { + if (is_null($endReason)) { + array_push($this->openAPINullablesSetToNull, 'endReason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endReason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endReason'] = $endReason; + + return $this; + } + + /** + * Gets forcedCompletion + * + * @return bool|null + */ + public function getForcedCompletion() + { + return $this->container['forcedCompletion']; + } + + /** + * Sets forcedCompletion + * + * @param bool|null $forcedCompletion True when the Live Activity was marked complete without a confirmed APNs end delivery. + * + * @return self + */ + public function setForcedCompletion($forcedCompletion) + { + if (is_null($forcedCompletion)) { + throw new \InvalidArgumentException('non-nullable forcedCompletion cannot be null'); + } + $this->container['forcedCompletion'] = $forcedCompletion; + + return $this; + } + + /** + * Gets warning + * + * @return string|null + */ + public function getWarning() + { + return $this->container['warning']; + } + + /** + * Sets warning + * + * @param string|null $warning warning + * + * @return self + */ + public function setWarning($warning) + { + if (is_null($warning)) { + throw new \InvalidArgumentException('non-nullable warning cannot be null'); + } + $this->container['warning'] = $warning; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Per-device delivery errors when some devices could not be reached. + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStartResponse.php b/generated/Model/LiveActivityStartResponse.php index 879dcb1..31504a0 100644 --- a/generated/Model/LiveActivityStartResponse.php +++ b/generated/Model/LiveActivityStartResponse.php @@ -64,7 +64,10 @@ class LiveActivityStartResponse implements ModelInterface, ArrayAccess, \JsonSer 'activityId' => 'string', 'effectiveChannelSlugs' => 'string[]', 'tags' => 'string[]', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'endedActivityId' => 'string', + 'message' => 'string', + 'errors' => 'string[]' ]; /** @@ -81,7 +84,10 @@ class LiveActivityStartResponse implements ModelInterface, ArrayAccess, \JsonSer 'activityId' => null, 'effectiveChannelSlugs' => null, 'tags' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'endedActivityId' => null, + 'message' => null, + 'errors' => null ]; /** @@ -96,7 +102,10 @@ class LiveActivityStartResponse implements ModelInterface, ArrayAccess, \JsonSer 'activityId' => false, 'effectiveChannelSlugs' => false, 'tags' => false, - 'timestamp' => false + 'timestamp' => false, + 'endedActivityId' => false, + 'message' => false, + 'errors' => false ]; /** @@ -191,7 +200,10 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'activity_id', 'effectiveChannelSlugs' => 'effective_channel_slugs', 'tags' => 'tags', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'endedActivityId' => 'ended_activity_id', + 'message' => 'message', + 'errors' => 'errors' ]; /** @@ -206,7 +218,10 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'setActivityId', 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', 'tags' => 'setTags', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'endedActivityId' => 'setEndedActivityId', + 'message' => 'setMessage', + 'errors' => 'setErrors' ]; /** @@ -221,7 +236,10 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'getActivityId', 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', 'tags' => 'getTags', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'endedActivityId' => 'getEndedActivityId', + 'message' => 'getMessage', + 'errors' => 'getErrors' ]; /** @@ -288,6 +306,9 @@ public function __construct(array $data = null) $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('endedActivityId', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); } /** @@ -529,6 +550,87 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets endedActivityId + * + * @return string|null + */ + public function getEndedActivityId() + { + return $this->container['endedActivityId']; + } + + /** + * Sets endedActivityId + * + * @param string|null $endedActivityId Present when starting this Live Activity ended an older one to stay within the device limit. + * + * @return self + */ + public function setEndedActivityId($endedActivityId) + { + if (is_null($endedActivityId)) { + throw new \InvalidArgumentException('non-nullable endedActivityId cannot be null'); + } + $this->container['endedActivityId'] = $endedActivityId; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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 errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Per-device delivery errors when some devices could not be reached. + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStreamDeleteResponse.php b/generated/Model/LiveActivityStreamDeleteResponse.php index ee420c3..6af99a6 100644 --- a/generated/Model/LiveActivityStreamDeleteResponse.php +++ b/generated/Model/LiveActivityStreamDeleteResponse.php @@ -64,7 +64,12 @@ class LiveActivityStreamDeleteResponse implements ModelInterface, ArrayAccess, \ 'activityId' => 'string', 'devicesQueued' => 'int', 'devicesNotified' => 'int', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'ignored' => 'bool', + 'message' => 'string', + 'forcedCompletion' => 'bool', + 'warning' => 'string', + 'errors' => 'string[]' ]; /** @@ -81,7 +86,12 @@ class LiveActivityStreamDeleteResponse implements ModelInterface, ArrayAccess, \ 'activityId' => null, 'devicesQueued' => null, 'devicesNotified' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'ignored' => null, + 'message' => null, + 'forcedCompletion' => null, + 'warning' => null, + 'errors' => null ]; /** @@ -96,7 +106,12 @@ class LiveActivityStreamDeleteResponse implements ModelInterface, ArrayAccess, \ 'activityId' => true, 'devicesQueued' => false, 'devicesNotified' => false, - 'timestamp' => false + 'timestamp' => false, + 'ignored' => false, + 'message' => false, + 'forcedCompletion' => false, + 'warning' => false, + 'errors' => false ]; /** @@ -191,7 +206,12 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'activity_id', 'devicesQueued' => 'devices_queued', 'devicesNotified' => 'devices_notified', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'ignored' => 'ignored', + 'message' => 'message', + 'forcedCompletion' => 'forced_completion', + 'warning' => 'warning', + 'errors' => 'errors' ]; /** @@ -206,7 +226,12 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'setActivityId', 'devicesQueued' => 'setDevicesQueued', 'devicesNotified' => 'setDevicesNotified', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'ignored' => 'setIgnored', + 'message' => 'setMessage', + 'forcedCompletion' => 'setForcedCompletion', + 'warning' => 'setWarning', + 'errors' => 'setErrors' ]; /** @@ -221,7 +246,12 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'getActivityId', 'devicesQueued' => 'getDevicesQueued', 'devicesNotified' => 'getDevicesNotified', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'ignored' => 'getIgnored', + 'message' => 'getMessage', + 'forcedCompletion' => 'getForcedCompletion', + 'warning' => 'getWarning', + 'errors' => 'getErrors' ]; /** @@ -301,6 +331,11 @@ public function __construct(array $data = null) $this->setIfExists('devicesQueued', $data ?? [], null); $this->setIfExists('devicesNotified', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('ignored', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('forcedCompletion', $data ?? [], null); + $this->setIfExists('warning', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); } /** @@ -571,6 +606,141 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets ignored + * + * @return bool|null + */ + public function getIgnored() + { + return $this->container['ignored']; + } + + /** + * Sets ignored + * + * @param bool|null $ignored True when the stream was already ended and the request had no effect. + * + * @return self + */ + public function setIgnored($ignored) + { + if (is_null($ignored)) { + throw new \InvalidArgumentException('non-nullable ignored cannot be null'); + } + $this->container['ignored'] = $ignored; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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 forcedCompletion + * + * @return bool|null + */ + public function getForcedCompletion() + { + return $this->container['forcedCompletion']; + } + + /** + * Sets forcedCompletion + * + * @param bool|null $forcedCompletion forcedCompletion + * + * @return self + */ + public function setForcedCompletion($forcedCompletion) + { + if (is_null($forcedCompletion)) { + throw new \InvalidArgumentException('non-nullable forcedCompletion cannot be null'); + } + $this->container['forcedCompletion'] = $forcedCompletion; + + return $this; + } + + /** + * Gets warning + * + * @return string|null + */ + public function getWarning() + { + return $this->container['warning']; + } + + /** + * Sets warning + * + * @param string|null $warning warning + * + * @return self + */ + public function setWarning($warning) + { + if (is_null($warning)) { + throw new \InvalidArgumentException('non-nullable warning cannot be null'); + } + $this->container['warning'] = $warning; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Per-device delivery errors when some devices could not be reached. + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStreamPutResponse.php b/generated/Model/LiveActivityStreamPutResponse.php index e1c0e7e..7db9d6b 100644 --- a/generated/Model/LiveActivityStreamPutResponse.php +++ b/generated/Model/LiveActivityStreamPutResponse.php @@ -68,7 +68,12 @@ class LiveActivityStreamPutResponse implements ModelInterface, ArrayAccess, \Jso 'usersNotified' => 'int', 'effectiveChannelSlugs' => 'string[]', 'tags' => 'string[]', - 'timestamp' => '\DateTime' + 'warning' => 'string', + 'timestamp' => '\DateTime', + 'ignored' => 'bool', + 'remotePushSent' => 'bool', + 'message' => 'string', + 'errors' => 'string[]' ]; /** @@ -89,7 +94,12 @@ class LiveActivityStreamPutResponse implements ModelInterface, ArrayAccess, \Jso 'usersNotified' => null, 'effectiveChannelSlugs' => null, 'tags' => null, - 'timestamp' => 'date-time' + 'warning' => null, + 'timestamp' => 'date-time', + 'ignored' => null, + 'remotePushSent' => null, + 'message' => null, + 'errors' => null ]; /** @@ -108,7 +118,12 @@ class LiveActivityStreamPutResponse implements ModelInterface, ArrayAccess, \Jso 'usersNotified' => false, 'effectiveChannelSlugs' => false, 'tags' => false, - 'timestamp' => false + 'warning' => false, + 'timestamp' => false, + 'ignored' => false, + 'remotePushSent' => false, + 'message' => false, + 'errors' => false ]; /** @@ -207,7 +222,12 @@ public function isNullableSetToNull(string $property): bool 'usersNotified' => 'users_notified', 'effectiveChannelSlugs' => 'effective_channel_slugs', 'tags' => 'tags', - 'timestamp' => 'timestamp' + 'warning' => 'warning', + 'timestamp' => 'timestamp', + 'ignored' => 'ignored', + 'remotePushSent' => 'remote_push_sent', + 'message' => 'message', + 'errors' => 'errors' ]; /** @@ -226,7 +246,12 @@ public function isNullableSetToNull(string $property): bool 'usersNotified' => 'setUsersNotified', 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', 'tags' => 'setTags', - 'timestamp' => 'setTimestamp' + 'warning' => 'setWarning', + 'timestamp' => 'setTimestamp', + 'ignored' => 'setIgnored', + 'remotePushSent' => 'setRemotePushSent', + 'message' => 'setMessage', + 'errors' => 'setErrors' ]; /** @@ -245,7 +270,12 @@ public function isNullableSetToNull(string $property): bool 'usersNotified' => 'getUsersNotified', 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', 'tags' => 'getTags', - 'timestamp' => 'getTimestamp' + 'warning' => 'getWarning', + 'timestamp' => 'getTimestamp', + 'ignored' => 'getIgnored', + 'remotePushSent' => 'getRemotePushSent', + 'message' => 'getMessage', + 'errors' => 'getErrors' ]; /** @@ -336,7 +366,12 @@ public function __construct(array $data = null) $this->setIfExists('usersNotified', $data ?? [], null); $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('warning', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('ignored', $data ?? [], null); + $this->setIfExists('remotePushSent', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); } /** @@ -689,6 +724,33 @@ public function setTags($tags) return $this; } + /** + * Gets warning + * + * @return string|null + */ + public function getWarning() + { + return $this->container['warning']; + } + + /** + * Sets warning + * + * @param string|null $warning Present on `updated` responses when the current Live Activity has received more than 12 updates and has averaged more than one update every 2 minutes since it started. The update is still sent, but iOS may throttle Live Activities that update this often. + * + * @return self + */ + public function setWarning($warning) + { + if (is_null($warning)) { + throw new \InvalidArgumentException('non-nullable warning cannot be null'); + } + $this->container['warning'] = $warning; + + return $this; + } + /** * Gets timestamp * @@ -715,6 +777,114 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets ignored + * + * @return bool|null + */ + public function getIgnored() + { + return $this->container['ignored']; + } + + /** + * Sets ignored + * + * @param bool|null $ignored True when the request had no effect. + * + * @return self + */ + public function setIgnored($ignored) + { + if (is_null($ignored)) { + throw new \InvalidArgumentException('non-nullable ignored cannot be null'); + } + $this->container['ignored'] = $ignored; + + return $this; + } + + /** + * Gets remotePushSent + * + * @return bool|null + */ + public function getRemotePushSent() + { + return $this->container['remotePushSent']; + } + + /** + * Sets remotePushSent + * + * @param bool|null $remotePushSent remotePushSent + * + * @return self + */ + public function setRemotePushSent($remotePushSent) + { + if (is_null($remotePushSent)) { + throw new \InvalidArgumentException('non-nullable remotePushSent cannot be null'); + } + $this->container['remotePushSent'] = $remotePushSent; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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 errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Per-device delivery errors when some devices could not be reached. + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityUpdateResponse.php b/generated/Model/LiveActivityUpdateResponse.php index f1b1891..c1269b8 100644 --- a/generated/Model/LiveActivityUpdateResponse.php +++ b/generated/Model/LiveActivityUpdateResponse.php @@ -62,7 +62,14 @@ class LiveActivityUpdateResponse implements ModelInterface, ArrayAccess, \JsonSe 'activityId' => 'string', 'devicesQueued' => 'int', 'devicesNotified' => 'int', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'usersNotified' => 'int', + 'effectiveChannelSlugs' => 'string[]', + 'tags' => 'string[]', + 'operation' => 'string', + 'streamKey' => 'string', + 'previousActivityId' => 'string', + 'errors' => 'string[]' ]; /** @@ -77,7 +84,14 @@ class LiveActivityUpdateResponse implements ModelInterface, ArrayAccess, \JsonSe 'activityId' => null, 'devicesQueued' => null, 'devicesNotified' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'usersNotified' => null, + 'effectiveChannelSlugs' => null, + 'tags' => null, + 'operation' => null, + 'streamKey' => null, + 'previousActivityId' => null, + 'errors' => null ]; /** @@ -90,7 +104,14 @@ class LiveActivityUpdateResponse implements ModelInterface, ArrayAccess, \JsonSe 'activityId' => false, 'devicesQueued' => false, 'devicesNotified' => false, - 'timestamp' => false + 'timestamp' => false, + 'usersNotified' => false, + 'effectiveChannelSlugs' => false, + 'tags' => false, + 'operation' => false, + 'streamKey' => false, + 'previousActivityId' => false, + 'errors' => false ]; /** @@ -183,7 +204,14 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'activity_id', 'devicesQueued' => 'devices_queued', 'devicesNotified' => 'devices_notified', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'usersNotified' => 'users_notified', + 'effectiveChannelSlugs' => 'effective_channel_slugs', + 'tags' => 'tags', + 'operation' => 'operation', + 'streamKey' => 'stream_key', + 'previousActivityId' => 'previous_activity_id', + 'errors' => 'errors' ]; /** @@ -196,7 +224,14 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'setActivityId', 'devicesQueued' => 'setDevicesQueued', 'devicesNotified' => 'setDevicesNotified', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'usersNotified' => 'setUsersNotified', + 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', + 'tags' => 'setTags', + 'operation' => 'setOperation', + 'streamKey' => 'setStreamKey', + 'previousActivityId' => 'setPreviousActivityId', + 'errors' => 'setErrors' ]; /** @@ -209,7 +244,14 @@ public function isNullableSetToNull(string $property): bool 'activityId' => 'getActivityId', 'devicesQueued' => 'getDevicesQueued', 'devicesNotified' => 'getDevicesNotified', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'usersNotified' => 'getUsersNotified', + 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', + 'tags' => 'getTags', + 'operation' => 'getOperation', + 'streamKey' => 'getStreamKey', + 'previousActivityId' => 'getPreviousActivityId', + 'errors' => 'getErrors' ]; /** @@ -274,6 +316,13 @@ public function __construct(array $data = null) $this->setIfExists('devicesQueued', $data ?? [], null); $this->setIfExists('devicesNotified', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('usersNotified', $data ?? [], null); + $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('operation', $data ?? [], null); + $this->setIfExists('streamKey', $data ?? [], null); + $this->setIfExists('previousActivityId', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); } /** @@ -461,6 +510,195 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets usersNotified + * + * @return int|null + */ + public function getUsersNotified() + { + return $this->container['usersNotified']; + } + + /** + * Sets usersNotified + * + * @param int|null $usersNotified usersNotified + * + * @return self + */ + public function setUsersNotified($usersNotified) + { + if (is_null($usersNotified)) { + throw new \InvalidArgumentException('non-nullable usersNotified cannot be null'); + } + $this->container['usersNotified'] = $usersNotified; + + 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 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 operation + * + * @return string|null + */ + public function getOperation() + { + return $this->container['operation']; + } + + /** + * Sets operation + * + * @param string|null $operation Present when the update started a new Live Activity for a managed stream. + * + * @return self + */ + public function setOperation($operation) + { + if (is_null($operation)) { + throw new \InvalidArgumentException('non-nullable operation cannot be null'); + } + $this->container['operation'] = $operation; + + return $this; + } + + /** + * Gets streamKey + * + * @return string|null + */ + public function getStreamKey() + { + return $this->container['streamKey']; + } + + /** + * Sets streamKey + * + * @param string|null $streamKey streamKey + * + * @return self + */ + public function setStreamKey($streamKey) + { + if (is_null($streamKey)) { + throw new \InvalidArgumentException('non-nullable streamKey cannot be null'); + } + $this->container['streamKey'] = $streamKey; + + return $this; + } + + /** + * Gets previousActivityId + * + * @return string|null + */ + public function getPreviousActivityId() + { + return $this->container['previousActivityId']; + } + + /** + * Sets previousActivityId + * + * @param string|null $previousActivityId previousActivityId + * + * @return self + */ + public function setPreviousActivityId($previousActivityId) + { + if (is_null($previousActivityId)) { + throw new \InvalidArgumentException('non-nullable previousActivityId cannot be null'); + } + $this->container['previousActivityId'] = $previousActivityId; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Per-device delivery errors when some devices could not be reached. + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/PushNotificationReplaceRequest.php b/generated/Model/PushNotificationReplaceRequest.php new file mode 100644 index 0000000..6c0a356 --- /dev/null +++ b/generated/Model/PushNotificationReplaceRequest.php @@ -0,0 +1,802 @@ + + */ +class PushNotificationReplaceRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PushNotificationReplaceRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => 'array', + 'title' => 'string', + 'message' => 'string', + 'subtitle' => 'string', + 'icon' => 'string', + 'media' => 'string', + 'redirection' => 'string', + 'actions' => '\ActivitySmith\Generated\Model\PushNotificationAction[]', + 'payload' => 'object', + 'badge' => 'int', + 'tags' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null, + 'title' => null, + 'message' => null, + 'subtitle' => null, + 'icon' => 'uri', + 'media' => 'uri', + 'redirection' => 'uri', + 'actions' => null, + 'payload' => null, + 'badge' => null, + 'tags' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => false, + 'title' => false, + 'message' => false, + 'subtitle' => false, + 'icon' => false, + 'media' => false, + 'redirection' => false, + 'actions' => false, + 'payload' => false, + 'badge' => false, + 'tags' => 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 = [ + 'metadata' => 'metadata', + 'title' => 'title', + 'message' => 'message', + 'subtitle' => 'subtitle', + 'icon' => 'icon', + 'media' => 'media', + 'redirection' => 'redirection', + 'actions' => 'actions', + 'payload' => 'payload', + 'badge' => 'badge', + 'tags' => 'tags' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata', + 'title' => 'setTitle', + 'message' => 'setMessage', + 'subtitle' => 'setSubtitle', + 'icon' => 'setIcon', + 'media' => 'setMedia', + 'redirection' => 'setRedirection', + 'actions' => 'setActions', + 'payload' => 'setPayload', + 'badge' => 'setBadge', + 'tags' => 'setTags' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata', + 'title' => 'getTitle', + 'message' => 'getMessage', + 'subtitle' => 'getSubtitle', + 'icon' => 'getIcon', + 'media' => 'getMedia', + 'redirection' => 'getRedirection', + 'actions' => 'getActions', + 'payload' => 'getPayload', + 'badge' => 'getBadge', + 'tags' => 'getTags' + ]; + + /** + * 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) + { + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('subtitle', $data ?? [], null); + $this->setIfExists('icon', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('redirection', $data ?? [], null); + $this->setIfExists('actions', $data ?? [], null); + $this->setIfExists('payload', $data ?? [], null); + $this->setIfExists('badge', $data ?? [], null); + $this->setIfExists('tags', $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 (!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"; + } + if (!is_null($this->container['icon']) && !preg_match("/^https:\/\//", $this->container['icon'])) { + $invalidProperties[] = "invalid value for 'icon', must be conform to the pattern /^https:\/\//."; + } + + if (!is_null($this->container['media']) && !preg_match("/^https:\/\//", $this->container['media'])) { + $invalidProperties[] = "invalid value for 'media', must be conform to the pattern /^https:\/\//."; + } + + 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)) { + $invalidProperties[] = "invalid value for 'actions', number of items must be less than or equal to 4."; + } + + 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 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 PushNotificationReplaceRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title title + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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 subtitle + * + * @return string|null + */ + public function getSubtitle() + { + return $this->container['subtitle']; + } + + /** + * Sets subtitle + * + * @param string|null $subtitle subtitle + * + * @return self + */ + public function setSubtitle($subtitle) + { + if (is_null($subtitle)) { + throw new \InvalidArgumentException('non-nullable subtitle cannot be null'); + } + $this->container['subtitle'] = $subtitle; + + return $this; + } + + /** + * Gets icon + * + * @return string|null + */ + public function getIcon() + { + return $this->container['icon']; + } + + /** + * Sets icon + * + * @param string|null $icon Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon. + * + * @return self + */ + public function setIcon($icon) + { + if (is_null($icon)) { + throw new \InvalidArgumentException('non-nullable icon cannot be null'); + } + + if ((!preg_match("/^https:\/\//", ObjectSerializer::toString($icon)))) { + throw new \InvalidArgumentException("invalid value for \$icon when calling PushNotificationReplaceRequest., must conform to the pattern /^https:\/\//."); + } + + $this->container['icon'] = $icon; + + return $this; + } + + /** + * Gets media + * + * @return string|null + */ + public function getMedia() + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param string|null $media Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`. + * + * @return self + */ + public function setMedia($media) + { + if (is_null($media)) { + throw new \InvalidArgumentException('non-nullable media cannot be null'); + } + + if ((!preg_match("/^https:\/\//", ObjectSerializer::toString($media)))) { + throw new \InvalidArgumentException("invalid value for \$media when calling PushNotificationReplaceRequest., must conform to the pattern /^https:\/\//."); + } + + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets redirection + * + * @return string|null + */ + public function getRedirection() + { + return $this->container['redirection']; + } + + /** + * Sets redirection + * + * @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 + */ + public function setRedirection($redirection) + { + if (is_null($redirection)) { + throw new \InvalidArgumentException('non-nullable redirection cannot be null'); + } + if ((mb_strlen($redirection) > 2048)) { + throw new \InvalidArgumentException('invalid length for $redirection when calling PushNotificationReplaceRequest., 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 PushNotificationReplaceRequest., must conform to the pattern /^[A-Za-z][A-Za-z0-9+.-]*:/."); + } + + $this->container['redirection'] = $redirection; + + return $this; + } + + /** + * Gets actions + * + * @return \ActivitySmith\Generated\Model\PushNotificationAction[]|null + */ + public function getActions() + { + return $this->container['actions']; + } + + /** + * Sets actions + * + * @param \ActivitySmith\Generated\Model\PushNotificationAction[]|null $actions Optional interactive actions shown when users expand the notification. Cannot be combined with `media`. + * + * @return self + */ + public function setActions($actions) + { + if (is_null($actions)) { + throw new \InvalidArgumentException('non-nullable actions cannot be null'); + } + + if ((count($actions) > 4)) { + throw new \InvalidArgumentException('invalid value for $actions when calling PushNotificationReplaceRequest., number of items must be less than or equal to 4.'); + } + $this->container['actions'] = $actions; + + return $this; + } + + /** + * Gets payload + * + * @return object|null + */ + public function getPayload() + { + return $this->container['payload']; + } + + /** + * Sets payload + * + * @param object|null $payload payload + * + * @return self + */ + public function setPayload($payload) + { + if (is_null($payload)) { + throw new \InvalidArgumentException('non-nullable payload cannot be null'); + } + $this->container['payload'] = $payload; + + return $this; + } + + /** + * Gets badge + * + * @return int|null + */ + public function getBadge() + { + return $this->container['badge']; + } + + /** + * Sets badge + * + * @param int|null $badge badge + * + * @return self + */ + public function setBadge($badge) + { + if (is_null($badge)) { + throw new \InvalidArgumentException('non-nullable badge cannot be null'); + } + $this->container['badge'] = $badge; + + 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; + } + /** + * 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/PushNotificationReplaceResponse.php b/generated/Model/PushNotificationReplaceResponse.php new file mode 100644 index 0000000..cce175c --- /dev/null +++ b/generated/Model/PushNotificationReplaceResponse.php @@ -0,0 +1,623 @@ + + */ +class PushNotificationReplaceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PushNotificationReplaceResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success' => 'bool', + 'notificationId' => 'string', + 'devicesNotified' => 'int', + 'usersNotified' => 'int', + 'effectiveChannelSlugs' => 'string[]', + 'tags' => 'string[]', + 'timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'notificationId' => null, + 'devicesNotified' => null, + 'usersNotified' => null, + 'effectiveChannelSlugs' => null, + 'tags' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success' => false, + 'notificationId' => false, + 'devicesNotified' => false, + 'usersNotified' => false, + 'effectiveChannelSlugs' => false, + 'tags' => false, + 'timestamp' => 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 = [ + 'success' => 'success', + 'notificationId' => 'notification_id', + 'devicesNotified' => 'devices_notified', + 'usersNotified' => 'users_notified', + 'effectiveChannelSlugs' => 'effective_channel_slugs', + 'tags' => 'tags', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'notificationId' => 'setNotificationId', + 'devicesNotified' => 'setDevicesNotified', + 'usersNotified' => 'setUsersNotified', + 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', + 'tags' => 'setTags', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'notificationId' => 'getNotificationId', + 'devicesNotified' => 'getDevicesNotified', + 'usersNotified' => 'getUsersNotified', + 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', + 'tags' => 'getTags', + 'timestamp' => 'getTimestamp' + ]; + + /** + * 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) + { + $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('notificationId', $data ?? [], null); + $this->setIfExists('devicesNotified', $data ?? [], null); + $this->setIfExists('usersNotified', $data ?? [], null); + $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('timestamp', $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['success'] === null) { + $invalidProperties[] = "'success' can't be null"; + } + if ($this->container['notificationId'] === null) { + $invalidProperties[] = "'notificationId' can't be null"; + } + if ($this->container['timestamp'] === null) { + $invalidProperties[] = "'timestamp' 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 success + * + * @return bool + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool $success True when APNs accepts the replacement for at least one device. + * + * @return self + */ + public function setSuccess($success) + { + if (is_null($success)) { + throw new \InvalidArgumentException('non-nullable success cannot be null'); + } + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets notificationId + * + * @return string + */ + public function getNotificationId() + { + return $this->container['notificationId']; + } + + /** + * Sets notificationId + * + * @param string $notificationId ID of the replaced Push Notification. It stays the same, so you can replace it again. + * + * @return self + */ + public function setNotificationId($notificationId) + { + if (is_null($notificationId)) { + throw new \InvalidArgumentException('non-nullable notificationId cannot be null'); + } + $this->container['notificationId'] = $notificationId; + + return $this; + } + + /** + * Gets devicesNotified + * + * @return int|null + */ + public function getDevicesNotified() + { + return $this->container['devicesNotified']; + } + + /** + * Sets devicesNotified + * + * @param int|null $devicesNotified Number of device tokens for which APNs accepted the notification, without confirming on-device delivery. + * + * @return self + */ + public function setDevicesNotified($devicesNotified) + { + if (is_null($devicesNotified)) { + throw new \InvalidArgumentException('non-nullable devicesNotified cannot be null'); + } + $this->container['devicesNotified'] = $devicesNotified; + + return $this; + } + + /** + * Gets usersNotified + * + * @return int|null + */ + public function getUsersNotified() + { + return $this->container['usersNotified']; + } + + /** + * Sets usersNotified + * + * @param int|null $usersNotified usersNotified + * + * @return self + */ + public function setUsersNotified($usersNotified) + { + if (is_null($usersNotified)) { + throw new \InvalidArgumentException('non-nullable usersNotified cannot be null'); + } + $this->container['usersNotified'] = $usersNotified; + + 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 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 timestamp + * + * @return \DateTime + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param \DateTime $timestamp timestamp + * + * @return self + */ + public function setTimestamp($timestamp) + { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + 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/PushNotificationResponse.php b/generated/Model/PushNotificationResponse.php index a82fd00..511c88e 100644 --- a/generated/Model/PushNotificationResponse.php +++ b/generated/Model/PushNotificationResponse.php @@ -59,11 +59,17 @@ class PushNotificationResponse implements ModelInterface, ArrayAccess, \JsonSeri */ protected static $openAPITypes = [ 'success' => 'bool', + 'notificationId' => 'string', 'devicesNotified' => 'int', 'usersNotified' => 'int', 'effectiveChannelSlugs' => 'string[]', 'tags' => 'string[]', - 'timestamp' => '\DateTime' + 'timestamp' => '\DateTime', + 'devicesTargeted' => 'int', + 'devicesDeactivated' => 'int', + 'devicesUnregistered' => 'int', + 'credentialTest' => 'bool', + 'message' => 'string' ]; /** @@ -75,11 +81,17 @@ class PushNotificationResponse implements ModelInterface, ArrayAccess, \JsonSeri */ protected static $openAPIFormats = [ 'success' => null, + 'notificationId' => null, 'devicesNotified' => null, 'usersNotified' => null, 'effectiveChannelSlugs' => null, 'tags' => null, - 'timestamp' => 'date-time' + 'timestamp' => 'date-time', + 'devicesTargeted' => null, + 'devicesDeactivated' => null, + 'devicesUnregistered' => null, + 'credentialTest' => null, + 'message' => null ]; /** @@ -89,11 +101,17 @@ class PushNotificationResponse implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'success' => false, + 'notificationId' => false, 'devicesNotified' => false, 'usersNotified' => false, 'effectiveChannelSlugs' => false, 'tags' => false, - 'timestamp' => false + 'timestamp' => false, + 'devicesTargeted' => false, + 'devicesDeactivated' => false, + 'devicesUnregistered' => false, + 'credentialTest' => false, + 'message' => false ]; /** @@ -183,11 +201,17 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'success' => 'success', + 'notificationId' => 'notification_id', 'devicesNotified' => 'devices_notified', 'usersNotified' => 'users_notified', 'effectiveChannelSlugs' => 'effective_channel_slugs', 'tags' => 'tags', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'devicesTargeted' => 'devices_targeted', + 'devicesDeactivated' => 'devices_deactivated', + 'devicesUnregistered' => 'devices_unregistered', + 'credentialTest' => 'credential_test', + 'message' => 'message' ]; /** @@ -197,11 +221,17 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'success' => 'setSuccess', + 'notificationId' => 'setNotificationId', 'devicesNotified' => 'setDevicesNotified', 'usersNotified' => 'setUsersNotified', 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', 'tags' => 'setTags', - 'timestamp' => 'setTimestamp' + 'timestamp' => 'setTimestamp', + 'devicesTargeted' => 'setDevicesTargeted', + 'devicesDeactivated' => 'setDevicesDeactivated', + 'devicesUnregistered' => 'setDevicesUnregistered', + 'credentialTest' => 'setCredentialTest', + 'message' => 'setMessage' ]; /** @@ -211,11 +241,17 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'success' => 'getSuccess', + 'notificationId' => 'getNotificationId', 'devicesNotified' => 'getDevicesNotified', 'usersNotified' => 'getUsersNotified', 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', 'tags' => 'getTags', - 'timestamp' => 'getTimestamp' + 'timestamp' => 'getTimestamp', + 'devicesTargeted' => 'getDevicesTargeted', + 'devicesDeactivated' => 'getDevicesDeactivated', + 'devicesUnregistered' => 'getDevicesUnregistered', + 'credentialTest' => 'getCredentialTest', + 'message' => 'getMessage' ]; /** @@ -276,11 +312,17 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('notificationId', $data ?? [], null); $this->setIfExists('devicesNotified', $data ?? [], null); $this->setIfExists('usersNotified', $data ?? [], null); $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('devicesTargeted', $data ?? [], null); + $this->setIfExists('devicesDeactivated', $data ?? [], null); + $this->setIfExists('devicesUnregistered', $data ?? [], null); + $this->setIfExists('credentialTest', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); } /** @@ -358,6 +400,33 @@ public function setSuccess($success) return $this; } + /** + * Gets notificationId + * + * @return string|null + */ + public function getNotificationId() + { + return $this->container['notificationId']; + } + + /** + * Sets notificationId + * + * @param string|null $notificationId ID of this Push Notification. Pass it to `PUT /push-notification/{notification_id}` to replace the notification later. + * + * @return self + */ + public function setNotificationId($notificationId) + { + if (is_null($notificationId)) { + throw new \InvalidArgumentException('non-nullable notificationId cannot be null'); + } + $this->container['notificationId'] = $notificationId; + + return $this; + } + /** * Gets devicesNotified * @@ -492,6 +561,141 @@ public function setTimestamp($timestamp) return $this; } + + /** + * Gets devicesTargeted + * + * @return int|null + */ + public function getDevicesTargeted() + { + return $this->container['devicesTargeted']; + } + + /** + * Sets devicesTargeted + * + * @param int|null $devicesTargeted Number of device tokens targeted. + * + * @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 devicesDeactivated + * + * @return int|null + */ + public function getDevicesDeactivated() + { + return $this->container['devicesDeactivated']; + } + + /** + * Sets devicesDeactivated + * + * @param int|null $devicesDeactivated Number of device tokens deactivated because APNs reported them unregistered. + * + * @return self + */ + public function setDevicesDeactivated($devicesDeactivated) + { + if (is_null($devicesDeactivated)) { + throw new \InvalidArgumentException('non-nullable devicesDeactivated cannot be null'); + } + $this->container['devicesDeactivated'] = $devicesDeactivated; + + return $this; + } + + /** + * Gets devicesUnregistered + * + * @return int|null + */ + public function getDevicesUnregistered() + { + return $this->container['devicesUnregistered']; + } + + /** + * Sets devicesUnregistered + * + * @param int|null $devicesUnregistered Number of targeted device tokens APNs reported as unregistered. + * + * @return self + */ + public function setDevicesUnregistered($devicesUnregistered) + { + if (is_null($devicesUnregistered)) { + throw new \InvalidArgumentException('non-nullable devicesUnregistered cannot be null'); + } + $this->container['devicesUnregistered'] = $devicesUnregistered; + + return $this; + } + + /** + * Gets credentialTest + * + * @return bool|null + */ + public function getCredentialTest() + { + return $this->container['credentialTest']; + } + + /** + * Sets credentialTest + * + * @param bool|null $credentialTest True when the request was an integration connection test and no paired devices were available. + * + * @return self + */ + public function setCredentialTest($credentialTest) + { + if (is_null($credentialTest)) { + throw new \InvalidArgumentException('non-nullable credentialTest cannot be null'); + } + $this->container['credentialTest'] = $credentialTest; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $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; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/openapi-source.json b/generated/openapi-source.json index a320213..7ff5c4a 100644 --- a/generated/openapi-source.json +++ b/generated/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "ce15d69eeb25776a3ae395e77d8b907ff7ba0709", + "commit": "28d53b08b0f8ae50d6b9d29fe878ae8065faa64e", "path": "openapi.json", - "sha256": "b113d50e06d6581707d9472dda6e371b996441f58dceba87a88f79cb96508a7d" + "sha256": "1f7f54dd50f0459fc18a4efc0dd0bbecd42788fca936abb32250f53a8238c0ef" } From a0cde509995623d0bed041c4d8808683e909467e Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 12 Oct 2026 11:00:54 +0700 Subject: [PATCH 2/4] feat: add notifications.replace and release 1.14.0 Replace a sent Push Notification by its notification_id. Also picks up the corrected response contract, so the SDK reads every field the API returns. Co-Authored-By: Claude Opus 5.5 --- src/Notifications.php | 51 +++++++++++++++++++++++++++++++++++++++ src/Version.php | 2 +- tests/PushOptionsTest.php | 30 +++++++++++++++++++++++ tests/SmokeTest.php | 3 ++- 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/Notifications.php b/src/Notifications.php index a6afee6..84c12ec 100644 --- a/src/Notifications.php +++ b/src/Notifications.php @@ -103,6 +103,57 @@ public function sendPushNotification( ); } + /** + * Silently replaces a sent Push Notification, using the notification_id returned by send(). + * + * @param array>|null $actions + * @param array|null $tags + */ + public function replace( + string $notificationId, + mixed $request = null, + ?string $title = null, + ?string $message = null, + ?string $subtitle = null, + ?string $media = null, + ?string $redirection = null, + ?array $actions = null, + ?array $tags = null, + array|\stdClass|null $metadata = null, + ?string $icon = null + ): mixed { + $request = $this->buildRequest( + $request, + [ + 'title' => $title, + 'message' => $message, + 'subtitle' => $subtitle, + 'media' => $media, + 'redirection' => $redirection, + 'actions' => $actions, + 'tags' => $tags, + 'metadata' => $metadata, + 'icon' => $icon, + ] + ); + $normalized = Metadata::normalizeRequest($request); + $this->assertValidMediaActionsCombination($normalized); + + return $this->api->replacePushNotification($notificationId, $normalized); + } + + // Generated-style alias. + public function replacePushNotification( + string $notificationId, + mixed $pushNotificationReplaceRequest = null, + string $contentType = PushNotificationsApi::contentTypes['replacePushNotification'][0] + ): mixed { + $normalized = Metadata::normalizeRequest($pushNotificationReplaceRequest); + $this->assertValidMediaActionsCombination($normalized); + + return $this->api->replacePushNotification($notificationId, $normalized, $contentType); + } + public function __call(string $name, array $arguments): mixed { return $this->api->{$name}(...$arguments); diff --git a/src/Version.php b/src/Version.php index 2ea9c3d..b91ad28 100644 --- a/src/Version.php +++ b/src/Version.php @@ -6,7 +6,7 @@ final class Version { - public const VERSION = '1.13.0'; + public const VERSION = '1.14.0'; private function __construct() { diff --git a/tests/PushOptionsTest.php b/tests/PushOptionsTest.php index 9442250..878f675 100644 --- a/tests/PushOptionsTest.php +++ b/tests/PushOptionsTest.php @@ -53,6 +53,36 @@ public function testSerializationAcrossNamedArrayAndModelInputs(): void } } + public function testReplaceSendsPutWithReplacementBody(): void + { + foreach (['named', 'array', 'alias'] as $form) { + $history = []; + $stack = HandlerStack::create(new MockHandler([new Response(200, ['Content-Type' => 'application/json'], '{"success":true,"notification_id":"pn1","devices_notified":1,"future_field":true,"timestamp":"2026-10-12T00:00:00Z"}')])); + $stack->push(Middleware::history($history)); + $notifications = new Notifications(new PushNotificationsApi(new Client(['handler' => $stack]))); + $fields = ['title' => 'Answered from desk', 'tags' => [], 'metadata' => ['attempts' => 0, 'resolved' => false]]; + if ($form === 'named') { + $response = $notifications->replace('pn1', title: 'Answered from desk', tags: [], metadata: ['attempts' => 0, 'resolved' => false]); + } elseif ($form === 'array') { + $response = $notifications->replace('pn1', $fields); + } else { + $response = $notifications->replacePushNotification('pn1', $fields); + } + $request = $history[0]['request']; + $this->assertSame('PUT', $request->getMethod()); + $this->assertStringEndsWith('/push-notification/pn1', $request->getUri()->getPath()); + $this->assertEquals($fields, json_decode((string) $request->getBody(), true)); + $this->assertSame('pn1', $response->getNotificationId()); + } + } + + public function testReplaceRejectsMediaWithActions(): void + { + $notifications = new Notifications(new PushNotificationsApi(new Client(['handler' => HandlerStack::create(new MockHandler([]))]))); + $this->expectExceptionMessage('ActivitySmith: media cannot be combined with actions'); + $notifications->replace('pn1', title: 'Done', media: 'https://cdn.activitysmith.com/voice.mp3', actions: [['title' => 'Open', 'type' => 'open_url', 'url' => 'https://example.com']]); + } + public function testInvalidLevelNeverReachesTransport(): void { $api = $this->getMockBuilder(PushNotificationsApi::class)->disableOriginalConstructor()->onlyMethods(['sendPushNotification'])->getMock(); diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php index e696fda..aea7276 100644 --- a/tests/SmokeTest.php +++ b/tests/SmokeTest.php @@ -21,6 +21,7 @@ public function testClientConstructsWhenGeneratedCodeIsPresent(): void $this->assertNotNull($client->notifications); $this->assertNotNull($client->liveActivities); $this->assertTrue(method_exists($client->notifications, 'send')); + $this->assertTrue(method_exists($client->notifications, 'replace')); $this->assertTrue(method_exists($client->liveActivities, 'start')); $this->assertTrue(method_exists($client->liveActivities, 'update')); $this->assertTrue(method_exists($client->liveActivities, 'end')); @@ -28,6 +29,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.13.0', Version::VERSION); + $this->assertSame('1.14.0', Version::VERSION); } } From 73812cc477bd916fadf6f6fc2dd783469eb85d7e Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 12 Oct 2026 11:24:12 +0700 Subject: [PATCH 3/4] chore: regenerate SDK from backend dd6757c --- generated/openapi-source.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/openapi-source.json b/generated/openapi-source.json index 7ff5c4a..28e1d47 100644 --- a/generated/openapi-source.json +++ b/generated/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "28d53b08b0f8ae50d6b9d29fe878ae8065faa64e", + "commit": "dd6757c5defa3d1e6524faef789b6829184fb852", "path": "openapi.json", - "sha256": "1f7f54dd50f0459fc18a4efc0dd0bbecd42788fca936abb32250f53a8238c0ef" + "sha256": "24dae2d064095351d5e5cf800228e64a2d23c40b1e31a9754503081ddf31c5d8" } From bfec9e6fab4ec8c1a21d6319ae46214de09c4295 Mon Sep 17 00:00:00 2001 From: bardonadam Date: Mon, 12 Oct 2026 11:32:15 +0700 Subject: [PATCH 4/4] docs: add the 1.14.0 changelog and replace docs to the README Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 ++++ README.md | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3cdd04..91abd88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.14.0 + +Adds the ability to replace a Push Notification you already sent with a new one. + ## 1.13.0 Adds custom icons and interruption levels for Push Notifications. Set `icon` to show a service logo or avatar on the notification, and `interruptionLevel` to deliver it as `passive`, `active`, or `time-sensitive`. diff --git a/README.md b/README.md index c1661d9..49cff60 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,25 @@ $activitysmith->notifications->send( ); ``` +### Replace a Push Notification + +Every send returns a `notification_id`. Pass it to `replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original. + +Omit `metadata` or `tags` to keep their stored values. + +```php +$sent = $activitysmith->notifications->send( + title: '🚨 checkout-api is down', + message: '500 errors on 62% of requests.', +); + +$activitysmith->notifications->replace( + $sent->getNotificationId(), + title: '✅ checkout-api recovered', + message: 'Error rate is back to normal. Incident resolved.', +); +``` + ## Live Activities Choose the Live Activity type that matches what you want to show: