diff --git a/generated/Api/LiveActivitiesApi.php b/generated/Api/LiveActivitiesApi.php index b4bf213..fe26edd 100644 --- a/generated/Api/LiveActivitiesApi.php +++ b/generated/Api/LiveActivitiesApi.php @@ -74,6 +74,12 @@ class LiveActivitiesApi 'endLiveActivity' => [ 'application/json', ], + 'endLiveActivityStream' => [ + 'application/json', + ], + 'reconcileLiveActivityStream' => [ + 'application/json', + ], 'startLiveActivity' => [ 'application/json', ], @@ -508,6 +514,917 @@ public function endLiveActivityRequest($liveActivityEndRequest, string $contentT ); } + /** + * Operation endLiveActivityStream + * + * End a stream + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamDeleteRequest $liveActivityStreamDeleteRequest liveActivityStreamDeleteRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endLiveActivityStream'] 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\LiveActivityStreamDeleteResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\RateLimitError + */ + public function endLiveActivityStream($streamKey, $liveActivityStreamDeleteRequest = null, string $contentType = self::contentTypes['endLiveActivityStream'][0]) + { + list($response) = $this->endLiveActivityStreamWithHttpInfo($streamKey, $liveActivityStreamDeleteRequest, $contentType); + return $response; + } + + /** + * Operation endLiveActivityStreamWithHttpInfo + * + * End a stream + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamDeleteRequest $liveActivityStreamDeleteRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endLiveActivityStream'] 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\LiveActivityStreamDeleteResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\NotFoundError|\ActivitySmith\Generated\Model\RateLimitError, HTTP status code, HTTP response headers (array of strings) + */ + public function endLiveActivityStreamWithHttpInfo($streamKey, $liveActivityStreamDeleteRequest = null, string $contentType = self::contentTypes['endLiveActivityStream'][0]) + { + $request = $this->endLiveActivityStreamRequest($streamKey, $liveActivityStreamDeleteRequest, $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\LiveActivityStreamDeleteResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\LiveActivityStreamDeleteResponse' !== '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\LiveActivityStreamDeleteResponse', []), + $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 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 429: + if ('\ActivitySmith\Generated\Model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\RateLimitError' !== '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\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\ActivitySmith\Generated\Model\LiveActivityStreamDeleteResponse'; + 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\LiveActivityStreamDeleteResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\BadRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\NotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation endLiveActivityStreamAsync + * + * End a stream + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamDeleteRequest $liveActivityStreamDeleteRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function endLiveActivityStreamAsync($streamKey, $liveActivityStreamDeleteRequest = null, string $contentType = self::contentTypes['endLiveActivityStream'][0]) + { + return $this->endLiveActivityStreamAsyncWithHttpInfo($streamKey, $liveActivityStreamDeleteRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation endLiveActivityStreamAsyncWithHttpInfo + * + * End a stream + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamDeleteRequest $liveActivityStreamDeleteRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function endLiveActivityStreamAsyncWithHttpInfo($streamKey, $liveActivityStreamDeleteRequest = null, string $contentType = self::contentTypes['endLiveActivityStream'][0]) + { + $returnType = '\ActivitySmith\Generated\Model\LiveActivityStreamDeleteResponse'; + $request = $this->endLiveActivityStreamRequest($streamKey, $liveActivityStreamDeleteRequest, $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 'endLiveActivityStream' + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamDeleteRequest $liveActivityStreamDeleteRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function endLiveActivityStreamRequest($streamKey, $liveActivityStreamDeleteRequest = null, string $contentType = self::contentTypes['endLiveActivityStream'][0]) + { + + // verify the required parameter 'streamKey' is set + if ($streamKey === null || (is_array($streamKey) && count($streamKey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $streamKey when calling endLiveActivityStream' + ); + } + if (strlen($streamKey) > 255) { + throw new \InvalidArgumentException('invalid length for "$streamKey" when calling LiveActivitiesApi.endLiveActivityStream, must be smaller than or equal to 255.'); + } + if (!preg_match("/^[A-Za-z0-9_-]+$/", $streamKey)) { + throw new \InvalidArgumentException("invalid value for \"streamKey\" when calling LiveActivitiesApi.endLiveActivityStream, must conform to the pattern /^[A-Za-z0-9_-]+$/."); + } + + + + $resourcePath = '/live-activity/stream/{stream_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($streamKey !== null) { + $resourcePath = str_replace( + '{' . 'stream_key' . '}', + ObjectSerializer::toPathValue($streamKey), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($liveActivityStreamDeleteRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($liveActivityStreamDeleteRequest)); + } else { + $httpBody = $liveActivityStreamDeleteRequest; + } + } 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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation reconcileLiveActivityStream + * + * Send a stream update + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamRequest $liveActivityStreamRequest liveActivityStreamRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reconcileLiveActivityStream'] 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\LiveActivityStreamPutResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response + */ + public function reconcileLiveActivityStream($streamKey, $liveActivityStreamRequest, string $contentType = self::contentTypes['reconcileLiveActivityStream'][0]) + { + list($response) = $this->reconcileLiveActivityStreamWithHttpInfo($streamKey, $liveActivityStreamRequest, $contentType); + return $response; + } + + /** + * Operation reconcileLiveActivityStreamWithHttpInfo + * + * Send a stream update + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamRequest $liveActivityStreamRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reconcileLiveActivityStream'] 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\LiveActivityStreamPutResponse|\ActivitySmith\Generated\Model\BadRequestError|\ActivitySmith\Generated\Model\ForbiddenError|\ActivitySmith\Generated\Model\NoRecipientsError|\ActivitySmith\Generated\Model\SendPushNotification429Response, HTTP status code, HTTP response headers (array of strings) + */ + public function reconcileLiveActivityStreamWithHttpInfo($streamKey, $liveActivityStreamRequest, string $contentType = self::contentTypes['reconcileLiveActivityStream'][0]) + { + $request = $this->reconcileLiveActivityStreamRequest($streamKey, $liveActivityStreamRequest, $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\LiveActivityStreamPutResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ActivitySmith\Generated\Model\LiveActivityStreamPutResponse' !== '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\LiveActivityStreamPutResponse', []), + $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 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\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\LiveActivityStreamPutResponse'; + 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\LiveActivityStreamPutResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ActivitySmith\Generated\Model\BadRequestError', + $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\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 reconcileLiveActivityStreamAsync + * + * Send a stream update + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamRequest $liveActivityStreamRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reconcileLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function reconcileLiveActivityStreamAsync($streamKey, $liveActivityStreamRequest, string $contentType = self::contentTypes['reconcileLiveActivityStream'][0]) + { + return $this->reconcileLiveActivityStreamAsyncWithHttpInfo($streamKey, $liveActivityStreamRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation reconcileLiveActivityStreamAsyncWithHttpInfo + * + * Send a stream update + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamRequest $liveActivityStreamRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reconcileLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function reconcileLiveActivityStreamAsyncWithHttpInfo($streamKey, $liveActivityStreamRequest, string $contentType = self::contentTypes['reconcileLiveActivityStream'][0]) + { + $returnType = '\ActivitySmith\Generated\Model\LiveActivityStreamPutResponse'; + $request = $this->reconcileLiveActivityStreamRequest($streamKey, $liveActivityStreamRequest, $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 'reconcileLiveActivityStream' + * + * @param string $streamKey Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens. (required) + * @param \ActivitySmith\Generated\Model\LiveActivityStreamRequest $liveActivityStreamRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reconcileLiveActivityStream'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function reconcileLiveActivityStreamRequest($streamKey, $liveActivityStreamRequest, string $contentType = self::contentTypes['reconcileLiveActivityStream'][0]) + { + + // verify the required parameter 'streamKey' is set + if ($streamKey === null || (is_array($streamKey) && count($streamKey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $streamKey when calling reconcileLiveActivityStream' + ); + } + if (strlen($streamKey) > 255) { + throw new \InvalidArgumentException('invalid length for "$streamKey" when calling LiveActivitiesApi.reconcileLiveActivityStream, must be smaller than or equal to 255.'); + } + if (!preg_match("/^[A-Za-z0-9_-]+$/", $streamKey)) { + throw new \InvalidArgumentException("invalid value for \"streamKey\" when calling LiveActivitiesApi.reconcileLiveActivityStream, must conform to the pattern /^[A-Za-z0-9_-]+$/."); + } + + // verify the required parameter 'liveActivityStreamRequest' is set + if ($liveActivityStreamRequest === null || (is_array($liveActivityStreamRequest) && count($liveActivityStreamRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $liveActivityStreamRequest when calling reconcileLiveActivityStream' + ); + } + + + $resourcePath = '/live-activity/stream/{stream_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($streamKey !== null) { + $resourcePath = str_replace( + '{' . 'stream_key' . '}', + ObjectSerializer::toPathValue($streamKey), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($liveActivityStreamRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($liveActivityStreamRequest)); + } else { + $httpBody = $liveActivityStreamRequest; + } + } 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 startLiveActivity * diff --git a/generated/Model/ActivityMetric.php b/generated/Model/ActivityMetric.php new file mode 100644 index 0000000..cb2b665 --- /dev/null +++ b/generated/Model/ActivityMetric.php @@ -0,0 +1,508 @@ + + */ +class ActivityMetric implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ActivityMetric'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'label' => 'string', + 'value' => 'float', + 'unit' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'label' => null, + 'value' => null, + 'unit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'label' => false, + 'value' => false, + 'unit' => 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 = [ + 'label' => 'label', + 'value' => 'value', + 'unit' => 'unit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'label' => 'setLabel', + 'value' => 'setValue', + 'unit' => 'setUnit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'label' => 'getLabel', + 'value' => 'getValue', + 'unit' => 'getUnit' + ]; + + /** + * 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('label', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('unit', $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['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + if ((mb_strlen($this->container['label']) < 1)) { + $invalidProperties[] = "invalid value for 'label', the character length must be bigger than or equal to 1."; + } + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if (($this->container['value'] > 100)) { + $invalidProperties[] = "invalid value for 'value', must be smaller than or equal to 100."; + } + + if (($this->container['value'] < 0)) { + $invalidProperties[] = "invalid value for 'value', must be bigger than or equal to 0."; + } + + 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 label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label label + * + * @return self + */ + public function setLabel($label) + { + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); + } + + if ((mb_strlen($label) < 1)) { + throw new \InvalidArgumentException('invalid length for $label when calling ActivityMetric., must be bigger than or equal to 1.'); + } + + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets value + * + * @return float + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + if (($value > 100)) { + throw new \InvalidArgumentException('invalid value for $value when calling ActivityMetric., must be smaller than or equal to 100.'); + } + if (($value < 0)) { + throw new \InvalidArgumentException('invalid value for $value when calling ActivityMetric., must be bigger than or equal to 0.'); + } + + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + 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/ContentStateEnd.php b/generated/Model/ContentStateEnd.php index b4ce46a..adfe931 100644 --- a/generated/Model/ContentStateEnd.php +++ b/generated/Model/ContentStateEnd.php @@ -35,7 +35,7 @@ * ContentStateEnd Class Doc Comment * * @category Class - * @description End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. + * @description End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -65,9 +65,11 @@ class ContentStateEnd implements ModelInterface, ArrayAccess, \JsonSerializable 'percentage' => 'float', 'value' => 'float', 'upperLimit' => 'float', + 'metrics' => '\ActivitySmith\Generated\Model\ActivityMetric[]', 'type' => 'string', 'color' => 'string', 'stepColor' => 'string', + 'stepColors' => 'string[]', 'autoDismissMinutes' => 'int' ]; @@ -86,9 +88,11 @@ class ContentStateEnd implements ModelInterface, ArrayAccess, \JsonSerializable 'percentage' => null, 'value' => null, 'upperLimit' => null, + 'metrics' => null, 'type' => null, 'color' => null, 'stepColor' => null, + 'stepColors' => null, 'autoDismissMinutes' => null ]; @@ -105,9 +109,11 @@ class ContentStateEnd implements ModelInterface, ArrayAccess, \JsonSerializable 'percentage' => false, 'value' => false, 'upperLimit' => false, + 'metrics' => false, 'type' => false, 'color' => false, 'stepColor' => false, + 'stepColors' => false, 'autoDismissMinutes' => false ]; @@ -204,9 +210,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'percentage', 'value' => 'value', 'upperLimit' => 'upper_limit', + 'metrics' => 'metrics', 'type' => 'type', 'color' => 'color', 'stepColor' => 'step_color', + 'stepColors' => 'step_colors', 'autoDismissMinutes' => 'auto_dismiss_minutes' ]; @@ -223,9 +231,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'setPercentage', 'value' => 'setValue', 'upperLimit' => 'setUpperLimit', + 'metrics' => 'setMetrics', 'type' => 'setType', 'color' => 'setColor', 'stepColor' => 'setStepColor', + 'stepColors' => 'setStepColors', 'autoDismissMinutes' => 'setAutoDismissMinutes' ]; @@ -242,9 +252,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'getPercentage', 'value' => 'getValue', 'upperLimit' => 'getUpperLimit', + 'metrics' => 'getMetrics', 'type' => 'getType', 'color' => 'getColor', 'stepColor' => 'getStepColor', + 'stepColors' => 'getStepColors', 'autoDismissMinutes' => 'getAutoDismissMinutes' ]; @@ -291,6 +303,10 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; + public const TYPE_METRICS = 'metrics'; + public const TYPE_COUNTER = 'counter'; + public const TYPE_TIMER = 'timer'; + public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -309,6 +325,15 @@ public function getModelName() public const STEP_COLOR_RED = 'red'; public const STEP_COLOR_ORANGE = 'orange'; public const STEP_COLOR_YELLOW = 'yellow'; + public const STEP_COLORS_LIME = 'lime'; + public const STEP_COLORS_GREEN = 'green'; + public const STEP_COLORS_CYAN = 'cyan'; + public const STEP_COLORS_BLUE = 'blue'; + public const STEP_COLORS_PURPLE = 'purple'; + public const STEP_COLORS_MAGENTA = 'magenta'; + public const STEP_COLORS_RED = 'red'; + public const STEP_COLORS_ORANGE = 'orange'; + public const STEP_COLORS_YELLOW = 'yellow'; /** * Gets allowable values of the enum @@ -320,6 +345,10 @@ public function getTypeAllowableValues() return [ self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, + self::TYPE_METRICS, + self::TYPE_COUNTER, + self::TYPE_TIMER, + self::TYPE_COUNTDOWN, ]; } @@ -363,6 +392,26 @@ public function getStepColorAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStepColorsAllowableValues() + { + return [ + self::STEP_COLORS_LIME, + self::STEP_COLORS_GREEN, + self::STEP_COLORS_CYAN, + self::STEP_COLORS_BLUE, + self::STEP_COLORS_PURPLE, + self::STEP_COLORS_MAGENTA, + self::STEP_COLORS_RED, + self::STEP_COLORS_ORANGE, + self::STEP_COLORS_YELLOW, + ]; + } + /** * Associative array for storing property values * @@ -385,9 +434,11 @@ public function __construct(array $data = null) $this->setIfExists('percentage', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); $this->setIfExists('upperLimit', $data ?? [], null); + $this->setIfExists('metrics', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('color', $data ?? [], 'blue'); $this->setIfExists('stepColor', $data ?? [], null); + $this->setIfExists('stepColors', $data ?? [], null); $this->setIfExists('autoDismissMinutes', $data ?? [], 3); } @@ -437,6 +488,10 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 0."; } + if (!is_null($this->container['metrics']) && (count($this->container['metrics']) < 1)) { + $invalidProperties[] = "invalid value for 'metrics', number of items must be greater than or equal to 1."; + } + $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -690,6 +745,38 @@ public function setUpperLimit($upperLimit) return $this; } + /** + * Gets metrics + * + * @return \ActivitySmith\Generated\Model\ActivityMetric[]|null + */ + public function getMetrics() + { + return $this->container['metrics']; + } + + /** + * Sets metrics + * + * @param \ActivitySmith\Generated\Model\ActivityMetric[]|null $metrics Use for type=metrics. + * + * @return self + */ + public function setMetrics($metrics) + { + if (is_null($metrics)) { + throw new \InvalidArgumentException('non-nullable metrics cannot be null'); + } + + + if ((count($metrics) < 1)) { + throw new \InvalidArgumentException('invalid length for $metrics when calling ContentStateEnd., number of items must be greater than or equal to 1.'); + } + $this->container['metrics'] = $metrics; + + return $this; + } + /** * Gets type * @@ -801,6 +888,42 @@ public function setStepColor($stepColor) return $this; } + /** + * Gets stepColors + * + * @return string[]|null + */ + public function getStepColors() + { + return $this->container['stepColors']; + } + + /** + * Sets stepColors + * + * @param string[]|null $stepColors Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. + * + * @return self + */ + public function setStepColors($stepColors) + { + if (is_null($stepColors)) { + throw new \InvalidArgumentException('non-nullable stepColors cannot be null'); + } + $allowedValues = $this->getStepColorsAllowableValues(); + if (array_diff($stepColors, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'stepColors', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['stepColors'] = $stepColors; + + return $this; + } + /** * Gets autoDismissMinutes * diff --git a/generated/Model/ContentStateStart.php b/generated/Model/ContentStateStart.php index e6455c6..1080b91 100644 --- a/generated/Model/ContentStateStart.php +++ b/generated/Model/ContentStateStart.php @@ -35,7 +35,7 @@ * ContentStateStart Class Doc Comment * * @category Class - * @description Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. + * @description Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -65,9 +65,11 @@ class ContentStateStart implements ModelInterface, ArrayAccess, \JsonSerializabl 'percentage' => 'float', 'value' => 'float', 'upperLimit' => 'float', + 'metrics' => '\ActivitySmith\Generated\Model\ActivityMetric[]', 'type' => 'string', 'color' => 'string', - 'stepColor' => 'string' + 'stepColor' => 'string', + 'stepColors' => 'string[]' ]; /** @@ -85,9 +87,11 @@ class ContentStateStart implements ModelInterface, ArrayAccess, \JsonSerializabl 'percentage' => null, 'value' => null, 'upperLimit' => null, + 'metrics' => null, 'type' => null, 'color' => null, - 'stepColor' => null + 'stepColor' => null, + 'stepColors' => null ]; /** @@ -103,9 +107,11 @@ class ContentStateStart implements ModelInterface, ArrayAccess, \JsonSerializabl 'percentage' => false, 'value' => false, 'upperLimit' => false, + 'metrics' => false, 'type' => false, 'color' => false, - 'stepColor' => false + 'stepColor' => false, + 'stepColors' => false ]; /** @@ -201,9 +207,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'percentage', 'value' => 'value', 'upperLimit' => 'upper_limit', + 'metrics' => 'metrics', 'type' => 'type', 'color' => 'color', - 'stepColor' => 'step_color' + 'stepColor' => 'step_color', + 'stepColors' => 'step_colors' ]; /** @@ -219,9 +227,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'setPercentage', 'value' => 'setValue', 'upperLimit' => 'setUpperLimit', + 'metrics' => 'setMetrics', 'type' => 'setType', 'color' => 'setColor', - 'stepColor' => 'setStepColor' + 'stepColor' => 'setStepColor', + 'stepColors' => 'setStepColors' ]; /** @@ -237,9 +247,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'getPercentage', 'value' => 'getValue', 'upperLimit' => 'getUpperLimit', + 'metrics' => 'getMetrics', 'type' => 'getType', 'color' => 'getColor', - 'stepColor' => 'getStepColor' + 'stepColor' => 'getStepColor', + 'stepColors' => 'getStepColors' ]; /** @@ -285,6 +297,10 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; + public const TYPE_METRICS = 'metrics'; + public const TYPE_COUNTER = 'counter'; + public const TYPE_TIMER = 'timer'; + public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -303,6 +319,15 @@ public function getModelName() public const STEP_COLOR_RED = 'red'; public const STEP_COLOR_ORANGE = 'orange'; public const STEP_COLOR_YELLOW = 'yellow'; + public const STEP_COLORS_LIME = 'lime'; + public const STEP_COLORS_GREEN = 'green'; + public const STEP_COLORS_CYAN = 'cyan'; + public const STEP_COLORS_BLUE = 'blue'; + public const STEP_COLORS_PURPLE = 'purple'; + public const STEP_COLORS_MAGENTA = 'magenta'; + public const STEP_COLORS_RED = 'red'; + public const STEP_COLORS_ORANGE = 'orange'; + public const STEP_COLORS_YELLOW = 'yellow'; /** * Gets allowable values of the enum @@ -314,6 +339,10 @@ public function getTypeAllowableValues() return [ self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, + self::TYPE_METRICS, + self::TYPE_COUNTER, + self::TYPE_TIMER, + self::TYPE_COUNTDOWN, ]; } @@ -357,6 +386,26 @@ public function getStepColorAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStepColorsAllowableValues() + { + return [ + self::STEP_COLORS_LIME, + self::STEP_COLORS_GREEN, + self::STEP_COLORS_CYAN, + self::STEP_COLORS_BLUE, + self::STEP_COLORS_PURPLE, + self::STEP_COLORS_MAGENTA, + self::STEP_COLORS_RED, + self::STEP_COLORS_ORANGE, + self::STEP_COLORS_YELLOW, + ]; + } + /** * Associative array for storing property values * @@ -379,9 +428,11 @@ public function __construct(array $data = null) $this->setIfExists('percentage', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); $this->setIfExists('upperLimit', $data ?? [], null); + $this->setIfExists('metrics', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('color', $data ?? [], 'blue'); $this->setIfExists('stepColor', $data ?? [], null); + $this->setIfExists('stepColors', $data ?? [], null); } /** @@ -430,6 +481,10 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 0."; } + if (!is_null($this->container['metrics']) && (count($this->container['metrics']) < 1)) { + $invalidProperties[] = "invalid value for 'metrics', number of items must be greater than or equal to 1."; + } + if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } @@ -682,6 +737,38 @@ public function setUpperLimit($upperLimit) return $this; } + /** + * Gets metrics + * + * @return \ActivitySmith\Generated\Model\ActivityMetric[]|null + */ + public function getMetrics() + { + return $this->container['metrics']; + } + + /** + * Sets metrics + * + * @param \ActivitySmith\Generated\Model\ActivityMetric[]|null $metrics Use for type=metrics. + * + * @return self + */ + public function setMetrics($metrics) + { + if (is_null($metrics)) { + throw new \InvalidArgumentException('non-nullable metrics cannot be null'); + } + + + if ((count($metrics) < 1)) { + throw new \InvalidArgumentException('invalid length for $metrics when calling ContentStateStart., number of items must be greater than or equal to 1.'); + } + $this->container['metrics'] = $metrics; + + return $this; + } + /** * Gets type * @@ -792,6 +879,42 @@ public function setStepColor($stepColor) return $this; } + + /** + * Gets stepColors + * + * @return string[]|null + */ + public function getStepColors() + { + return $this->container['stepColors']; + } + + /** + * Sets stepColors + * + * @param string[]|null $stepColors Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. + * + * @return self + */ + public function setStepColors($stepColors) + { + if (is_null($stepColors)) { + throw new \InvalidArgumentException('non-nullable stepColors cannot be null'); + } + $allowedValues = $this->getStepColorsAllowableValues(); + if (array_diff($stepColors, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'stepColors', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['stepColors'] = $stepColors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/ContentStateUpdate.php b/generated/Model/ContentStateUpdate.php index 68b9d7b..6ddf1d2 100644 --- a/generated/Model/ContentStateUpdate.php +++ b/generated/Model/ContentStateUpdate.php @@ -35,7 +35,7 @@ * ContentStateUpdate Class Doc Comment * * @category Class - * @description Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. + * @description Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates. * @package ActivitySmith\Generated * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -65,9 +65,11 @@ class ContentStateUpdate implements ModelInterface, ArrayAccess, \JsonSerializab 'percentage' => 'float', 'value' => 'float', 'upperLimit' => 'float', + 'metrics' => '\ActivitySmith\Generated\Model\ActivityMetric[]', 'type' => 'string', 'color' => 'string', - 'stepColor' => 'string' + 'stepColor' => 'string', + 'stepColors' => 'string[]' ]; /** @@ -85,9 +87,11 @@ class ContentStateUpdate implements ModelInterface, ArrayAccess, \JsonSerializab 'percentage' => null, 'value' => null, 'upperLimit' => null, + 'metrics' => null, 'type' => null, 'color' => null, - 'stepColor' => null + 'stepColor' => null, + 'stepColors' => null ]; /** @@ -103,9 +107,11 @@ class ContentStateUpdate implements ModelInterface, ArrayAccess, \JsonSerializab 'percentage' => false, 'value' => false, 'upperLimit' => false, + 'metrics' => false, 'type' => false, 'color' => false, - 'stepColor' => false + 'stepColor' => false, + 'stepColors' => false ]; /** @@ -201,9 +207,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'percentage', 'value' => 'value', 'upperLimit' => 'upper_limit', + 'metrics' => 'metrics', 'type' => 'type', 'color' => 'color', - 'stepColor' => 'step_color' + 'stepColor' => 'step_color', + 'stepColors' => 'step_colors' ]; /** @@ -219,9 +227,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'setPercentage', 'value' => 'setValue', 'upperLimit' => 'setUpperLimit', + 'metrics' => 'setMetrics', 'type' => 'setType', 'color' => 'setColor', - 'stepColor' => 'setStepColor' + 'stepColor' => 'setStepColor', + 'stepColors' => 'setStepColors' ]; /** @@ -237,9 +247,11 @@ public function isNullableSetToNull(string $property): bool 'percentage' => 'getPercentage', 'value' => 'getValue', 'upperLimit' => 'getUpperLimit', + 'metrics' => 'getMetrics', 'type' => 'getType', 'color' => 'getColor', - 'stepColor' => 'getStepColor' + 'stepColor' => 'getStepColor', + 'stepColors' => 'getStepColors' ]; /** @@ -285,6 +297,10 @@ public function getModelName() public const TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; public const TYPE_PROGRESS = 'progress'; + public const TYPE_METRICS = 'metrics'; + public const TYPE_COUNTER = 'counter'; + public const TYPE_TIMER = 'timer'; + public const TYPE_COUNTDOWN = 'countdown'; public const COLOR_LIME = 'lime'; public const COLOR_GREEN = 'green'; public const COLOR_CYAN = 'cyan'; @@ -303,6 +319,15 @@ public function getModelName() public const STEP_COLOR_RED = 'red'; public const STEP_COLOR_ORANGE = 'orange'; public const STEP_COLOR_YELLOW = 'yellow'; + public const STEP_COLORS_LIME = 'lime'; + public const STEP_COLORS_GREEN = 'green'; + public const STEP_COLORS_CYAN = 'cyan'; + public const STEP_COLORS_BLUE = 'blue'; + public const STEP_COLORS_PURPLE = 'purple'; + public const STEP_COLORS_MAGENTA = 'magenta'; + public const STEP_COLORS_RED = 'red'; + public const STEP_COLORS_ORANGE = 'orange'; + public const STEP_COLORS_YELLOW = 'yellow'; /** * Gets allowable values of the enum @@ -314,6 +339,10 @@ public function getTypeAllowableValues() return [ self::TYPE_SEGMENTED_PROGRESS, self::TYPE_PROGRESS, + self::TYPE_METRICS, + self::TYPE_COUNTER, + self::TYPE_TIMER, + self::TYPE_COUNTDOWN, ]; } @@ -357,6 +386,26 @@ public function getStepColorAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStepColorsAllowableValues() + { + return [ + self::STEP_COLORS_LIME, + self::STEP_COLORS_GREEN, + self::STEP_COLORS_CYAN, + self::STEP_COLORS_BLUE, + self::STEP_COLORS_PURPLE, + self::STEP_COLORS_MAGENTA, + self::STEP_COLORS_RED, + self::STEP_COLORS_ORANGE, + self::STEP_COLORS_YELLOW, + ]; + } + /** * Associative array for storing property values * @@ -379,9 +428,11 @@ public function __construct(array $data = null) $this->setIfExists('percentage', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); $this->setIfExists('upperLimit', $data ?? [], null); + $this->setIfExists('metrics', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('color', $data ?? [], 'blue'); $this->setIfExists('stepColor', $data ?? [], null); + $this->setIfExists('stepColors', $data ?? [], null); } /** @@ -430,6 +481,10 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 0."; } + if (!is_null($this->container['metrics']) && (count($this->container['metrics']) < 1)) { + $invalidProperties[] = "invalid value for 'metrics', number of items must be greater than or equal to 1."; + } + $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -679,6 +734,38 @@ public function setUpperLimit($upperLimit) return $this; } + /** + * Gets metrics + * + * @return \ActivitySmith\Generated\Model\ActivityMetric[]|null + */ + public function getMetrics() + { + return $this->container['metrics']; + } + + /** + * Sets metrics + * + * @param \ActivitySmith\Generated\Model\ActivityMetric[]|null $metrics Use for type=metrics. + * + * @return self + */ + public function setMetrics($metrics) + { + if (is_null($metrics)) { + throw new \InvalidArgumentException('non-nullable metrics cannot be null'); + } + + + if ((count($metrics) < 1)) { + throw new \InvalidArgumentException('invalid length for $metrics when calling ContentStateUpdate., number of items must be greater than or equal to 1.'); + } + $this->container['metrics'] = $metrics; + + return $this; + } + /** * Gets type * @@ -789,6 +876,42 @@ public function setStepColor($stepColor) return $this; } + + /** + * Gets stepColors + * + * @return string[]|null + */ + public function getStepColors() + { + return $this->container['stepColors']; + } + + /** + * Sets stepColors + * + * @param string[]|null $stepColors Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. + * + * @return self + */ + public function setStepColors($stepColors) + { + if (is_null($stepColors)) { + throw new \InvalidArgumentException('non-nullable stepColors cannot be null'); + } + $allowedValues = $this->getStepColorsAllowableValues(); + if (array_diff($stepColors, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'stepColors', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['stepColors'] = $stepColors; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/generated/Model/LiveActivityStreamDeleteRequest.php b/generated/Model/LiveActivityStreamDeleteRequest.php new file mode 100644 index 0000000..c8b95c3 --- /dev/null +++ b/generated/Model/LiveActivityStreamDeleteRequest.php @@ -0,0 +1,478 @@ + + */ +class LiveActivityStreamDeleteRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LiveActivityStreamDeleteRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', + 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'alert' => '\ActivitySmith\Generated\Model\AlertPayload' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contentState' => null, + 'action' => null, + 'alert' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contentState' => false, + 'action' => false, + 'alert' => 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 = [ + 'contentState' => 'content_state', + 'action' => 'action', + 'alert' => 'alert' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contentState' => 'setContentState', + 'action' => 'setAction', + 'alert' => 'setAlert' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contentState' => 'getContentState', + 'action' => 'getAction', + 'alert' => 'getAlert' + ]; + + /** + * 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('contentState', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('alert', $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; + } + + + /** + * Gets contentState + * + * @return \ActivitySmith\Generated\Model\StreamContentState|null + */ + public function getContentState() + { + return $this->container['contentState']; + } + + /** + * Sets contentState + * + * @param \ActivitySmith\Generated\Model\StreamContentState|null $contentState contentState + * + * @return self + */ + public function setContentState($contentState) + { + if (is_null($contentState)) { + throw new \InvalidArgumentException('non-nullable contentState cannot be null'); + } + $this->container['contentState'] = $contentState; + + return $this; + } + + /** + * Gets action + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets alert + * + * @return \ActivitySmith\Generated\Model\AlertPayload|null + */ + public function getAlert() + { + return $this->container['alert']; + } + + /** + * Sets alert + * + * @param \ActivitySmith\Generated\Model\AlertPayload|null $alert alert + * + * @return self + */ + public function setAlert($alert) + { + if (is_null($alert)) { + throw new \InvalidArgumentException('non-nullable alert cannot be null'); + } + $this->container['alert'] = $alert; + + 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/LiveActivityStreamDeleteResponse.php b/generated/Model/LiveActivityStreamDeleteResponse.php new file mode 100644 index 0000000..ee420c3 --- /dev/null +++ b/generated/Model/LiveActivityStreamDeleteResponse.php @@ -0,0 +1,665 @@ + + */ +class LiveActivityStreamDeleteResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LiveActivityStreamDeleteResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success' => 'bool', + 'operation' => 'string', + 'streamKey' => 'string', + 'activityId' => 'string', + 'devicesQueued' => 'int', + 'devicesNotified' => 'int', + '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, + 'operation' => null, + 'streamKey' => null, + 'activityId' => null, + 'devicesQueued' => null, + 'devicesNotified' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success' => false, + 'operation' => false, + 'streamKey' => false, + 'activityId' => true, + 'devicesQueued' => false, + 'devicesNotified' => 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', + 'operation' => 'operation', + 'streamKey' => 'stream_key', + 'activityId' => 'activity_id', + 'devicesQueued' => 'devices_queued', + 'devicesNotified' => 'devices_notified', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'operation' => 'setOperation', + 'streamKey' => 'setStreamKey', + 'activityId' => 'setActivityId', + 'devicesQueued' => 'setDevicesQueued', + 'devicesNotified' => 'setDevicesNotified', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'operation' => 'getOperation', + 'streamKey' => 'getStreamKey', + 'activityId' => 'getActivityId', + 'devicesQueued' => 'getDevicesQueued', + 'devicesNotified' => 'getDevicesNotified', + '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; + } + + public const OPERATION_ENDED = 'ended'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperationAllowableValues() + { + return [ + self::OPERATION_ENDED, + ]; + } + + /** + * 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('operation', $data ?? [], null); + $this->setIfExists('streamKey', $data ?? [], null); + $this->setIfExists('activityId', $data ?? [], null); + $this->setIfExists('devicesQueued', $data ?? [], null); + $this->setIfExists('devicesNotified', $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['operation'] === null) { + $invalidProperties[] = "'operation' can't be null"; + } + $allowedValues = $this->getOperationAllowableValues(); + if (!is_null($this->container['operation']) && !in_array($this->container['operation'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operation', must be one of '%s'", + $this->container['operation'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['streamKey'] === null) { + $invalidProperties[] = "'streamKey' 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 success + * + * @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 operation + * + * @return string + */ + public function getOperation() + { + return $this->container['operation']; + } + + /** + * Sets operation + * + * @param string $operation operation + * + * @return self + */ + public function setOperation($operation) + { + if (is_null($operation)) { + throw new \InvalidArgumentException('non-nullable operation cannot be null'); + } + $allowedValues = $this->getOperationAllowableValues(); + if (!in_array($operation, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operation', must be one of '%s'", + $operation, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operation'] = $operation; + + return $this; + } + + /** + * Gets streamKey + * + * @return string + */ + public function getStreamKey() + { + return $this->container['streamKey']; + } + + /** + * Sets streamKey + * + * @param string $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 activityId + * + * @return string|null + */ + public function getActivityId() + { + return $this->container['activityId']; + } + + /** + * Sets activityId + * + * @param string|null $activityId activityId + * + * @return self + */ + public function setActivityId($activityId) + { + if (is_null($activityId)) { + array_push($this->openAPINullablesSetToNull, 'activityId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityId'] = $activityId; + + return $this; + } + + /** + * Gets devicesQueued + * + * @return int|null + */ + public function getDevicesQueued() + { + return $this->container['devicesQueued']; + } + + /** + * Sets devicesQueued + * + * @param int|null $devicesQueued devicesQueued + * + * @return self + */ + public function setDevicesQueued($devicesQueued) + { + if (is_null($devicesQueued)) { + throw new \InvalidArgumentException('non-nullable devicesQueued cannot be null'); + } + $this->container['devicesQueued'] = $devicesQueued; + + return $this; + } + + /** + * Gets devicesNotified + * + * @return int|null + */ + public function getDevicesNotified() + { + return $this->container['devicesNotified']; + } + + /** + * Sets devicesNotified + * + * @param int|null $devicesNotified devicesNotified + * + * @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 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/LiveActivityStreamPutResponse.php b/generated/Model/LiveActivityStreamPutResponse.php new file mode 100644 index 0000000..6102c00 --- /dev/null +++ b/generated/Model/LiveActivityStreamPutResponse.php @@ -0,0 +1,775 @@ + + */ +class LiveActivityStreamPutResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LiveActivityStreamPutResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success' => 'bool', + 'operation' => 'string', + 'streamKey' => 'string', + 'activityId' => 'string', + 'previousActivityId' => 'string', + 'devicesNotified' => 'int', + 'devicesQueued' => 'int', + 'usersNotified' => 'int', + 'effectiveChannelSlugs' => '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, + 'operation' => null, + 'streamKey' => null, + 'activityId' => null, + 'previousActivityId' => null, + 'devicesNotified' => null, + 'devicesQueued' => null, + 'usersNotified' => null, + 'effectiveChannelSlugs' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success' => false, + 'operation' => false, + 'streamKey' => false, + 'activityId' => true, + 'previousActivityId' => false, + 'devicesNotified' => false, + 'devicesQueued' => false, + 'usersNotified' => false, + 'effectiveChannelSlugs' => 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', + 'operation' => 'operation', + 'streamKey' => 'stream_key', + 'activityId' => 'activity_id', + 'previousActivityId' => 'previous_activity_id', + 'devicesNotified' => 'devices_notified', + 'devicesQueued' => 'devices_queued', + 'usersNotified' => 'users_notified', + 'effectiveChannelSlugs' => 'effective_channel_slugs', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'operation' => 'setOperation', + 'streamKey' => 'setStreamKey', + 'activityId' => 'setActivityId', + 'previousActivityId' => 'setPreviousActivityId', + 'devicesNotified' => 'setDevicesNotified', + 'devicesQueued' => 'setDevicesQueued', + 'usersNotified' => 'setUsersNotified', + 'effectiveChannelSlugs' => 'setEffectiveChannelSlugs', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'operation' => 'getOperation', + 'streamKey' => 'getStreamKey', + 'activityId' => 'getActivityId', + 'previousActivityId' => 'getPreviousActivityId', + 'devicesNotified' => 'getDevicesNotified', + 'devicesQueued' => 'getDevicesQueued', + 'usersNotified' => 'getUsersNotified', + 'effectiveChannelSlugs' => 'getEffectiveChannelSlugs', + '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; + } + + public const OPERATION_STARTED = 'started'; + public const OPERATION_UPDATED = 'updated'; + public const OPERATION_ROTATED = 'rotated'; + public const OPERATION_NOOP = 'noop'; + public const OPERATION_PAUSED = 'paused'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperationAllowableValues() + { + return [ + self::OPERATION_STARTED, + self::OPERATION_UPDATED, + self::OPERATION_ROTATED, + self::OPERATION_NOOP, + self::OPERATION_PAUSED, + ]; + } + + /** + * 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('operation', $data ?? [], null); + $this->setIfExists('streamKey', $data ?? [], null); + $this->setIfExists('activityId', $data ?? [], null); + $this->setIfExists('previousActivityId', $data ?? [], null); + $this->setIfExists('devicesNotified', $data ?? [], null); + $this->setIfExists('devicesQueued', $data ?? [], null); + $this->setIfExists('usersNotified', $data ?? [], null); + $this->setIfExists('effectiveChannelSlugs', $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['operation'] === null) { + $invalidProperties[] = "'operation' can't be null"; + } + $allowedValues = $this->getOperationAllowableValues(); + if (!is_null($this->container['operation']) && !in_array($this->container['operation'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operation', must be one of '%s'", + $this->container['operation'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['streamKey'] === null) { + $invalidProperties[] = "'streamKey' 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 success + * + * @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 operation + * + * @return string + */ + public function getOperation() + { + return $this->container['operation']; + } + + /** + * Sets operation + * + * @param string $operation operation + * + * @return self + */ + public function setOperation($operation) + { + if (is_null($operation)) { + throw new \InvalidArgumentException('non-nullable operation cannot be null'); + } + $allowedValues = $this->getOperationAllowableValues(); + if (!in_array($operation, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operation', must be one of '%s'", + $operation, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operation'] = $operation; + + return $this; + } + + /** + * Gets streamKey + * + * @return string + */ + public function getStreamKey() + { + return $this->container['streamKey']; + } + + /** + * Sets streamKey + * + * @param string $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 activityId + * + * @return string|null + */ + public function getActivityId() + { + return $this->container['activityId']; + } + + /** + * Sets activityId + * + * @param string|null $activityId activityId + * + * @return self + */ + public function setActivityId($activityId) + { + if (is_null($activityId)) { + array_push($this->openAPINullablesSetToNull, 'activityId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityId'] = $activityId; + + 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 devicesNotified + * + * @return int|null + */ + public function getDevicesNotified() + { + return $this->container['devicesNotified']; + } + + /** + * Sets devicesNotified + * + * @param int|null $devicesNotified devicesNotified + * + * @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 devicesQueued + * + * @return int|null + */ + public function getDevicesQueued() + { + return $this->container['devicesQueued']; + } + + /** + * Sets devicesQueued + * + * @param int|null $devicesQueued devicesQueued + * + * @return self + */ + public function setDevicesQueued($devicesQueued) + { + if (is_null($devicesQueued)) { + throw new \InvalidArgumentException('non-nullable devicesQueued cannot be null'); + } + $this->container['devicesQueued'] = $devicesQueued; + + 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 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/LiveActivityStreamRequest.php b/generated/Model/LiveActivityStreamRequest.php new file mode 100644 index 0000000..2545e02 --- /dev/null +++ b/generated/Model/LiveActivityStreamRequest.php @@ -0,0 +1,558 @@ + + */ +class LiveActivityStreamRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LiveActivityStreamRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contentState' => '\ActivitySmith\Generated\Model\StreamContentState', + 'action' => '\ActivitySmith\Generated\Model\LiveActivityAction', + 'alert' => '\ActivitySmith\Generated\Model\AlertPayload', + 'channels' => 'string[]', + 'target' => '\ActivitySmith\Generated\Model\ChannelTarget' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contentState' => null, + 'action' => null, + 'alert' => null, + 'channels' => null, + 'target' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contentState' => false, + 'action' => false, + 'alert' => false, + 'channels' => false, + 'target' => 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 = [ + 'contentState' => 'content_state', + 'action' => 'action', + 'alert' => 'alert', + 'channels' => 'channels', + 'target' => 'target' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contentState' => 'setContentState', + 'action' => 'setAction', + 'alert' => 'setAlert', + 'channels' => 'setChannels', + 'target' => 'setTarget' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contentState' => 'getContentState', + 'action' => 'getAction', + 'alert' => 'getAlert', + 'channels' => 'getChannels', + 'target' => 'getTarget' + ]; + + /** + * 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('contentState', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('alert', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('target', $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['contentState'] === null) { + $invalidProperties[] = "'contentState' can't be null"; + } + if (!is_null($this->container['channels']) && (count($this->container['channels']) < 1)) { + $invalidProperties[] = "invalid value for 'channels', number of items must be greater than or equal to 1."; + } + + 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 contentState + * + * @return \ActivitySmith\Generated\Model\StreamContentState + */ + public function getContentState() + { + return $this->container['contentState']; + } + + /** + * Sets contentState + * + * @param \ActivitySmith\Generated\Model\StreamContentState $contentState contentState + * + * @return self + */ + public function setContentState($contentState) + { + if (is_null($contentState)) { + throw new \InvalidArgumentException('non-nullable contentState cannot be null'); + } + $this->container['contentState'] = $contentState; + + return $this; + } + + /** + * Gets action + * + * @return \ActivitySmith\Generated\Model\LiveActivityAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \ActivitySmith\Generated\Model\LiveActivityAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets alert + * + * @return \ActivitySmith\Generated\Model\AlertPayload|null + */ + public function getAlert() + { + return $this->container['alert']; + } + + /** + * Sets alert + * + * @param \ActivitySmith\Generated\Model\AlertPayload|null $alert alert + * + * @return self + */ + public function setAlert($alert) + { + if (is_null($alert)) { + throw new \InvalidArgumentException('non-nullable alert cannot be null'); + } + $this->container['alert'] = $alert; + + return $this; + } + + /** + * Gets channels + * + * @return string[]|null + */ + public function getChannels() + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param string[]|null $channels Channel slugs. When omitted, API key scope determines recipients. + * + * @return self + */ + public function setChannels($channels) + { + if (is_null($channels)) { + throw new \InvalidArgumentException('non-nullable channels cannot be null'); + } + + + if ((count($channels) < 1)) { + throw new \InvalidArgumentException('invalid length for $channels when calling LiveActivityStreamRequest., number of items must be greater than or equal to 1.'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets target + * + * @return \ActivitySmith\Generated\Model\ChannelTarget|null + */ + public function getTarget() + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param \ActivitySmith\Generated\Model\ChannelTarget|null $target target + * + * @return self + */ + public function setTarget($target) + { + if (is_null($target)) { + throw new \InvalidArgumentException('non-nullable target cannot be null'); + } + $this->container['target'] = $target; + + 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/NotFoundError.php b/generated/Model/NotFoundError.php new file mode 100644 index 0000000..b18effb --- /dev/null +++ b/generated/Model/NotFoundError.php @@ -0,0 +1,449 @@ + + */ +class NotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NotFoundError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => 'string', + 'message' => 'string' + ]; + + /** + * 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 + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'message' => 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' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'message' => 'getMessage' + ]; + + /** + * 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('error', $data ?? [], null); + $this->setIfExists('message', $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"; + } + 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; + } + /** + * 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/StreamContentState.php b/generated/Model/StreamContentState.php new file mode 100644 index 0000000..237bbbc --- /dev/null +++ b/generated/Model/StreamContentState.php @@ -0,0 +1,1092 @@ + + */ +class StreamContentState implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StreamContentState'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'subtitle' => 'string', + 'numberOfSteps' => 'int', + 'currentStep' => 'int', + 'percentage' => 'float', + 'value' => 'float', + 'upperLimit' => 'float', + 'type' => 'string', + 'color' => 'string', + 'stepColor' => 'string', + 'stepColors' => 'string[]', + 'metrics' => '\ActivitySmith\Generated\Model\ActivityMetric[]', + 'autoDismissSeconds' => 'int', + 'autoDismissMinutes' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'subtitle' => null, + 'numberOfSteps' => null, + 'currentStep' => null, + 'percentage' => null, + 'value' => null, + 'upperLimit' => null, + 'type' => null, + 'color' => null, + 'stepColor' => null, + 'stepColors' => null, + 'metrics' => null, + 'autoDismissSeconds' => null, + 'autoDismissMinutes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'subtitle' => false, + 'numberOfSteps' => false, + 'currentStep' => false, + 'percentage' => false, + 'value' => false, + 'upperLimit' => false, + 'type' => false, + 'color' => false, + 'stepColor' => false, + 'stepColors' => false, + 'metrics' => false, + 'autoDismissSeconds' => false, + 'autoDismissMinutes' => 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 = [ + 'title' => 'title', + 'subtitle' => 'subtitle', + 'numberOfSteps' => 'number_of_steps', + 'currentStep' => 'current_step', + 'percentage' => 'percentage', + 'value' => 'value', + 'upperLimit' => 'upper_limit', + 'type' => 'type', + 'color' => 'color', + 'stepColor' => 'step_color', + 'stepColors' => 'step_colors', + 'metrics' => 'metrics', + 'autoDismissSeconds' => 'auto_dismiss_seconds', + 'autoDismissMinutes' => 'auto_dismiss_minutes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'subtitle' => 'setSubtitle', + 'numberOfSteps' => 'setNumberOfSteps', + 'currentStep' => 'setCurrentStep', + 'percentage' => 'setPercentage', + 'value' => 'setValue', + 'upperLimit' => 'setUpperLimit', + 'type' => 'setType', + 'color' => 'setColor', + 'stepColor' => 'setStepColor', + 'stepColors' => 'setStepColors', + 'metrics' => 'setMetrics', + 'autoDismissSeconds' => 'setAutoDismissSeconds', + 'autoDismissMinutes' => 'setAutoDismissMinutes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'subtitle' => 'getSubtitle', + 'numberOfSteps' => 'getNumberOfSteps', + 'currentStep' => 'getCurrentStep', + 'percentage' => 'getPercentage', + 'value' => 'getValue', + 'upperLimit' => 'getUpperLimit', + 'type' => 'getType', + 'color' => 'getColor', + 'stepColor' => 'getStepColor', + 'stepColors' => 'getStepColors', + 'metrics' => 'getMetrics', + 'autoDismissSeconds' => 'getAutoDismissSeconds', + 'autoDismissMinutes' => 'getAutoDismissMinutes' + ]; + + /** + * 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 TYPE_SEGMENTED_PROGRESS = 'segmented_progress'; + public const TYPE_PROGRESS = 'progress'; + public const TYPE_METRICS = 'metrics'; + public const TYPE_COUNTER = 'counter'; + public const TYPE_TIMER = 'timer'; + public const TYPE_COUNTDOWN = 'countdown'; + public const COLOR_LIME = 'lime'; + public const COLOR_GREEN = 'green'; + public const COLOR_CYAN = 'cyan'; + public const COLOR_BLUE = 'blue'; + public const COLOR_PURPLE = 'purple'; + public const COLOR_MAGENTA = 'magenta'; + public const COLOR_RED = 'red'; + public const COLOR_ORANGE = 'orange'; + public const COLOR_YELLOW = 'yellow'; + public const STEP_COLOR_LIME = 'lime'; + public const STEP_COLOR_GREEN = 'green'; + public const STEP_COLOR_CYAN = 'cyan'; + public const STEP_COLOR_BLUE = 'blue'; + public const STEP_COLOR_PURPLE = 'purple'; + public const STEP_COLOR_MAGENTA = 'magenta'; + public const STEP_COLOR_RED = 'red'; + public const STEP_COLOR_ORANGE = 'orange'; + public const STEP_COLOR_YELLOW = 'yellow'; + public const STEP_COLORS_LIME = 'lime'; + public const STEP_COLORS_GREEN = 'green'; + public const STEP_COLORS_CYAN = 'cyan'; + public const STEP_COLORS_BLUE = 'blue'; + public const STEP_COLORS_PURPLE = 'purple'; + public const STEP_COLORS_MAGENTA = 'magenta'; + public const STEP_COLORS_RED = 'red'; + public const STEP_COLORS_ORANGE = 'orange'; + public const STEP_COLORS_YELLOW = 'yellow'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_SEGMENTED_PROGRESS, + self::TYPE_PROGRESS, + self::TYPE_METRICS, + self::TYPE_COUNTER, + self::TYPE_TIMER, + self::TYPE_COUNTDOWN, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getColorAllowableValues() + { + return [ + self::COLOR_LIME, + self::COLOR_GREEN, + self::COLOR_CYAN, + self::COLOR_BLUE, + self::COLOR_PURPLE, + self::COLOR_MAGENTA, + self::COLOR_RED, + self::COLOR_ORANGE, + self::COLOR_YELLOW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStepColorAllowableValues() + { + return [ + self::STEP_COLOR_LIME, + self::STEP_COLOR_GREEN, + self::STEP_COLOR_CYAN, + self::STEP_COLOR_BLUE, + self::STEP_COLOR_PURPLE, + self::STEP_COLOR_MAGENTA, + self::STEP_COLOR_RED, + self::STEP_COLOR_ORANGE, + self::STEP_COLOR_YELLOW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStepColorsAllowableValues() + { + return [ + self::STEP_COLORS_LIME, + self::STEP_COLORS_GREEN, + self::STEP_COLORS_CYAN, + self::STEP_COLORS_BLUE, + self::STEP_COLORS_PURPLE, + self::STEP_COLORS_MAGENTA, + self::STEP_COLORS_RED, + self::STEP_COLORS_ORANGE, + self::STEP_COLORS_YELLOW, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('subtitle', $data ?? [], null); + $this->setIfExists('numberOfSteps', $data ?? [], null); + $this->setIfExists('currentStep', $data ?? [], null); + $this->setIfExists('percentage', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('upperLimit', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('color', $data ?? [], 'blue'); + $this->setIfExists('stepColor', $data ?? [], null); + $this->setIfExists('stepColors', $data ?? [], null); + $this->setIfExists('metrics', $data ?? [], null); + $this->setIfExists('autoDismissSeconds', $data ?? [], null); + $this->setIfExists('autoDismissMinutes', $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['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if (!is_null($this->container['numberOfSteps']) && ($this->container['numberOfSteps'] < 1)) { + $invalidProperties[] = "invalid value for 'numberOfSteps', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['currentStep']) && ($this->container['currentStep'] < 1)) { + $invalidProperties[] = "invalid value for 'currentStep', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['percentage']) && ($this->container['percentage'] > 100)) { + $invalidProperties[] = "invalid value for 'percentage', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['percentage']) && ($this->container['percentage'] < 0)) { + $invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getColorAllowableValues(); + if (!is_null($this->container['color']) && !in_array($this->container['color'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'color', must be one of '%s'", + $this->container['color'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStepColorAllowableValues(); + if (!is_null($this->container['stepColor']) && !in_array($this->container['stepColor'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'stepColor', must be one of '%s'", + $this->container['stepColor'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['metrics']) && (count($this->container['metrics']) < 1)) { + $invalidProperties[] = "invalid value for 'metrics', number of items must be greater than or equal to 1."; + } + + if (!is_null($this->container['autoDismissSeconds']) && ($this->container['autoDismissSeconds'] < 0)) { + $invalidProperties[] = "invalid value for 'autoDismissSeconds', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['autoDismissMinutes']) && ($this->container['autoDismissMinutes'] < 0)) { + $invalidProperties[] = "invalid value for 'autoDismissMinutes', must be bigger than or equal to 0."; + } + + 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 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 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 numberOfSteps + * + * @return int|null + */ + public function getNumberOfSteps() + { + return $this->container['numberOfSteps']; + } + + /** + * Sets numberOfSteps + * + * @param int|null $numberOfSteps Use for segmented_progress, counter, timer, and countdown. + * + * @return self + */ + public function setNumberOfSteps($numberOfSteps) + { + if (is_null($numberOfSteps)) { + throw new \InvalidArgumentException('non-nullable numberOfSteps cannot be null'); + } + + if (($numberOfSteps < 1)) { + throw new \InvalidArgumentException('invalid value for $numberOfSteps when calling StreamContentState., must be bigger than or equal to 1.'); + } + + $this->container['numberOfSteps'] = $numberOfSteps; + + return $this; + } + + /** + * Gets currentStep + * + * @return int|null + */ + public function getCurrentStep() + { + return $this->container['currentStep']; + } + + /** + * Sets currentStep + * + * @param int|null $currentStep Use for segmented_progress, counter, timer, and countdown. + * + * @return self + */ + public function setCurrentStep($currentStep) + { + if (is_null($currentStep)) { + throw new \InvalidArgumentException('non-nullable currentStep cannot be null'); + } + + if (($currentStep < 1)) { + throw new \InvalidArgumentException('invalid value for $currentStep when calling StreamContentState., must be bigger than or equal to 1.'); + } + + $this->container['currentStep'] = $currentStep; + + return $this; + } + + /** + * Gets percentage + * + * @return float|null + */ + public function getPercentage() + { + return $this->container['percentage']; + } + + /** + * Sets percentage + * + * @param float|null $percentage Use for progress. Takes precedence over value/upper_limit if both are provided. + * + * @return self + */ + public function setPercentage($percentage) + { + if (is_null($percentage)) { + throw new \InvalidArgumentException('non-nullable percentage cannot be null'); + } + + if (($percentage > 100)) { + throw new \InvalidArgumentException('invalid value for $percentage when calling StreamContentState., must be smaller than or equal to 100.'); + } + if (($percentage < 0)) { + throw new \InvalidArgumentException('invalid value for $percentage when calling StreamContentState., must be bigger than or equal to 0.'); + } + + $this->container['percentage'] = $percentage; + + return $this; + } + + /** + * Gets value + * + * @return float|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float|null $value Current progress value. Use with upper_limit for progress. + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets upperLimit + * + * @return float|null + */ + public function getUpperLimit() + { + return $this->container['upperLimit']; + } + + /** + * Sets upperLimit + * + * @param float|null $upperLimit Maximum progress value. Use with value for progress. + * + * @return self + */ + public function setUpperLimit($upperLimit) + { + if (is_null($upperLimit)) { + throw new \InvalidArgumentException('non-nullable upperLimit cannot be null'); + } + $this->container['upperLimit'] = $upperLimit; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Required on the first PUT or whenever the stream cannot infer the current activity type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets color + * + * @return string|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string|null $color Optional. Accent color for the Live Activity. Defaults to blue. + * + * @return self + */ + public function setColor($color) + { + if (is_null($color)) { + throw new \InvalidArgumentException('non-nullable color cannot be null'); + } + $allowedValues = $this->getColorAllowableValues(); + if (!in_array($color, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'color', must be one of '%s'", + $color, + implode("', '", $allowedValues) + ) + ); + } + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets stepColor + * + * @return string|null + */ + public function getStepColor() + { + return $this->container['stepColor']; + } + + /** + * Sets stepColor + * + * @param string|null $stepColor Optional. Overrides color for the current step. Only applies to segmented_progress. + * + * @return self + */ + public function setStepColor($stepColor) + { + if (is_null($stepColor)) { + throw new \InvalidArgumentException('non-nullable stepColor cannot be null'); + } + $allowedValues = $this->getStepColorAllowableValues(); + if (!in_array($stepColor, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'stepColor', must be one of '%s'", + $stepColor, + implode("', '", $allowedValues) + ) + ); + } + $this->container['stepColor'] = $stepColor; + + return $this; + } + + /** + * Gets stepColors + * + * @return string[]|null + */ + public function getStepColors() + { + return $this->container['stepColors']; + } + + /** + * Sets stepColors + * + * @param string[]|null $stepColors Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step. + * + * @return self + */ + public function setStepColors($stepColors) + { + if (is_null($stepColors)) { + throw new \InvalidArgumentException('non-nullable stepColors cannot be null'); + } + $allowedValues = $this->getStepColorsAllowableValues(); + if (array_diff($stepColors, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'stepColors', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['stepColors'] = $stepColors; + + return $this; + } + + /** + * Gets metrics + * + * @return \ActivitySmith\Generated\Model\ActivityMetric[]|null + */ + public function getMetrics() + { + return $this->container['metrics']; + } + + /** + * Sets metrics + * + * @param \ActivitySmith\Generated\Model\ActivityMetric[]|null $metrics Use for metrics activities. + * + * @return self + */ + public function setMetrics($metrics) + { + if (is_null($metrics)) { + throw new \InvalidArgumentException('non-nullable metrics cannot be null'); + } + + + if ((count($metrics) < 1)) { + throw new \InvalidArgumentException('invalid length for $metrics when calling StreamContentState., number of items must be greater than or equal to 1.'); + } + $this->container['metrics'] = $metrics; + + return $this; + } + + /** + * Gets autoDismissSeconds + * + * @return int|null + */ + public function getAutoDismissSeconds() + { + return $this->container['autoDismissSeconds']; + } + + /** + * Sets autoDismissSeconds + * + * @param int|null $autoDismissSeconds Optional. Seconds before the ended Live Activity is dismissed. + * + * @return self + */ + public function setAutoDismissSeconds($autoDismissSeconds) + { + if (is_null($autoDismissSeconds)) { + throw new \InvalidArgumentException('non-nullable autoDismissSeconds cannot be null'); + } + + if (($autoDismissSeconds < 0)) { + throw new \InvalidArgumentException('invalid value for $autoDismissSeconds when calling StreamContentState., must be bigger than or equal to 0.'); + } + + $this->container['autoDismissSeconds'] = $autoDismissSeconds; + + return $this; + } + + /** + * Gets autoDismissMinutes + * + * @return int|null + */ + public function getAutoDismissMinutes() + { + return $this->container['autoDismissMinutes']; + } + + /** + * Sets autoDismissMinutes + * + * @param int|null $autoDismissMinutes Optional. Minutes before the ended Live Activity is dismissed. + * + * @return self + */ + public function setAutoDismissMinutes($autoDismissMinutes) + { + if (is_null($autoDismissMinutes)) { + throw new \InvalidArgumentException('non-nullable autoDismissMinutes cannot be null'); + } + + if (($autoDismissMinutes < 0)) { + throw new \InvalidArgumentException('invalid value for $autoDismissMinutes when calling StreamContentState., must be bigger than or equal to 0.'); + } + + $this->container['autoDismissMinutes'] = $autoDismissMinutes; + + 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)); + } +} + +