diff --git a/generated/Api/AppIconBadgesApi.php b/generated/Api/AppIconBadgesApi.php index 2260dd3..b49ac20 100644 --- a/generated/Api/AppIconBadgesApi.php +++ b/generated/Api/AppIconBadgesApi.php @@ -132,7 +132,7 @@ public function getConfig() * * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\RateLimitError + * @return \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError|\ActivitySmith\Generated\Model\RateLimitError */ public function updateAppIconBadgeCount($appIconBadgeCountUpdateRequest, string $contentType = self::contentTypes['updateAppIconBadgeCount'][0]) { @@ -150,7 +150,7 @@ public function updateAppIconBadgeCount($appIconBadgeCountUpdateRequest, string * * @throws \ActivitySmith\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) + * @return array of \ActivitySmith\Generated\Model\AppIconBadgeCountUpdateResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response|\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) */ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequest, string $contentType = self::contentTypes['updateAppIconBadgeCount'][0]) { @@ -273,12 +273,12 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ $response->getStatusCode(), $response->getHeaders() ]; - case 404: - if ('\ActivitySmith\Generated\Model\NoRecipientsError' === '\SplFileObject') { + case 422: + if ('\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ActivitySmith\Generated\Model\NoRecipientsError' !== 'string') { + if ('\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -296,7 +296,34 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ } return [ - ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\NoRecipientsError', []), + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 502: + if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -383,10 +410,18 @@ public function updateAppIconBadgeCountWithHttpInfo($appIconBadgeCountUpdateRequ ); $e->setResponseObject($data); break; - case 404: + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\UpdateAppIconBadgeCount422Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 502: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ActivitySmith\Generated\Model\NoRecipientsError', + '\ActivitySmith\Generated\Model\AppIconBadgeCountUpdateError', $e->getResponseHeaders() ); $e->setResponseObject($data); diff --git a/generated/Model/AppIconBadgeCountUpdateError.php b/generated/Model/AppIconBadgeCountUpdateError.php new file mode 100644 index 0000000..f88711a --- /dev/null +++ b/generated/Model/AppIconBadgeCountUpdateError.php @@ -0,0 +1,748 @@ + + */ +class AppIconBadgeCountUpdateError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AppIconBadgeCountUpdateError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => 'string', + 'code' => 'string', + 'message' => 'string', + 'badge' => 'int', + 'devicesTargeted' => 'int', + 'devicesUpdated' => 'int', + 'usersUpdated' => 'int', + 'devicesNotified' => 'int', + 'effectiveChannelSlugs' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null, + 'code' => null, + 'message' => null, + 'badge' => null, + 'devicesTargeted' => null, + 'devicesUpdated' => null, + 'usersUpdated' => null, + 'devicesNotified' => null, + 'effectiveChannelSlugs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'code' => false, + 'message' => false, + 'badge' => false, + 'devicesTargeted' => false, + 'devicesUpdated' => false, + 'usersUpdated' => false, + 'devicesNotified' => false, + 'effectiveChannelSlugs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error' => 'error', + 'code' => 'code', + 'message' => 'message', + 'badge' => 'badge', + 'devicesTargeted' => 'devices_targeted', + 'devicesUpdated' => 'devices_updated', + 'usersUpdated' => 'users_updated', + 'devicesNotified' => 'devices_notified', + 'effectiveChannelSlugs' => 'effective_channel_slugs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'code' => 'setCode', + 'message' => 'setMessage', + 'badge' => 'setBadge', + 'devicesTargeted' => 'setDevicesTargeted', + 'devicesUpdated' => 'setDevicesUpdated', + 'usersUpdated' => 'setUsersUpdated', + 'devicesNotified' => 'setDevicesNotified', + 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'code' => 'getCode', + 'message' => 'getMessage', + 'badge' => 'getBadge', + 'devicesTargeted' => 'getDevicesTargeted', + 'devicesUpdated' => 'getDevicesUpdated', + 'usersUpdated' => 'getUsersUpdated', + 'devicesNotified' => 'getDevicesNotified', + 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CODE_DEVICE_DISCONNECTED = 'badge_device_disconnected'; + public const CODE_UPDATE_FAILED = 'badge_update_failed'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_DEVICE_DISCONNECTED, + self::CODE_UPDATE_FAILED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('badge', $data ?? [], null); + $this->setIfExists('devicesTargeted', $data ?? [], null); + $this->setIfExists('devicesUpdated', $data ?? [], null); + $this->setIfExists('usersUpdated', $data ?? [], null); + $this->setIfExists('devicesNotified', $data ?? [], null); + $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['badge'] === null) { + $invalidProperties[] = "'badge' can't be null"; + } + if (($this->container['badge'] > 2147483647)) { + $invalidProperties[] = "invalid value for 'badge', must be smaller than or equal to 2147483647."; + } + + if (($this->container['badge'] < 0)) { + $invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0."; + } + + if ($this->container['devicesUpdated'] === null) { + $invalidProperties[] = "'devicesUpdated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error + * + * @return string + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets badge + * + * @return int + */ + public function getBadge() + { + return $this->container['badge']; + } + + /** + * Sets badge + * + * @param int $badge badge + * + * @return self + */ + public function setBadge($badge) + { + if (is_null($badge)) { + throw new \InvalidArgumentException('non-nullable badge cannot be null'); + } + + if (($badge > 2147483647)) { + throw new \InvalidArgumentException('invalid value for $badge when calling AppIconBadgeCountUpdateError., must be smaller than or equal to 2147483647.'); + } + if (($badge < 0)) { + throw new \InvalidArgumentException('invalid value for $badge when calling AppIconBadgeCountUpdateError., must be bigger than or equal to 0.'); + } + + $this->container['badge'] = $badge; + + return $this; + } + + /** + * Gets devicesTargeted + * + * @return int|null + */ + public function getDevicesTargeted() + { + return $this->container['devicesTargeted']; + } + + /** + * Sets devicesTargeted + * + * @param int|null $devicesTargeted devicesTargeted + * + * @return self + */ + public function setDevicesTargeted($devicesTargeted) + { + if (is_null($devicesTargeted)) { + throw new \InvalidArgumentException('non-nullable devicesTargeted cannot be null'); + } + $this->container['devicesTargeted'] = $devicesTargeted; + + return $this; + } + + /** + * Gets devicesUpdated + * + * @return int + */ + public function getDevicesUpdated() + { + return $this->container['devicesUpdated']; + } + + /** + * Sets devicesUpdated + * + * @param int $devicesUpdated devicesUpdated + * + * @return self + */ + public function setDevicesUpdated($devicesUpdated) + { + if (is_null($devicesUpdated)) { + throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null'); + } + $this->container['devicesUpdated'] = $devicesUpdated; + + return $this; + } + + /** + * Gets usersUpdated + * + * @return int|null + */ + public function getUsersUpdated() + { + return $this->container['usersUpdated']; + } + + /** + * Sets usersUpdated + * + * @param int|null $usersUpdated usersUpdated + * + * @return self + */ + public function setUsersUpdated($usersUpdated) + { + if (is_null($usersUpdated)) { + throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null'); + } + $this->container['usersUpdated'] = $usersUpdated; + + return $this; + } + + /** + * Gets devicesNotified + * + * @return int|null + * @deprecated + */ + public function getDevicesNotified() + { + return $this->container['devicesNotified']; + } + + /** + * Sets devicesNotified + * + * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated. + * + * @return self + * @deprecated + */ + public function setDevicesNotified($devicesNotified) + { + if (is_null($devicesNotified)) { + throw new \InvalidArgumentException('non-nullable devicesNotified cannot be null'); + } + $this->container['devicesNotified'] = $devicesNotified; + + return $this; + } + + /** + * Gets effectiveChannelSlugs + * + * @return string[]|null + */ + public function getEffectiveChannelSlugs() + { + return $this->container['effectiveChannelSlugs']; + } + + /** + * Sets effectiveChannelSlugs + * + * @param string[]|null $effectiveChannelSlugs effectiveChannelSlugs + * + * @return self + */ + public function setEffectiveChannelSlugs($effectiveChannelSlugs) + { + if (is_null($effectiveChannelSlugs)) { + throw new \InvalidArgumentException('non-nullable effectiveChannelSlugs cannot be null'); + } + $this->container['effectiveChannelSlugs'] = $effectiveChannelSlugs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/generated/Model/AppIconBadgeCountUpdateResponse.php b/generated/Model/AppIconBadgeCountUpdateResponse.php index 96a06e4..2a526ac 100644 --- a/generated/Model/AppIconBadgeCountUpdateResponse.php +++ b/generated/Model/AppIconBadgeCountUpdateResponse.php @@ -59,6 +59,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J protected static $openAPITypes = [ 'success' => 'bool', 'badge' => 'int', + 'devicesUpdated' => 'int', + 'usersUpdated' => 'int', 'devicesNotified' => 'int', 'usersNotified' => 'int', 'effectiveChannelSlugs' => 'string[]', @@ -75,6 +77,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J protected static $openAPIFormats = [ 'success' => null, 'badge' => null, + 'devicesUpdated' => null, + 'usersUpdated' => null, 'devicesNotified' => null, 'usersNotified' => null, 'effectiveChannelSlugs' => null, @@ -89,6 +93,8 @@ class AppIconBadgeCountUpdateResponse implements ModelInterface, ArrayAccess, \J protected static array $openAPINullables = [ 'success' => false, 'badge' => false, + 'devicesUpdated' => false, + 'usersUpdated' => false, 'devicesNotified' => false, 'usersNotified' => false, 'effectiveChannelSlugs' => false, @@ -183,6 +189,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'success' => 'success', 'badge' => 'badge', + 'devicesUpdated' => 'devices_updated', + 'usersUpdated' => 'users_updated', 'devicesNotified' => 'devices_notified', 'usersNotified' => 'users_notified', 'effectiveChannelSlugs' => 'effective_channel_slugs', @@ -197,6 +205,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'success' => 'setSuccess', 'badge' => 'setBadge', + 'devicesUpdated' => 'setDevicesUpdated', + 'usersUpdated' => 'setUsersUpdated', 'devicesNotified' => 'setDevicesNotified', 'usersNotified' => 'setUsersNotified', 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', @@ -211,6 +221,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'success' => 'getSuccess', 'badge' => 'getBadge', + 'devicesUpdated' => 'getDevicesUpdated', + 'usersUpdated' => 'getUsersUpdated', 'devicesNotified' => 'getDevicesNotified', 'usersNotified' => 'getUsersNotified', 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', @@ -276,6 +288,8 @@ public function __construct(array $data = null) { $this->setIfExists('success', $data ?? [], null); $this->setIfExists('badge', $data ?? [], null); + $this->setIfExists('devicesUpdated', $data ?? [], null); + $this->setIfExists('usersUpdated', $data ?? [], null); $this->setIfExists('devicesNotified', $data ?? [], null); $this->setIfExists('usersNotified', $data ?? [], null); $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); @@ -323,11 +337,11 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0."; } - if ($this->container['devicesNotified'] === null) { - $invalidProperties[] = "'devicesNotified' can't be null"; + if ($this->container['devicesUpdated'] === null) { + $invalidProperties[] = "'devicesUpdated' can't be null"; } - if ($this->container['usersNotified'] === null) { - $invalidProperties[] = "'usersNotified' can't be null"; + if ($this->container['usersUpdated'] === null) { + $invalidProperties[] = "'usersUpdated' can't be null"; } if ($this->container['effectiveChannelSlugs'] === null) { $invalidProperties[] = "'effectiveChannelSlugs' can't be null"; @@ -413,10 +427,65 @@ public function setBadge($badge) } /** - * Gets devicesNotified + * Gets devicesUpdated + * + * @return int + */ + public function getDevicesUpdated() + { + return $this->container['devicesUpdated']; + } + + /** + * Sets devicesUpdated + * + * @param int $devicesUpdated Number of devices whose App Icon Badge Count was updated. + * + * @return self + */ + public function setDevicesUpdated($devicesUpdated) + { + if (is_null($devicesUpdated)) { + throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null'); + } + $this->container['devicesUpdated'] = $devicesUpdated; + + return $this; + } + + /** + * Gets usersUpdated * * @return int */ + public function getUsersUpdated() + { + return $this->container['usersUpdated']; + } + + /** + * Sets usersUpdated + * + * @param int $usersUpdated Number of account users with at least one updated device. + * + * @return self + */ + public function setUsersUpdated($usersUpdated) + { + if (is_null($usersUpdated)) { + throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null'); + } + $this->container['usersUpdated'] = $usersUpdated; + + return $this; + } + + /** + * Gets devicesNotified + * + * @return int|null + * @deprecated + */ public function getDevicesNotified() { return $this->container['devicesNotified']; @@ -425,9 +494,10 @@ public function getDevicesNotified() /** * Sets devicesNotified * - * @param int $devicesNotified devicesNotified + * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated. * * @return self + * @deprecated */ public function setDevicesNotified($devicesNotified) { @@ -442,7 +512,8 @@ public function setDevicesNotified($devicesNotified) /** * Gets usersNotified * - * @return int + * @return int|null + * @deprecated */ public function getUsersNotified() { @@ -452,9 +523,10 @@ public function getUsersNotified() /** * Sets usersNotified * - * @param int $usersNotified usersNotified + * @param int|null $usersNotified Deprecated compatibility alias for users_updated. * * @return self + * @deprecated */ public function setUsersNotified($usersNotified) { diff --git a/generated/Model/LiveActivityEndRequest.php b/generated/Model/LiveActivityEndRequest.php index 217a9df..6adb132 100644 --- a/generated/Model/LiveActivityEndRequest.php +++ b/generated/Model/LiveActivityEndRequest.php @@ -58,7 +58,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', 'activityId' => 'string', + 'tags' => 'string[]', 'contentState' => '\ActivitySmith\Generated\Model\ContentStateEnd', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction' @@ -72,7 +74,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, 'activityId' => null, + 'tags' => null, 'contentState' => null, 'action' => null, 'secondaryAction' => null @@ -84,7 +88,9 @@ class LiveActivityEndRequest implements ModelInterface, ArrayAccess, \JsonSerial * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, 'activityId' => false, + 'tags' => false, 'contentState' => false, 'action' => false, 'secondaryAction' => false @@ -176,7 +182,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', 'activityId' => 'activity_id', + 'tags' => 'tags', 'contentState' => 'content_state', 'action' => 'action', 'secondaryAction' => 'secondary_action' @@ -188,7 +196,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', 'activityId' => 'setActivityId', + 'tags' => 'setTags', 'contentState' => 'setContentState', 'action' => 'setAction', 'secondaryAction' => 'setSecondaryAction' @@ -200,7 +210,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', 'activityId' => 'getActivityId', + 'tags' => 'getTags', 'contentState' => 'getContentState', 'action' => 'getAction', 'secondaryAction' => 'getSecondaryAction' @@ -263,7 +275,9 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('activityId', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); $this->setIfExists('secondaryAction', $data ?? [], null); @@ -296,9 +310,17 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + if ($this->container['activityId'] === null) { $invalidProperties[] = "'activityId' can't be null"; } + if (!is_null($this->container['tags']) && (count($this->container['tags']) > 20)) { + $invalidProperties[] = "invalid value for 'tags', number of items must be less than or equal to 20."; + } + if ($this->container['contentState'] === null) { $invalidProperties[] = "'contentState' can't be null"; } @@ -317,6 +339,37 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityEndRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets activityId * @@ -344,6 +397,37 @@ public function setActivityId($activityId) return $this; } + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them. + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + + if ((count($tags) > 20)) { + throw new \InvalidArgumentException('invalid value for $tags when calling LiveActivityEndRequest., number of items must be less than or equal to 20.'); + } + $this->container['tags'] = $tags; + + return $this; + } + /** * Gets contentState * diff --git a/generated/Model/LiveActivityLimitError.php b/generated/Model/LiveActivityLimitError.php index 724cbb3..4e6855e 100644 --- a/generated/Model/LiveActivityLimitError.php +++ b/generated/Model/LiveActivityLimitError.php @@ -60,7 +60,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial 'error' => 'string', 'message' => 'string', 'limit' => 'int', - 'active' => 'int' + 'active' => 'int', + 'blockedDevices' => 'int', + 'targetedDevices' => 'int' ]; /** @@ -74,7 +76,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial 'error' => null, 'message' => null, 'limit' => null, - 'active' => null + 'active' => null, + 'blockedDevices' => null, + 'targetedDevices' => null ]; /** @@ -86,7 +90,9 @@ class LiveActivityLimitError implements ModelInterface, ArrayAccess, \JsonSerial 'error' => false, 'message' => false, 'limit' => false, - 'active' => false + 'active' => false, + 'blockedDevices' => false, + 'targetedDevices' => false ]; /** @@ -178,7 +184,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'error', 'message' => 'message', 'limit' => 'limit', - 'active' => 'active' + 'active' => 'active', + 'blockedDevices' => 'blocked_devices', + 'targetedDevices' => 'targeted_devices' ]; /** @@ -190,7 +198,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'setError', 'message' => 'setMessage', 'limit' => 'setLimit', - 'active' => 'setActive' + 'active' => 'setActive', + 'blockedDevices' => 'setBlockedDevices', + 'targetedDevices' => 'setTargetedDevices' ]; /** @@ -202,7 +212,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'getError', 'message' => 'getMessage', 'limit' => 'getLimit', - 'active' => 'getActive' + 'active' => 'getActive', + 'blockedDevices' => 'getBlockedDevices', + 'targetedDevices' => 'getTargetedDevices' ]; /** @@ -266,6 +278,8 @@ public function __construct(array $data = null) $this->setIfExists('message', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('blockedDevices', $data ?? [], null); + $this->setIfExists('targetedDevices', $data ?? [], null); } /** @@ -416,7 +430,7 @@ public function getActive() /** * Sets active * - * @param int $active Current number of active Live Activities. + * @param int $active Highest number of active Live Activities among the targeted devices. * * @return self */ @@ -429,6 +443,60 @@ public function setActive($active) return $this; } + + /** + * Gets blockedDevices + * + * @return int|null + */ + public function getBlockedDevices() + { + return $this->container['blockedDevices']; + } + + /** + * Sets blockedDevices + * + * @param int|null $blockedDevices Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity. + * + * @return self + */ + public function setBlockedDevices($blockedDevices) + { + if (is_null($blockedDevices)) { + throw new \InvalidArgumentException('non-nullable blockedDevices cannot be null'); + } + $this->container['blockedDevices'] = $blockedDevices; + + return $this; + } + + /** + * Gets targetedDevices + * + * @return int|null + */ + public function getTargetedDevices() + { + return $this->container['targetedDevices']; + } + + /** + * Sets targetedDevices + * + * @param int|null $targetedDevices Total number of targeted devices. Included only when targeted devices have mixed capacity. + * + * @return self + */ + public function setTargetedDevices($targetedDevices) + { + if (is_null($targetedDevices)) { + throw new \InvalidArgumentException('non-nullable targetedDevices cannot be null'); + } + $this->container['targetedDevices'] = $targetedDevices; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStartRequest.php b/generated/Model/LiveActivityStartRequest.php index ee43938..445118c 100644 --- a/generated/Model/LiveActivityStartRequest.php +++ b/generated/Model/LiveActivityStartRequest.php @@ -58,6 +58,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', 'contentState' => '\ActivitySmith\Generated\Model\ContentStateStart', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', @@ -74,6 +75,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, 'contentState' => null, 'action' => null, 'secondaryAction' => null, @@ -88,6 +90,7 @@ class LiveActivityStartRequest implements ModelInterface, ArrayAccess, \JsonSeri * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, 'contentState' => false, 'action' => false, 'secondaryAction' => false, @@ -182,6 +185,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', 'contentState' => 'content_state', 'action' => 'action', 'secondaryAction' => 'secondary_action', @@ -196,6 +200,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', 'contentState' => 'setContentState', 'action' => 'setAction', 'secondaryAction' => 'setSecondaryAction', @@ -210,6 +215,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', 'contentState' => 'getContentState', 'action' => 'getAction', 'secondaryAction' => 'getSecondaryAction', @@ -275,6 +281,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); $this->setIfExists('secondaryAction', $data ?? [], null); @@ -310,6 +317,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + if ($this->container['contentState'] === null) { $invalidProperties[] = "'contentState' can't be null"; } @@ -328,6 +339,37 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStartRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets contentState * diff --git a/generated/Model/LiveActivityStreamDeleteRequest.php b/generated/Model/LiveActivityStreamDeleteRequest.php index 39b7c85..3491a9f 100644 --- a/generated/Model/LiveActivityStreamDeleteRequest.php +++ b/generated/Model/LiveActivityStreamDeleteRequest.php @@ -58,6 +58,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', + 'tags' => 'string[]', 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', @@ -72,6 +74,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, + 'tags' => null, 'contentState' => null, 'action' => null, 'secondaryAction' => null, @@ -84,6 +88,8 @@ class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \J * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, + 'tags' => false, 'contentState' => false, 'action' => false, 'secondaryAction' => false, @@ -176,6 +182,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', + 'tags' => 'tags', 'contentState' => 'content_state', 'action' => 'action', 'secondaryAction' => 'secondary_action', @@ -188,6 +196,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', + 'tags' => 'setTags', 'contentState' => 'setContentState', 'action' => 'setAction', 'secondaryAction' => 'setSecondaryAction', @@ -200,6 +210,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', + 'tags' => 'getTags', 'contentState' => 'getContentState', 'action' => 'getAction', 'secondaryAction' => 'getSecondaryAction', @@ -263,6 +275,8 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); $this->setIfExists('secondaryAction', $data ?? [], null); @@ -296,6 +310,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + return $invalidProperties; } @@ -311,6 +329,64 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStreamDeleteRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Optional tags to organize and filter notification history. + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + /** * Gets contentState * diff --git a/generated/Model/LiveActivityStreamRequest.php b/generated/Model/LiveActivityStreamRequest.php index d31ca9d..9e7ac2d 100644 --- a/generated/Model/LiveActivityStreamRequest.php +++ b/generated/Model/LiveActivityStreamRequest.php @@ -58,6 +58,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction', @@ -75,6 +76,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, 'contentState' => null, 'action' => null, 'secondaryAction' => null, @@ -90,6 +92,7 @@ class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSer * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, 'contentState' => false, 'action' => false, 'secondaryAction' => false, @@ -185,6 +188,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', 'contentState' => 'content_state', 'action' => 'action', 'secondaryAction' => 'secondary_action', @@ -200,6 +204,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', 'contentState' => 'setContentState', 'action' => 'setAction', 'secondaryAction' => 'setSecondaryAction', @@ -215,6 +220,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', 'contentState' => 'getContentState', 'action' => 'getAction', 'secondaryAction' => 'getSecondaryAction', @@ -281,6 +287,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); $this->setIfExists('secondaryAction', $data ?? [], null); @@ -317,6 +324,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + if ($this->container['contentState'] === null) { $invalidProperties[] = "'contentState' can't be null"; } @@ -339,6 +350,37 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityStreamRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets contentState * diff --git a/generated/Model/LiveActivityUpdateRequest.php b/generated/Model/LiveActivityUpdateRequest.php index b3bfc02..3dc121d 100644 --- a/generated/Model/LiveActivityUpdateRequest.php +++ b/generated/Model/LiveActivityUpdateRequest.php @@ -58,7 +58,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', 'activityId' => 'string', + 'tags' => 'string[]', 'contentState' => '\ActivitySmith\Generated\Model\ContentStateUpdate', 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', 'secondaryAction' => '\ActivitySmith\Generated\Model\LiveActivityAction' @@ -72,7 +74,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, 'activityId' => null, + 'tags' => null, 'contentState' => null, 'action' => null, 'secondaryAction' => null @@ -84,7 +88,9 @@ class LiveActivityUpdateRequest implements ModelInterface, ArrayAccess, \JsonSer * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, 'activityId' => false, + 'tags' => false, 'contentState' => false, 'action' => false, 'secondaryAction' => false @@ -176,7 +182,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', 'activityId' => 'activity_id', + 'tags' => 'tags', 'contentState' => 'content_state', 'action' => 'action', 'secondaryAction' => 'secondary_action' @@ -188,7 +196,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', 'activityId' => 'setActivityId', + 'tags' => 'setTags', 'contentState' => 'setContentState', 'action' => 'setAction', 'secondaryAction' => 'setSecondaryAction' @@ -200,7 +210,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', 'activityId' => 'getActivityId', + 'tags' => 'getTags', 'contentState' => 'getContentState', 'action' => 'getAction', 'secondaryAction' => 'getSecondaryAction' @@ -263,7 +275,9 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('activityId', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('contentState', $data ?? [], null); $this->setIfExists('action', $data ?? [], null); $this->setIfExists('secondaryAction', $data ?? [], null); @@ -296,9 +310,17 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + if ($this->container['activityId'] === null) { $invalidProperties[] = "'activityId' can't be null"; } + if (!is_null($this->container['tags']) && (count($this->container['tags']) > 20)) { + $invalidProperties[] = "invalid value for 'tags', number of items must be less than or equal to 20."; + } + if ($this->container['contentState'] === null) { $invalidProperties[] = "'contentState' can't be null"; } @@ -317,6 +339,37 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling LiveActivityUpdateRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets activityId * @@ -344,6 +397,37 @@ public function setActivityId($activityId) return $this; } + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them. + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + + if ((count($tags) > 20)) { + throw new \InvalidArgumentException('invalid value for $tags when calling LiveActivityUpdateRequest., number of items must be less than or equal to 20.'); + } + $this->container['tags'] = $tags; + + return $this; + } + /** * Gets contentState * diff --git a/generated/Model/MetadataValue.php b/generated/Model/MetadataValue.php new file mode 100644 index 0000000..8905c94 --- /dev/null +++ b/generated/Model/MetadataValue.php @@ -0,0 +1,381 @@ + + */ +class MetadataValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Metadata_value'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/generated/Model/PushNotificationAction.php b/generated/Model/PushNotificationAction.php index 6b00712..0ee4f01 100644 --- a/generated/Model/PushNotificationAction.php +++ b/generated/Model/PushNotificationAction.php @@ -393,7 +393,7 @@ public function getUrl() /** * Sets url * - * @param string $url Action URL. For open_url, use an HTTP or HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend. + * @param string $url Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend. * * @return self */ diff --git a/generated/Model/PushNotificationRequest.php b/generated/Model/PushNotificationRequest.php index c1b401e..95801e9 100644 --- a/generated/Model/PushNotificationRequest.php +++ b/generated/Model/PushNotificationRequest.php @@ -57,6 +57,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ + 'metadata' => 'array', 'title' => 'string', 'message' => 'string', 'subtitle' => 'string', @@ -78,6 +79,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ + 'metadata' => null, 'title' => null, 'message' => null, 'subtitle' => null, @@ -97,6 +99,7 @@ class PushNotificationRequest implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ + 'metadata' => false, 'title' => false, 'message' => false, 'subtitle' => false, @@ -196,6 +199,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'metadata' => 'metadata', 'title' => 'title', 'message' => 'message', 'subtitle' => 'subtitle', @@ -215,6 +219,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'metadata' => 'setMetadata', 'title' => 'setTitle', 'message' => 'setMessage', 'subtitle' => 'setSubtitle', @@ -234,6 +239,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'metadata' => 'getMetadata', 'title' => 'getTitle', 'message' => 'getMessage', 'subtitle' => 'getSubtitle', @@ -304,6 +310,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('title', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); $this->setIfExists('subtitle', $data ?? [], null); @@ -344,6 +351,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 50)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 50."; + } + if ($this->container['title'] === null) { $invalidProperties[] = "'title' can't be null"; } @@ -351,8 +362,12 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'media', must be conform to the pattern /^https:\/\//."; } - if (!is_null($this->container['redirection']) && !preg_match("/^(http|https|shortcuts):\/\//", $this->container['redirection'])) { - $invalidProperties[] = "invalid value for 'redirection', must be conform to the pattern /^(http|https|shortcuts):\/\//."; + if (!is_null($this->container['redirection']) && (mb_strlen($this->container['redirection']) > 2048)) { + $invalidProperties[] = "invalid value for 'redirection', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['redirection']) && !preg_match("/^[A-Za-z][A-Za-z0-9+.-]*:/", $this->container['redirection'])) { + $invalidProperties[] = "invalid value for 'redirection', must be conform to the pattern /^[A-Za-z][A-Za-z0-9+.-]*:/."; } if (!is_null($this->container['actions']) && (count($this->container['actions']) > 4)) { @@ -374,6 +389,37 @@ public function valid() } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 50)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling PushNotificationRequest., number of items must be less than or equal to 50.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets title * @@ -500,7 +546,7 @@ public function getRedirection() /** * Sets redirection * - * @param string|null $redirection Optional HTTP URL, HTTPS URL, or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided. + * @param string|null $redirection Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media. * * @return self */ @@ -509,9 +555,11 @@ public function setRedirection($redirection) if (is_null($redirection)) { throw new \InvalidArgumentException('non-nullable redirection cannot be null'); } - - if ((!preg_match("/^(http|https|shortcuts):\/\//", ObjectSerializer::toString($redirection)))) { - throw new \InvalidArgumentException("invalid value for \$redirection when calling PushNotificationRequest., must conform to the pattern /^(http|https|shortcuts):\/\//."); + if ((mb_strlen($redirection) > 2048)) { + throw new \InvalidArgumentException('invalid length for $redirection when calling PushNotificationRequest., must be smaller than or equal to 2048.'); + } + if ((!preg_match("/^[A-Za-z][A-Za-z0-9+.-]*:/", ObjectSerializer::toString($redirection)))) { + throw new \InvalidArgumentException("invalid value for \$redirection when calling PushNotificationRequest., must conform to the pattern /^[A-Za-z][A-Za-z0-9+.-]*:/."); } $this->container['redirection'] = $redirection; diff --git a/generated/Model/SendPushNotification429Response.php b/generated/Model/SendPushNotification429Response.php index e9299ca..699a703 100644 --- a/generated/Model/SendPushNotification429Response.php +++ b/generated/Model/SendPushNotification429Response.php @@ -60,7 +60,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J 'error' => 'string', 'message' => 'string', 'limit' => 'int', - 'active' => 'int' + 'active' => 'int', + 'blockedDevices' => 'int', + 'targetedDevices' => 'int' ]; /** @@ -74,7 +76,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J 'error' => null, 'message' => null, 'limit' => null, - 'active' => null + 'active' => null, + 'blockedDevices' => null, + 'targetedDevices' => null ]; /** @@ -86,7 +90,9 @@ class SendPushNotification429Response implements ModelInterface, ArrayAccess, \J 'error' => false, 'message' => false, 'limit' => false, - 'active' => false + 'active' => false, + 'blockedDevices' => false, + 'targetedDevices' => false ]; /** @@ -178,7 +184,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'error', 'message' => 'message', 'limit' => 'limit', - 'active' => 'active' + 'active' => 'active', + 'blockedDevices' => 'blocked_devices', + 'targetedDevices' => 'targeted_devices' ]; /** @@ -190,7 +198,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'setError', 'message' => 'setMessage', 'limit' => 'setLimit', - 'active' => 'setActive' + 'active' => 'setActive', + 'blockedDevices' => 'setBlockedDevices', + 'targetedDevices' => 'setTargetedDevices' ]; /** @@ -202,7 +212,9 @@ public function isNullableSetToNull(string $property): bool 'error' => 'getError', 'message' => 'getMessage', 'limit' => 'getLimit', - 'active' => 'getActive' + 'active' => 'getActive', + 'blockedDevices' => 'getBlockedDevices', + 'targetedDevices' => 'getTargetedDevices' ]; /** @@ -266,6 +278,8 @@ public function __construct(array $data = null) $this->setIfExists('message', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('blockedDevices', $data ?? [], null); + $this->setIfExists('targetedDevices', $data ?? [], null); } /** @@ -416,7 +430,7 @@ public function getActive() /** * Sets active * - * @param int $active Current number of active Live Activities. + * @param int $active Highest number of active Live Activities among the targeted devices. * * @return self */ @@ -429,6 +443,60 @@ public function setActive($active) return $this; } + + /** + * Gets blockedDevices + * + * @return int|null + */ + public function getBlockedDevices() + { + return $this->container['blockedDevices']; + } + + /** + * Sets blockedDevices + * + * @param int|null $blockedDevices Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity. + * + * @return self + */ + public function setBlockedDevices($blockedDevices) + { + if (is_null($blockedDevices)) { + throw new \InvalidArgumentException('non-nullable blockedDevices cannot be null'); + } + $this->container['blockedDevices'] = $blockedDevices; + + return $this; + } + + /** + * Gets targetedDevices + * + * @return int|null + */ + public function getTargetedDevices() + { + return $this->container['targetedDevices']; + } + + /** + * Sets targetedDevices + * + * @param int|null $targetedDevices Total number of targeted devices. Included only when targeted devices have mixed capacity. + * + * @return self + */ + public function setTargetedDevices($targetedDevices) + { + if (is_null($targetedDevices)) { + throw new \InvalidArgumentException('non-nullable targetedDevices cannot be null'); + } + $this->container['targetedDevices'] = $targetedDevices; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/UpdateAppIconBadgeCount422Response.php b/generated/Model/UpdateAppIconBadgeCount422Response.php new file mode 100644 index 0000000..9b314f0 --- /dev/null +++ b/generated/Model/UpdateAppIconBadgeCount422Response.php @@ -0,0 +1,748 @@ + + */ +class UpdateAppIconBadgeCount422Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'updateAppIconBadgeCount_422_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => 'string', + 'message' => 'string', + 'effectiveChannelSlugs' => 'string[]', + 'code' => 'string', + 'badge' => 'int', + 'devicesTargeted' => 'int', + 'devicesUpdated' => 'int', + 'usersUpdated' => 'int', + 'devicesNotified' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null, + 'message' => null, + 'effectiveChannelSlugs' => null, + 'code' => null, + 'badge' => null, + 'devicesTargeted' => null, + 'devicesUpdated' => null, + 'usersUpdated' => null, + 'devicesNotified' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'message' => false, + 'effectiveChannelSlugs' => false, + 'code' => false, + 'badge' => false, + 'devicesTargeted' => false, + 'devicesUpdated' => false, + 'usersUpdated' => false, + 'devicesNotified' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error' => 'error', + 'message' => 'message', + 'effectiveChannelSlugs' => 'effective_channel_slugs', + 'code' => 'code', + 'badge' => 'badge', + 'devicesTargeted' => 'devices_targeted', + 'devicesUpdated' => 'devices_updated', + 'usersUpdated' => 'users_updated', + 'devicesNotified' => 'devices_notified' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'message' => 'setMessage', + 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', + 'code' => 'setCode', + 'badge' => 'setBadge', + 'devicesTargeted' => 'setDevicesTargeted', + 'devicesUpdated' => 'setDevicesUpdated', + 'usersUpdated' => 'setUsersUpdated', + 'devicesNotified' => 'setDevicesNotified' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'message' => 'getMessage', + 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', + 'code' => 'getCode', + 'badge' => 'getBadge', + 'devicesTargeted' => 'getDevicesTargeted', + 'devicesUpdated' => 'getDevicesUpdated', + 'usersUpdated' => 'getUsersUpdated', + 'devicesNotified' => 'getDevicesNotified' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CODE_DEVICE_DISCONNECTED = 'badge_device_disconnected'; + public const CODE_UPDATE_FAILED = 'badge_update_failed'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_DEVICE_DISCONNECTED, + self::CODE_UPDATE_FAILED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('effectiveChannelSlugs', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('badge', $data ?? [], null); + $this->setIfExists('devicesTargeted', $data ?? [], null); + $this->setIfExists('devicesUpdated', $data ?? [], null); + $this->setIfExists('usersUpdated', $data ?? [], null); + $this->setIfExists('devicesNotified', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['badge'] === null) { + $invalidProperties[] = "'badge' can't be null"; + } + if (($this->container['badge'] > 2147483647)) { + $invalidProperties[] = "invalid value for 'badge', must be smaller than or equal to 2147483647."; + } + + if (($this->container['badge'] < 0)) { + $invalidProperties[] = "invalid value for 'badge', must be bigger than or equal to 0."; + } + + if ($this->container['devicesUpdated'] === null) { + $invalidProperties[] = "'devicesUpdated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error + * + * @return string + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets effectiveChannelSlugs + * + * @return string[]|null + */ + public function getEffectiveChannelSlugs() + { + return $this->container['effectiveChannelSlugs']; + } + + /** + * Sets effectiveChannelSlugs + * + * @param string[]|null $effectiveChannelSlugs effectiveChannelSlugs + * + * @return self + */ + public function setEffectiveChannelSlugs($effectiveChannelSlugs) + { + if (is_null($effectiveChannelSlugs)) { + throw new \InvalidArgumentException('non-nullable effectiveChannelSlugs cannot be null'); + } + $this->container['effectiveChannelSlugs'] = $effectiveChannelSlugs; + + return $this; + } + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets badge + * + * @return int + */ + public function getBadge() + { + return $this->container['badge']; + } + + /** + * Sets badge + * + * @param int $badge badge + * + * @return self + */ + public function setBadge($badge) + { + if (is_null($badge)) { + throw new \InvalidArgumentException('non-nullable badge cannot be null'); + } + + if (($badge > 2147483647)) { + throw new \InvalidArgumentException('invalid value for $badge when calling UpdateAppIconBadgeCount422Response., must be smaller than or equal to 2147483647.'); + } + if (($badge < 0)) { + throw new \InvalidArgumentException('invalid value for $badge when calling UpdateAppIconBadgeCount422Response., must be bigger than or equal to 0.'); + } + + $this->container['badge'] = $badge; + + return $this; + } + + /** + * Gets devicesTargeted + * + * @return int|null + */ + public function getDevicesTargeted() + { + return $this->container['devicesTargeted']; + } + + /** + * Sets devicesTargeted + * + * @param int|null $devicesTargeted devicesTargeted + * + * @return self + */ + public function setDevicesTargeted($devicesTargeted) + { + if (is_null($devicesTargeted)) { + throw new \InvalidArgumentException('non-nullable devicesTargeted cannot be null'); + } + $this->container['devicesTargeted'] = $devicesTargeted; + + return $this; + } + + /** + * Gets devicesUpdated + * + * @return int + */ + public function getDevicesUpdated() + { + return $this->container['devicesUpdated']; + } + + /** + * Sets devicesUpdated + * + * @param int $devicesUpdated devicesUpdated + * + * @return self + */ + public function setDevicesUpdated($devicesUpdated) + { + if (is_null($devicesUpdated)) { + throw new \InvalidArgumentException('non-nullable devicesUpdated cannot be null'); + } + $this->container['devicesUpdated'] = $devicesUpdated; + + return $this; + } + + /** + * Gets usersUpdated + * + * @return int|null + */ + public function getUsersUpdated() + { + return $this->container['usersUpdated']; + } + + /** + * Sets usersUpdated + * + * @param int|null $usersUpdated usersUpdated + * + * @return self + */ + public function setUsersUpdated($usersUpdated) + { + if (is_null($usersUpdated)) { + throw new \InvalidArgumentException('non-nullable usersUpdated cannot be null'); + } + $this->container['usersUpdated'] = $usersUpdated; + + return $this; + } + + /** + * Gets devicesNotified + * + * @return int|null + * @deprecated + */ + public function getDevicesNotified() + { + return $this->container['devicesNotified']; + } + + /** + * Sets devicesNotified + * + * @param int|null $devicesNotified Deprecated compatibility alias for devices_updated. + * + * @return self + * @deprecated + */ + public function setDevicesNotified($devicesNotified) + { + if (is_null($devicesNotified)) { + throw new \InvalidArgumentException('non-nullable devicesNotified cannot be null'); + } + $this->container['devicesNotified'] = $devicesNotified; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/generated/ObjectSerializer.php b/generated/ObjectSerializer.php index ac74510..35ceda4 100644 --- a/generated/ObjectSerializer.php +++ b/generated/ObjectSerializer.php @@ -77,7 +77,8 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } - return $data; + // OpenAPI string-keyed maps must serialize as JSON objects, including {}. + return str_starts_with($type ?? '', 'array