From db685382a38f86f8ec56fc29b783b3e682d2aaa5 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 15:27:05 +0300 Subject: [PATCH 1/9] Codegen: Marketing Email --- .../Emails/Api/MarketingEmailsApi.php | 6013 +++++++++++++++++ .../Marketing/Emails/Api/StatisticsApi.php | 918 +++ codegen/Marketing/Emails/ApiException.php | 119 + codegen/Marketing/Emails/Configuration.php | 531 ++ codegen/Marketing/Emails/HeaderSelector.php | 245 + .../Emails/Model/AbTestCreateRequestVNext.php | 450 ++ .../Emails/Model/AggregateEmailStatistics.php | 478 ++ ...ithTotalEmailStatisticIntervalNoPaging.php | 450 ++ ...ponseWithTotalPublicEmailForwardPaging.php | 484 ++ ...ionResponseWithTotalVersionPublicEmail.php | 484 ++ .../Emails/Model/ContentCloneRequestVNext.php | 447 ++ .../Emails/Model/EmailCreateRequest.php | 2921 ++++++++ .../Emails/Model/EmailStatisticInterval.php | 443 ++ .../Emails/Model/EmailStatisticsData.php | 523 ++ .../Emails/Model/EmailUpdateRequest.php | 2884 ++++++++ codegen/Marketing/Emails/Model/Error.php | 622 ++ .../Marketing/Emails/Model/ErrorDetail.php | 548 ++ .../Marketing/Emails/Model/ForwardPaging.php | 409 ++ codegen/Marketing/Emails/Model/Interval.php | 449 ++ .../Marketing/Emails/Model/ModelInterface.php | 111 + codegen/Marketing/Emails/Model/NextPage.php | 447 ++ codegen/Marketing/Emails/Model/Paging.php | 447 ++ .../Marketing/Emails/Model/PreviousPage.php | 447 ++ .../Model/PublicButtonStyleSettings.php | 477 ++ .../Model/PublicDividerStyleSettings.php | 477 ++ .../Marketing/Emails/Model/PublicEmail.php | 3383 ++++++++++ .../Emails/Model/PublicEmailContent.php | 648 ++ .../Emails/Model/PublicEmailFromDetails.php | 478 ++ .../Emails/Model/PublicEmailRecipients.php | 444 ++ .../Emails/Model/PublicEmailStyleSettings.php | 1395 ++++ .../Model/PublicEmailSubscriptionDetails.php | 478 ++ .../Model/PublicEmailTestingDetails.php | 788 +++ .../Emails/Model/PublicEmailToDetails.php | 546 ++ .../Emails/Model/PublicFontStyle.php | 579 ++ .../Emails/Model/PublicRssEmailDetails.php | 682 ++ .../Emails/Model/PublicWebversionDetails.php | 715 ++ .../Emails/Model/VersionPublicEmail.php | 524 ++ .../Marketing/Emails/Model/VersionUser.php | 487 ++ codegen/Marketing/Emails/ObjectSerializer.php | 567 ++ 39 files changed, 33538 insertions(+) create mode 100644 codegen/Marketing/Emails/Api/MarketingEmailsApi.php create mode 100644 codegen/Marketing/Emails/Api/StatisticsApi.php create mode 100644 codegen/Marketing/Emails/ApiException.php create mode 100644 codegen/Marketing/Emails/Configuration.php create mode 100644 codegen/Marketing/Emails/HeaderSelector.php create mode 100644 codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php create mode 100644 codegen/Marketing/Emails/Model/AggregateEmailStatistics.php create mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php create mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php create mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php create mode 100644 codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php create mode 100644 codegen/Marketing/Emails/Model/EmailCreateRequest.php create mode 100644 codegen/Marketing/Emails/Model/EmailStatisticInterval.php create mode 100644 codegen/Marketing/Emails/Model/EmailStatisticsData.php create mode 100644 codegen/Marketing/Emails/Model/EmailUpdateRequest.php create mode 100644 codegen/Marketing/Emails/Model/Error.php create mode 100644 codegen/Marketing/Emails/Model/ErrorDetail.php create mode 100644 codegen/Marketing/Emails/Model/ForwardPaging.php create mode 100644 codegen/Marketing/Emails/Model/Interval.php create mode 100644 codegen/Marketing/Emails/Model/ModelInterface.php create mode 100644 codegen/Marketing/Emails/Model/NextPage.php create mode 100644 codegen/Marketing/Emails/Model/Paging.php create mode 100644 codegen/Marketing/Emails/Model/PreviousPage.php create mode 100644 codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php create mode 100644 codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmail.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailContent.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailFromDetails.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailRecipients.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php create mode 100644 codegen/Marketing/Emails/Model/PublicEmailToDetails.php create mode 100644 codegen/Marketing/Emails/Model/PublicFontStyle.php create mode 100644 codegen/Marketing/Emails/Model/PublicRssEmailDetails.php create mode 100644 codegen/Marketing/Emails/Model/PublicWebversionDetails.php create mode 100644 codegen/Marketing/Emails/Model/VersionPublicEmail.php create mode 100644 codegen/Marketing/Emails/Model/VersionUser.php create mode 100644 codegen/Marketing/Emails/ObjectSerializer.php diff --git a/codegen/Marketing/Emails/Api/MarketingEmailsApi.php b/codegen/Marketing/Emails/Api/MarketingEmailsApi.php new file mode 100644 index 000000000..cb4efe504 --- /dev/null +++ b/codegen/Marketing/Emails/Api/MarketingEmailsApi.php @@ -0,0 +1,6013 @@ + [ + 'application/json', + ], + 'callClone' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'createAbTestVariation' => [ + 'application/json', + ], + 'getAbTestVariation' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getDraft' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'getRevisionById' => [ + 'application/json', + ], + 'getRevisions' => [ + 'application/json', + ], + 'publishOrSend' => [ + 'application/json', + ], + 'resetDraft' => [ + 'application/json', + ], + 'restoreDraftRevision' => [ + 'application/json', + ], + 'restoreRevision' => [ + 'application/json', + ], + 'unpublishOrCancel' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + 'upsertDraft' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Delete a marketing email. + * + * @param string $email_id The ID of the marketing email to delete. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archive($email_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) + { + $this->archiveWithHttpInfo($email_id, $archived, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete a marketing email. + * + * @param string $email_id The ID of the marketing email to delete. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($email_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($email_id, $archived, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete a marketing email. + * + * @param string $email_id The ID of the marketing email to delete. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($email_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($email_id, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete a marketing email. + * + * @param string $email_id The ID of the marketing email to delete. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($email_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($email_id, $archived, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param string $email_id The ID of the marketing email to delete. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($email_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling archive' + ); + } + + + + $resourcePath = '/marketing/v3/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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 callClone + * + * Clone a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\ContentCloneRequestVNext $content_clone_request_v_next content_clone_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function callClone($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + { + list($response) = $this->callCloneWithHttpInfo($content_clone_request_v_next, $contentType); + return $response; + } + + /** + * Operation callCloneWithHttpInfo + * + * Clone a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\ContentCloneRequestVNext $content_clone_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function callCloneWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + { + $request = $this->callCloneRequest($content_clone_request_v_next, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation callCloneAsync + * + * Clone a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\ContentCloneRequestVNext $content_clone_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function callCloneAsync($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + { + return $this->callCloneAsyncWithHttpInfo($content_clone_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation callCloneAsyncWithHttpInfo + * + * Clone a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\ContentCloneRequestVNext $content_clone_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function callCloneAsyncWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->callCloneRequest($content_clone_request_v_next, $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 'callClone' + * + * @param \HubSpot\Client\Marketing\Emails\Model\ContentCloneRequestVNext $content_clone_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function callCloneRequest($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + { + + // verify the required parameter 'content_clone_request_v_next' is set + if ($content_clone_request_v_next === null || (is_array($content_clone_request_v_next) && count($content_clone_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $content_clone_request_v_next when calling callClone' + ); + } + + + $resourcePath = '/marketing/v3/emails/clone'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($content_clone_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next)); + } else { + $httpBody = $content_clone_request_v_next; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create a new marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailCreateRequest $email_create_request email_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function create($email_create_request, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($email_create_request, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create a new marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailCreateRequest $email_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($email_create_request, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($email_create_request, $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 201: + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create a new marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailCreateRequest $email_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($email_create_request, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($email_create_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create a new marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailCreateRequest $email_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($email_create_request, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->createRequest($email_create_request, $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 'create' + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailCreateRequest $email_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($email_create_request, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'email_create_request' is set + if ($email_create_request === null || (is_array($email_create_request) && count($email_create_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_create_request when calling create' + ); + } + + + $resourcePath = '/marketing/v3/emails/'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($email_create_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($email_create_request)); + } else { + $httpBody = $email_create_request; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createAbTestVariation + * + * Create an A/B test variation of a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next ab_test_create_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAbTestVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function createAbTestVariation($ab_test_create_request_v_next, string $contentType = self::contentTypes['createAbTestVariation'][0]) + { + list($response) = $this->createAbTestVariationWithHttpInfo($ab_test_create_request_v_next, $contentType); + return $response; + } + + /** + * Operation createAbTestVariationWithHttpInfo + * + * Create an A/B test variation of a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAbTestVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createAbTestVariationWithHttpInfo($ab_test_create_request_v_next, string $contentType = self::contentTypes['createAbTestVariation'][0]) + { + $request = $this->createAbTestVariationRequest($ab_test_create_request_v_next, $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 201: + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAbTestVariationAsync + * + * Create an A/B test variation of a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAbTestVariationAsync($ab_test_create_request_v_next, string $contentType = self::contentTypes['createAbTestVariation'][0]) + { + return $this->createAbTestVariationAsyncWithHttpInfo($ab_test_create_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAbTestVariationAsyncWithHttpInfo + * + * Create an A/B test variation of a marketing email. + * + * @param \HubSpot\Client\Marketing\Emails\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAbTestVariationAsyncWithHttpInfo($ab_test_create_request_v_next, string $contentType = self::contentTypes['createAbTestVariation'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->createAbTestVariationRequest($ab_test_create_request_v_next, $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 'createAbTestVariation' + * + * @param \HubSpot\Client\Marketing\Emails\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createAbTestVariationRequest($ab_test_create_request_v_next, string $contentType = self::contentTypes['createAbTestVariation'][0]) + { + + // verify the required parameter 'ab_test_create_request_v_next' is set + if ($ab_test_create_request_v_next === null || (is_array($ab_test_create_request_v_next) && count($ab_test_create_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $ab_test_create_request_v_next when calling createAbTestVariation' + ); + } + + + $resourcePath = '/marketing/v3/emails/ab-test/create-variation'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ab_test_create_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next)); + } else { + $httpBody = $ab_test_create_request_v_next; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAbTestVariation + * + * Get the variation of a an A/B marketing email + * + * @param string $email_id The ID of an A/B marketing email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getAbTestVariation($email_id, string $contentType = self::contentTypes['getAbTestVariation'][0]) + { + list($response) = $this->getAbTestVariationWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getAbTestVariationWithHttpInfo + * + * Get the variation of a an A/B marketing email + * + * @param string $email_id The ID of an A/B marketing email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAbTestVariationWithHttpInfo($email_id, string $contentType = self::contentTypes['getAbTestVariation'][0]) + { + $request = $this->getAbTestVariationRequest($email_id, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAbTestVariationAsync + * + * Get the variation of a an A/B marketing email + * + * @param string $email_id The ID of an A/B marketing email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAbTestVariationAsync($email_id, string $contentType = self::contentTypes['getAbTestVariation'][0]) + { + return $this->getAbTestVariationAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAbTestVariationAsyncWithHttpInfo + * + * Get the variation of a an A/B marketing email + * + * @param string $email_id The ID of an A/B marketing email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAbTestVariationAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getAbTestVariation'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->getAbTestVariationRequest($email_id, $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 'getAbTestVariation' + * + * @param string $email_id The ID of an A/B marketing email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAbTestVariationRequest($email_id, string $contentType = self::contentTypes['getAbTestVariation'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getAbTestVariation' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/ab-test/get-variation'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getById + * + * Get the details of a specified marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param bool $include_stats Include statistics with email (optional) + * @param bool $marketing_campaign_names marketing_campaign_names (optional) + * @param bool $workflow_names workflow_names (optional) + * @param string[] $included_properties included_properties (optional) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getById($email_id, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getById'][0]) + { + list($response) = $this->getByIdWithHttpInfo($email_id, $include_stats, $marketing_campaign_names, $workflow_names, $included_properties, $archived, $contentType); + return $response; + } + + /** + * Operation getByIdWithHttpInfo + * + * Get the details of a specified marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param bool $include_stats Include statistics with email (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getByIdWithHttpInfo($email_id, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getById'][0]) + { + $request = $this->getByIdRequest($email_id, $include_stats, $marketing_campaign_names, $workflow_names, $included_properties, $archived, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getByIdAsync + * + * Get the details of a specified marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param bool $include_stats Include statistics with email (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsync($email_id, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getById'][0]) + { + return $this->getByIdAsyncWithHttpInfo($email_id, $include_stats, $marketing_campaign_names, $workflow_names, $included_properties, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getByIdAsyncWithHttpInfo + * + * Get the details of a specified marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param bool $include_stats Include statistics with email (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsyncWithHttpInfo($email_id, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getById'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->getByIdRequest($email_id, $include_stats, $marketing_campaign_names, $workflow_names, $included_properties, $archived, $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 'getById' + * + * @param string $email_id The marketing email ID. (required) + * @param bool $include_stats Include statistics with email (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getByIdRequest($email_id, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getById'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getById' + ); + } + + + + + + + + $resourcePath = '/marketing/v3/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_stats, + 'includeStats', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $marketing_campaign_names, + 'marketingCampaignNames', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $workflow_names, + 'workflowNames', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $included_properties, + 'includedProperties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDraft + * + * Get draft version of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getDraft($email_id, string $contentType = self::contentTypes['getDraft'][0]) + { + list($response) = $this->getDraftWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getDraftWithHttpInfo + * + * Get draft version of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getDraftWithHttpInfo($email_id, string $contentType = self::contentTypes['getDraft'][0]) + { + $request = $this->getDraftRequest($email_id, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDraftAsync + * + * Get draft version of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDraftAsync($email_id, string $contentType = self::contentTypes['getDraft'][0]) + { + return $this->getDraftAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDraftAsyncWithHttpInfo + * + * Get draft version of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDraftAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getDraft'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->getDraftRequest($email_id, $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 'getDraft' + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDraftRequest($email_id, string $contentType = self::contentTypes['getDraft'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getDraft' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/draft'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPage + * + * Get all marketing emails for a HubSpot account. + * + * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime $created_after Only return emails created after the specified time. (optional) + * @param \DateTime $created_before Only return emails created before the specified time. (optional) + * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) + * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param bool $include_stats Include statistics with emails. (optional) + * @param bool $marketing_campaign_names marketing_campaign_names (optional) + * @param bool $workflow_names workflow_names (optional) + * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[] $included_properties included_properties (optional) + * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getPage($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $type = null, $is_published = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getPage'][0]) + { + list($response) = $this->getPageWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $include_stats, $marketing_campaign_names, $workflow_names, $type, $is_published, $included_properties, $archived, $contentType); + return $response; + } + + /** + * Operation getPageWithHttpInfo + * + * Get all marketing emails for a HubSpot account. + * + * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime $created_after Only return emails created after the specified time. (optional) + * @param \DateTime $created_before Only return emails created before the specified time. (optional) + * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) + * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param bool $include_stats Include statistics with emails. (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPageWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $type = null, $is_published = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getPage'][0]) + { + $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $include_stats, $marketing_campaign_names, $workflow_names, $type, $is_published, $included_properties, $archived, $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 ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging' !== '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, '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPageAsync + * + * Get all marketing emails for a HubSpot account. + * + * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime $created_after Only return emails created after the specified time. (optional) + * @param \DateTime $created_before Only return emails created before the specified time. (optional) + * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) + * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param bool $include_stats Include statistics with emails. (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsync($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $type = null, $is_published = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getPage'][0]) + { + return $this->getPageAsyncWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $include_stats, $marketing_campaign_names, $workflow_names, $type, $is_published, $included_properties, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPageAsyncWithHttpInfo + * + * Get all marketing emails for a HubSpot account. + * + * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime $created_after Only return emails created after the specified time. (optional) + * @param \DateTime $created_before Only return emails created before the specified time. (optional) + * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) + * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param bool $include_stats Include statistics with emails. (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsyncWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $type = null, $is_published = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getPage'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging'; + $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $include_stats, $marketing_campaign_names, $workflow_names, $type, $is_published, $included_properties, $archived, $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 'getPage' + * + * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime $created_after Only return emails created after the specified time. (optional) + * @param \DateTime $created_before Only return emails created before the specified time. (optional) + * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) + * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param bool $include_stats Include statistics with emails. (optional) + * @param bool $marketing_campaign_names (optional) + * @param bool $workflow_names (optional) + * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[] $included_properties (optional) + * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPageRequest($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $include_stats = null, $marketing_campaign_names = null, $workflow_names = null, $type = null, $is_published = null, $included_properties = null, $archived = null, string $contentType = self::contentTypes['getPage'][0]) + { + + + + + + + + + + + + + + + + + + + $resourcePath = '/marketing/v3/emails/'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_at, + 'createdAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_after, + 'createdAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_before, + 'createdBefore', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_at, + 'updatedAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_after, + 'updatedAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_before, + 'updatedBefore', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_stats, + 'includeStats', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $marketing_campaign_names, + 'marketingCampaignNames', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $workflow_names, + 'workflowNames', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $is_published, + 'isPublished', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $included_properties, + 'includedProperties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRevisionById + * + * Get a revision of a marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisionById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getRevisionById($email_id, $revision_id, string $contentType = self::contentTypes['getRevisionById'][0]) + { + list($response) = $this->getRevisionByIdWithHttpInfo($email_id, $revision_id, $contentType); + return $response; + } + + /** + * Operation getRevisionByIdWithHttpInfo + * + * Get a revision of a marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisionById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getRevisionByIdWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['getRevisionById'][0]) + { + $request = $this->getRevisionByIdRequest($email_id, $revision_id, $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 ('\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRevisionByIdAsync + * + * Get a revision of a marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisionById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRevisionByIdAsync($email_id, $revision_id, string $contentType = self::contentTypes['getRevisionById'][0]) + { + return $this->getRevisionByIdAsyncWithHttpInfo($email_id, $revision_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRevisionByIdAsyncWithHttpInfo + * + * Get a revision of a marketing email. + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisionById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRevisionByIdAsyncWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['getRevisionById'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail'; + $request = $this->getRevisionByIdRequest($email_id, $revision_id, $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 'getRevisionById' + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisionById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRevisionByIdRequest($email_id, $revision_id, string $contentType = self::contentTypes['getRevisionById'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRevisionById' + ); + } + + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $revision_id when calling getRevisionById' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/revisions/{revisionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRevisions + * + * Get revisions of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getRevisions($email_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getRevisions'][0]) + { + list($response) = $this->getRevisionsWithHttpInfo($email_id, $after, $before, $limit, $contentType); + return $response; + } + + /** + * Operation getRevisionsWithHttpInfo + * + * Get revisions of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getRevisionsWithHttpInfo($email_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getRevisions'][0]) + { + $request = $this->getRevisionsRequest($email_id, $after, $before, $limit, $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 ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRevisionsAsync + * + * Get revisions of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRevisionsAsync($email_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getRevisions'][0]) + { + return $this->getRevisionsAsyncWithHttpInfo($email_id, $after, $before, $limit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRevisionsAsyncWithHttpInfo + * + * Get revisions of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRevisionsAsyncWithHttpInfo($email_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getRevisions'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail'; + $request = $this->getRevisionsRequest($email_id, $after, $before, $limit, $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 'getRevisions' + * + * @param string $email_id The marketing email ID. (required) + * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRevisionsRequest($email_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getRevisions'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRevisions' + ); + } + + + + + + $resourcePath = '/marketing/v3/emails/{emailId}/revisions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation publishOrSend + * + * Publish or send a marketing email. + * + * @param string $email_id email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishOrSend'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function publishOrSend($email_id, string $contentType = self::contentTypes['publishOrSend'][0]) + { + $this->publishOrSendWithHttpInfo($email_id, $contentType); + } + + /** + * Operation publishOrSendWithHttpInfo + * + * Publish or send a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishOrSend'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function publishOrSendWithHttpInfo($email_id, string $contentType = self::contentTypes['publishOrSend'][0]) + { + $request = $this->publishOrSendRequest($email_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation publishOrSendAsync + * + * Publish or send a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishOrSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function publishOrSendAsync($email_id, string $contentType = self::contentTypes['publishOrSend'][0]) + { + return $this->publishOrSendAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation publishOrSendAsyncWithHttpInfo + * + * Publish or send a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishOrSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function publishOrSendAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['publishOrSend'][0]) + { + $returnType = ''; + $request = $this->publishOrSendRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'publishOrSend' + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishOrSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function publishOrSendRequest($email_id, string $contentType = self::contentTypes['publishOrSend'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling publishOrSend' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/publish'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation resetDraft + * + * Reset Draft + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function resetDraft($email_id, string $contentType = self::contentTypes['resetDraft'][0]) + { + $this->resetDraftWithHttpInfo($email_id, $contentType); + } + + /** + * Operation resetDraftWithHttpInfo + * + * Reset Draft + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function resetDraftWithHttpInfo($email_id, string $contentType = self::contentTypes['resetDraft'][0]) + { + $request = $this->resetDraftRequest($email_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation resetDraftAsync + * + * Reset Draft + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resetDraftAsync($email_id, string $contentType = self::contentTypes['resetDraft'][0]) + { + return $this->resetDraftAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation resetDraftAsyncWithHttpInfo + * + * Reset Draft + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resetDraftAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['resetDraft'][0]) + { + $returnType = ''; + $request = $this->resetDraftRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'resetDraft' + * + * @param string $email_id The marketing email ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function resetDraftRequest($email_id, string $contentType = self::contentTypes['resetDraft'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling resetDraft' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/draft/reset'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation restoreDraftRevision + * + * Restore a revision of a marketing email to DRAFT state + * + * @param string $email_id The marketing email ID. (required) + * @param int $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreDraftRevision'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function restoreDraftRevision($email_id, $revision_id, string $contentType = self::contentTypes['restoreDraftRevision'][0]) + { + list($response) = $this->restoreDraftRevisionWithHttpInfo($email_id, $revision_id, $contentType); + return $response; + } + + /** + * Operation restoreDraftRevisionWithHttpInfo + * + * Restore a revision of a marketing email to DRAFT state + * + * @param string $email_id The marketing email ID. (required) + * @param int $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreDraftRevision'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function restoreDraftRevisionWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['restoreDraftRevision'][0]) + { + $request = $this->restoreDraftRevisionRequest($email_id, $revision_id, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation restoreDraftRevisionAsync + * + * Restore a revision of a marketing email to DRAFT state + * + * @param string $email_id The marketing email ID. (required) + * @param int $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreDraftRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreDraftRevisionAsync($email_id, $revision_id, string $contentType = self::contentTypes['restoreDraftRevision'][0]) + { + return $this->restoreDraftRevisionAsyncWithHttpInfo($email_id, $revision_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation restoreDraftRevisionAsyncWithHttpInfo + * + * Restore a revision of a marketing email to DRAFT state + * + * @param string $email_id The marketing email ID. (required) + * @param int $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreDraftRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreDraftRevisionAsyncWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['restoreDraftRevision'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->restoreDraftRevisionRequest($email_id, $revision_id, $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 'restoreDraftRevision' + * + * @param string $email_id The marketing email ID. (required) + * @param int $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreDraftRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function restoreDraftRevisionRequest($email_id, $revision_id, string $contentType = self::contentTypes['restoreDraftRevision'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling restoreDraftRevision' + ); + } + + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $revision_id when calling restoreDraftRevision' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/revisions/{revisionId}/restore-to-draft'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation restoreRevision + * + * Restore a revision of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreRevision'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function restoreRevision($email_id, $revision_id, string $contentType = self::contentTypes['restoreRevision'][0]) + { + $this->restoreRevisionWithHttpInfo($email_id, $revision_id, $contentType); + } + + /** + * Operation restoreRevisionWithHttpInfo + * + * Restore a revision of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreRevision'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function restoreRevisionWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['restoreRevision'][0]) + { + $request = $this->restoreRevisionRequest($email_id, $revision_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation restoreRevisionAsync + * + * Restore a revision of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreRevisionAsync($email_id, $revision_id, string $contentType = self::contentTypes['restoreRevision'][0]) + { + return $this->restoreRevisionAsyncWithHttpInfo($email_id, $revision_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation restoreRevisionAsyncWithHttpInfo + * + * Restore a revision of a marketing email + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreRevisionAsyncWithHttpInfo($email_id, $revision_id, string $contentType = self::contentTypes['restoreRevision'][0]) + { + $returnType = ''; + $request = $this->restoreRevisionRequest($email_id, $revision_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'restoreRevision' + * + * @param string $email_id The marketing email ID. (required) + * @param string $revision_id The ID of a revision. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreRevision'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function restoreRevisionRequest($email_id, $revision_id, string $contentType = self::contentTypes['restoreRevision'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling restoreRevision' + ); + } + + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $revision_id when calling restoreRevision' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/revisions/{revisionId}/restore'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation unpublishOrCancel + * + * Unpublish or cancel a marketing email. + * + * @param string $email_id email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishOrCancel'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function unpublishOrCancel($email_id, string $contentType = self::contentTypes['unpublishOrCancel'][0]) + { + $this->unpublishOrCancelWithHttpInfo($email_id, $contentType); + } + + /** + * Operation unpublishOrCancelWithHttpInfo + * + * Unpublish or cancel a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishOrCancel'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function unpublishOrCancelWithHttpInfo($email_id, string $contentType = self::contentTypes['unpublishOrCancel'][0]) + { + $request = $this->unpublishOrCancelRequest($email_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation unpublishOrCancelAsync + * + * Unpublish or cancel a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishOrCancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unpublishOrCancelAsync($email_id, string $contentType = self::contentTypes['unpublishOrCancel'][0]) + { + return $this->unpublishOrCancelAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation unpublishOrCancelAsyncWithHttpInfo + * + * Unpublish or cancel a marketing email. + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishOrCancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unpublishOrCancelAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['unpublishOrCancel'][0]) + { + $returnType = ''; + $request = $this->unpublishOrCancelRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'unpublishOrCancel' + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishOrCancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function unpublishOrCancelRequest($email_id, string $contentType = self::contentTypes['unpublishOrCancel'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling unpublishOrCancel' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/unpublish'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a marketing email. + * + * @param string $email_id The ID of the marketing email that should get updated (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function update($email_id, $email_update_request, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($email_id, $email_update_request, $archived, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a marketing email. + * + * @param string $email_id The ID of the marketing email that should get updated (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($email_id, $email_update_request, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($email_id, $email_update_request, $archived, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update a marketing email. + * + * @param string $email_id The ID of the marketing email that should get updated (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($email_id, $email_update_request, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($email_id, $email_update_request, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update a marketing email. + * + * @param string $email_id The ID of the marketing email that should get updated (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($email_id, $email_update_request, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->updateRequest($email_id, $email_update_request, $archived, $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 'update' + * + * @param string $email_id The ID of the marketing email that should get updated (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) + * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($email_id, $email_update_request, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling update' + ); + } + + // verify the required parameter 'email_update_request' is set + if ($email_update_request === null || (is_array($email_update_request) && count($email_update_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_update_request when calling update' + ); + } + + + + $resourcePath = '/marketing/v3/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($email_update_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($email_update_request)); + } else { + $httpBody = $email_update_request; + } + } 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 OAuth (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( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsertDraft + * + * Create or update draft version + * + * @param string $email_id The marketing email ID. (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties in the email's current draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function upsertDraft($email_id, $email_update_request, string $contentType = self::contentTypes['upsertDraft'][0]) + { + list($response) = $this->upsertDraftWithHttpInfo($email_id, $email_update_request, $contentType); + return $response; + } + + /** + * Operation upsertDraftWithHttpInfo + * + * Create or update draft version + * + * @param string $email_id The marketing email ID. (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties in the email's current draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertDraft'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\PublicEmail|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertDraftWithHttpInfo($email_id, $email_update_request, string $contentType = self::contentTypes['upsertDraft'][0]) + { + $request = $this->upsertDraftRequest($email_id, $email_update_request, $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 ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\PublicEmail' !== '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, '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertDraftAsync + * + * Create or update draft version + * + * @param string $email_id The marketing email ID. (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties in the email's current draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertDraftAsync($email_id, $email_update_request, string $contentType = self::contentTypes['upsertDraft'][0]) + { + return $this->upsertDraftAsyncWithHttpInfo($email_id, $email_update_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertDraftAsyncWithHttpInfo + * + * Create or update draft version + * + * @param string $email_id The marketing email ID. (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties in the email's current draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertDraftAsyncWithHttpInfo($email_id, $email_update_request, string $contentType = self::contentTypes['upsertDraft'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; + $request = $this->upsertDraftRequest($email_id, $email_update_request, $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 'upsertDraft' + * + * @param string $email_id The marketing email ID. (required) + * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties in the email's current draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertDraftRequest($email_id, $email_update_request, string $contentType = self::contentTypes['upsertDraft'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling upsertDraft' + ); + } + + // verify the required parameter 'email_update_request' is set + if ($email_update_request === null || (is_array($email_update_request) && count($email_update_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_update_request when calling upsertDraft' + ); + } + + + $resourcePath = '/marketing/v3/emails/{emailId}/draft'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($email_update_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($email_update_request)); + } else { + $httpBody = $email_update_request; + } + } 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 OAuth (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( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Emails/Api/StatisticsApi.php b/codegen/Marketing/Emails/Api/StatisticsApi.php new file mode 100644 index 000000000..48e902bdc --- /dev/null +++ b/codegen/Marketing/Emails/Api/StatisticsApi.php @@ -0,0 +1,918 @@ + [ + 'application/json', + ], + 'getHistogram' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getEmailsList + * + * Get aggregated statistics. + * + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getEmailsList($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) + { + list($response) = $this->getEmailsListWithHttpInfo($start_timestamp, $end_timestamp, $email_ids, $property, $contentType); + return $response; + } + + /** + * Operation getEmailsListWithHttpInfo + * + * Get aggregated statistics. + * + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailsListWithHttpInfo($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) + { + $request = $this->getEmailsListRequest($start_timestamp, $end_timestamp, $email_ids, $property, $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 ('\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics' !== '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, '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailsListAsync + * + * Get aggregated statistics. + * + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsListAsync($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) + { + return $this->getEmailsListAsyncWithHttpInfo($start_timestamp, $end_timestamp, $email_ids, $property, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailsListAsyncWithHttpInfo + * + * Get aggregated statistics. + * + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsListAsyncWithHttpInfo($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics'; + $request = $this->getEmailsListRequest($start_timestamp, $end_timestamp, $email_ids, $property, $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 'getEmailsList' + * + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailsListRequest($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) + { + + + + + + + $resourcePath = '/marketing/v3/emails/statistics/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_timestamp, + 'startTimestamp', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_timestamp, + 'endTimestamp', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_ids, + 'emailIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $property, + 'property', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getHistogram + * + * Get aggregated statistic intervals. + * + * @param string $interval The interval to aggregate statistics for. (optional) + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging|\HubSpot\Client\Marketing\Emails\Model\Error + */ + public function getHistogram($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) + { + list($response) = $this->getHistogramWithHttpInfo($interval, $start_timestamp, $end_timestamp, $email_ids, $contentType); + return $response; + } + + /** + * Operation getHistogramWithHttpInfo + * + * Get aggregated statistic intervals. + * + * @param string $interval The interval to aggregate statistics for. (optional) + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getHistogramWithHttpInfo($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) + { + $request = $this->getHistogramRequest($interval, $start_timestamp, $end_timestamp, $email_ids, $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 ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging' !== '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, '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Emails\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Emails\Model\Error' !== '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, '\HubSpot\Client\Marketing\Emails\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; + 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(), + '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Emails\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getHistogramAsync + * + * Get aggregated statistic intervals. + * + * @param string $interval The interval to aggregate statistics for. (optional) + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getHistogramAsync($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) + { + return $this->getHistogramAsyncWithHttpInfo($interval, $start_timestamp, $end_timestamp, $email_ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getHistogramAsyncWithHttpInfo + * + * Get aggregated statistic intervals. + * + * @param string $interval The interval to aggregate statistics for. (optional) + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getHistogramAsyncWithHttpInfo($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; + $request = $this->getHistogramRequest($interval, $start_timestamp, $end_timestamp, $email_ids, $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 'getHistogram' + * + * @param string $interval The interval to aggregate statistics for. (optional) + * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getHistogramRequest($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) + { + + + + + + + $resourcePath = '/marketing/v3/emails/statistics/histogram'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $interval, + 'interval', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_timestamp, + 'startTimestamp', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_timestamp, + 'endTimestamp', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_ids, + 'emailIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Emails/ApiException.php b/codegen/Marketing/Emails/ApiException.php new file mode 100644 index 000000000..600d585c3 --- /dev/null +++ b/codegen/Marketing/Emails/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen/Marketing/Emails/Configuration.php b/codegen/Marketing/Emails/Configuration.php new file mode 100644 index 000000000..957fd6af0 --- /dev/null +++ b/codegen/Marketing/Emails/Configuration.php @@ -0,0 +1,531 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (HubSpot\Client\Marketing\Emails) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.hubapi.com", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/codegen/Marketing/Emails/HeaderSelector.php b/codegen/Marketing/Emails/HeaderSelector.php new file mode 100644 index 000000000..a4941006d --- /dev/null +++ b/codegen/Marketing/Emails/HeaderSelector.php @@ -0,0 +1,245 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php b/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php new file mode 100644 index 000000000..2985008b2 --- /dev/null +++ b/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php @@ -0,0 +1,450 @@ + + */ +class AbTestCreateRequestVNext implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AbTestCreateRequestVNext'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'variation_name' => 'string', + 'content_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'variation_name' => null, + 'content_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'variation_name' => false, + 'content_id' => 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 = [ + 'variation_name' => 'variationName', + 'content_id' => 'contentId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'variation_name' => 'setVariationName', + 'content_id' => 'setContentId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'variation_name' => 'getVariationName', + 'content_id' => 'getContentId' + ]; + + /** + * 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('variation_name', $data ?? [], null); + $this->setIfExists('content_id', $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['variation_name'] === null) { + $invalidProperties[] = "'variation_name' can't be null"; + } + if ($this->container['content_id'] === null) { + $invalidProperties[] = "'content_id' 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 variation_name + * + * @return string + */ + public function getVariationName() + { + return $this->container['variation_name']; + } + + /** + * Sets variation_name + * + * @param string $variation_name variation_name + * + * @return self + */ + public function setVariationName($variation_name) + { + if (is_null($variation_name)) { + throw new \InvalidArgumentException('non-nullable variation_name cannot be null'); + } + $this->container['variation_name'] = $variation_name; + + return $this; + } + + /** + * Gets content_id + * + * @return string + */ + public function getContentId() + { + return $this->container['content_id']; + } + + /** + * Sets content_id + * + * @param string $content_id ID of the object to test. + * + * @return self + */ + public function setContentId($content_id) + { + if (is_null($content_id)) { + throw new \InvalidArgumentException('non-nullable content_id cannot be null'); + } + $this->container['content_id'] = $content_id; + + 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/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php b/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php new file mode 100644 index 000000000..9c0841663 --- /dev/null +++ b/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php @@ -0,0 +1,478 @@ + + */ +class AggregateEmailStatistics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AggregateEmailStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'emails' => 'int[]', + 'campaign_aggregations' => 'array', + 'aggregate' => '\HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'emails' => 'int64', + 'campaign_aggregations' => null, + 'aggregate' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'emails' => false, + 'campaign_aggregations' => false, + 'aggregate' => 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 = [ + 'emails' => 'emails', + 'campaign_aggregations' => 'campaignAggregations', + 'aggregate' => 'aggregate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'emails' => 'setEmails', + 'campaign_aggregations' => 'setCampaignAggregations', + 'aggregate' => 'setAggregate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'emails' => 'getEmails', + 'campaign_aggregations' => 'getCampaignAggregations', + 'aggregate' => 'getAggregate' + ]; + + /** + * 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('emails', $data ?? [], null); + $this->setIfExists('campaign_aggregations', $data ?? [], null); + $this->setIfExists('aggregate', $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 emails + * + * @return int[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param int[]|null $emails List of email IDs that were sent during the time span. + * + * @return self + */ + public function setEmails($emails) + { + if (is_null($emails)) { + throw new \InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets campaign_aggregations + * + * @return array|null + */ + public function getCampaignAggregations() + { + return $this->container['campaign_aggregations']; + } + + /** + * Sets campaign_aggregations + * + * @param array|null $campaign_aggregations The aggregated statistics per campaign. + * + * @return self + */ + public function setCampaignAggregations($campaign_aggregations) + { + if (is_null($campaign_aggregations)) { + throw new \InvalidArgumentException('non-nullable campaign_aggregations cannot be null'); + } + $this->container['campaign_aggregations'] = $campaign_aggregations; + + return $this; + } + + /** + * Gets aggregate + * + * @return \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null + */ + public function getAggregate() + { + return $this->container['aggregate']; + } + + /** + * Sets aggregate + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null $aggregate aggregate + * + * @return self + */ + public function setAggregate($aggregate) + { + if (is_null($aggregate)) { + throw new \InvalidArgumentException('non-nullable aggregate cannot be null'); + } + $this->container['aggregate'] = $aggregate; + + 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/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php new file mode 100644 index 000000000..18fe8ada6 --- /dev/null +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php @@ -0,0 +1,450 @@ + + */ +class CollectionResponseWithTotalEmailStatisticIntervalNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'results' => '\HubSpot\Client\Marketing\Emails\Model\EmailStatisticInterval[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'results' => 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 = [ + 'total' => 'total', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'results' => 'getResults' + ]; + + /** + * 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('total', $data ?? [], null); + $this->setIfExists('results', $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['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' 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 total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total Total number of objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Emails\Model\EmailStatisticInterval[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailStatisticInterval[] $results Collection of objects. + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php new file mode 100644 index 000000000..45b2e7e6e --- /dev/null +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php @@ -0,0 +1,484 @@ + + */ +class CollectionResponseWithTotalPublicEmailForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalPublicEmailForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'paging' => '\HubSpot\Client\Marketing\Emails\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => 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 = [ + 'total' => 'total', + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * 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('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $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['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' 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 total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total Total number of content emails. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Marketing\Emails\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Marketing\Emails\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmail[] $results Collection of emails. + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php new file mode 100644 index 000000000..9b4c9e70c --- /dev/null +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php @@ -0,0 +1,484 @@ + + */ +class CollectionResponseWithTotalVersionPublicEmail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalVersionPublicEmail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'paging' => '\HubSpot\Client\Marketing\Emails\Model\Paging', + 'results' => '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => 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 = [ + 'total' => 'total', + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * 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('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $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['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' 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 total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total Total number of content emails. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Marketing\Emails\Model\Paging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Marketing\Emails\Model\Paging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail[] $results Collection of emails. + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php b/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php new file mode 100644 index 000000000..3980c09d0 --- /dev/null +++ b/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php @@ -0,0 +1,447 @@ + + */ +class ContentCloneRequestVNext implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContentCloneRequestVNext'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'clone_name' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'clone_name' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'clone_name' => false, + 'id' => 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 = [ + 'clone_name' => 'cloneName', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'clone_name' => 'setCloneName', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'clone_name' => 'getCloneName', + 'id' => 'getId' + ]; + + /** + * 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('clone_name', $data ?? [], null); + $this->setIfExists('id', $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['id'] === null) { + $invalidProperties[] = "'id' 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 clone_name + * + * @return string|null + */ + public function getCloneName() + { + return $this->container['clone_name']; + } + + /** + * Sets clone_name + * + * @param string|null $clone_name Name of the cloned email. + * + * @return self + */ + public function setCloneName($clone_name) + { + if (is_null($clone_name)) { + throw new \InvalidArgumentException('non-nullable clone_name cannot be null'); + } + $this->container['clone_name'] = $clone_name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the email to be cloned. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Marketing/Emails/Model/EmailCreateRequest.php b/codegen/Marketing/Emails/Model/EmailCreateRequest.php new file mode 100644 index 000000000..4e6af9e23 --- /dev/null +++ b/codegen/Marketing/Emails/Model/EmailCreateRequest.php @@ -0,0 +1,2921 @@ + + */ +class EmailCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'feedback_survey_id' => 'string', + 'rss_data' => '\HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails', + 'subject' => 'string', + 'testing' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails', + 'publish_date' => '\DateTime', + 'language' => 'string', + 'business_unit_id' => 'int', + 'content' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailContent', + 'webversion' => '\HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails', + 'archived' => 'bool', + 'subscription_details' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails', + 'active_domain' => 'string', + 'name' => 'string', + 'campaign' => 'string', + 'from' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails', + 'jitter_send_time' => 'bool', + 'state' => 'string', + 'to' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails', + 'subcategory' => 'string', + 'send_on_publish' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'feedback_survey_id' => null, + 'rss_data' => null, + 'subject' => null, + 'testing' => null, + 'publish_date' => 'date-time', + 'language' => null, + 'business_unit_id' => 'int64', + 'content' => null, + 'webversion' => null, + 'archived' => null, + 'subscription_details' => null, + 'active_domain' => null, + 'name' => null, + 'campaign' => null, + 'from' => null, + 'jitter_send_time' => null, + 'state' => null, + 'to' => null, + 'subcategory' => null, + 'send_on_publish' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'feedback_survey_id' => false, + 'rss_data' => false, + 'subject' => false, + 'testing' => false, + 'publish_date' => false, + 'language' => false, + 'business_unit_id' => false, + 'content' => false, + 'webversion' => false, + 'archived' => false, + 'subscription_details' => false, + 'active_domain' => false, + 'name' => false, + 'campaign' => false, + 'from' => false, + 'jitter_send_time' => false, + 'state' => false, + 'to' => false, + 'subcategory' => false, + 'send_on_publish' => 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 = [ + 'feedback_survey_id' => 'feedbackSurveyId', + 'rss_data' => 'rssData', + 'subject' => 'subject', + 'testing' => 'testing', + 'publish_date' => 'publishDate', + 'language' => 'language', + 'business_unit_id' => 'businessUnitId', + 'content' => 'content', + 'webversion' => 'webversion', + 'archived' => 'archived', + 'subscription_details' => 'subscriptionDetails', + 'active_domain' => 'activeDomain', + 'name' => 'name', + 'campaign' => 'campaign', + 'from' => 'from', + 'jitter_send_time' => 'jitterSendTime', + 'state' => 'state', + 'to' => 'to', + 'subcategory' => 'subcategory', + 'send_on_publish' => 'sendOnPublish' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'feedback_survey_id' => 'setFeedbackSurveyId', + 'rss_data' => 'setRssData', + 'subject' => 'setSubject', + 'testing' => 'setTesting', + 'publish_date' => 'setPublishDate', + 'language' => 'setLanguage', + 'business_unit_id' => 'setBusinessUnitId', + 'content' => 'setContent', + 'webversion' => 'setWebversion', + 'archived' => 'setArchived', + 'subscription_details' => 'setSubscriptionDetails', + 'active_domain' => 'setActiveDomain', + 'name' => 'setName', + 'campaign' => 'setCampaign', + 'from' => 'setFrom', + 'jitter_send_time' => 'setJitterSendTime', + 'state' => 'setState', + 'to' => 'setTo', + 'subcategory' => 'setSubcategory', + 'send_on_publish' => 'setSendOnPublish' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'feedback_survey_id' => 'getFeedbackSurveyId', + 'rss_data' => 'getRssData', + 'subject' => 'getSubject', + 'testing' => 'getTesting', + 'publish_date' => 'getPublishDate', + 'language' => 'getLanguage', + 'business_unit_id' => 'getBusinessUnitId', + 'content' => 'getContent', + 'webversion' => 'getWebversion', + 'archived' => 'getArchived', + 'subscription_details' => 'getSubscriptionDetails', + 'active_domain' => 'getActiveDomain', + 'name' => 'getName', + 'campaign' => 'getCampaign', + 'from' => 'getFrom', + 'jitter_send_time' => 'getJitterSendTime', + 'state' => 'getState', + 'to' => 'getTo', + 'subcategory' => 'getSubcategory', + 'send_on_publish' => 'getSendOnPublish' + ]; + + /** + * 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 LANGUAGE_AF = 'af'; + public const LANGUAGE_AF_NA = 'af-na'; + public const LANGUAGE_AF_ZA = 'af-za'; + public const LANGUAGE_AGQ = 'agq'; + public const LANGUAGE_AGQ_CM = 'agq-cm'; + public const LANGUAGE_AK = 'ak'; + public const LANGUAGE_AK_GH = 'ak-gh'; + public const LANGUAGE_AM = 'am'; + public const LANGUAGE_AM_ET = 'am-et'; + public const LANGUAGE_ANN = 'ann'; + public const LANGUAGE_ANN_NG = 'ann-ng'; + public const LANGUAGE_AR = 'ar'; + public const LANGUAGE_AR_001 = 'ar-001'; + public const LANGUAGE_AR_AE = 'ar-ae'; + public const LANGUAGE_AR_BH = 'ar-bh'; + public const LANGUAGE_AR_DJ = 'ar-dj'; + public const LANGUAGE_AR_DZ = 'ar-dz'; + public const LANGUAGE_AR_EG = 'ar-eg'; + public const LANGUAGE_AR_EH = 'ar-eh'; + public const LANGUAGE_AR_ER = 'ar-er'; + public const LANGUAGE_AR_IL = 'ar-il'; + public const LANGUAGE_AR_IQ = 'ar-iq'; + public const LANGUAGE_AR_JO = 'ar-jo'; + public const LANGUAGE_AR_KM = 'ar-km'; + public const LANGUAGE_AR_KW = 'ar-kw'; + public const LANGUAGE_AR_LB = 'ar-lb'; + public const LANGUAGE_AR_LY = 'ar-ly'; + public const LANGUAGE_AR_MA = 'ar-ma'; + public const LANGUAGE_AR_MR = 'ar-mr'; + public const LANGUAGE_AR_OM = 'ar-om'; + public const LANGUAGE_AR_PS = 'ar-ps'; + public const LANGUAGE_AR_QA = 'ar-qa'; + public const LANGUAGE_AR_SA = 'ar-sa'; + public const LANGUAGE_AR_SD = 'ar-sd'; + public const LANGUAGE_AR_SO = 'ar-so'; + public const LANGUAGE_AR_SS = 'ar-ss'; + public const LANGUAGE_AR_SY = 'ar-sy'; + public const LANGUAGE_AR_TD = 'ar-td'; + public const LANGUAGE_AR_TN = 'ar-tn'; + public const LANGUAGE_AR_YE = 'ar-ye'; + public const LANGUAGE__AS = 'as'; + public const LANGUAGE_ASA = 'asa'; + public const LANGUAGE_ASA_TZ = 'asa-tz'; + public const LANGUAGE_AST = 'ast'; + public const LANGUAGE_AST_ES = 'ast-es'; + public const LANGUAGE_AS_IN = 'as-in'; + public const LANGUAGE_AZ = 'az'; + public const LANGUAGE_AZ_AZ = 'az-az'; + public const LANGUAGE_BAS = 'bas'; + public const LANGUAGE_BAS_CM = 'bas-cm'; + public const LANGUAGE_BE = 'be'; + public const LANGUAGE_BEM = 'bem'; + public const LANGUAGE_BEM_ZM = 'bem-zm'; + public const LANGUAGE_BEZ = 'bez'; + public const LANGUAGE_BEZ_TZ = 'bez-tz'; + public const LANGUAGE_BE_BY = 'be-by'; + public const LANGUAGE_BG = 'bg'; + public const LANGUAGE_BGC = 'bgc'; + public const LANGUAGE_BGC_IN = 'bgc-in'; + public const LANGUAGE_BG_BG = 'bg-bg'; + public const LANGUAGE_BHO = 'bho'; + public const LANGUAGE_BHO_IN = 'bho-in'; + public const LANGUAGE_BM = 'bm'; + public const LANGUAGE_BM_ML = 'bm-ml'; + public const LANGUAGE_BN = 'bn'; + public const LANGUAGE_BN_BD = 'bn-bd'; + public const LANGUAGE_BN_IN = 'bn-in'; + public const LANGUAGE_BO = 'bo'; + public const LANGUAGE_BO_CN = 'bo-cn'; + public const LANGUAGE_BO_IN = 'bo-in'; + public const LANGUAGE_BR = 'br'; + public const LANGUAGE_BRX = 'brx'; + public const LANGUAGE_BRX_IN = 'brx-in'; + public const LANGUAGE_BR_FR = 'br-fr'; + public const LANGUAGE_BS = 'bs'; + public const LANGUAGE_BS_BA = 'bs-ba'; + public const LANGUAGE_CA = 'ca'; + public const LANGUAGE_CA_AD = 'ca-ad'; + public const LANGUAGE_CA_ES = 'ca-es'; + public const LANGUAGE_CA_FR = 'ca-fr'; + public const LANGUAGE_CA_IT = 'ca-it'; + public const LANGUAGE_CCP = 'ccp'; + public const LANGUAGE_CCP_BD = 'ccp-bd'; + public const LANGUAGE_CCP_IN = 'ccp-in'; + public const LANGUAGE_CE = 'ce'; + public const LANGUAGE_CEB = 'ceb'; + public const LANGUAGE_CEB_PH = 'ceb-ph'; + public const LANGUAGE_CE_RU = 'ce-ru'; + public const LANGUAGE_CGG = 'cgg'; + public const LANGUAGE_CGG_UG = 'cgg-ug'; + public const LANGUAGE_CHR = 'chr'; + public const LANGUAGE_CHR_US = 'chr-us'; + public const LANGUAGE_CKB = 'ckb'; + public const LANGUAGE_CKB_IQ = 'ckb-iq'; + public const LANGUAGE_CKB_IR = 'ckb-ir'; + public const LANGUAGE_CS = 'cs'; + public const LANGUAGE_CS_CZ = 'cs-cz'; + public const LANGUAGE_CU = 'cu'; + public const LANGUAGE_CU_RU = 'cu-ru'; + public const LANGUAGE_CV = 'cv'; + public const LANGUAGE_CV_RU = 'cv-ru'; + public const LANGUAGE_CY = 'cy'; + public const LANGUAGE_CY_GB = 'cy-gb'; + public const LANGUAGE_DA = 'da'; + public const LANGUAGE_DAV = 'dav'; + public const LANGUAGE_DAV_KE = 'dav-ke'; + public const LANGUAGE_DA_DK = 'da-dk'; + public const LANGUAGE_DA_GL = 'da-gl'; + public const LANGUAGE_DE = 'de'; + public const LANGUAGE_DE_AT = 'de-at'; + public const LANGUAGE_DE_BE = 'de-be'; + public const LANGUAGE_DE_CH = 'de-ch'; + public const LANGUAGE_DE_DE = 'de-de'; + public const LANGUAGE_DE_GR = 'de-gr'; + public const LANGUAGE_DE_IT = 'de-it'; + public const LANGUAGE_DE_LI = 'de-li'; + public const LANGUAGE_DE_LU = 'de-lu'; + public const LANGUAGE_DJE = 'dje'; + public const LANGUAGE_DJE_NE = 'dje-ne'; + public const LANGUAGE_DOI = 'doi'; + public const LANGUAGE_DOI_IN = 'doi-in'; + public const LANGUAGE_DSB = 'dsb'; + public const LANGUAGE_DSB_DE = 'dsb-de'; + public const LANGUAGE_DUA = 'dua'; + public const LANGUAGE_DUA_CM = 'dua-cm'; + public const LANGUAGE_DYO = 'dyo'; + public const LANGUAGE_DYO_SN = 'dyo-sn'; + public const LANGUAGE_DZ = 'dz'; + public const LANGUAGE_DZ_BT = 'dz-bt'; + public const LANGUAGE_EBU = 'ebu'; + public const LANGUAGE_EBU_KE = 'ebu-ke'; + public const LANGUAGE_EE = 'ee'; + public const LANGUAGE_EE_GH = 'ee-gh'; + public const LANGUAGE_EE_TG = 'ee-tg'; + public const LANGUAGE_EL = 'el'; + public const LANGUAGE_EL_CY = 'el-cy'; + public const LANGUAGE_EL_GR = 'el-gr'; + public const LANGUAGE_EN = 'en'; + public const LANGUAGE_EN_001 = 'en-001'; + public const LANGUAGE_EN_150 = 'en-150'; + public const LANGUAGE_EN_AE = 'en-ae'; + public const LANGUAGE_EN_AG = 'en-ag'; + public const LANGUAGE_EN_AI = 'en-ai'; + public const LANGUAGE_EN_AS = 'en-as'; + public const LANGUAGE_EN_AT = 'en-at'; + public const LANGUAGE_EN_AU = 'en-au'; + public const LANGUAGE_EN_BB = 'en-bb'; + public const LANGUAGE_EN_BE = 'en-be'; + public const LANGUAGE_EN_BI = 'en-bi'; + public const LANGUAGE_EN_BM = 'en-bm'; + public const LANGUAGE_EN_BS = 'en-bs'; + public const LANGUAGE_EN_BW = 'en-bw'; + public const LANGUAGE_EN_BZ = 'en-bz'; + public const LANGUAGE_EN_CA = 'en-ca'; + public const LANGUAGE_EN_CC = 'en-cc'; + public const LANGUAGE_EN_CH = 'en-ch'; + public const LANGUAGE_EN_CK = 'en-ck'; + public const LANGUAGE_EN_CM = 'en-cm'; + public const LANGUAGE_EN_CN = 'en-cn'; + public const LANGUAGE_EN_CX = 'en-cx'; + public const LANGUAGE_EN_CY = 'en-cy'; + public const LANGUAGE_EN_DE = 'en-de'; + public const LANGUAGE_EN_DG = 'en-dg'; + public const LANGUAGE_EN_DK = 'en-dk'; + public const LANGUAGE_EN_DM = 'en-dm'; + public const LANGUAGE_EN_EE = 'en-ee'; + public const LANGUAGE_EN_ER = 'en-er'; + public const LANGUAGE_EN_FI = 'en-fi'; + public const LANGUAGE_EN_FJ = 'en-fj'; + public const LANGUAGE_EN_FK = 'en-fk'; + public const LANGUAGE_EN_FM = 'en-fm'; + public const LANGUAGE_EN_FR = 'en-fr'; + public const LANGUAGE_EN_GB = 'en-gb'; + public const LANGUAGE_EN_GD = 'en-gd'; + public const LANGUAGE_EN_GG = 'en-gg'; + public const LANGUAGE_EN_GH = 'en-gh'; + public const LANGUAGE_EN_GI = 'en-gi'; + public const LANGUAGE_EN_GM = 'en-gm'; + public const LANGUAGE_EN_GU = 'en-gu'; + public const LANGUAGE_EN_GY = 'en-gy'; + public const LANGUAGE_EN_HK = 'en-hk'; + public const LANGUAGE_EN_IE = 'en-ie'; + public const LANGUAGE_EN_IL = 'en-il'; + public const LANGUAGE_EN_IM = 'en-im'; + public const LANGUAGE_EN_IN = 'en-in'; + public const LANGUAGE_EN_IO = 'en-io'; + public const LANGUAGE_EN_JE = 'en-je'; + public const LANGUAGE_EN_JM = 'en-jm'; + public const LANGUAGE_EN_KE = 'en-ke'; + public const LANGUAGE_EN_KI = 'en-ki'; + public const LANGUAGE_EN_KN = 'en-kn'; + public const LANGUAGE_EN_KY = 'en-ky'; + public const LANGUAGE_EN_LC = 'en-lc'; + public const LANGUAGE_EN_LR = 'en-lr'; + public const LANGUAGE_EN_LS = 'en-ls'; + public const LANGUAGE_EN_LU = 'en-lu'; + public const LANGUAGE_EN_MG = 'en-mg'; + public const LANGUAGE_EN_MH = 'en-mh'; + public const LANGUAGE_EN_MO = 'en-mo'; + public const LANGUAGE_EN_MP = 'en-mp'; + public const LANGUAGE_EN_MS = 'en-ms'; + public const LANGUAGE_EN_MT = 'en-mt'; + public const LANGUAGE_EN_MU = 'en-mu'; + public const LANGUAGE_EN_MV = 'en-mv'; + public const LANGUAGE_EN_MW = 'en-mw'; + public const LANGUAGE_EN_MX = 'en-mx'; + public const LANGUAGE_EN_MY = 'en-my'; + public const LANGUAGE_EN_NA = 'en-na'; + public const LANGUAGE_EN_NF = 'en-nf'; + public const LANGUAGE_EN_NG = 'en-ng'; + public const LANGUAGE_EN_NL = 'en-nl'; + public const LANGUAGE_EN_NR = 'en-nr'; + public const LANGUAGE_EN_NU = 'en-nu'; + public const LANGUAGE_EN_NZ = 'en-nz'; + public const LANGUAGE_EN_PG = 'en-pg'; + public const LANGUAGE_EN_PH = 'en-ph'; + public const LANGUAGE_EN_PK = 'en-pk'; + public const LANGUAGE_EN_PN = 'en-pn'; + public const LANGUAGE_EN_PR = 'en-pr'; + public const LANGUAGE_EN_PW = 'en-pw'; + public const LANGUAGE_EN_RW = 'en-rw'; + public const LANGUAGE_EN_SB = 'en-sb'; + public const LANGUAGE_EN_SC = 'en-sc'; + public const LANGUAGE_EN_SD = 'en-sd'; + public const LANGUAGE_EN_SE = 'en-se'; + public const LANGUAGE_EN_SG = 'en-sg'; + public const LANGUAGE_EN_SH = 'en-sh'; + public const LANGUAGE_EN_SI = 'en-si'; + public const LANGUAGE_EN_SL = 'en-sl'; + public const LANGUAGE_EN_SS = 'en-ss'; + public const LANGUAGE_EN_SX = 'en-sx'; + public const LANGUAGE_EN_SZ = 'en-sz'; + public const LANGUAGE_EN_TC = 'en-tc'; + public const LANGUAGE_EN_TK = 'en-tk'; + public const LANGUAGE_EN_TO = 'en-to'; + public const LANGUAGE_EN_TT = 'en-tt'; + public const LANGUAGE_EN_TV = 'en-tv'; + public const LANGUAGE_EN_TZ = 'en-tz'; + public const LANGUAGE_EN_UG = 'en-ug'; + public const LANGUAGE_EN_UM = 'en-um'; + public const LANGUAGE_EN_US = 'en-us'; + public const LANGUAGE_EN_VC = 'en-vc'; + public const LANGUAGE_EN_VG = 'en-vg'; + public const LANGUAGE_EN_VI = 'en-vi'; + public const LANGUAGE_EN_VU = 'en-vu'; + public const LANGUAGE_EN_WS = 'en-ws'; + public const LANGUAGE_EN_ZA = 'en-za'; + public const LANGUAGE_EN_ZM = 'en-zm'; + public const LANGUAGE_EN_ZW = 'en-zw'; + public const LANGUAGE_EO = 'eo'; + public const LANGUAGE_EO_001 = 'eo-001'; + public const LANGUAGE_ES = 'es'; + public const LANGUAGE_ES_419 = 'es-419'; + public const LANGUAGE_ES_AR = 'es-ar'; + public const LANGUAGE_ES_BO = 'es-bo'; + public const LANGUAGE_ES_BR = 'es-br'; + public const LANGUAGE_ES_BZ = 'es-bz'; + public const LANGUAGE_ES_CL = 'es-cl'; + public const LANGUAGE_ES_CO = 'es-co'; + public const LANGUAGE_ES_CR = 'es-cr'; + public const LANGUAGE_ES_CU = 'es-cu'; + public const LANGUAGE_ES_DO = 'es-do'; + public const LANGUAGE_ES_EA = 'es-ea'; + public const LANGUAGE_ES_EC = 'es-ec'; + public const LANGUAGE_ES_ES = 'es-es'; + public const LANGUAGE_ES_GQ = 'es-gq'; + public const LANGUAGE_ES_GT = 'es-gt'; + public const LANGUAGE_ES_HN = 'es-hn'; + public const LANGUAGE_ES_IC = 'es-ic'; + public const LANGUAGE_ES_MX = 'es-mx'; + public const LANGUAGE_ES_NI = 'es-ni'; + public const LANGUAGE_ES_PA = 'es-pa'; + public const LANGUAGE_ES_PE = 'es-pe'; + public const LANGUAGE_ES_PH = 'es-ph'; + public const LANGUAGE_ES_PR = 'es-pr'; + public const LANGUAGE_ES_PY = 'es-py'; + public const LANGUAGE_ES_SV = 'es-sv'; + public const LANGUAGE_ES_US = 'es-us'; + public const LANGUAGE_ES_UY = 'es-uy'; + public const LANGUAGE_ES_VE = 'es-ve'; + public const LANGUAGE_ET = 'et'; + public const LANGUAGE_ET_EE = 'et-ee'; + public const LANGUAGE_EU = 'eu'; + public const LANGUAGE_EU_ES = 'eu-es'; + public const LANGUAGE_EWO = 'ewo'; + public const LANGUAGE_EWO_CM = 'ewo-cm'; + public const LANGUAGE_FA = 'fa'; + public const LANGUAGE_FA_AF = 'fa-af'; + public const LANGUAGE_FA_IR = 'fa-ir'; + public const LANGUAGE_FF = 'ff'; + public const LANGUAGE_FF_BF = 'ff-bf'; + public const LANGUAGE_FF_CM = 'ff-cm'; + public const LANGUAGE_FF_GH = 'ff-gh'; + public const LANGUAGE_FF_GM = 'ff-gm'; + public const LANGUAGE_FF_GN = 'ff-gn'; + public const LANGUAGE_FF_GW = 'ff-gw'; + public const LANGUAGE_FF_LR = 'ff-lr'; + public const LANGUAGE_FF_MR = 'ff-mr'; + public const LANGUAGE_FF_NE = 'ff-ne'; + public const LANGUAGE_FF_NG = 'ff-ng'; + public const LANGUAGE_FF_SL = 'ff-sl'; + public const LANGUAGE_FF_SN = 'ff-sn'; + public const LANGUAGE_FI = 'fi'; + public const LANGUAGE_FIL = 'fil'; + public const LANGUAGE_FIL_PH = 'fil-ph'; + public const LANGUAGE_FI_FI = 'fi-fi'; + public const LANGUAGE_FO = 'fo'; + public const LANGUAGE_FO_DK = 'fo-dk'; + public const LANGUAGE_FO_FO = 'fo-fo'; + public const LANGUAGE_FR = 'fr'; + public const LANGUAGE_FRR = 'frr'; + public const LANGUAGE_FRR_DE = 'frr-de'; + public const LANGUAGE_FR_BE = 'fr-be'; + public const LANGUAGE_FR_BF = 'fr-bf'; + public const LANGUAGE_FR_BI = 'fr-bi'; + public const LANGUAGE_FR_BJ = 'fr-bj'; + public const LANGUAGE_FR_BL = 'fr-bl'; + public const LANGUAGE_FR_CA = 'fr-ca'; + public const LANGUAGE_FR_CD = 'fr-cd'; + public const LANGUAGE_FR_CF = 'fr-cf'; + public const LANGUAGE_FR_CG = 'fr-cg'; + public const LANGUAGE_FR_CH = 'fr-ch'; + public const LANGUAGE_FR_CI = 'fr-ci'; + public const LANGUAGE_FR_CM = 'fr-cm'; + public const LANGUAGE_FR_DJ = 'fr-dj'; + public const LANGUAGE_FR_DZ = 'fr-dz'; + public const LANGUAGE_FR_FR = 'fr-fr'; + public const LANGUAGE_FR_GA = 'fr-ga'; + public const LANGUAGE_FR_GF = 'fr-gf'; + public const LANGUAGE_FR_GN = 'fr-gn'; + public const LANGUAGE_FR_GP = 'fr-gp'; + public const LANGUAGE_FR_GQ = 'fr-gq'; + public const LANGUAGE_FR_HT = 'fr-ht'; + public const LANGUAGE_FR_KM = 'fr-km'; + public const LANGUAGE_FR_LU = 'fr-lu'; + public const LANGUAGE_FR_MA = 'fr-ma'; + public const LANGUAGE_FR_MC = 'fr-mc'; + public const LANGUAGE_FR_MF = 'fr-mf'; + public const LANGUAGE_FR_MG = 'fr-mg'; + public const LANGUAGE_FR_ML = 'fr-ml'; + public const LANGUAGE_FR_MQ = 'fr-mq'; + public const LANGUAGE_FR_MR = 'fr-mr'; + public const LANGUAGE_FR_MU = 'fr-mu'; + public const LANGUAGE_FR_NC = 'fr-nc'; + public const LANGUAGE_FR_NE = 'fr-ne'; + public const LANGUAGE_FR_PF = 'fr-pf'; + public const LANGUAGE_FR_PM = 'fr-pm'; + public const LANGUAGE_FR_RE = 'fr-re'; + public const LANGUAGE_FR_RW = 'fr-rw'; + public const LANGUAGE_FR_SC = 'fr-sc'; + public const LANGUAGE_FR_SN = 'fr-sn'; + public const LANGUAGE_FR_SY = 'fr-sy'; + public const LANGUAGE_FR_TD = 'fr-td'; + public const LANGUAGE_FR_TG = 'fr-tg'; + public const LANGUAGE_FR_TN = 'fr-tn'; + public const LANGUAGE_FR_VU = 'fr-vu'; + public const LANGUAGE_FR_WF = 'fr-wf'; + public const LANGUAGE_FR_YT = 'fr-yt'; + public const LANGUAGE_FUR = 'fur'; + public const LANGUAGE_FUR_IT = 'fur-it'; + public const LANGUAGE_FY = 'fy'; + public const LANGUAGE_FY_NL = 'fy-nl'; + public const LANGUAGE_GA = 'ga'; + public const LANGUAGE_GA_GB = 'ga-gb'; + public const LANGUAGE_GA_IE = 'ga-ie'; + public const LANGUAGE_GD = 'gd'; + public const LANGUAGE_GD_GB = 'gd-gb'; + public const LANGUAGE_GL = 'gl'; + public const LANGUAGE_GL_ES = 'gl-es'; + public const LANGUAGE_GSW = 'gsw'; + public const LANGUAGE_GSW_CH = 'gsw-ch'; + public const LANGUAGE_GSW_FR = 'gsw-fr'; + public const LANGUAGE_GSW_LI = 'gsw-li'; + public const LANGUAGE_GU = 'gu'; + public const LANGUAGE_GUZ = 'guz'; + public const LANGUAGE_GUZ_KE = 'guz-ke'; + public const LANGUAGE_GU_IN = 'gu-in'; + public const LANGUAGE_GV = 'gv'; + public const LANGUAGE_GV_IM = 'gv-im'; + public const LANGUAGE_HA = 'ha'; + public const LANGUAGE_HAW = 'haw'; + public const LANGUAGE_HAW_US = 'haw-us'; + public const LANGUAGE_HA_GH = 'ha-gh'; + public const LANGUAGE_HA_NE = 'ha-ne'; + public const LANGUAGE_HA_NG = 'ha-ng'; + public const LANGUAGE_HE = 'he'; + public const LANGUAGE_HI = 'hi'; + public const LANGUAGE_HI_IN = 'hi-in'; + public const LANGUAGE_HR = 'hr'; + public const LANGUAGE_HR_BA = 'hr-ba'; + public const LANGUAGE_HR_HR = 'hr-hr'; + public const LANGUAGE_HSB = 'hsb'; + public const LANGUAGE_HSB_DE = 'hsb-de'; + public const LANGUAGE_HU = 'hu'; + public const LANGUAGE_HU_HU = 'hu-hu'; + public const LANGUAGE_HY = 'hy'; + public const LANGUAGE_HY_AM = 'hy-am'; + public const LANGUAGE_IA = 'ia'; + public const LANGUAGE_IA_001 = 'ia-001'; + public const LANGUAGE_ID = 'id'; + public const LANGUAGE_IG = 'ig'; + public const LANGUAGE_IG_NG = 'ig-ng'; + public const LANGUAGE_II = 'ii'; + public const LANGUAGE_II_CN = 'ii-cn'; + public const LANGUAGE_ID_ID = 'id-id'; + public const LANGUAGE_IS = 'is'; + public const LANGUAGE_IS_IS = 'is-is'; + public const LANGUAGE_IT = 'it'; + public const LANGUAGE_IT_CH = 'it-ch'; + public const LANGUAGE_IT_IT = 'it-it'; + public const LANGUAGE_IT_SM = 'it-sm'; + public const LANGUAGE_IT_VA = 'it-va'; + public const LANGUAGE_HE_IL = 'he-il'; + public const LANGUAGE_JA = 'ja'; + public const LANGUAGE_JA_JP = 'ja-jp'; + public const LANGUAGE_JGO = 'jgo'; + public const LANGUAGE_JGO_CM = 'jgo-cm'; + public const LANGUAGE_YI = 'yi'; + public const LANGUAGE_YI_001 = 'yi-001'; + public const LANGUAGE_JMC = 'jmc'; + public const LANGUAGE_JMC_TZ = 'jmc-tz'; + public const LANGUAGE_JV = 'jv'; + public const LANGUAGE_JV_ID = 'jv-id'; + public const LANGUAGE_KA = 'ka'; + public const LANGUAGE_KAB = 'kab'; + public const LANGUAGE_KAB_DZ = 'kab-dz'; + public const LANGUAGE_KAM = 'kam'; + public const LANGUAGE_KAM_KE = 'kam-ke'; + public const LANGUAGE_KA_GE = 'ka-ge'; + public const LANGUAGE_KDE = 'kde'; + public const LANGUAGE_KDE_TZ = 'kde-tz'; + public const LANGUAGE_KEA = 'kea'; + public const LANGUAGE_KEA_CV = 'kea-cv'; + public const LANGUAGE_KGP = 'kgp'; + public const LANGUAGE_KGP_BR = 'kgp-br'; + public const LANGUAGE_KHQ = 'khq'; + public const LANGUAGE_KHQ_ML = 'khq-ml'; + public const LANGUAGE_KI = 'ki'; + public const LANGUAGE_KI_KE = 'ki-ke'; + public const LANGUAGE_KK = 'kk'; + public const LANGUAGE_KKJ = 'kkj'; + public const LANGUAGE_KKJ_CM = 'kkj-cm'; + public const LANGUAGE_KK_KZ = 'kk-kz'; + public const LANGUAGE_KL = 'kl'; + public const LANGUAGE_KLN = 'kln'; + public const LANGUAGE_KLN_KE = 'kln-ke'; + public const LANGUAGE_KL_GL = 'kl-gl'; + public const LANGUAGE_KM = 'km'; + public const LANGUAGE_KM_KH = 'km-kh'; + public const LANGUAGE_KN = 'kn'; + public const LANGUAGE_KN_IN = 'kn-in'; + public const LANGUAGE_KO = 'ko'; + public const LANGUAGE_KOK = 'kok'; + public const LANGUAGE_KOK_IN = 'kok-in'; + public const LANGUAGE_KO_KP = 'ko-kp'; + public const LANGUAGE_KO_KR = 'ko-kr'; + public const LANGUAGE_KS = 'ks'; + public const LANGUAGE_KSB = 'ksb'; + public const LANGUAGE_KSB_TZ = 'ksb-tz'; + public const LANGUAGE_KSF = 'ksf'; + public const LANGUAGE_KSF_CM = 'ksf-cm'; + public const LANGUAGE_KSH = 'ksh'; + public const LANGUAGE_KSH_DE = 'ksh-de'; + public const LANGUAGE_KS_IN = 'ks-in'; + public const LANGUAGE_KU = 'ku'; + public const LANGUAGE_KU_TR = 'ku-tr'; + public const LANGUAGE_KW = 'kw'; + public const LANGUAGE_KW_GB = 'kw-gb'; + public const LANGUAGE_KY = 'ky'; + public const LANGUAGE_KY_KG = 'ky-kg'; + public const LANGUAGE_LAG = 'lag'; + public const LANGUAGE_LAG_TZ = 'lag-tz'; + public const LANGUAGE_LB = 'lb'; + public const LANGUAGE_LB_LU = 'lb-lu'; + public const LANGUAGE_LG = 'lg'; + public const LANGUAGE_LG_UG = 'lg-ug'; + public const LANGUAGE_LKT = 'lkt'; + public const LANGUAGE_LKT_US = 'lkt-us'; + public const LANGUAGE_LN = 'ln'; + public const LANGUAGE_LN_AO = 'ln-ao'; + public const LANGUAGE_LN_CD = 'ln-cd'; + public const LANGUAGE_LN_CF = 'ln-cf'; + public const LANGUAGE_LN_CG = 'ln-cg'; + public const LANGUAGE_LO = 'lo'; + public const LANGUAGE_LO_LA = 'lo-la'; + public const LANGUAGE_LRC = 'lrc'; + public const LANGUAGE_LRC_IQ = 'lrc-iq'; + public const LANGUAGE_LRC_IR = 'lrc-ir'; + public const LANGUAGE_LT = 'lt'; + public const LANGUAGE_LT_LT = 'lt-lt'; + public const LANGUAGE_LU = 'lu'; + public const LANGUAGE_LUO = 'luo'; + public const LANGUAGE_LUO_KE = 'luo-ke'; + public const LANGUAGE_LUY = 'luy'; + public const LANGUAGE_LUY_KE = 'luy-ke'; + public const LANGUAGE_LU_CD = 'lu-cd'; + public const LANGUAGE_LV = 'lv'; + public const LANGUAGE_LV_LV = 'lv-lv'; + public const LANGUAGE_MAI = 'mai'; + public const LANGUAGE_MAI_IN = 'mai-in'; + public const LANGUAGE_MAS = 'mas'; + public const LANGUAGE_MAS_KE = 'mas-ke'; + public const LANGUAGE_MAS_TZ = 'mas-tz'; + public const LANGUAGE_MDF = 'mdf'; + public const LANGUAGE_MDF_RU = 'mdf-ru'; + public const LANGUAGE_MER = 'mer'; + public const LANGUAGE_MER_KE = 'mer-ke'; + public const LANGUAGE_MFE = 'mfe'; + public const LANGUAGE_MFE_MU = 'mfe-mu'; + public const LANGUAGE_MG = 'mg'; + public const LANGUAGE_MGH = 'mgh'; + public const LANGUAGE_MGH_MZ = 'mgh-mz'; + public const LANGUAGE_MGO = 'mgo'; + public const LANGUAGE_MGO_CM = 'mgo-cm'; + public const LANGUAGE_MG_MG = 'mg-mg'; + public const LANGUAGE_MI = 'mi'; + public const LANGUAGE_MI_NZ = 'mi-nz'; + public const LANGUAGE_MK = 'mk'; + public const LANGUAGE_MK_MK = 'mk-mk'; + public const LANGUAGE_ML = 'ml'; + public const LANGUAGE_ML_IN = 'ml-in'; + public const LANGUAGE_MN = 'mn'; + public const LANGUAGE_MNI = 'mni'; + public const LANGUAGE_MNI_IN = 'mni-in'; + public const LANGUAGE_MN_MN = 'mn-mn'; + public const LANGUAGE_MR = 'mr'; + public const LANGUAGE_MR_IN = 'mr-in'; + public const LANGUAGE_MS = 'ms'; + public const LANGUAGE_MS_BN = 'ms-bn'; + public const LANGUAGE_MS_ID = 'ms-id'; + public const LANGUAGE_MS_MY = 'ms-my'; + public const LANGUAGE_MS_SG = 'ms-sg'; + public const LANGUAGE_MT = 'mt'; + public const LANGUAGE_MT_MT = 'mt-mt'; + public const LANGUAGE_MUA = 'mua'; + public const LANGUAGE_MUA_CM = 'mua-cm'; + public const LANGUAGE_MY = 'my'; + public const LANGUAGE_MY_MM = 'my-mm'; + public const LANGUAGE_MZN = 'mzn'; + public const LANGUAGE_MZN_IR = 'mzn-ir'; + public const LANGUAGE_NAQ = 'naq'; + public const LANGUAGE_NAQ_NA = 'naq-na'; + public const LANGUAGE_NB = 'nb'; + public const LANGUAGE_NB_NO = 'nb-no'; + public const LANGUAGE_NB_SJ = 'nb-sj'; + public const LANGUAGE_ND = 'nd'; + public const LANGUAGE_NDS = 'nds'; + public const LANGUAGE_NDS_DE = 'nds-de'; + public const LANGUAGE_NDS_NL = 'nds-nl'; + public const LANGUAGE_ND_ZW = 'nd-zw'; + public const LANGUAGE_NE = 'ne'; + public const LANGUAGE_NE_IN = 'ne-in'; + public const LANGUAGE_NE_NP = 'ne-np'; + public const LANGUAGE_NL = 'nl'; + public const LANGUAGE_NL_AW = 'nl-aw'; + public const LANGUAGE_NL_BE = 'nl-be'; + public const LANGUAGE_NL_BQ = 'nl-bq'; + public const LANGUAGE_NL_CH = 'nl-ch'; + public const LANGUAGE_NL_CW = 'nl-cw'; + public const LANGUAGE_NL_LU = 'nl-lu'; + public const LANGUAGE_NL_NL = 'nl-nl'; + public const LANGUAGE_NL_SR = 'nl-sr'; + public const LANGUAGE_NL_SX = 'nl-sx'; + public const LANGUAGE_NMG = 'nmg'; + public const LANGUAGE_NMG_CM = 'nmg-cm'; + public const LANGUAGE_NN = 'nn'; + public const LANGUAGE_NNH = 'nnh'; + public const LANGUAGE_NNH_CM = 'nnh-cm'; + public const LANGUAGE_NN_NO = 'nn-no'; + public const LANGUAGE_NO = 'no'; + public const LANGUAGE_NO_NO = 'no-no'; + public const LANGUAGE_NUS = 'nus'; + public const LANGUAGE_NUS_SS = 'nus-ss'; + public const LANGUAGE_NYN = 'nyn'; + public const LANGUAGE_NYN_UG = 'nyn-ug'; + public const LANGUAGE_OC = 'oc'; + public const LANGUAGE_OC_ES = 'oc-es'; + public const LANGUAGE_OC_FR = 'oc-fr'; + public const LANGUAGE_OM = 'om'; + public const LANGUAGE_OM_ET = 'om-et'; + public const LANGUAGE_OM_KE = 'om-ke'; + public const LANGUAGE__OR = 'or'; + public const LANGUAGE_OR_IN = 'or-in'; + public const LANGUAGE_OS = 'os'; + public const LANGUAGE_OS_GE = 'os-ge'; + public const LANGUAGE_OS_RU = 'os-ru'; + public const LANGUAGE_PA = 'pa'; + public const LANGUAGE_PA_IN = 'pa-in'; + public const LANGUAGE_PA_PK = 'pa-pk'; + public const LANGUAGE_PCM = 'pcm'; + public const LANGUAGE_PCM_NG = 'pcm-ng'; + public const LANGUAGE_PIS = 'pis'; + public const LANGUAGE_PIS_SB = 'pis-sb'; + public const LANGUAGE_PL = 'pl'; + public const LANGUAGE_PL_PL = 'pl-pl'; + public const LANGUAGE_PRG = 'prg'; + public const LANGUAGE_PRG_001 = 'prg-001'; + public const LANGUAGE_PS = 'ps'; + public const LANGUAGE_PS_AF = 'ps-af'; + public const LANGUAGE_PS_PK = 'ps-pk'; + public const LANGUAGE_PT = 'pt'; + public const LANGUAGE_PT_AO = 'pt-ao'; + public const LANGUAGE_PT_BR = 'pt-br'; + public const LANGUAGE_PT_CH = 'pt-ch'; + public const LANGUAGE_PT_CV = 'pt-cv'; + public const LANGUAGE_PT_GQ = 'pt-gq'; + public const LANGUAGE_PT_GW = 'pt-gw'; + public const LANGUAGE_PT_LU = 'pt-lu'; + public const LANGUAGE_PT_MO = 'pt-mo'; + public const LANGUAGE_PT_MZ = 'pt-mz'; + public const LANGUAGE_PT_PT = 'pt-pt'; + public const LANGUAGE_PT_ST = 'pt-st'; + public const LANGUAGE_PT_TL = 'pt-tl'; + public const LANGUAGE_QU = 'qu'; + public const LANGUAGE_QU_BO = 'qu-bo'; + public const LANGUAGE_QU_EC = 'qu-ec'; + public const LANGUAGE_QU_PE = 'qu-pe'; + public const LANGUAGE_RAJ = 'raj'; + public const LANGUAGE_RAJ_IN = 'raj-in'; + public const LANGUAGE_RM = 'rm'; + public const LANGUAGE_RM_CH = 'rm-ch'; + public const LANGUAGE_RN = 'rn'; + public const LANGUAGE_RN_BI = 'rn-bi'; + public const LANGUAGE_RO = 'ro'; + public const LANGUAGE_ROF = 'rof'; + public const LANGUAGE_ROF_TZ = 'rof-tz'; + public const LANGUAGE_RO_MD = 'ro-md'; + public const LANGUAGE_RO_RO = 'ro-ro'; + public const LANGUAGE_RU = 'ru'; + public const LANGUAGE_RU_BY = 'ru-by'; + public const LANGUAGE_RU_KG = 'ru-kg'; + public const LANGUAGE_RU_KZ = 'ru-kz'; + public const LANGUAGE_RU_MD = 'ru-md'; + public const LANGUAGE_RU_RU = 'ru-ru'; + public const LANGUAGE_RU_UA = 'ru-ua'; + public const LANGUAGE_RW = 'rw'; + public const LANGUAGE_RWK = 'rwk'; + public const LANGUAGE_RWK_TZ = 'rwk-tz'; + public const LANGUAGE_RW_RW = 'rw-rw'; + public const LANGUAGE_SA = 'sa'; + public const LANGUAGE_SAH = 'sah'; + public const LANGUAGE_SAH_RU = 'sah-ru'; + public const LANGUAGE_SAQ = 'saq'; + public const LANGUAGE_SAQ_KE = 'saq-ke'; + public const LANGUAGE_SAT = 'sat'; + public const LANGUAGE_SAT_IN = 'sat-in'; + public const LANGUAGE_SA_IN = 'sa-in'; + public const LANGUAGE_SBP = 'sbp'; + public const LANGUAGE_SBP_TZ = 'sbp-tz'; + public const LANGUAGE_SC = 'sc'; + public const LANGUAGE_SC_IT = 'sc-it'; + public const LANGUAGE_SD = 'sd'; + public const LANGUAGE_SD_IN = 'sd-in'; + public const LANGUAGE_SD_PK = 'sd-pk'; + public const LANGUAGE_SE = 'se'; + public const LANGUAGE_SEH = 'seh'; + public const LANGUAGE_SEH_MZ = 'seh-mz'; + public const LANGUAGE_SES = 'ses'; + public const LANGUAGE_SES_ML = 'ses-ml'; + public const LANGUAGE_SE_FI = 'se-fi'; + public const LANGUAGE_SE_NO = 'se-no'; + public const LANGUAGE_SE_SE = 'se-se'; + public const LANGUAGE_SG = 'sg'; + public const LANGUAGE_SG_CF = 'sg-cf'; + public const LANGUAGE_SHI = 'shi'; + public const LANGUAGE_SHI_MA = 'shi-ma'; + public const LANGUAGE_SI = 'si'; + public const LANGUAGE_SI_LK = 'si-lk'; + public const LANGUAGE_SK = 'sk'; + public const LANGUAGE_SK_SK = 'sk-sk'; + public const LANGUAGE_SL = 'sl'; + public const LANGUAGE_SL_SI = 'sl-si'; + public const LANGUAGE_SMN = 'smn'; + public const LANGUAGE_SMN_FI = 'smn-fi'; + public const LANGUAGE_SMS = 'sms'; + public const LANGUAGE_SMS_FI = 'sms-fi'; + public const LANGUAGE_SN = 'sn'; + public const LANGUAGE_SN_ZW = 'sn-zw'; + public const LANGUAGE_SO = 'so'; + public const LANGUAGE_SO_DJ = 'so-dj'; + public const LANGUAGE_SO_ET = 'so-et'; + public const LANGUAGE_SO_KE = 'so-ke'; + public const LANGUAGE_SO_SO = 'so-so'; + public const LANGUAGE_SQ = 'sq'; + public const LANGUAGE_SQ_AL = 'sq-al'; + public const LANGUAGE_SQ_MK = 'sq-mk'; + public const LANGUAGE_SQ_XK = 'sq-xk'; + public const LANGUAGE_SR = 'sr'; + public const LANGUAGE_SR_BA = 'sr-ba'; + public const LANGUAGE_SR_CS = 'sr-cs'; + public const LANGUAGE_SR_ME = 'sr-me'; + public const LANGUAGE_SR_RS = 'sr-rs'; + public const LANGUAGE_SR_XK = 'sr-xk'; + public const LANGUAGE_SU = 'su'; + public const LANGUAGE_SU_ID = 'su-id'; + public const LANGUAGE_SV = 'sv'; + public const LANGUAGE_SV_AX = 'sv-ax'; + public const LANGUAGE_SV_FI = 'sv-fi'; + public const LANGUAGE_SV_SE = 'sv-se'; + public const LANGUAGE_SW = 'sw'; + public const LANGUAGE_SW_CD = 'sw-cd'; + public const LANGUAGE_SW_KE = 'sw-ke'; + public const LANGUAGE_SW_TZ = 'sw-tz'; + public const LANGUAGE_SW_UG = 'sw-ug'; + public const LANGUAGE_SY = 'sy'; + public const LANGUAGE_TA = 'ta'; + public const LANGUAGE_TA_IN = 'ta-in'; + public const LANGUAGE_TA_LK = 'ta-lk'; + public const LANGUAGE_TA_MY = 'ta-my'; + public const LANGUAGE_TA_SG = 'ta-sg'; + public const LANGUAGE_TE = 'te'; + public const LANGUAGE_TEO = 'teo'; + public const LANGUAGE_TEO_KE = 'teo-ke'; + public const LANGUAGE_TEO_UG = 'teo-ug'; + public const LANGUAGE_TE_IN = 'te-in'; + public const LANGUAGE_TG = 'tg'; + public const LANGUAGE_TG_TJ = 'tg-tj'; + public const LANGUAGE_TH = 'th'; + public const LANGUAGE_TH_TH = 'th-th'; + public const LANGUAGE_TI = 'ti'; + public const LANGUAGE_TI_ER = 'ti-er'; + public const LANGUAGE_TI_ET = 'ti-et'; + public const LANGUAGE_TK = 'tk'; + public const LANGUAGE_TK_TM = 'tk-tm'; + public const LANGUAGE_TL = 'tl'; + public const LANGUAGE_TO = 'to'; + public const LANGUAGE_TOK = 'tok'; + public const LANGUAGE_TOK_001 = 'tok-001'; + public const LANGUAGE_TO_TO = 'to-to'; + public const LANGUAGE_TR = 'tr'; + public const LANGUAGE_TR_CY = 'tr-cy'; + public const LANGUAGE_TR_TR = 'tr-tr'; + public const LANGUAGE_TT = 'tt'; + public const LANGUAGE_TT_RU = 'tt-ru'; + public const LANGUAGE_TWQ = 'twq'; + public const LANGUAGE_TWQ_NE = 'twq-ne'; + public const LANGUAGE_TZM = 'tzm'; + public const LANGUAGE_TZM_MA = 'tzm-ma'; + public const LANGUAGE_UG = 'ug'; + public const LANGUAGE_UG_CN = 'ug-cn'; + public const LANGUAGE_UK = 'uk'; + public const LANGUAGE_UK_UA = 'uk-ua'; + public const LANGUAGE_UR = 'ur'; + public const LANGUAGE_UR_IN = 'ur-in'; + public const LANGUAGE_UR_PK = 'ur-pk'; + public const LANGUAGE_UZ = 'uz'; + public const LANGUAGE_UZ_AF = 'uz-af'; + public const LANGUAGE_UZ_UZ = 'uz-uz'; + public const LANGUAGE_VAI = 'vai'; + public const LANGUAGE_VAI_LR = 'vai-lr'; + public const LANGUAGE_VI = 'vi'; + public const LANGUAGE_VI_VN = 'vi-vn'; + public const LANGUAGE_VO = 'vo'; + public const LANGUAGE_VO_001 = 'vo-001'; + public const LANGUAGE_VUN = 'vun'; + public const LANGUAGE_VUN_TZ = 'vun-tz'; + public const LANGUAGE_WAE = 'wae'; + public const LANGUAGE_WAE_CH = 'wae-ch'; + public const LANGUAGE_WO = 'wo'; + public const LANGUAGE_WO_SN = 'wo-sn'; + public const LANGUAGE_XH = 'xh'; + public const LANGUAGE_XH_ZA = 'xh-za'; + public const LANGUAGE_XOG = 'xog'; + public const LANGUAGE_XOG_UG = 'xog-ug'; + public const LANGUAGE_YAV = 'yav'; + public const LANGUAGE_YAV_CM = 'yav-cm'; + public const LANGUAGE_YO = 'yo'; + public const LANGUAGE_YO_BJ = 'yo-bj'; + public const LANGUAGE_YO_NG = 'yo-ng'; + public const LANGUAGE_YRL = 'yrl'; + public const LANGUAGE_YRL_BR = 'yrl-br'; + public const LANGUAGE_YRL_CO = 'yrl-co'; + public const LANGUAGE_YRL_VE = 'yrl-ve'; + public const LANGUAGE_YUE = 'yue'; + public const LANGUAGE_YUE_CN = 'yue-cn'; + public const LANGUAGE_YUE_HK = 'yue-hk'; + public const LANGUAGE_ZGH = 'zgh'; + public const LANGUAGE_ZGH_MA = 'zgh-ma'; + public const LANGUAGE_ZH = 'zh'; + public const LANGUAGE_ZH_CN = 'zh-cn'; + public const LANGUAGE_ZH_HANS = 'zh-hans'; + public const LANGUAGE_ZH_HANT = 'zh-hant'; + public const LANGUAGE_ZH_HK = 'zh-hk'; + public const LANGUAGE_ZH_MO = 'zh-mo'; + public const LANGUAGE_ZH_SG = 'zh-sg'; + public const LANGUAGE_ZH_TW = 'zh-tw'; + public const LANGUAGE_ZU = 'zu'; + public const LANGUAGE_ZU_ZA = 'zu-za'; + public const STATE_AUTOMATED = 'AUTOMATED'; + public const STATE_AUTOMATED_DRAFT = 'AUTOMATED_DRAFT'; + public const STATE_AUTOMATED_SENDING = 'AUTOMATED_SENDING'; + public const STATE_AUTOMATED_FOR_FORM = 'AUTOMATED_FOR_FORM'; + public const STATE_AUTOMATED_FOR_FORM_BUFFER = 'AUTOMATED_FOR_FORM_BUFFER'; + public const STATE_AUTOMATED_FOR_FORM_DRAFT = 'AUTOMATED_FOR_FORM_DRAFT'; + public const STATE_AUTOMATED_FOR_FORM_LEGACY = 'AUTOMATED_FOR_FORM_LEGACY'; + public const STATE_BLOG_EMAIL_DRAFT = 'BLOG_EMAIL_DRAFT'; + public const STATE_BLOG_EMAIL_PUBLISHED = 'BLOG_EMAIL_PUBLISHED'; + public const STATE_DRAFT = 'DRAFT'; + public const STATE_DRAFT_AB = 'DRAFT_AB'; + public const STATE_DRAFT_AB_VARIANT = 'DRAFT_AB_VARIANT'; + public const STATE_ERROR = 'ERROR'; + public const STATE_LOSER_AB_VARIANT = 'LOSER_AB_VARIANT'; + public const STATE_PAGE_STUB = 'PAGE_STUB'; + public const STATE_PRE_PROCESSING = 'PRE_PROCESSING'; + public const STATE_PROCESSING = 'PROCESSING'; + public const STATE_PUBLISHED = 'PUBLISHED'; + public const STATE_PUBLISHED_AB = 'PUBLISHED_AB'; + public const STATE_PUBLISHED_AB_VARIANT = 'PUBLISHED_AB_VARIANT'; + public const STATE_PUBLISHED_OR_SCHEDULED = 'PUBLISHED_OR_SCHEDULED'; + public const STATE_RSS_TO_EMAIL_DRAFT = 'RSS_TO_EMAIL_DRAFT'; + public const STATE_RSS_TO_EMAIL_PUBLISHED = 'RSS_TO_EMAIL_PUBLISHED'; + public const STATE_SCHEDULED = 'SCHEDULED'; + public const STATE_SCHEDULED_AB = 'SCHEDULED_AB'; + public const STATE_SCHEDULED_OR_PUBLISHED = 'SCHEDULED_OR_PUBLISHED'; + public const STATE_AUTOMATED_AB = 'AUTOMATED_AB'; + public const STATE_AUTOMATED_AB_VARIANT = 'AUTOMATED_AB_VARIANT'; + public const STATE_AUTOMATED_DRAFT_AB = 'AUTOMATED_DRAFT_AB'; + public const STATE_AUTOMATED_DRAFT_ABVARIANT = 'AUTOMATED_DRAFT_ABVARIANT'; + public const STATE_AUTOMATED_LOSER_ABVARIANT = 'AUTOMATED_LOSER_ABVARIANT'; + public const SUBCATEGORY_AB_MASTER = 'ab_master'; + public const SUBCATEGORY_AB_VARIANT = 'ab_variant'; + public const SUBCATEGORY_AB_LOSER_VARIANT = 'ab_loser_variant'; + public const SUBCATEGORY_PAGE_STUB = 'page_stub'; + public const SUBCATEGORY_LANDING_PAGE = 'landing_page'; + public const SUBCATEGORY_SITE_PAGE = 'site_page'; + public const SUBCATEGORY_LEGACY_PAGE = 'legacy_page'; + public const SUBCATEGORY_AB_MASTER_SITE_PAGE = 'ab_master_site_page'; + public const SUBCATEGORY_AB_VARIANT_SITE_PAGE = 'ab_variant_site_page'; + public const SUBCATEGORY_AB_LOSER_VARIANT_SITE_PAGE = 'ab_loser_variant_site_page'; + public const SUBCATEGORY_PERFORMABLE_LANDING_PAGE = 'performable_landing_page'; + public const SUBCATEGORY_PERFORMABLE_LANDING_PAGE_CUTOVER = 'performable_landing_page_cutover'; + public const SUBCATEGORY_STAGED_PAGE = 'staged_page'; + public const SUBCATEGORY_AUTOMATED = 'automated'; + public const SUBCATEGORY_AUTOMATED_FOR_DEAL = 'automated_for_deal'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM = 'automated_for_form'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_LEGACY = 'automated_for_form_legacy'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_BUFFER = 'automated_for_form_buffer'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_DRAFT = 'automated_for_form_draft'; + public const SUBCATEGORY_RSS_TO_EMAIL = 'rss_to_email'; + public const SUBCATEGORY_RSS_TO_EMAIL_CHILD = 'rss_to_email_child'; + public const SUBCATEGORY_BLOG_EMAIL = 'blog_email'; + public const SUBCATEGORY_BLOG_EMAIL_CHILD = 'blog_email_child'; + public const SUBCATEGORY_OPTIN_EMAIL = 'optin_email'; + public const SUBCATEGORY_OPTIN_FOLLOWUP_EMAIL = 'optin_followup_email'; + public const SUBCATEGORY_BATCH = 'batch'; + public const SUBCATEGORY_RESUBSCRIBE_EMAIL = 'resubscribe_email'; + public const SUBCATEGORY_UNSUBSCRIBE_CONFIRMATION_EMAIL = 'unsubscribe_confirmation_email'; + public const SUBCATEGORY_RESUBSCRIBE_CONFIRMATION_EMAIL = 'resubscribe_confirmation_email'; + public const SUBCATEGORY_SINGLE_SEND_API = 'single_send_api'; + public const SUBCATEGORY_MARKETING_SINGLE_SEND_API = 'marketing_single_send_api'; + public const SUBCATEGORY_SMTP_TOKEN = 'smtp_token'; + public const SUBCATEGORY_LOCALTIME = 'localtime'; + public const SUBCATEGORY_AUTOMATED_FOR_TICKET = 'automated_for_ticket'; + public const SUBCATEGORY_AUTOMATED_FOR_LEADFLOW = 'automated_for_leadflow'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CES = 'automated_for_feedback_ces'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_NPS = 'automated_for_feedback_nps'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CUSTOM = 'automated_for_feedback_custom'; + public const SUBCATEGORY_MEMBERSHIP_REGISTRATION = 'membership_registration'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORD_SAVED = 'membership_password_saved'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORD_RESET = 'membership_password_reset'; + public const SUBCATEGORY_MEMBERSHIP_OTP_LOGIN = 'membership_otp_login'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORDLESS_AUTH = 'membership_passwordless_auth'; + public const SUBCATEGORY_MEMBERSHIP_EMAIL_VERIFICATION = 'membership_email_verification'; + public const SUBCATEGORY_MEMBERSHIP_REGISTRATION_FOLLOW_UP = 'membership_registration_follow_up'; + public const SUBCATEGORY_MEMBERSHIP_VERIFICATION = 'membership_verification'; + public const SUBCATEGORY_MEMBERSHIP_FOLLOW_UP = 'membership_follow_up'; + public const SUBCATEGORY_TICKET_CLOSED_KICKBACK_EMAIL = 'ticket_closed_kickback_email'; + public const SUBCATEGORY_TICKET_OPENED_KICKBACK_EMAIL = 'ticket_opened_kickback_email'; + public const SUBCATEGORY_AUTOMATED_FOR_CUSTOM_SURVEY = 'automated_for_custom_survey'; + public const SUBCATEGORY_DISCARDABLE_STUB = 'discardable_stub'; + public const SUBCATEGORY_NORMAL_BLOG_POST = 'normal_blog_post'; + public const SUBCATEGORY_LEGACY_BLOG_POST = 'legacy_blog_post'; + public const SUBCATEGORY_IMPORTED_BLOG_POST = 'imported_blog_post'; + public const SUBCATEGORY_AUTOMATED_AB_MASTER = 'automated_ab_master'; + public const SUBCATEGORY_AUTOMATED_AB_VARIANT = 'automated_ab_variant'; + public const SUBCATEGORY_WEB_INTERACTIVE = 'web_interactive'; + public const SUBCATEGORY_PORTAL_CONTENT = 'portal_content'; + public const SUBCATEGORY_PAGE_INSTANCE_LAYOUT = 'page_instance_layout'; + public const SUBCATEGORY_KB_ARTICLE_INSTANCE_LAYOUT = 'kb_article_instance_layout'; + public const SUBCATEGORY_KB_LISTING = 'kb_listing'; + public const SUBCATEGORY_KB_SEARCH_RESULTS = 'kb_search_results'; + public const SUBCATEGORY_KB_SUPPORT_FORM = 'kb_support_form'; + public const SUBCATEGORY_CASE_STUDY = 'case_study'; + public const SUBCATEGORY_CASE_STUDY_LISTING = 'case_study_listing'; + public const SUBCATEGORY_CASE_STUDY_INSTANCE_LAYOUT = 'case_study_instance_layout'; + public const SUBCATEGORY_UNKNOWN = 'UNKNOWN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_AF, + self::LANGUAGE_AF_NA, + self::LANGUAGE_AF_ZA, + self::LANGUAGE_AGQ, + self::LANGUAGE_AGQ_CM, + self::LANGUAGE_AK, + self::LANGUAGE_AK_GH, + self::LANGUAGE_AM, + self::LANGUAGE_AM_ET, + self::LANGUAGE_ANN, + self::LANGUAGE_ANN_NG, + self::LANGUAGE_AR, + self::LANGUAGE_AR_001, + self::LANGUAGE_AR_AE, + self::LANGUAGE_AR_BH, + self::LANGUAGE_AR_DJ, + self::LANGUAGE_AR_DZ, + self::LANGUAGE_AR_EG, + self::LANGUAGE_AR_EH, + self::LANGUAGE_AR_ER, + self::LANGUAGE_AR_IL, + self::LANGUAGE_AR_IQ, + self::LANGUAGE_AR_JO, + self::LANGUAGE_AR_KM, + self::LANGUAGE_AR_KW, + self::LANGUAGE_AR_LB, + self::LANGUAGE_AR_LY, + self::LANGUAGE_AR_MA, + self::LANGUAGE_AR_MR, + self::LANGUAGE_AR_OM, + self::LANGUAGE_AR_PS, + self::LANGUAGE_AR_QA, + self::LANGUAGE_AR_SA, + self::LANGUAGE_AR_SD, + self::LANGUAGE_AR_SO, + self::LANGUAGE_AR_SS, + self::LANGUAGE_AR_SY, + self::LANGUAGE_AR_TD, + self::LANGUAGE_AR_TN, + self::LANGUAGE_AR_YE, + self::LANGUAGE__AS, + self::LANGUAGE_ASA, + self::LANGUAGE_ASA_TZ, + self::LANGUAGE_AST, + self::LANGUAGE_AST_ES, + self::LANGUAGE_AS_IN, + self::LANGUAGE_AZ, + self::LANGUAGE_AZ_AZ, + self::LANGUAGE_BAS, + self::LANGUAGE_BAS_CM, + self::LANGUAGE_BE, + self::LANGUAGE_BEM, + self::LANGUAGE_BEM_ZM, + self::LANGUAGE_BEZ, + self::LANGUAGE_BEZ_TZ, + self::LANGUAGE_BE_BY, + self::LANGUAGE_BG, + self::LANGUAGE_BGC, + self::LANGUAGE_BGC_IN, + self::LANGUAGE_BG_BG, + self::LANGUAGE_BHO, + self::LANGUAGE_BHO_IN, + self::LANGUAGE_BM, + self::LANGUAGE_BM_ML, + self::LANGUAGE_BN, + self::LANGUAGE_BN_BD, + self::LANGUAGE_BN_IN, + self::LANGUAGE_BO, + self::LANGUAGE_BO_CN, + self::LANGUAGE_BO_IN, + self::LANGUAGE_BR, + self::LANGUAGE_BRX, + self::LANGUAGE_BRX_IN, + self::LANGUAGE_BR_FR, + self::LANGUAGE_BS, + self::LANGUAGE_BS_BA, + self::LANGUAGE_CA, + self::LANGUAGE_CA_AD, + self::LANGUAGE_CA_ES, + self::LANGUAGE_CA_FR, + self::LANGUAGE_CA_IT, + self::LANGUAGE_CCP, + self::LANGUAGE_CCP_BD, + self::LANGUAGE_CCP_IN, + self::LANGUAGE_CE, + self::LANGUAGE_CEB, + self::LANGUAGE_CEB_PH, + self::LANGUAGE_CE_RU, + self::LANGUAGE_CGG, + self::LANGUAGE_CGG_UG, + self::LANGUAGE_CHR, + self::LANGUAGE_CHR_US, + self::LANGUAGE_CKB, + self::LANGUAGE_CKB_IQ, + self::LANGUAGE_CKB_IR, + self::LANGUAGE_CS, + self::LANGUAGE_CS_CZ, + self::LANGUAGE_CU, + self::LANGUAGE_CU_RU, + self::LANGUAGE_CV, + self::LANGUAGE_CV_RU, + self::LANGUAGE_CY, + self::LANGUAGE_CY_GB, + self::LANGUAGE_DA, + self::LANGUAGE_DAV, + self::LANGUAGE_DAV_KE, + self::LANGUAGE_DA_DK, + self::LANGUAGE_DA_GL, + self::LANGUAGE_DE, + self::LANGUAGE_DE_AT, + self::LANGUAGE_DE_BE, + self::LANGUAGE_DE_CH, + self::LANGUAGE_DE_DE, + self::LANGUAGE_DE_GR, + self::LANGUAGE_DE_IT, + self::LANGUAGE_DE_LI, + self::LANGUAGE_DE_LU, + self::LANGUAGE_DJE, + self::LANGUAGE_DJE_NE, + self::LANGUAGE_DOI, + self::LANGUAGE_DOI_IN, + self::LANGUAGE_DSB, + self::LANGUAGE_DSB_DE, + self::LANGUAGE_DUA, + self::LANGUAGE_DUA_CM, + self::LANGUAGE_DYO, + self::LANGUAGE_DYO_SN, + self::LANGUAGE_DZ, + self::LANGUAGE_DZ_BT, + self::LANGUAGE_EBU, + self::LANGUAGE_EBU_KE, + self::LANGUAGE_EE, + self::LANGUAGE_EE_GH, + self::LANGUAGE_EE_TG, + self::LANGUAGE_EL, + self::LANGUAGE_EL_CY, + self::LANGUAGE_EL_GR, + self::LANGUAGE_EN, + self::LANGUAGE_EN_001, + self::LANGUAGE_EN_150, + self::LANGUAGE_EN_AE, + self::LANGUAGE_EN_AG, + self::LANGUAGE_EN_AI, + self::LANGUAGE_EN_AS, + self::LANGUAGE_EN_AT, + self::LANGUAGE_EN_AU, + self::LANGUAGE_EN_BB, + self::LANGUAGE_EN_BE, + self::LANGUAGE_EN_BI, + self::LANGUAGE_EN_BM, + self::LANGUAGE_EN_BS, + self::LANGUAGE_EN_BW, + self::LANGUAGE_EN_BZ, + self::LANGUAGE_EN_CA, + self::LANGUAGE_EN_CC, + self::LANGUAGE_EN_CH, + self::LANGUAGE_EN_CK, + self::LANGUAGE_EN_CM, + self::LANGUAGE_EN_CN, + self::LANGUAGE_EN_CX, + self::LANGUAGE_EN_CY, + self::LANGUAGE_EN_DE, + self::LANGUAGE_EN_DG, + self::LANGUAGE_EN_DK, + self::LANGUAGE_EN_DM, + self::LANGUAGE_EN_EE, + self::LANGUAGE_EN_ER, + self::LANGUAGE_EN_FI, + self::LANGUAGE_EN_FJ, + self::LANGUAGE_EN_FK, + self::LANGUAGE_EN_FM, + self::LANGUAGE_EN_FR, + self::LANGUAGE_EN_GB, + self::LANGUAGE_EN_GD, + self::LANGUAGE_EN_GG, + self::LANGUAGE_EN_GH, + self::LANGUAGE_EN_GI, + self::LANGUAGE_EN_GM, + self::LANGUAGE_EN_GU, + self::LANGUAGE_EN_GY, + self::LANGUAGE_EN_HK, + self::LANGUAGE_EN_IE, + self::LANGUAGE_EN_IL, + self::LANGUAGE_EN_IM, + self::LANGUAGE_EN_IN, + self::LANGUAGE_EN_IO, + self::LANGUAGE_EN_JE, + self::LANGUAGE_EN_JM, + self::LANGUAGE_EN_KE, + self::LANGUAGE_EN_KI, + self::LANGUAGE_EN_KN, + self::LANGUAGE_EN_KY, + self::LANGUAGE_EN_LC, + self::LANGUAGE_EN_LR, + self::LANGUAGE_EN_LS, + self::LANGUAGE_EN_LU, + self::LANGUAGE_EN_MG, + self::LANGUAGE_EN_MH, + self::LANGUAGE_EN_MO, + self::LANGUAGE_EN_MP, + self::LANGUAGE_EN_MS, + self::LANGUAGE_EN_MT, + self::LANGUAGE_EN_MU, + self::LANGUAGE_EN_MV, + self::LANGUAGE_EN_MW, + self::LANGUAGE_EN_MX, + self::LANGUAGE_EN_MY, + self::LANGUAGE_EN_NA, + self::LANGUAGE_EN_NF, + self::LANGUAGE_EN_NG, + self::LANGUAGE_EN_NL, + self::LANGUAGE_EN_NR, + self::LANGUAGE_EN_NU, + self::LANGUAGE_EN_NZ, + self::LANGUAGE_EN_PG, + self::LANGUAGE_EN_PH, + self::LANGUAGE_EN_PK, + self::LANGUAGE_EN_PN, + self::LANGUAGE_EN_PR, + self::LANGUAGE_EN_PW, + self::LANGUAGE_EN_RW, + self::LANGUAGE_EN_SB, + self::LANGUAGE_EN_SC, + self::LANGUAGE_EN_SD, + self::LANGUAGE_EN_SE, + self::LANGUAGE_EN_SG, + self::LANGUAGE_EN_SH, + self::LANGUAGE_EN_SI, + self::LANGUAGE_EN_SL, + self::LANGUAGE_EN_SS, + self::LANGUAGE_EN_SX, + self::LANGUAGE_EN_SZ, + self::LANGUAGE_EN_TC, + self::LANGUAGE_EN_TK, + self::LANGUAGE_EN_TO, + self::LANGUAGE_EN_TT, + self::LANGUAGE_EN_TV, + self::LANGUAGE_EN_TZ, + self::LANGUAGE_EN_UG, + self::LANGUAGE_EN_UM, + self::LANGUAGE_EN_US, + self::LANGUAGE_EN_VC, + self::LANGUAGE_EN_VG, + self::LANGUAGE_EN_VI, + self::LANGUAGE_EN_VU, + self::LANGUAGE_EN_WS, + self::LANGUAGE_EN_ZA, + self::LANGUAGE_EN_ZM, + self::LANGUAGE_EN_ZW, + self::LANGUAGE_EO, + self::LANGUAGE_EO_001, + self::LANGUAGE_ES, + self::LANGUAGE_ES_419, + self::LANGUAGE_ES_AR, + self::LANGUAGE_ES_BO, + self::LANGUAGE_ES_BR, + self::LANGUAGE_ES_BZ, + self::LANGUAGE_ES_CL, + self::LANGUAGE_ES_CO, + self::LANGUAGE_ES_CR, + self::LANGUAGE_ES_CU, + self::LANGUAGE_ES_DO, + self::LANGUAGE_ES_EA, + self::LANGUAGE_ES_EC, + self::LANGUAGE_ES_ES, + self::LANGUAGE_ES_GQ, + self::LANGUAGE_ES_GT, + self::LANGUAGE_ES_HN, + self::LANGUAGE_ES_IC, + self::LANGUAGE_ES_MX, + self::LANGUAGE_ES_NI, + self::LANGUAGE_ES_PA, + self::LANGUAGE_ES_PE, + self::LANGUAGE_ES_PH, + self::LANGUAGE_ES_PR, + self::LANGUAGE_ES_PY, + self::LANGUAGE_ES_SV, + self::LANGUAGE_ES_US, + self::LANGUAGE_ES_UY, + self::LANGUAGE_ES_VE, + self::LANGUAGE_ET, + self::LANGUAGE_ET_EE, + self::LANGUAGE_EU, + self::LANGUAGE_EU_ES, + self::LANGUAGE_EWO, + self::LANGUAGE_EWO_CM, + self::LANGUAGE_FA, + self::LANGUAGE_FA_AF, + self::LANGUAGE_FA_IR, + self::LANGUAGE_FF, + self::LANGUAGE_FF_BF, + self::LANGUAGE_FF_CM, + self::LANGUAGE_FF_GH, + self::LANGUAGE_FF_GM, + self::LANGUAGE_FF_GN, + self::LANGUAGE_FF_GW, + self::LANGUAGE_FF_LR, + self::LANGUAGE_FF_MR, + self::LANGUAGE_FF_NE, + self::LANGUAGE_FF_NG, + self::LANGUAGE_FF_SL, + self::LANGUAGE_FF_SN, + self::LANGUAGE_FI, + self::LANGUAGE_FIL, + self::LANGUAGE_FIL_PH, + self::LANGUAGE_FI_FI, + self::LANGUAGE_FO, + self::LANGUAGE_FO_DK, + self::LANGUAGE_FO_FO, + self::LANGUAGE_FR, + self::LANGUAGE_FRR, + self::LANGUAGE_FRR_DE, + self::LANGUAGE_FR_BE, + self::LANGUAGE_FR_BF, + self::LANGUAGE_FR_BI, + self::LANGUAGE_FR_BJ, + self::LANGUAGE_FR_BL, + self::LANGUAGE_FR_CA, + self::LANGUAGE_FR_CD, + self::LANGUAGE_FR_CF, + self::LANGUAGE_FR_CG, + self::LANGUAGE_FR_CH, + self::LANGUAGE_FR_CI, + self::LANGUAGE_FR_CM, + self::LANGUAGE_FR_DJ, + self::LANGUAGE_FR_DZ, + self::LANGUAGE_FR_FR, + self::LANGUAGE_FR_GA, + self::LANGUAGE_FR_GF, + self::LANGUAGE_FR_GN, + self::LANGUAGE_FR_GP, + self::LANGUAGE_FR_GQ, + self::LANGUAGE_FR_HT, + self::LANGUAGE_FR_KM, + self::LANGUAGE_FR_LU, + self::LANGUAGE_FR_MA, + self::LANGUAGE_FR_MC, + self::LANGUAGE_FR_MF, + self::LANGUAGE_FR_MG, + self::LANGUAGE_FR_ML, + self::LANGUAGE_FR_MQ, + self::LANGUAGE_FR_MR, + self::LANGUAGE_FR_MU, + self::LANGUAGE_FR_NC, + self::LANGUAGE_FR_NE, + self::LANGUAGE_FR_PF, + self::LANGUAGE_FR_PM, + self::LANGUAGE_FR_RE, + self::LANGUAGE_FR_RW, + self::LANGUAGE_FR_SC, + self::LANGUAGE_FR_SN, + self::LANGUAGE_FR_SY, + self::LANGUAGE_FR_TD, + self::LANGUAGE_FR_TG, + self::LANGUAGE_FR_TN, + self::LANGUAGE_FR_VU, + self::LANGUAGE_FR_WF, + self::LANGUAGE_FR_YT, + self::LANGUAGE_FUR, + self::LANGUAGE_FUR_IT, + self::LANGUAGE_FY, + self::LANGUAGE_FY_NL, + self::LANGUAGE_GA, + self::LANGUAGE_GA_GB, + self::LANGUAGE_GA_IE, + self::LANGUAGE_GD, + self::LANGUAGE_GD_GB, + self::LANGUAGE_GL, + self::LANGUAGE_GL_ES, + self::LANGUAGE_GSW, + self::LANGUAGE_GSW_CH, + self::LANGUAGE_GSW_FR, + self::LANGUAGE_GSW_LI, + self::LANGUAGE_GU, + self::LANGUAGE_GUZ, + self::LANGUAGE_GUZ_KE, + self::LANGUAGE_GU_IN, + self::LANGUAGE_GV, + self::LANGUAGE_GV_IM, + self::LANGUAGE_HA, + self::LANGUAGE_HAW, + self::LANGUAGE_HAW_US, + self::LANGUAGE_HA_GH, + self::LANGUAGE_HA_NE, + self::LANGUAGE_HA_NG, + self::LANGUAGE_HE, + self::LANGUAGE_HI, + self::LANGUAGE_HI_IN, + self::LANGUAGE_HR, + self::LANGUAGE_HR_BA, + self::LANGUAGE_HR_HR, + self::LANGUAGE_HSB, + self::LANGUAGE_HSB_DE, + self::LANGUAGE_HU, + self::LANGUAGE_HU_HU, + self::LANGUAGE_HY, + self::LANGUAGE_HY_AM, + self::LANGUAGE_IA, + self::LANGUAGE_IA_001, + self::LANGUAGE_ID, + self::LANGUAGE_IG, + self::LANGUAGE_IG_NG, + self::LANGUAGE_II, + self::LANGUAGE_II_CN, + self::LANGUAGE_ID_ID, + self::LANGUAGE_IS, + self::LANGUAGE_IS_IS, + self::LANGUAGE_IT, + self::LANGUAGE_IT_CH, + self::LANGUAGE_IT_IT, + self::LANGUAGE_IT_SM, + self::LANGUAGE_IT_VA, + self::LANGUAGE_HE_IL, + self::LANGUAGE_JA, + self::LANGUAGE_JA_JP, + self::LANGUAGE_JGO, + self::LANGUAGE_JGO_CM, + self::LANGUAGE_YI, + self::LANGUAGE_YI_001, + self::LANGUAGE_JMC, + self::LANGUAGE_JMC_TZ, + self::LANGUAGE_JV, + self::LANGUAGE_JV_ID, + self::LANGUAGE_KA, + self::LANGUAGE_KAB, + self::LANGUAGE_KAB_DZ, + self::LANGUAGE_KAM, + self::LANGUAGE_KAM_KE, + self::LANGUAGE_KA_GE, + self::LANGUAGE_KDE, + self::LANGUAGE_KDE_TZ, + self::LANGUAGE_KEA, + self::LANGUAGE_KEA_CV, + self::LANGUAGE_KGP, + self::LANGUAGE_KGP_BR, + self::LANGUAGE_KHQ, + self::LANGUAGE_KHQ_ML, + self::LANGUAGE_KI, + self::LANGUAGE_KI_KE, + self::LANGUAGE_KK, + self::LANGUAGE_KKJ, + self::LANGUAGE_KKJ_CM, + self::LANGUAGE_KK_KZ, + self::LANGUAGE_KL, + self::LANGUAGE_KLN, + self::LANGUAGE_KLN_KE, + self::LANGUAGE_KL_GL, + self::LANGUAGE_KM, + self::LANGUAGE_KM_KH, + self::LANGUAGE_KN, + self::LANGUAGE_KN_IN, + self::LANGUAGE_KO, + self::LANGUAGE_KOK, + self::LANGUAGE_KOK_IN, + self::LANGUAGE_KO_KP, + self::LANGUAGE_KO_KR, + self::LANGUAGE_KS, + self::LANGUAGE_KSB, + self::LANGUAGE_KSB_TZ, + self::LANGUAGE_KSF, + self::LANGUAGE_KSF_CM, + self::LANGUAGE_KSH, + self::LANGUAGE_KSH_DE, + self::LANGUAGE_KS_IN, + self::LANGUAGE_KU, + self::LANGUAGE_KU_TR, + self::LANGUAGE_KW, + self::LANGUAGE_KW_GB, + self::LANGUAGE_KY, + self::LANGUAGE_KY_KG, + self::LANGUAGE_LAG, + self::LANGUAGE_LAG_TZ, + self::LANGUAGE_LB, + self::LANGUAGE_LB_LU, + self::LANGUAGE_LG, + self::LANGUAGE_LG_UG, + self::LANGUAGE_LKT, + self::LANGUAGE_LKT_US, + self::LANGUAGE_LN, + self::LANGUAGE_LN_AO, + self::LANGUAGE_LN_CD, + self::LANGUAGE_LN_CF, + self::LANGUAGE_LN_CG, + self::LANGUAGE_LO, + self::LANGUAGE_LO_LA, + self::LANGUAGE_LRC, + self::LANGUAGE_LRC_IQ, + self::LANGUAGE_LRC_IR, + self::LANGUAGE_LT, + self::LANGUAGE_LT_LT, + self::LANGUAGE_LU, + self::LANGUAGE_LUO, + self::LANGUAGE_LUO_KE, + self::LANGUAGE_LUY, + self::LANGUAGE_LUY_KE, + self::LANGUAGE_LU_CD, + self::LANGUAGE_LV, + self::LANGUAGE_LV_LV, + self::LANGUAGE_MAI, + self::LANGUAGE_MAI_IN, + self::LANGUAGE_MAS, + self::LANGUAGE_MAS_KE, + self::LANGUAGE_MAS_TZ, + self::LANGUAGE_MDF, + self::LANGUAGE_MDF_RU, + self::LANGUAGE_MER, + self::LANGUAGE_MER_KE, + self::LANGUAGE_MFE, + self::LANGUAGE_MFE_MU, + self::LANGUAGE_MG, + self::LANGUAGE_MGH, + self::LANGUAGE_MGH_MZ, + self::LANGUAGE_MGO, + self::LANGUAGE_MGO_CM, + self::LANGUAGE_MG_MG, + self::LANGUAGE_MI, + self::LANGUAGE_MI_NZ, + self::LANGUAGE_MK, + self::LANGUAGE_MK_MK, + self::LANGUAGE_ML, + self::LANGUAGE_ML_IN, + self::LANGUAGE_MN, + self::LANGUAGE_MNI, + self::LANGUAGE_MNI_IN, + self::LANGUAGE_MN_MN, + self::LANGUAGE_MR, + self::LANGUAGE_MR_IN, + self::LANGUAGE_MS, + self::LANGUAGE_MS_BN, + self::LANGUAGE_MS_ID, + self::LANGUAGE_MS_MY, + self::LANGUAGE_MS_SG, + self::LANGUAGE_MT, + self::LANGUAGE_MT_MT, + self::LANGUAGE_MUA, + self::LANGUAGE_MUA_CM, + self::LANGUAGE_MY, + self::LANGUAGE_MY_MM, + self::LANGUAGE_MZN, + self::LANGUAGE_MZN_IR, + self::LANGUAGE_NAQ, + self::LANGUAGE_NAQ_NA, + self::LANGUAGE_NB, + self::LANGUAGE_NB_NO, + self::LANGUAGE_NB_SJ, + self::LANGUAGE_ND, + self::LANGUAGE_NDS, + self::LANGUAGE_NDS_DE, + self::LANGUAGE_NDS_NL, + self::LANGUAGE_ND_ZW, + self::LANGUAGE_NE, + self::LANGUAGE_NE_IN, + self::LANGUAGE_NE_NP, + self::LANGUAGE_NL, + self::LANGUAGE_NL_AW, + self::LANGUAGE_NL_BE, + self::LANGUAGE_NL_BQ, + self::LANGUAGE_NL_CH, + self::LANGUAGE_NL_CW, + self::LANGUAGE_NL_LU, + self::LANGUAGE_NL_NL, + self::LANGUAGE_NL_SR, + self::LANGUAGE_NL_SX, + self::LANGUAGE_NMG, + self::LANGUAGE_NMG_CM, + self::LANGUAGE_NN, + self::LANGUAGE_NNH, + self::LANGUAGE_NNH_CM, + self::LANGUAGE_NN_NO, + self::LANGUAGE_NO, + self::LANGUAGE_NO_NO, + self::LANGUAGE_NUS, + self::LANGUAGE_NUS_SS, + self::LANGUAGE_NYN, + self::LANGUAGE_NYN_UG, + self::LANGUAGE_OC, + self::LANGUAGE_OC_ES, + self::LANGUAGE_OC_FR, + self::LANGUAGE_OM, + self::LANGUAGE_OM_ET, + self::LANGUAGE_OM_KE, + self::LANGUAGE__OR, + self::LANGUAGE_OR_IN, + self::LANGUAGE_OS, + self::LANGUAGE_OS_GE, + self::LANGUAGE_OS_RU, + self::LANGUAGE_PA, + self::LANGUAGE_PA_IN, + self::LANGUAGE_PA_PK, + self::LANGUAGE_PCM, + self::LANGUAGE_PCM_NG, + self::LANGUAGE_PIS, + self::LANGUAGE_PIS_SB, + self::LANGUAGE_PL, + self::LANGUAGE_PL_PL, + self::LANGUAGE_PRG, + self::LANGUAGE_PRG_001, + self::LANGUAGE_PS, + self::LANGUAGE_PS_AF, + self::LANGUAGE_PS_PK, + self::LANGUAGE_PT, + self::LANGUAGE_PT_AO, + self::LANGUAGE_PT_BR, + self::LANGUAGE_PT_CH, + self::LANGUAGE_PT_CV, + self::LANGUAGE_PT_GQ, + self::LANGUAGE_PT_GW, + self::LANGUAGE_PT_LU, + self::LANGUAGE_PT_MO, + self::LANGUAGE_PT_MZ, + self::LANGUAGE_PT_PT, + self::LANGUAGE_PT_ST, + self::LANGUAGE_PT_TL, + self::LANGUAGE_QU, + self::LANGUAGE_QU_BO, + self::LANGUAGE_QU_EC, + self::LANGUAGE_QU_PE, + self::LANGUAGE_RAJ, + self::LANGUAGE_RAJ_IN, + self::LANGUAGE_RM, + self::LANGUAGE_RM_CH, + self::LANGUAGE_RN, + self::LANGUAGE_RN_BI, + self::LANGUAGE_RO, + self::LANGUAGE_ROF, + self::LANGUAGE_ROF_TZ, + self::LANGUAGE_RO_MD, + self::LANGUAGE_RO_RO, + self::LANGUAGE_RU, + self::LANGUAGE_RU_BY, + self::LANGUAGE_RU_KG, + self::LANGUAGE_RU_KZ, + self::LANGUAGE_RU_MD, + self::LANGUAGE_RU_RU, + self::LANGUAGE_RU_UA, + self::LANGUAGE_RW, + self::LANGUAGE_RWK, + self::LANGUAGE_RWK_TZ, + self::LANGUAGE_RW_RW, + self::LANGUAGE_SA, + self::LANGUAGE_SAH, + self::LANGUAGE_SAH_RU, + self::LANGUAGE_SAQ, + self::LANGUAGE_SAQ_KE, + self::LANGUAGE_SAT, + self::LANGUAGE_SAT_IN, + self::LANGUAGE_SA_IN, + self::LANGUAGE_SBP, + self::LANGUAGE_SBP_TZ, + self::LANGUAGE_SC, + self::LANGUAGE_SC_IT, + self::LANGUAGE_SD, + self::LANGUAGE_SD_IN, + self::LANGUAGE_SD_PK, + self::LANGUAGE_SE, + self::LANGUAGE_SEH, + self::LANGUAGE_SEH_MZ, + self::LANGUAGE_SES, + self::LANGUAGE_SES_ML, + self::LANGUAGE_SE_FI, + self::LANGUAGE_SE_NO, + self::LANGUAGE_SE_SE, + self::LANGUAGE_SG, + self::LANGUAGE_SG_CF, + self::LANGUAGE_SHI, + self::LANGUAGE_SHI_MA, + self::LANGUAGE_SI, + self::LANGUAGE_SI_LK, + self::LANGUAGE_SK, + self::LANGUAGE_SK_SK, + self::LANGUAGE_SL, + self::LANGUAGE_SL_SI, + self::LANGUAGE_SMN, + self::LANGUAGE_SMN_FI, + self::LANGUAGE_SMS, + self::LANGUAGE_SMS_FI, + self::LANGUAGE_SN, + self::LANGUAGE_SN_ZW, + self::LANGUAGE_SO, + self::LANGUAGE_SO_DJ, + self::LANGUAGE_SO_ET, + self::LANGUAGE_SO_KE, + self::LANGUAGE_SO_SO, + self::LANGUAGE_SQ, + self::LANGUAGE_SQ_AL, + self::LANGUAGE_SQ_MK, + self::LANGUAGE_SQ_XK, + self::LANGUAGE_SR, + self::LANGUAGE_SR_BA, + self::LANGUAGE_SR_CS, + self::LANGUAGE_SR_ME, + self::LANGUAGE_SR_RS, + self::LANGUAGE_SR_XK, + self::LANGUAGE_SU, + self::LANGUAGE_SU_ID, + self::LANGUAGE_SV, + self::LANGUAGE_SV_AX, + self::LANGUAGE_SV_FI, + self::LANGUAGE_SV_SE, + self::LANGUAGE_SW, + self::LANGUAGE_SW_CD, + self::LANGUAGE_SW_KE, + self::LANGUAGE_SW_TZ, + self::LANGUAGE_SW_UG, + self::LANGUAGE_SY, + self::LANGUAGE_TA, + self::LANGUAGE_TA_IN, + self::LANGUAGE_TA_LK, + self::LANGUAGE_TA_MY, + self::LANGUAGE_TA_SG, + self::LANGUAGE_TE, + self::LANGUAGE_TEO, + self::LANGUAGE_TEO_KE, + self::LANGUAGE_TEO_UG, + self::LANGUAGE_TE_IN, + self::LANGUAGE_TG, + self::LANGUAGE_TG_TJ, + self::LANGUAGE_TH, + self::LANGUAGE_TH_TH, + self::LANGUAGE_TI, + self::LANGUAGE_TI_ER, + self::LANGUAGE_TI_ET, + self::LANGUAGE_TK, + self::LANGUAGE_TK_TM, + self::LANGUAGE_TL, + self::LANGUAGE_TO, + self::LANGUAGE_TOK, + self::LANGUAGE_TOK_001, + self::LANGUAGE_TO_TO, + self::LANGUAGE_TR, + self::LANGUAGE_TR_CY, + self::LANGUAGE_TR_TR, + self::LANGUAGE_TT, + self::LANGUAGE_TT_RU, + self::LANGUAGE_TWQ, + self::LANGUAGE_TWQ_NE, + self::LANGUAGE_TZM, + self::LANGUAGE_TZM_MA, + self::LANGUAGE_UG, + self::LANGUAGE_UG_CN, + self::LANGUAGE_UK, + self::LANGUAGE_UK_UA, + self::LANGUAGE_UR, + self::LANGUAGE_UR_IN, + self::LANGUAGE_UR_PK, + self::LANGUAGE_UZ, + self::LANGUAGE_UZ_AF, + self::LANGUAGE_UZ_UZ, + self::LANGUAGE_VAI, + self::LANGUAGE_VAI_LR, + self::LANGUAGE_VI, + self::LANGUAGE_VI_VN, + self::LANGUAGE_VO, + self::LANGUAGE_VO_001, + self::LANGUAGE_VUN, + self::LANGUAGE_VUN_TZ, + self::LANGUAGE_WAE, + self::LANGUAGE_WAE_CH, + self::LANGUAGE_WO, + self::LANGUAGE_WO_SN, + self::LANGUAGE_XH, + self::LANGUAGE_XH_ZA, + self::LANGUAGE_XOG, + self::LANGUAGE_XOG_UG, + self::LANGUAGE_YAV, + self::LANGUAGE_YAV_CM, + self::LANGUAGE_YO, + self::LANGUAGE_YO_BJ, + self::LANGUAGE_YO_NG, + self::LANGUAGE_YRL, + self::LANGUAGE_YRL_BR, + self::LANGUAGE_YRL_CO, + self::LANGUAGE_YRL_VE, + self::LANGUAGE_YUE, + self::LANGUAGE_YUE_CN, + self::LANGUAGE_YUE_HK, + self::LANGUAGE_ZGH, + self::LANGUAGE_ZGH_MA, + self::LANGUAGE_ZH, + self::LANGUAGE_ZH_CN, + self::LANGUAGE_ZH_HANS, + self::LANGUAGE_ZH_HANT, + self::LANGUAGE_ZH_HK, + self::LANGUAGE_ZH_MO, + self::LANGUAGE_ZH_SG, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_ZU, + self::LANGUAGE_ZU_ZA, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_AUTOMATED, + self::STATE_AUTOMATED_DRAFT, + self::STATE_AUTOMATED_SENDING, + self::STATE_AUTOMATED_FOR_FORM, + self::STATE_AUTOMATED_FOR_FORM_BUFFER, + self::STATE_AUTOMATED_FOR_FORM_DRAFT, + self::STATE_AUTOMATED_FOR_FORM_LEGACY, + self::STATE_BLOG_EMAIL_DRAFT, + self::STATE_BLOG_EMAIL_PUBLISHED, + self::STATE_DRAFT, + self::STATE_DRAFT_AB, + self::STATE_DRAFT_AB_VARIANT, + self::STATE_ERROR, + self::STATE_LOSER_AB_VARIANT, + self::STATE_PAGE_STUB, + self::STATE_PRE_PROCESSING, + self::STATE_PROCESSING, + self::STATE_PUBLISHED, + self::STATE_PUBLISHED_AB, + self::STATE_PUBLISHED_AB_VARIANT, + self::STATE_PUBLISHED_OR_SCHEDULED, + self::STATE_RSS_TO_EMAIL_DRAFT, + self::STATE_RSS_TO_EMAIL_PUBLISHED, + self::STATE_SCHEDULED, + self::STATE_SCHEDULED_AB, + self::STATE_SCHEDULED_OR_PUBLISHED, + self::STATE_AUTOMATED_AB, + self::STATE_AUTOMATED_AB_VARIANT, + self::STATE_AUTOMATED_DRAFT_AB, + self::STATE_AUTOMATED_DRAFT_ABVARIANT, + self::STATE_AUTOMATED_LOSER_ABVARIANT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSubcategoryAllowableValues() + { + return [ + self::SUBCATEGORY_AB_MASTER, + self::SUBCATEGORY_AB_VARIANT, + self::SUBCATEGORY_AB_LOSER_VARIANT, + self::SUBCATEGORY_PAGE_STUB, + self::SUBCATEGORY_LANDING_PAGE, + self::SUBCATEGORY_SITE_PAGE, + self::SUBCATEGORY_LEGACY_PAGE, + self::SUBCATEGORY_AB_MASTER_SITE_PAGE, + self::SUBCATEGORY_AB_VARIANT_SITE_PAGE, + self::SUBCATEGORY_AB_LOSER_VARIANT_SITE_PAGE, + self::SUBCATEGORY_PERFORMABLE_LANDING_PAGE, + self::SUBCATEGORY_PERFORMABLE_LANDING_PAGE_CUTOVER, + self::SUBCATEGORY_STAGED_PAGE, + self::SUBCATEGORY_AUTOMATED, + self::SUBCATEGORY_AUTOMATED_FOR_DEAL, + self::SUBCATEGORY_AUTOMATED_FOR_FORM, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_LEGACY, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_BUFFER, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_DRAFT, + self::SUBCATEGORY_RSS_TO_EMAIL, + self::SUBCATEGORY_RSS_TO_EMAIL_CHILD, + self::SUBCATEGORY_BLOG_EMAIL, + self::SUBCATEGORY_BLOG_EMAIL_CHILD, + self::SUBCATEGORY_OPTIN_EMAIL, + self::SUBCATEGORY_OPTIN_FOLLOWUP_EMAIL, + self::SUBCATEGORY_BATCH, + self::SUBCATEGORY_RESUBSCRIBE_EMAIL, + self::SUBCATEGORY_UNSUBSCRIBE_CONFIRMATION_EMAIL, + self::SUBCATEGORY_RESUBSCRIBE_CONFIRMATION_EMAIL, + self::SUBCATEGORY_SINGLE_SEND_API, + self::SUBCATEGORY_MARKETING_SINGLE_SEND_API, + self::SUBCATEGORY_SMTP_TOKEN, + self::SUBCATEGORY_LOCALTIME, + self::SUBCATEGORY_AUTOMATED_FOR_TICKET, + self::SUBCATEGORY_AUTOMATED_FOR_LEADFLOW, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CES, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_NPS, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CUSTOM, + self::SUBCATEGORY_MEMBERSHIP_REGISTRATION, + self::SUBCATEGORY_MEMBERSHIP_PASSWORD_SAVED, + self::SUBCATEGORY_MEMBERSHIP_PASSWORD_RESET, + self::SUBCATEGORY_MEMBERSHIP_OTP_LOGIN, + self::SUBCATEGORY_MEMBERSHIP_PASSWORDLESS_AUTH, + self::SUBCATEGORY_MEMBERSHIP_EMAIL_VERIFICATION, + self::SUBCATEGORY_MEMBERSHIP_REGISTRATION_FOLLOW_UP, + self::SUBCATEGORY_MEMBERSHIP_VERIFICATION, + self::SUBCATEGORY_MEMBERSHIP_FOLLOW_UP, + self::SUBCATEGORY_TICKET_CLOSED_KICKBACK_EMAIL, + self::SUBCATEGORY_TICKET_OPENED_KICKBACK_EMAIL, + self::SUBCATEGORY_AUTOMATED_FOR_CUSTOM_SURVEY, + self::SUBCATEGORY_DISCARDABLE_STUB, + self::SUBCATEGORY_NORMAL_BLOG_POST, + self::SUBCATEGORY_LEGACY_BLOG_POST, + self::SUBCATEGORY_IMPORTED_BLOG_POST, + self::SUBCATEGORY_AUTOMATED_AB_MASTER, + self::SUBCATEGORY_AUTOMATED_AB_VARIANT, + self::SUBCATEGORY_WEB_INTERACTIVE, + self::SUBCATEGORY_PORTAL_CONTENT, + self::SUBCATEGORY_PAGE_INSTANCE_LAYOUT, + self::SUBCATEGORY_KB_ARTICLE_INSTANCE_LAYOUT, + self::SUBCATEGORY_KB_LISTING, + self::SUBCATEGORY_KB_SEARCH_RESULTS, + self::SUBCATEGORY_KB_SUPPORT_FORM, + self::SUBCATEGORY_CASE_STUDY, + self::SUBCATEGORY_CASE_STUDY_LISTING, + self::SUBCATEGORY_CASE_STUDY_INSTANCE_LAYOUT, + self::SUBCATEGORY_UNKNOWN, + ]; + } + + /** + * 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('feedback_survey_id', $data ?? [], null); + $this->setIfExists('rss_data', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('testing', $data ?? [], null); + $this->setIfExists('publish_date', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('business_unit_id', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('webversion', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('subscription_details', $data ?? [], null); + $this->setIfExists('active_domain', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('jitter_send_time', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('subcategory', $data ?? [], null); + $this->setIfExists('send_on_publish', $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 = []; + + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSubcategoryAllowableValues(); + if (!is_null($this->container['subcategory']) && !in_array($this->container['subcategory'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'subcategory', must be one of '%s'", + $this->container['subcategory'], + implode("', '", $allowedValues) + ); + } + + 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 feedback_survey_id + * + * @return string|null + */ + public function getFeedbackSurveyId() + { + return $this->container['feedback_survey_id']; + } + + /** + * Sets feedback_survey_id + * + * @param string|null $feedback_survey_id The ID of the feedback survey linked to the email. + * + * @return self + */ + public function setFeedbackSurveyId($feedback_survey_id) + { + if (is_null($feedback_survey_id)) { + throw new \InvalidArgumentException('non-nullable feedback_survey_id cannot be null'); + } + $this->container['feedback_survey_id'] = $feedback_survey_id; + + return $this; + } + + /** + * Gets rss_data + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null + */ + public function getRssData() + { + return $this->container['rss_data']; + } + + /** + * Sets rss_data + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null $rss_data rss_data + * + * @return self + */ + public function setRssData($rss_data) + { + if (is_null($rss_data)) { + throw new \InvalidArgumentException('non-nullable rss_data cannot be null'); + } + $this->container['rss_data'] = $rss_data; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject The subject of the email. + * + * @return self + */ + public function setSubject($subject) + { + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets testing + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null + */ + public function getTesting() + { + return $this->container['testing']; + } + + /** + * Sets testing + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null $testing testing + * + * @return self + */ + public function setTesting($testing) + { + if (is_null($testing)) { + throw new \InvalidArgumentException('non-nullable testing cannot be null'); + } + $this->container['testing'] = $testing; + + return $this; + } + + /** + * Gets publish_date + * + * @return \DateTime|null + */ + public function getPublishDate() + { + return $this->container['publish_date']; + } + + /** + * Sets publish_date + * + * @param \DateTime|null $publish_date The date and time the email is scheduled for, in ISO8601 representation. This is only used in local time or scheduled emails. + * + * @return self + */ + public function setPublishDate($publish_date) + { + if (is_null($publish_date)) { + throw new \InvalidArgumentException('non-nullable publish_date cannot be null'); + } + $this->container['publish_date'] = $publish_date; + + return $this; + } + + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets business_unit_id + * + * @return int|null + */ + public function getBusinessUnitId() + { + return $this->container['business_unit_id']; + } + + /** + * Sets business_unit_id + * + * @param int|null $business_unit_id business_unit_id + * + * @return self + */ + public function setBusinessUnitId($business_unit_id) + { + if (is_null($business_unit_id)) { + throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); + } + $this->container['business_unit_id'] = $business_unit_id; + + return $this; + } + + /** + * Gets content + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets webversion + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null + */ + public function getWebversion() + { + return $this->container['webversion']; + } + + /** + * Sets webversion + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null $webversion webversion + * + * @return self + */ + public function setWebversion($webversion) + { + if (is_null($webversion)) { + throw new \InvalidArgumentException('non-nullable webversion cannot be null'); + } + $this->container['webversion'] = $webversion; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived Determines if the email is archived or not. + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets subscription_details + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null + */ + public function getSubscriptionDetails() + { + return $this->container['subscription_details']; + } + + /** + * Sets subscription_details + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null $subscription_details subscription_details + * + * @return self + */ + public function setSubscriptionDetails($subscription_details) + { + if (is_null($subscription_details)) { + throw new \InvalidArgumentException('non-nullable subscription_details cannot be null'); + } + $this->container['subscription_details'] = $subscription_details; + + return $this; + } + + /** + * Gets active_domain + * + * @return string|null + */ + public function getActiveDomain() + { + return $this->container['active_domain']; + } + + /** + * Sets active_domain + * + * @param string|null $active_domain The active domain of the email. + * + * @return self + */ + public function setActiveDomain($active_domain) + { + if (is_null($active_domain)) { + throw new \InvalidArgumentException('non-nullable active_domain cannot be null'); + } + $this->container['active_domain'] = $active_domain; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the email, as displayed on the email dashboard. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign The ID of the campaign this email is associated to. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + throw new \InvalidArgumentException('non-nullable campaign cannot be null'); + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets from + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails|null $from from + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets jitter_send_time + * + * @return bool|null + */ + public function getJitterSendTime() + { + return $this->container['jitter_send_time']; + } + + /** + * Sets jitter_send_time + * + * @param bool|null $jitter_send_time jitter_send_time + * + * @return self + */ + public function setJitterSendTime($jitter_send_time) + { + if (is_null($jitter_send_time)) { + throw new \InvalidArgumentException('non-nullable jitter_send_time cannot be null'); + } + $this->container['jitter_send_time'] = $jitter_send_time; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state The email state. + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = $this->getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails|null $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets subcategory + * + * @return string|null + */ + public function getSubcategory() + { + return $this->container['subcategory']; + } + + /** + * Sets subcategory + * + * @param string|null $subcategory The email subcategory. + * + * @return self + */ + public function setSubcategory($subcategory) + { + if (is_null($subcategory)) { + throw new \InvalidArgumentException('non-nullable subcategory cannot be null'); + } + $allowedValues = $this->getSubcategoryAllowableValues(); + if (!in_array($subcategory, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'subcategory', must be one of '%s'", + $subcategory, + implode("', '", $allowedValues) + ) + ); + } + $this->container['subcategory'] = $subcategory; + + return $this; + } + + /** + * Gets send_on_publish + * + * @return bool|null + */ + public function getSendOnPublish() + { + return $this->container['send_on_publish']; + } + + /** + * Sets send_on_publish + * + * @param bool|null $send_on_publish Determines whether the email will be sent immediately on publish. + * + * @return self + */ + public function setSendOnPublish($send_on_publish) + { + if (is_null($send_on_publish)) { + throw new \InvalidArgumentException('non-nullable send_on_publish cannot be null'); + } + $this->container['send_on_publish'] = $send_on_publish; + + 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/codegen/Marketing/Emails/Model/EmailStatisticInterval.php b/codegen/Marketing/Emails/Model/EmailStatisticInterval.php new file mode 100644 index 000000000..8d2323fdc --- /dev/null +++ b/codegen/Marketing/Emails/Model/EmailStatisticInterval.php @@ -0,0 +1,443 @@ + + */ +class EmailStatisticInterval implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailStatisticInterval'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'interval' => '\HubSpot\Client\Marketing\Emails\Model\Interval', + 'aggregations' => '\HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'interval' => null, + 'aggregations' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'interval' => false, + 'aggregations' => 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 = [ + 'interval' => 'interval', + 'aggregations' => 'aggregations' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'interval' => 'setInterval', + 'aggregations' => 'setAggregations' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'interval' => 'getInterval', + 'aggregations' => 'getAggregations' + ]; + + /** + * 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('interval', $data ?? [], null); + $this->setIfExists('aggregations', $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 interval + * + * @return \HubSpot\Client\Marketing\Emails\Model\Interval|null + */ + public function getInterval() + { + return $this->container['interval']; + } + + /** + * Sets interval + * + * @param \HubSpot\Client\Marketing\Emails\Model\Interval|null $interval interval + * + * @return self + */ + public function setInterval($interval) + { + if (is_null($interval)) { + throw new \InvalidArgumentException('non-nullable interval cannot be null'); + } + $this->container['interval'] = $interval; + + return $this; + } + + /** + * Gets aggregations + * + * @return \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null + */ + public function getAggregations() + { + return $this->container['aggregations']; + } + + /** + * Sets aggregations + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null $aggregations aggregations + * + * @return self + */ + public function setAggregations($aggregations) + { + if (is_null($aggregations)) { + throw new \InvalidArgumentException('non-nullable aggregations cannot be null'); + } + $this->container['aggregations'] = $aggregations; + + 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/codegen/Marketing/Emails/Model/EmailStatisticsData.php b/codegen/Marketing/Emails/Model/EmailStatisticsData.php new file mode 100644 index 000000000..9aed01c16 --- /dev/null +++ b/codegen/Marketing/Emails/Model/EmailStatisticsData.php @@ -0,0 +1,523 @@ + + */ +class EmailStatisticsData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailStatisticsData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'device_breakdown' => 'array>', + 'qualifier_stats' => 'array>', + 'counters' => 'array', + 'ratios' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'device_breakdown' => 'int64', + 'qualifier_stats' => 'int64', + 'counters' => 'int64', + 'ratios' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'device_breakdown' => false, + 'qualifier_stats' => false, + 'counters' => false, + 'ratios' => 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 = [ + 'device_breakdown' => 'deviceBreakdown', + 'qualifier_stats' => 'qualifierStats', + 'counters' => 'counters', + 'ratios' => 'ratios' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'device_breakdown' => 'setDeviceBreakdown', + 'qualifier_stats' => 'setQualifierStats', + 'counters' => 'setCounters', + 'ratios' => 'setRatios' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'device_breakdown' => 'getDeviceBreakdown', + 'qualifier_stats' => 'getQualifierStats', + 'counters' => 'getCounters', + 'ratios' => 'getRatios' + ]; + + /** + * 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('device_breakdown', $data ?? [], null); + $this->setIfExists('qualifier_stats', $data ?? [], null); + $this->setIfExists('counters', $data ?? [], null); + $this->setIfExists('ratios', $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['device_breakdown'] === null) { + $invalidProperties[] = "'device_breakdown' can't be null"; + } + if ($this->container['qualifier_stats'] === null) { + $invalidProperties[] = "'qualifier_stats' can't be null"; + } + if ($this->container['counters'] === null) { + $invalidProperties[] = "'counters' can't be null"; + } + if ($this->container['ratios'] === null) { + $invalidProperties[] = "'ratios' 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 device_breakdown + * + * @return array> + */ + public function getDeviceBreakdown() + { + return $this->container['device_breakdown']; + } + + /** + * Sets device_breakdown + * + * @param array> $device_breakdown Statistics by device. + * + * @return self + */ + public function setDeviceBreakdown($device_breakdown) + { + if (is_null($device_breakdown)) { + throw new \InvalidArgumentException('non-nullable device_breakdown cannot be null'); + } + $this->container['device_breakdown'] = $device_breakdown; + + return $this; + } + + /** + * Gets qualifier_stats + * + * @return array> + */ + public function getQualifierStats() + { + return $this->container['qualifier_stats']; + } + + /** + * Sets qualifier_stats + * + * @param array> $qualifier_stats Number of emails that were dropped and bounced. + * + * @return self + */ + public function setQualifierStats($qualifier_stats) + { + if (is_null($qualifier_stats)) { + throw new \InvalidArgumentException('non-nullable qualifier_stats cannot be null'); + } + $this->container['qualifier_stats'] = $qualifier_stats; + + return $this; + } + + /** + * Gets counters + * + * @return array + */ + public function getCounters() + { + return $this->container['counters']; + } + + /** + * Sets counters + * + * @param array $counters Counters like number of `sent`, `open` or `delivered`. + * + * @return self + */ + public function setCounters($counters) + { + if (is_null($counters)) { + throw new \InvalidArgumentException('non-nullable counters cannot be null'); + } + $this->container['counters'] = $counters; + + return $this; + } + + /** + * Gets ratios + * + * @return array + */ + public function getRatios() + { + return $this->container['ratios']; + } + + /** + * Sets ratios + * + * @param array $ratios Ratios like `openratio` or `clickratio` + * + * @return self + */ + public function setRatios($ratios) + { + if (is_null($ratios)) { + throw new \InvalidArgumentException('non-nullable ratios cannot be null'); + } + $this->container['ratios'] = $ratios; + + 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/codegen/Marketing/Emails/Model/EmailUpdateRequest.php b/codegen/Marketing/Emails/Model/EmailUpdateRequest.php new file mode 100644 index 000000000..22078a199 --- /dev/null +++ b/codegen/Marketing/Emails/Model/EmailUpdateRequest.php @@ -0,0 +1,2884 @@ + + */ +class EmailUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rss_data' => '\HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails', + 'subject' => 'string', + 'testing' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails', + 'publish_date' => '\DateTime', + 'language' => 'string', + 'business_unit_id' => 'int', + 'content' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailContent', + 'webversion' => '\HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails', + 'archived' => 'bool', + 'subscription_details' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails', + 'active_domain' => 'string', + 'name' => 'string', + 'campaign' => 'string', + 'from' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails', + 'jitter_send_time' => 'bool', + 'state' => 'string', + 'to' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails', + 'subcategory' => 'string', + 'send_on_publish' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rss_data' => null, + 'subject' => null, + 'testing' => null, + 'publish_date' => 'date-time', + 'language' => null, + 'business_unit_id' => 'int64', + 'content' => null, + 'webversion' => null, + 'archived' => null, + 'subscription_details' => null, + 'active_domain' => null, + 'name' => null, + 'campaign' => null, + 'from' => null, + 'jitter_send_time' => null, + 'state' => null, + 'to' => null, + 'subcategory' => null, + 'send_on_publish' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rss_data' => false, + 'subject' => false, + 'testing' => false, + 'publish_date' => false, + 'language' => false, + 'business_unit_id' => false, + 'content' => false, + 'webversion' => false, + 'archived' => false, + 'subscription_details' => false, + 'active_domain' => false, + 'name' => false, + 'campaign' => false, + 'from' => false, + 'jitter_send_time' => false, + 'state' => false, + 'to' => false, + 'subcategory' => false, + 'send_on_publish' => 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 = [ + 'rss_data' => 'rssData', + 'subject' => 'subject', + 'testing' => 'testing', + 'publish_date' => 'publishDate', + 'language' => 'language', + 'business_unit_id' => 'businessUnitId', + 'content' => 'content', + 'webversion' => 'webversion', + 'archived' => 'archived', + 'subscription_details' => 'subscriptionDetails', + 'active_domain' => 'activeDomain', + 'name' => 'name', + 'campaign' => 'campaign', + 'from' => 'from', + 'jitter_send_time' => 'jitterSendTime', + 'state' => 'state', + 'to' => 'to', + 'subcategory' => 'subcategory', + 'send_on_publish' => 'sendOnPublish' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rss_data' => 'setRssData', + 'subject' => 'setSubject', + 'testing' => 'setTesting', + 'publish_date' => 'setPublishDate', + 'language' => 'setLanguage', + 'business_unit_id' => 'setBusinessUnitId', + 'content' => 'setContent', + 'webversion' => 'setWebversion', + 'archived' => 'setArchived', + 'subscription_details' => 'setSubscriptionDetails', + 'active_domain' => 'setActiveDomain', + 'name' => 'setName', + 'campaign' => 'setCampaign', + 'from' => 'setFrom', + 'jitter_send_time' => 'setJitterSendTime', + 'state' => 'setState', + 'to' => 'setTo', + 'subcategory' => 'setSubcategory', + 'send_on_publish' => 'setSendOnPublish' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rss_data' => 'getRssData', + 'subject' => 'getSubject', + 'testing' => 'getTesting', + 'publish_date' => 'getPublishDate', + 'language' => 'getLanguage', + 'business_unit_id' => 'getBusinessUnitId', + 'content' => 'getContent', + 'webversion' => 'getWebversion', + 'archived' => 'getArchived', + 'subscription_details' => 'getSubscriptionDetails', + 'active_domain' => 'getActiveDomain', + 'name' => 'getName', + 'campaign' => 'getCampaign', + 'from' => 'getFrom', + 'jitter_send_time' => 'getJitterSendTime', + 'state' => 'getState', + 'to' => 'getTo', + 'subcategory' => 'getSubcategory', + 'send_on_publish' => 'getSendOnPublish' + ]; + + /** + * 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 LANGUAGE_AF = 'af'; + public const LANGUAGE_AF_NA = 'af-na'; + public const LANGUAGE_AF_ZA = 'af-za'; + public const LANGUAGE_AGQ = 'agq'; + public const LANGUAGE_AGQ_CM = 'agq-cm'; + public const LANGUAGE_AK = 'ak'; + public const LANGUAGE_AK_GH = 'ak-gh'; + public const LANGUAGE_AM = 'am'; + public const LANGUAGE_AM_ET = 'am-et'; + public const LANGUAGE_ANN = 'ann'; + public const LANGUAGE_ANN_NG = 'ann-ng'; + public const LANGUAGE_AR = 'ar'; + public const LANGUAGE_AR_001 = 'ar-001'; + public const LANGUAGE_AR_AE = 'ar-ae'; + public const LANGUAGE_AR_BH = 'ar-bh'; + public const LANGUAGE_AR_DJ = 'ar-dj'; + public const LANGUAGE_AR_DZ = 'ar-dz'; + public const LANGUAGE_AR_EG = 'ar-eg'; + public const LANGUAGE_AR_EH = 'ar-eh'; + public const LANGUAGE_AR_ER = 'ar-er'; + public const LANGUAGE_AR_IL = 'ar-il'; + public const LANGUAGE_AR_IQ = 'ar-iq'; + public const LANGUAGE_AR_JO = 'ar-jo'; + public const LANGUAGE_AR_KM = 'ar-km'; + public const LANGUAGE_AR_KW = 'ar-kw'; + public const LANGUAGE_AR_LB = 'ar-lb'; + public const LANGUAGE_AR_LY = 'ar-ly'; + public const LANGUAGE_AR_MA = 'ar-ma'; + public const LANGUAGE_AR_MR = 'ar-mr'; + public const LANGUAGE_AR_OM = 'ar-om'; + public const LANGUAGE_AR_PS = 'ar-ps'; + public const LANGUAGE_AR_QA = 'ar-qa'; + public const LANGUAGE_AR_SA = 'ar-sa'; + public const LANGUAGE_AR_SD = 'ar-sd'; + public const LANGUAGE_AR_SO = 'ar-so'; + public const LANGUAGE_AR_SS = 'ar-ss'; + public const LANGUAGE_AR_SY = 'ar-sy'; + public const LANGUAGE_AR_TD = 'ar-td'; + public const LANGUAGE_AR_TN = 'ar-tn'; + public const LANGUAGE_AR_YE = 'ar-ye'; + public const LANGUAGE__AS = 'as'; + public const LANGUAGE_ASA = 'asa'; + public const LANGUAGE_ASA_TZ = 'asa-tz'; + public const LANGUAGE_AST = 'ast'; + public const LANGUAGE_AST_ES = 'ast-es'; + public const LANGUAGE_AS_IN = 'as-in'; + public const LANGUAGE_AZ = 'az'; + public const LANGUAGE_AZ_AZ = 'az-az'; + public const LANGUAGE_BAS = 'bas'; + public const LANGUAGE_BAS_CM = 'bas-cm'; + public const LANGUAGE_BE = 'be'; + public const LANGUAGE_BEM = 'bem'; + public const LANGUAGE_BEM_ZM = 'bem-zm'; + public const LANGUAGE_BEZ = 'bez'; + public const LANGUAGE_BEZ_TZ = 'bez-tz'; + public const LANGUAGE_BE_BY = 'be-by'; + public const LANGUAGE_BG = 'bg'; + public const LANGUAGE_BGC = 'bgc'; + public const LANGUAGE_BGC_IN = 'bgc-in'; + public const LANGUAGE_BG_BG = 'bg-bg'; + public const LANGUAGE_BHO = 'bho'; + public const LANGUAGE_BHO_IN = 'bho-in'; + public const LANGUAGE_BM = 'bm'; + public const LANGUAGE_BM_ML = 'bm-ml'; + public const LANGUAGE_BN = 'bn'; + public const LANGUAGE_BN_BD = 'bn-bd'; + public const LANGUAGE_BN_IN = 'bn-in'; + public const LANGUAGE_BO = 'bo'; + public const LANGUAGE_BO_CN = 'bo-cn'; + public const LANGUAGE_BO_IN = 'bo-in'; + public const LANGUAGE_BR = 'br'; + public const LANGUAGE_BRX = 'brx'; + public const LANGUAGE_BRX_IN = 'brx-in'; + public const LANGUAGE_BR_FR = 'br-fr'; + public const LANGUAGE_BS = 'bs'; + public const LANGUAGE_BS_BA = 'bs-ba'; + public const LANGUAGE_CA = 'ca'; + public const LANGUAGE_CA_AD = 'ca-ad'; + public const LANGUAGE_CA_ES = 'ca-es'; + public const LANGUAGE_CA_FR = 'ca-fr'; + public const LANGUAGE_CA_IT = 'ca-it'; + public const LANGUAGE_CCP = 'ccp'; + public const LANGUAGE_CCP_BD = 'ccp-bd'; + public const LANGUAGE_CCP_IN = 'ccp-in'; + public const LANGUAGE_CE = 'ce'; + public const LANGUAGE_CEB = 'ceb'; + public const LANGUAGE_CEB_PH = 'ceb-ph'; + public const LANGUAGE_CE_RU = 'ce-ru'; + public const LANGUAGE_CGG = 'cgg'; + public const LANGUAGE_CGG_UG = 'cgg-ug'; + public const LANGUAGE_CHR = 'chr'; + public const LANGUAGE_CHR_US = 'chr-us'; + public const LANGUAGE_CKB = 'ckb'; + public const LANGUAGE_CKB_IQ = 'ckb-iq'; + public const LANGUAGE_CKB_IR = 'ckb-ir'; + public const LANGUAGE_CS = 'cs'; + public const LANGUAGE_CS_CZ = 'cs-cz'; + public const LANGUAGE_CU = 'cu'; + public const LANGUAGE_CU_RU = 'cu-ru'; + public const LANGUAGE_CV = 'cv'; + public const LANGUAGE_CV_RU = 'cv-ru'; + public const LANGUAGE_CY = 'cy'; + public const LANGUAGE_CY_GB = 'cy-gb'; + public const LANGUAGE_DA = 'da'; + public const LANGUAGE_DAV = 'dav'; + public const LANGUAGE_DAV_KE = 'dav-ke'; + public const LANGUAGE_DA_DK = 'da-dk'; + public const LANGUAGE_DA_GL = 'da-gl'; + public const LANGUAGE_DE = 'de'; + public const LANGUAGE_DE_AT = 'de-at'; + public const LANGUAGE_DE_BE = 'de-be'; + public const LANGUAGE_DE_CH = 'de-ch'; + public const LANGUAGE_DE_DE = 'de-de'; + public const LANGUAGE_DE_GR = 'de-gr'; + public const LANGUAGE_DE_IT = 'de-it'; + public const LANGUAGE_DE_LI = 'de-li'; + public const LANGUAGE_DE_LU = 'de-lu'; + public const LANGUAGE_DJE = 'dje'; + public const LANGUAGE_DJE_NE = 'dje-ne'; + public const LANGUAGE_DOI = 'doi'; + public const LANGUAGE_DOI_IN = 'doi-in'; + public const LANGUAGE_DSB = 'dsb'; + public const LANGUAGE_DSB_DE = 'dsb-de'; + public const LANGUAGE_DUA = 'dua'; + public const LANGUAGE_DUA_CM = 'dua-cm'; + public const LANGUAGE_DYO = 'dyo'; + public const LANGUAGE_DYO_SN = 'dyo-sn'; + public const LANGUAGE_DZ = 'dz'; + public const LANGUAGE_DZ_BT = 'dz-bt'; + public const LANGUAGE_EBU = 'ebu'; + public const LANGUAGE_EBU_KE = 'ebu-ke'; + public const LANGUAGE_EE = 'ee'; + public const LANGUAGE_EE_GH = 'ee-gh'; + public const LANGUAGE_EE_TG = 'ee-tg'; + public const LANGUAGE_EL = 'el'; + public const LANGUAGE_EL_CY = 'el-cy'; + public const LANGUAGE_EL_GR = 'el-gr'; + public const LANGUAGE_EN = 'en'; + public const LANGUAGE_EN_001 = 'en-001'; + public const LANGUAGE_EN_150 = 'en-150'; + public const LANGUAGE_EN_AE = 'en-ae'; + public const LANGUAGE_EN_AG = 'en-ag'; + public const LANGUAGE_EN_AI = 'en-ai'; + public const LANGUAGE_EN_AS = 'en-as'; + public const LANGUAGE_EN_AT = 'en-at'; + public const LANGUAGE_EN_AU = 'en-au'; + public const LANGUAGE_EN_BB = 'en-bb'; + public const LANGUAGE_EN_BE = 'en-be'; + public const LANGUAGE_EN_BI = 'en-bi'; + public const LANGUAGE_EN_BM = 'en-bm'; + public const LANGUAGE_EN_BS = 'en-bs'; + public const LANGUAGE_EN_BW = 'en-bw'; + public const LANGUAGE_EN_BZ = 'en-bz'; + public const LANGUAGE_EN_CA = 'en-ca'; + public const LANGUAGE_EN_CC = 'en-cc'; + public const LANGUAGE_EN_CH = 'en-ch'; + public const LANGUAGE_EN_CK = 'en-ck'; + public const LANGUAGE_EN_CM = 'en-cm'; + public const LANGUAGE_EN_CN = 'en-cn'; + public const LANGUAGE_EN_CX = 'en-cx'; + public const LANGUAGE_EN_CY = 'en-cy'; + public const LANGUAGE_EN_DE = 'en-de'; + public const LANGUAGE_EN_DG = 'en-dg'; + public const LANGUAGE_EN_DK = 'en-dk'; + public const LANGUAGE_EN_DM = 'en-dm'; + public const LANGUAGE_EN_EE = 'en-ee'; + public const LANGUAGE_EN_ER = 'en-er'; + public const LANGUAGE_EN_FI = 'en-fi'; + public const LANGUAGE_EN_FJ = 'en-fj'; + public const LANGUAGE_EN_FK = 'en-fk'; + public const LANGUAGE_EN_FM = 'en-fm'; + public const LANGUAGE_EN_FR = 'en-fr'; + public const LANGUAGE_EN_GB = 'en-gb'; + public const LANGUAGE_EN_GD = 'en-gd'; + public const LANGUAGE_EN_GG = 'en-gg'; + public const LANGUAGE_EN_GH = 'en-gh'; + public const LANGUAGE_EN_GI = 'en-gi'; + public const LANGUAGE_EN_GM = 'en-gm'; + public const LANGUAGE_EN_GU = 'en-gu'; + public const LANGUAGE_EN_GY = 'en-gy'; + public const LANGUAGE_EN_HK = 'en-hk'; + public const LANGUAGE_EN_IE = 'en-ie'; + public const LANGUAGE_EN_IL = 'en-il'; + public const LANGUAGE_EN_IM = 'en-im'; + public const LANGUAGE_EN_IN = 'en-in'; + public const LANGUAGE_EN_IO = 'en-io'; + public const LANGUAGE_EN_JE = 'en-je'; + public const LANGUAGE_EN_JM = 'en-jm'; + public const LANGUAGE_EN_KE = 'en-ke'; + public const LANGUAGE_EN_KI = 'en-ki'; + public const LANGUAGE_EN_KN = 'en-kn'; + public const LANGUAGE_EN_KY = 'en-ky'; + public const LANGUAGE_EN_LC = 'en-lc'; + public const LANGUAGE_EN_LR = 'en-lr'; + public const LANGUAGE_EN_LS = 'en-ls'; + public const LANGUAGE_EN_LU = 'en-lu'; + public const LANGUAGE_EN_MG = 'en-mg'; + public const LANGUAGE_EN_MH = 'en-mh'; + public const LANGUAGE_EN_MO = 'en-mo'; + public const LANGUAGE_EN_MP = 'en-mp'; + public const LANGUAGE_EN_MS = 'en-ms'; + public const LANGUAGE_EN_MT = 'en-mt'; + public const LANGUAGE_EN_MU = 'en-mu'; + public const LANGUAGE_EN_MV = 'en-mv'; + public const LANGUAGE_EN_MW = 'en-mw'; + public const LANGUAGE_EN_MX = 'en-mx'; + public const LANGUAGE_EN_MY = 'en-my'; + public const LANGUAGE_EN_NA = 'en-na'; + public const LANGUAGE_EN_NF = 'en-nf'; + public const LANGUAGE_EN_NG = 'en-ng'; + public const LANGUAGE_EN_NL = 'en-nl'; + public const LANGUAGE_EN_NR = 'en-nr'; + public const LANGUAGE_EN_NU = 'en-nu'; + public const LANGUAGE_EN_NZ = 'en-nz'; + public const LANGUAGE_EN_PG = 'en-pg'; + public const LANGUAGE_EN_PH = 'en-ph'; + public const LANGUAGE_EN_PK = 'en-pk'; + public const LANGUAGE_EN_PN = 'en-pn'; + public const LANGUAGE_EN_PR = 'en-pr'; + public const LANGUAGE_EN_PW = 'en-pw'; + public const LANGUAGE_EN_RW = 'en-rw'; + public const LANGUAGE_EN_SB = 'en-sb'; + public const LANGUAGE_EN_SC = 'en-sc'; + public const LANGUAGE_EN_SD = 'en-sd'; + public const LANGUAGE_EN_SE = 'en-se'; + public const LANGUAGE_EN_SG = 'en-sg'; + public const LANGUAGE_EN_SH = 'en-sh'; + public const LANGUAGE_EN_SI = 'en-si'; + public const LANGUAGE_EN_SL = 'en-sl'; + public const LANGUAGE_EN_SS = 'en-ss'; + public const LANGUAGE_EN_SX = 'en-sx'; + public const LANGUAGE_EN_SZ = 'en-sz'; + public const LANGUAGE_EN_TC = 'en-tc'; + public const LANGUAGE_EN_TK = 'en-tk'; + public const LANGUAGE_EN_TO = 'en-to'; + public const LANGUAGE_EN_TT = 'en-tt'; + public const LANGUAGE_EN_TV = 'en-tv'; + public const LANGUAGE_EN_TZ = 'en-tz'; + public const LANGUAGE_EN_UG = 'en-ug'; + public const LANGUAGE_EN_UM = 'en-um'; + public const LANGUAGE_EN_US = 'en-us'; + public const LANGUAGE_EN_VC = 'en-vc'; + public const LANGUAGE_EN_VG = 'en-vg'; + public const LANGUAGE_EN_VI = 'en-vi'; + public const LANGUAGE_EN_VU = 'en-vu'; + public const LANGUAGE_EN_WS = 'en-ws'; + public const LANGUAGE_EN_ZA = 'en-za'; + public const LANGUAGE_EN_ZM = 'en-zm'; + public const LANGUAGE_EN_ZW = 'en-zw'; + public const LANGUAGE_EO = 'eo'; + public const LANGUAGE_EO_001 = 'eo-001'; + public const LANGUAGE_ES = 'es'; + public const LANGUAGE_ES_419 = 'es-419'; + public const LANGUAGE_ES_AR = 'es-ar'; + public const LANGUAGE_ES_BO = 'es-bo'; + public const LANGUAGE_ES_BR = 'es-br'; + public const LANGUAGE_ES_BZ = 'es-bz'; + public const LANGUAGE_ES_CL = 'es-cl'; + public const LANGUAGE_ES_CO = 'es-co'; + public const LANGUAGE_ES_CR = 'es-cr'; + public const LANGUAGE_ES_CU = 'es-cu'; + public const LANGUAGE_ES_DO = 'es-do'; + public const LANGUAGE_ES_EA = 'es-ea'; + public const LANGUAGE_ES_EC = 'es-ec'; + public const LANGUAGE_ES_ES = 'es-es'; + public const LANGUAGE_ES_GQ = 'es-gq'; + public const LANGUAGE_ES_GT = 'es-gt'; + public const LANGUAGE_ES_HN = 'es-hn'; + public const LANGUAGE_ES_IC = 'es-ic'; + public const LANGUAGE_ES_MX = 'es-mx'; + public const LANGUAGE_ES_NI = 'es-ni'; + public const LANGUAGE_ES_PA = 'es-pa'; + public const LANGUAGE_ES_PE = 'es-pe'; + public const LANGUAGE_ES_PH = 'es-ph'; + public const LANGUAGE_ES_PR = 'es-pr'; + public const LANGUAGE_ES_PY = 'es-py'; + public const LANGUAGE_ES_SV = 'es-sv'; + public const LANGUAGE_ES_US = 'es-us'; + public const LANGUAGE_ES_UY = 'es-uy'; + public const LANGUAGE_ES_VE = 'es-ve'; + public const LANGUAGE_ET = 'et'; + public const LANGUAGE_ET_EE = 'et-ee'; + public const LANGUAGE_EU = 'eu'; + public const LANGUAGE_EU_ES = 'eu-es'; + public const LANGUAGE_EWO = 'ewo'; + public const LANGUAGE_EWO_CM = 'ewo-cm'; + public const LANGUAGE_FA = 'fa'; + public const LANGUAGE_FA_AF = 'fa-af'; + public const LANGUAGE_FA_IR = 'fa-ir'; + public const LANGUAGE_FF = 'ff'; + public const LANGUAGE_FF_BF = 'ff-bf'; + public const LANGUAGE_FF_CM = 'ff-cm'; + public const LANGUAGE_FF_GH = 'ff-gh'; + public const LANGUAGE_FF_GM = 'ff-gm'; + public const LANGUAGE_FF_GN = 'ff-gn'; + public const LANGUAGE_FF_GW = 'ff-gw'; + public const LANGUAGE_FF_LR = 'ff-lr'; + public const LANGUAGE_FF_MR = 'ff-mr'; + public const LANGUAGE_FF_NE = 'ff-ne'; + public const LANGUAGE_FF_NG = 'ff-ng'; + public const LANGUAGE_FF_SL = 'ff-sl'; + public const LANGUAGE_FF_SN = 'ff-sn'; + public const LANGUAGE_FI = 'fi'; + public const LANGUAGE_FIL = 'fil'; + public const LANGUAGE_FIL_PH = 'fil-ph'; + public const LANGUAGE_FI_FI = 'fi-fi'; + public const LANGUAGE_FO = 'fo'; + public const LANGUAGE_FO_DK = 'fo-dk'; + public const LANGUAGE_FO_FO = 'fo-fo'; + public const LANGUAGE_FR = 'fr'; + public const LANGUAGE_FRR = 'frr'; + public const LANGUAGE_FRR_DE = 'frr-de'; + public const LANGUAGE_FR_BE = 'fr-be'; + public const LANGUAGE_FR_BF = 'fr-bf'; + public const LANGUAGE_FR_BI = 'fr-bi'; + public const LANGUAGE_FR_BJ = 'fr-bj'; + public const LANGUAGE_FR_BL = 'fr-bl'; + public const LANGUAGE_FR_CA = 'fr-ca'; + public const LANGUAGE_FR_CD = 'fr-cd'; + public const LANGUAGE_FR_CF = 'fr-cf'; + public const LANGUAGE_FR_CG = 'fr-cg'; + public const LANGUAGE_FR_CH = 'fr-ch'; + public const LANGUAGE_FR_CI = 'fr-ci'; + public const LANGUAGE_FR_CM = 'fr-cm'; + public const LANGUAGE_FR_DJ = 'fr-dj'; + public const LANGUAGE_FR_DZ = 'fr-dz'; + public const LANGUAGE_FR_FR = 'fr-fr'; + public const LANGUAGE_FR_GA = 'fr-ga'; + public const LANGUAGE_FR_GF = 'fr-gf'; + public const LANGUAGE_FR_GN = 'fr-gn'; + public const LANGUAGE_FR_GP = 'fr-gp'; + public const LANGUAGE_FR_GQ = 'fr-gq'; + public const LANGUAGE_FR_HT = 'fr-ht'; + public const LANGUAGE_FR_KM = 'fr-km'; + public const LANGUAGE_FR_LU = 'fr-lu'; + public const LANGUAGE_FR_MA = 'fr-ma'; + public const LANGUAGE_FR_MC = 'fr-mc'; + public const LANGUAGE_FR_MF = 'fr-mf'; + public const LANGUAGE_FR_MG = 'fr-mg'; + public const LANGUAGE_FR_ML = 'fr-ml'; + public const LANGUAGE_FR_MQ = 'fr-mq'; + public const LANGUAGE_FR_MR = 'fr-mr'; + public const LANGUAGE_FR_MU = 'fr-mu'; + public const LANGUAGE_FR_NC = 'fr-nc'; + public const LANGUAGE_FR_NE = 'fr-ne'; + public const LANGUAGE_FR_PF = 'fr-pf'; + public const LANGUAGE_FR_PM = 'fr-pm'; + public const LANGUAGE_FR_RE = 'fr-re'; + public const LANGUAGE_FR_RW = 'fr-rw'; + public const LANGUAGE_FR_SC = 'fr-sc'; + public const LANGUAGE_FR_SN = 'fr-sn'; + public const LANGUAGE_FR_SY = 'fr-sy'; + public const LANGUAGE_FR_TD = 'fr-td'; + public const LANGUAGE_FR_TG = 'fr-tg'; + public const LANGUAGE_FR_TN = 'fr-tn'; + public const LANGUAGE_FR_VU = 'fr-vu'; + public const LANGUAGE_FR_WF = 'fr-wf'; + public const LANGUAGE_FR_YT = 'fr-yt'; + public const LANGUAGE_FUR = 'fur'; + public const LANGUAGE_FUR_IT = 'fur-it'; + public const LANGUAGE_FY = 'fy'; + public const LANGUAGE_FY_NL = 'fy-nl'; + public const LANGUAGE_GA = 'ga'; + public const LANGUAGE_GA_GB = 'ga-gb'; + public const LANGUAGE_GA_IE = 'ga-ie'; + public const LANGUAGE_GD = 'gd'; + public const LANGUAGE_GD_GB = 'gd-gb'; + public const LANGUAGE_GL = 'gl'; + public const LANGUAGE_GL_ES = 'gl-es'; + public const LANGUAGE_GSW = 'gsw'; + public const LANGUAGE_GSW_CH = 'gsw-ch'; + public const LANGUAGE_GSW_FR = 'gsw-fr'; + public const LANGUAGE_GSW_LI = 'gsw-li'; + public const LANGUAGE_GU = 'gu'; + public const LANGUAGE_GUZ = 'guz'; + public const LANGUAGE_GUZ_KE = 'guz-ke'; + public const LANGUAGE_GU_IN = 'gu-in'; + public const LANGUAGE_GV = 'gv'; + public const LANGUAGE_GV_IM = 'gv-im'; + public const LANGUAGE_HA = 'ha'; + public const LANGUAGE_HAW = 'haw'; + public const LANGUAGE_HAW_US = 'haw-us'; + public const LANGUAGE_HA_GH = 'ha-gh'; + public const LANGUAGE_HA_NE = 'ha-ne'; + public const LANGUAGE_HA_NG = 'ha-ng'; + public const LANGUAGE_HE = 'he'; + public const LANGUAGE_HI = 'hi'; + public const LANGUAGE_HI_IN = 'hi-in'; + public const LANGUAGE_HR = 'hr'; + public const LANGUAGE_HR_BA = 'hr-ba'; + public const LANGUAGE_HR_HR = 'hr-hr'; + public const LANGUAGE_HSB = 'hsb'; + public const LANGUAGE_HSB_DE = 'hsb-de'; + public const LANGUAGE_HU = 'hu'; + public const LANGUAGE_HU_HU = 'hu-hu'; + public const LANGUAGE_HY = 'hy'; + public const LANGUAGE_HY_AM = 'hy-am'; + public const LANGUAGE_IA = 'ia'; + public const LANGUAGE_IA_001 = 'ia-001'; + public const LANGUAGE_ID = 'id'; + public const LANGUAGE_IG = 'ig'; + public const LANGUAGE_IG_NG = 'ig-ng'; + public const LANGUAGE_II = 'ii'; + public const LANGUAGE_II_CN = 'ii-cn'; + public const LANGUAGE_ID_ID = 'id-id'; + public const LANGUAGE_IS = 'is'; + public const LANGUAGE_IS_IS = 'is-is'; + public const LANGUAGE_IT = 'it'; + public const LANGUAGE_IT_CH = 'it-ch'; + public const LANGUAGE_IT_IT = 'it-it'; + public const LANGUAGE_IT_SM = 'it-sm'; + public const LANGUAGE_IT_VA = 'it-va'; + public const LANGUAGE_HE_IL = 'he-il'; + public const LANGUAGE_JA = 'ja'; + public const LANGUAGE_JA_JP = 'ja-jp'; + public const LANGUAGE_JGO = 'jgo'; + public const LANGUAGE_JGO_CM = 'jgo-cm'; + public const LANGUAGE_YI = 'yi'; + public const LANGUAGE_YI_001 = 'yi-001'; + public const LANGUAGE_JMC = 'jmc'; + public const LANGUAGE_JMC_TZ = 'jmc-tz'; + public const LANGUAGE_JV = 'jv'; + public const LANGUAGE_JV_ID = 'jv-id'; + public const LANGUAGE_KA = 'ka'; + public const LANGUAGE_KAB = 'kab'; + public const LANGUAGE_KAB_DZ = 'kab-dz'; + public const LANGUAGE_KAM = 'kam'; + public const LANGUAGE_KAM_KE = 'kam-ke'; + public const LANGUAGE_KA_GE = 'ka-ge'; + public const LANGUAGE_KDE = 'kde'; + public const LANGUAGE_KDE_TZ = 'kde-tz'; + public const LANGUAGE_KEA = 'kea'; + public const LANGUAGE_KEA_CV = 'kea-cv'; + public const LANGUAGE_KGP = 'kgp'; + public const LANGUAGE_KGP_BR = 'kgp-br'; + public const LANGUAGE_KHQ = 'khq'; + public const LANGUAGE_KHQ_ML = 'khq-ml'; + public const LANGUAGE_KI = 'ki'; + public const LANGUAGE_KI_KE = 'ki-ke'; + public const LANGUAGE_KK = 'kk'; + public const LANGUAGE_KKJ = 'kkj'; + public const LANGUAGE_KKJ_CM = 'kkj-cm'; + public const LANGUAGE_KK_KZ = 'kk-kz'; + public const LANGUAGE_KL = 'kl'; + public const LANGUAGE_KLN = 'kln'; + public const LANGUAGE_KLN_KE = 'kln-ke'; + public const LANGUAGE_KL_GL = 'kl-gl'; + public const LANGUAGE_KM = 'km'; + public const LANGUAGE_KM_KH = 'km-kh'; + public const LANGUAGE_KN = 'kn'; + public const LANGUAGE_KN_IN = 'kn-in'; + public const LANGUAGE_KO = 'ko'; + public const LANGUAGE_KOK = 'kok'; + public const LANGUAGE_KOK_IN = 'kok-in'; + public const LANGUAGE_KO_KP = 'ko-kp'; + public const LANGUAGE_KO_KR = 'ko-kr'; + public const LANGUAGE_KS = 'ks'; + public const LANGUAGE_KSB = 'ksb'; + public const LANGUAGE_KSB_TZ = 'ksb-tz'; + public const LANGUAGE_KSF = 'ksf'; + public const LANGUAGE_KSF_CM = 'ksf-cm'; + public const LANGUAGE_KSH = 'ksh'; + public const LANGUAGE_KSH_DE = 'ksh-de'; + public const LANGUAGE_KS_IN = 'ks-in'; + public const LANGUAGE_KU = 'ku'; + public const LANGUAGE_KU_TR = 'ku-tr'; + public const LANGUAGE_KW = 'kw'; + public const LANGUAGE_KW_GB = 'kw-gb'; + public const LANGUAGE_KY = 'ky'; + public const LANGUAGE_KY_KG = 'ky-kg'; + public const LANGUAGE_LAG = 'lag'; + public const LANGUAGE_LAG_TZ = 'lag-tz'; + public const LANGUAGE_LB = 'lb'; + public const LANGUAGE_LB_LU = 'lb-lu'; + public const LANGUAGE_LG = 'lg'; + public const LANGUAGE_LG_UG = 'lg-ug'; + public const LANGUAGE_LKT = 'lkt'; + public const LANGUAGE_LKT_US = 'lkt-us'; + public const LANGUAGE_LN = 'ln'; + public const LANGUAGE_LN_AO = 'ln-ao'; + public const LANGUAGE_LN_CD = 'ln-cd'; + public const LANGUAGE_LN_CF = 'ln-cf'; + public const LANGUAGE_LN_CG = 'ln-cg'; + public const LANGUAGE_LO = 'lo'; + public const LANGUAGE_LO_LA = 'lo-la'; + public const LANGUAGE_LRC = 'lrc'; + public const LANGUAGE_LRC_IQ = 'lrc-iq'; + public const LANGUAGE_LRC_IR = 'lrc-ir'; + public const LANGUAGE_LT = 'lt'; + public const LANGUAGE_LT_LT = 'lt-lt'; + public const LANGUAGE_LU = 'lu'; + public const LANGUAGE_LUO = 'luo'; + public const LANGUAGE_LUO_KE = 'luo-ke'; + public const LANGUAGE_LUY = 'luy'; + public const LANGUAGE_LUY_KE = 'luy-ke'; + public const LANGUAGE_LU_CD = 'lu-cd'; + public const LANGUAGE_LV = 'lv'; + public const LANGUAGE_LV_LV = 'lv-lv'; + public const LANGUAGE_MAI = 'mai'; + public const LANGUAGE_MAI_IN = 'mai-in'; + public const LANGUAGE_MAS = 'mas'; + public const LANGUAGE_MAS_KE = 'mas-ke'; + public const LANGUAGE_MAS_TZ = 'mas-tz'; + public const LANGUAGE_MDF = 'mdf'; + public const LANGUAGE_MDF_RU = 'mdf-ru'; + public const LANGUAGE_MER = 'mer'; + public const LANGUAGE_MER_KE = 'mer-ke'; + public const LANGUAGE_MFE = 'mfe'; + public const LANGUAGE_MFE_MU = 'mfe-mu'; + public const LANGUAGE_MG = 'mg'; + public const LANGUAGE_MGH = 'mgh'; + public const LANGUAGE_MGH_MZ = 'mgh-mz'; + public const LANGUAGE_MGO = 'mgo'; + public const LANGUAGE_MGO_CM = 'mgo-cm'; + public const LANGUAGE_MG_MG = 'mg-mg'; + public const LANGUAGE_MI = 'mi'; + public const LANGUAGE_MI_NZ = 'mi-nz'; + public const LANGUAGE_MK = 'mk'; + public const LANGUAGE_MK_MK = 'mk-mk'; + public const LANGUAGE_ML = 'ml'; + public const LANGUAGE_ML_IN = 'ml-in'; + public const LANGUAGE_MN = 'mn'; + public const LANGUAGE_MNI = 'mni'; + public const LANGUAGE_MNI_IN = 'mni-in'; + public const LANGUAGE_MN_MN = 'mn-mn'; + public const LANGUAGE_MR = 'mr'; + public const LANGUAGE_MR_IN = 'mr-in'; + public const LANGUAGE_MS = 'ms'; + public const LANGUAGE_MS_BN = 'ms-bn'; + public const LANGUAGE_MS_ID = 'ms-id'; + public const LANGUAGE_MS_MY = 'ms-my'; + public const LANGUAGE_MS_SG = 'ms-sg'; + public const LANGUAGE_MT = 'mt'; + public const LANGUAGE_MT_MT = 'mt-mt'; + public const LANGUAGE_MUA = 'mua'; + public const LANGUAGE_MUA_CM = 'mua-cm'; + public const LANGUAGE_MY = 'my'; + public const LANGUAGE_MY_MM = 'my-mm'; + public const LANGUAGE_MZN = 'mzn'; + public const LANGUAGE_MZN_IR = 'mzn-ir'; + public const LANGUAGE_NAQ = 'naq'; + public const LANGUAGE_NAQ_NA = 'naq-na'; + public const LANGUAGE_NB = 'nb'; + public const LANGUAGE_NB_NO = 'nb-no'; + public const LANGUAGE_NB_SJ = 'nb-sj'; + public const LANGUAGE_ND = 'nd'; + public const LANGUAGE_NDS = 'nds'; + public const LANGUAGE_NDS_DE = 'nds-de'; + public const LANGUAGE_NDS_NL = 'nds-nl'; + public const LANGUAGE_ND_ZW = 'nd-zw'; + public const LANGUAGE_NE = 'ne'; + public const LANGUAGE_NE_IN = 'ne-in'; + public const LANGUAGE_NE_NP = 'ne-np'; + public const LANGUAGE_NL = 'nl'; + public const LANGUAGE_NL_AW = 'nl-aw'; + public const LANGUAGE_NL_BE = 'nl-be'; + public const LANGUAGE_NL_BQ = 'nl-bq'; + public const LANGUAGE_NL_CH = 'nl-ch'; + public const LANGUAGE_NL_CW = 'nl-cw'; + public const LANGUAGE_NL_LU = 'nl-lu'; + public const LANGUAGE_NL_NL = 'nl-nl'; + public const LANGUAGE_NL_SR = 'nl-sr'; + public const LANGUAGE_NL_SX = 'nl-sx'; + public const LANGUAGE_NMG = 'nmg'; + public const LANGUAGE_NMG_CM = 'nmg-cm'; + public const LANGUAGE_NN = 'nn'; + public const LANGUAGE_NNH = 'nnh'; + public const LANGUAGE_NNH_CM = 'nnh-cm'; + public const LANGUAGE_NN_NO = 'nn-no'; + public const LANGUAGE_NO = 'no'; + public const LANGUAGE_NO_NO = 'no-no'; + public const LANGUAGE_NUS = 'nus'; + public const LANGUAGE_NUS_SS = 'nus-ss'; + public const LANGUAGE_NYN = 'nyn'; + public const LANGUAGE_NYN_UG = 'nyn-ug'; + public const LANGUAGE_OC = 'oc'; + public const LANGUAGE_OC_ES = 'oc-es'; + public const LANGUAGE_OC_FR = 'oc-fr'; + public const LANGUAGE_OM = 'om'; + public const LANGUAGE_OM_ET = 'om-et'; + public const LANGUAGE_OM_KE = 'om-ke'; + public const LANGUAGE__OR = 'or'; + public const LANGUAGE_OR_IN = 'or-in'; + public const LANGUAGE_OS = 'os'; + public const LANGUAGE_OS_GE = 'os-ge'; + public const LANGUAGE_OS_RU = 'os-ru'; + public const LANGUAGE_PA = 'pa'; + public const LANGUAGE_PA_IN = 'pa-in'; + public const LANGUAGE_PA_PK = 'pa-pk'; + public const LANGUAGE_PCM = 'pcm'; + public const LANGUAGE_PCM_NG = 'pcm-ng'; + public const LANGUAGE_PIS = 'pis'; + public const LANGUAGE_PIS_SB = 'pis-sb'; + public const LANGUAGE_PL = 'pl'; + public const LANGUAGE_PL_PL = 'pl-pl'; + public const LANGUAGE_PRG = 'prg'; + public const LANGUAGE_PRG_001 = 'prg-001'; + public const LANGUAGE_PS = 'ps'; + public const LANGUAGE_PS_AF = 'ps-af'; + public const LANGUAGE_PS_PK = 'ps-pk'; + public const LANGUAGE_PT = 'pt'; + public const LANGUAGE_PT_AO = 'pt-ao'; + public const LANGUAGE_PT_BR = 'pt-br'; + public const LANGUAGE_PT_CH = 'pt-ch'; + public const LANGUAGE_PT_CV = 'pt-cv'; + public const LANGUAGE_PT_GQ = 'pt-gq'; + public const LANGUAGE_PT_GW = 'pt-gw'; + public const LANGUAGE_PT_LU = 'pt-lu'; + public const LANGUAGE_PT_MO = 'pt-mo'; + public const LANGUAGE_PT_MZ = 'pt-mz'; + public const LANGUAGE_PT_PT = 'pt-pt'; + public const LANGUAGE_PT_ST = 'pt-st'; + public const LANGUAGE_PT_TL = 'pt-tl'; + public const LANGUAGE_QU = 'qu'; + public const LANGUAGE_QU_BO = 'qu-bo'; + public const LANGUAGE_QU_EC = 'qu-ec'; + public const LANGUAGE_QU_PE = 'qu-pe'; + public const LANGUAGE_RAJ = 'raj'; + public const LANGUAGE_RAJ_IN = 'raj-in'; + public const LANGUAGE_RM = 'rm'; + public const LANGUAGE_RM_CH = 'rm-ch'; + public const LANGUAGE_RN = 'rn'; + public const LANGUAGE_RN_BI = 'rn-bi'; + public const LANGUAGE_RO = 'ro'; + public const LANGUAGE_ROF = 'rof'; + public const LANGUAGE_ROF_TZ = 'rof-tz'; + public const LANGUAGE_RO_MD = 'ro-md'; + public const LANGUAGE_RO_RO = 'ro-ro'; + public const LANGUAGE_RU = 'ru'; + public const LANGUAGE_RU_BY = 'ru-by'; + public const LANGUAGE_RU_KG = 'ru-kg'; + public const LANGUAGE_RU_KZ = 'ru-kz'; + public const LANGUAGE_RU_MD = 'ru-md'; + public const LANGUAGE_RU_RU = 'ru-ru'; + public const LANGUAGE_RU_UA = 'ru-ua'; + public const LANGUAGE_RW = 'rw'; + public const LANGUAGE_RWK = 'rwk'; + public const LANGUAGE_RWK_TZ = 'rwk-tz'; + public const LANGUAGE_RW_RW = 'rw-rw'; + public const LANGUAGE_SA = 'sa'; + public const LANGUAGE_SAH = 'sah'; + public const LANGUAGE_SAH_RU = 'sah-ru'; + public const LANGUAGE_SAQ = 'saq'; + public const LANGUAGE_SAQ_KE = 'saq-ke'; + public const LANGUAGE_SAT = 'sat'; + public const LANGUAGE_SAT_IN = 'sat-in'; + public const LANGUAGE_SA_IN = 'sa-in'; + public const LANGUAGE_SBP = 'sbp'; + public const LANGUAGE_SBP_TZ = 'sbp-tz'; + public const LANGUAGE_SC = 'sc'; + public const LANGUAGE_SC_IT = 'sc-it'; + public const LANGUAGE_SD = 'sd'; + public const LANGUAGE_SD_IN = 'sd-in'; + public const LANGUAGE_SD_PK = 'sd-pk'; + public const LANGUAGE_SE = 'se'; + public const LANGUAGE_SEH = 'seh'; + public const LANGUAGE_SEH_MZ = 'seh-mz'; + public const LANGUAGE_SES = 'ses'; + public const LANGUAGE_SES_ML = 'ses-ml'; + public const LANGUAGE_SE_FI = 'se-fi'; + public const LANGUAGE_SE_NO = 'se-no'; + public const LANGUAGE_SE_SE = 'se-se'; + public const LANGUAGE_SG = 'sg'; + public const LANGUAGE_SG_CF = 'sg-cf'; + public const LANGUAGE_SHI = 'shi'; + public const LANGUAGE_SHI_MA = 'shi-ma'; + public const LANGUAGE_SI = 'si'; + public const LANGUAGE_SI_LK = 'si-lk'; + public const LANGUAGE_SK = 'sk'; + public const LANGUAGE_SK_SK = 'sk-sk'; + public const LANGUAGE_SL = 'sl'; + public const LANGUAGE_SL_SI = 'sl-si'; + public const LANGUAGE_SMN = 'smn'; + public const LANGUAGE_SMN_FI = 'smn-fi'; + public const LANGUAGE_SMS = 'sms'; + public const LANGUAGE_SMS_FI = 'sms-fi'; + public const LANGUAGE_SN = 'sn'; + public const LANGUAGE_SN_ZW = 'sn-zw'; + public const LANGUAGE_SO = 'so'; + public const LANGUAGE_SO_DJ = 'so-dj'; + public const LANGUAGE_SO_ET = 'so-et'; + public const LANGUAGE_SO_KE = 'so-ke'; + public const LANGUAGE_SO_SO = 'so-so'; + public const LANGUAGE_SQ = 'sq'; + public const LANGUAGE_SQ_AL = 'sq-al'; + public const LANGUAGE_SQ_MK = 'sq-mk'; + public const LANGUAGE_SQ_XK = 'sq-xk'; + public const LANGUAGE_SR = 'sr'; + public const LANGUAGE_SR_BA = 'sr-ba'; + public const LANGUAGE_SR_CS = 'sr-cs'; + public const LANGUAGE_SR_ME = 'sr-me'; + public const LANGUAGE_SR_RS = 'sr-rs'; + public const LANGUAGE_SR_XK = 'sr-xk'; + public const LANGUAGE_SU = 'su'; + public const LANGUAGE_SU_ID = 'su-id'; + public const LANGUAGE_SV = 'sv'; + public const LANGUAGE_SV_AX = 'sv-ax'; + public const LANGUAGE_SV_FI = 'sv-fi'; + public const LANGUAGE_SV_SE = 'sv-se'; + public const LANGUAGE_SW = 'sw'; + public const LANGUAGE_SW_CD = 'sw-cd'; + public const LANGUAGE_SW_KE = 'sw-ke'; + public const LANGUAGE_SW_TZ = 'sw-tz'; + public const LANGUAGE_SW_UG = 'sw-ug'; + public const LANGUAGE_SY = 'sy'; + public const LANGUAGE_TA = 'ta'; + public const LANGUAGE_TA_IN = 'ta-in'; + public const LANGUAGE_TA_LK = 'ta-lk'; + public const LANGUAGE_TA_MY = 'ta-my'; + public const LANGUAGE_TA_SG = 'ta-sg'; + public const LANGUAGE_TE = 'te'; + public const LANGUAGE_TEO = 'teo'; + public const LANGUAGE_TEO_KE = 'teo-ke'; + public const LANGUAGE_TEO_UG = 'teo-ug'; + public const LANGUAGE_TE_IN = 'te-in'; + public const LANGUAGE_TG = 'tg'; + public const LANGUAGE_TG_TJ = 'tg-tj'; + public const LANGUAGE_TH = 'th'; + public const LANGUAGE_TH_TH = 'th-th'; + public const LANGUAGE_TI = 'ti'; + public const LANGUAGE_TI_ER = 'ti-er'; + public const LANGUAGE_TI_ET = 'ti-et'; + public const LANGUAGE_TK = 'tk'; + public const LANGUAGE_TK_TM = 'tk-tm'; + public const LANGUAGE_TL = 'tl'; + public const LANGUAGE_TO = 'to'; + public const LANGUAGE_TOK = 'tok'; + public const LANGUAGE_TOK_001 = 'tok-001'; + public const LANGUAGE_TO_TO = 'to-to'; + public const LANGUAGE_TR = 'tr'; + public const LANGUAGE_TR_CY = 'tr-cy'; + public const LANGUAGE_TR_TR = 'tr-tr'; + public const LANGUAGE_TT = 'tt'; + public const LANGUAGE_TT_RU = 'tt-ru'; + public const LANGUAGE_TWQ = 'twq'; + public const LANGUAGE_TWQ_NE = 'twq-ne'; + public const LANGUAGE_TZM = 'tzm'; + public const LANGUAGE_TZM_MA = 'tzm-ma'; + public const LANGUAGE_UG = 'ug'; + public const LANGUAGE_UG_CN = 'ug-cn'; + public const LANGUAGE_UK = 'uk'; + public const LANGUAGE_UK_UA = 'uk-ua'; + public const LANGUAGE_UR = 'ur'; + public const LANGUAGE_UR_IN = 'ur-in'; + public const LANGUAGE_UR_PK = 'ur-pk'; + public const LANGUAGE_UZ = 'uz'; + public const LANGUAGE_UZ_AF = 'uz-af'; + public const LANGUAGE_UZ_UZ = 'uz-uz'; + public const LANGUAGE_VAI = 'vai'; + public const LANGUAGE_VAI_LR = 'vai-lr'; + public const LANGUAGE_VI = 'vi'; + public const LANGUAGE_VI_VN = 'vi-vn'; + public const LANGUAGE_VO = 'vo'; + public const LANGUAGE_VO_001 = 'vo-001'; + public const LANGUAGE_VUN = 'vun'; + public const LANGUAGE_VUN_TZ = 'vun-tz'; + public const LANGUAGE_WAE = 'wae'; + public const LANGUAGE_WAE_CH = 'wae-ch'; + public const LANGUAGE_WO = 'wo'; + public const LANGUAGE_WO_SN = 'wo-sn'; + public const LANGUAGE_XH = 'xh'; + public const LANGUAGE_XH_ZA = 'xh-za'; + public const LANGUAGE_XOG = 'xog'; + public const LANGUAGE_XOG_UG = 'xog-ug'; + public const LANGUAGE_YAV = 'yav'; + public const LANGUAGE_YAV_CM = 'yav-cm'; + public const LANGUAGE_YO = 'yo'; + public const LANGUAGE_YO_BJ = 'yo-bj'; + public const LANGUAGE_YO_NG = 'yo-ng'; + public const LANGUAGE_YRL = 'yrl'; + public const LANGUAGE_YRL_BR = 'yrl-br'; + public const LANGUAGE_YRL_CO = 'yrl-co'; + public const LANGUAGE_YRL_VE = 'yrl-ve'; + public const LANGUAGE_YUE = 'yue'; + public const LANGUAGE_YUE_CN = 'yue-cn'; + public const LANGUAGE_YUE_HK = 'yue-hk'; + public const LANGUAGE_ZGH = 'zgh'; + public const LANGUAGE_ZGH_MA = 'zgh-ma'; + public const LANGUAGE_ZH = 'zh'; + public const LANGUAGE_ZH_CN = 'zh-cn'; + public const LANGUAGE_ZH_HANS = 'zh-hans'; + public const LANGUAGE_ZH_HANT = 'zh-hant'; + public const LANGUAGE_ZH_HK = 'zh-hk'; + public const LANGUAGE_ZH_MO = 'zh-mo'; + public const LANGUAGE_ZH_SG = 'zh-sg'; + public const LANGUAGE_ZH_TW = 'zh-tw'; + public const LANGUAGE_ZU = 'zu'; + public const LANGUAGE_ZU_ZA = 'zu-za'; + public const STATE_AUTOMATED = 'AUTOMATED'; + public const STATE_AUTOMATED_DRAFT = 'AUTOMATED_DRAFT'; + public const STATE_AUTOMATED_SENDING = 'AUTOMATED_SENDING'; + public const STATE_AUTOMATED_FOR_FORM = 'AUTOMATED_FOR_FORM'; + public const STATE_AUTOMATED_FOR_FORM_BUFFER = 'AUTOMATED_FOR_FORM_BUFFER'; + public const STATE_AUTOMATED_FOR_FORM_DRAFT = 'AUTOMATED_FOR_FORM_DRAFT'; + public const STATE_AUTOMATED_FOR_FORM_LEGACY = 'AUTOMATED_FOR_FORM_LEGACY'; + public const STATE_BLOG_EMAIL_DRAFT = 'BLOG_EMAIL_DRAFT'; + public const STATE_BLOG_EMAIL_PUBLISHED = 'BLOG_EMAIL_PUBLISHED'; + public const STATE_DRAFT = 'DRAFT'; + public const STATE_DRAFT_AB = 'DRAFT_AB'; + public const STATE_DRAFT_AB_VARIANT = 'DRAFT_AB_VARIANT'; + public const STATE_ERROR = 'ERROR'; + public const STATE_LOSER_AB_VARIANT = 'LOSER_AB_VARIANT'; + public const STATE_PAGE_STUB = 'PAGE_STUB'; + public const STATE_PRE_PROCESSING = 'PRE_PROCESSING'; + public const STATE_PROCESSING = 'PROCESSING'; + public const STATE_PUBLISHED = 'PUBLISHED'; + public const STATE_PUBLISHED_AB = 'PUBLISHED_AB'; + public const STATE_PUBLISHED_AB_VARIANT = 'PUBLISHED_AB_VARIANT'; + public const STATE_PUBLISHED_OR_SCHEDULED = 'PUBLISHED_OR_SCHEDULED'; + public const STATE_RSS_TO_EMAIL_DRAFT = 'RSS_TO_EMAIL_DRAFT'; + public const STATE_RSS_TO_EMAIL_PUBLISHED = 'RSS_TO_EMAIL_PUBLISHED'; + public const STATE_SCHEDULED = 'SCHEDULED'; + public const STATE_SCHEDULED_AB = 'SCHEDULED_AB'; + public const STATE_SCHEDULED_OR_PUBLISHED = 'SCHEDULED_OR_PUBLISHED'; + public const STATE_AUTOMATED_AB = 'AUTOMATED_AB'; + public const STATE_AUTOMATED_AB_VARIANT = 'AUTOMATED_AB_VARIANT'; + public const STATE_AUTOMATED_DRAFT_AB = 'AUTOMATED_DRAFT_AB'; + public const STATE_AUTOMATED_DRAFT_ABVARIANT = 'AUTOMATED_DRAFT_ABVARIANT'; + public const STATE_AUTOMATED_LOSER_ABVARIANT = 'AUTOMATED_LOSER_ABVARIANT'; + public const SUBCATEGORY_AB_MASTER = 'ab_master'; + public const SUBCATEGORY_AB_VARIANT = 'ab_variant'; + public const SUBCATEGORY_AB_LOSER_VARIANT = 'ab_loser_variant'; + public const SUBCATEGORY_PAGE_STUB = 'page_stub'; + public const SUBCATEGORY_LANDING_PAGE = 'landing_page'; + public const SUBCATEGORY_SITE_PAGE = 'site_page'; + public const SUBCATEGORY_LEGACY_PAGE = 'legacy_page'; + public const SUBCATEGORY_AB_MASTER_SITE_PAGE = 'ab_master_site_page'; + public const SUBCATEGORY_AB_VARIANT_SITE_PAGE = 'ab_variant_site_page'; + public const SUBCATEGORY_AB_LOSER_VARIANT_SITE_PAGE = 'ab_loser_variant_site_page'; + public const SUBCATEGORY_PERFORMABLE_LANDING_PAGE = 'performable_landing_page'; + public const SUBCATEGORY_PERFORMABLE_LANDING_PAGE_CUTOVER = 'performable_landing_page_cutover'; + public const SUBCATEGORY_STAGED_PAGE = 'staged_page'; + public const SUBCATEGORY_AUTOMATED = 'automated'; + public const SUBCATEGORY_AUTOMATED_FOR_DEAL = 'automated_for_deal'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM = 'automated_for_form'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_LEGACY = 'automated_for_form_legacy'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_BUFFER = 'automated_for_form_buffer'; + public const SUBCATEGORY_AUTOMATED_FOR_FORM_DRAFT = 'automated_for_form_draft'; + public const SUBCATEGORY_RSS_TO_EMAIL = 'rss_to_email'; + public const SUBCATEGORY_RSS_TO_EMAIL_CHILD = 'rss_to_email_child'; + public const SUBCATEGORY_BLOG_EMAIL = 'blog_email'; + public const SUBCATEGORY_BLOG_EMAIL_CHILD = 'blog_email_child'; + public const SUBCATEGORY_OPTIN_EMAIL = 'optin_email'; + public const SUBCATEGORY_OPTIN_FOLLOWUP_EMAIL = 'optin_followup_email'; + public const SUBCATEGORY_BATCH = 'batch'; + public const SUBCATEGORY_RESUBSCRIBE_EMAIL = 'resubscribe_email'; + public const SUBCATEGORY_UNSUBSCRIBE_CONFIRMATION_EMAIL = 'unsubscribe_confirmation_email'; + public const SUBCATEGORY_RESUBSCRIBE_CONFIRMATION_EMAIL = 'resubscribe_confirmation_email'; + public const SUBCATEGORY_SINGLE_SEND_API = 'single_send_api'; + public const SUBCATEGORY_MARKETING_SINGLE_SEND_API = 'marketing_single_send_api'; + public const SUBCATEGORY_SMTP_TOKEN = 'smtp_token'; + public const SUBCATEGORY_LOCALTIME = 'localtime'; + public const SUBCATEGORY_AUTOMATED_FOR_TICKET = 'automated_for_ticket'; + public const SUBCATEGORY_AUTOMATED_FOR_LEADFLOW = 'automated_for_leadflow'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CES = 'automated_for_feedback_ces'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_NPS = 'automated_for_feedback_nps'; + public const SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CUSTOM = 'automated_for_feedback_custom'; + public const SUBCATEGORY_MEMBERSHIP_REGISTRATION = 'membership_registration'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORD_SAVED = 'membership_password_saved'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORD_RESET = 'membership_password_reset'; + public const SUBCATEGORY_MEMBERSHIP_OTP_LOGIN = 'membership_otp_login'; + public const SUBCATEGORY_MEMBERSHIP_PASSWORDLESS_AUTH = 'membership_passwordless_auth'; + public const SUBCATEGORY_MEMBERSHIP_EMAIL_VERIFICATION = 'membership_email_verification'; + public const SUBCATEGORY_MEMBERSHIP_REGISTRATION_FOLLOW_UP = 'membership_registration_follow_up'; + public const SUBCATEGORY_MEMBERSHIP_VERIFICATION = 'membership_verification'; + public const SUBCATEGORY_MEMBERSHIP_FOLLOW_UP = 'membership_follow_up'; + public const SUBCATEGORY_TICKET_CLOSED_KICKBACK_EMAIL = 'ticket_closed_kickback_email'; + public const SUBCATEGORY_TICKET_OPENED_KICKBACK_EMAIL = 'ticket_opened_kickback_email'; + public const SUBCATEGORY_AUTOMATED_FOR_CUSTOM_SURVEY = 'automated_for_custom_survey'; + public const SUBCATEGORY_DISCARDABLE_STUB = 'discardable_stub'; + public const SUBCATEGORY_NORMAL_BLOG_POST = 'normal_blog_post'; + public const SUBCATEGORY_LEGACY_BLOG_POST = 'legacy_blog_post'; + public const SUBCATEGORY_IMPORTED_BLOG_POST = 'imported_blog_post'; + public const SUBCATEGORY_AUTOMATED_AB_MASTER = 'automated_ab_master'; + public const SUBCATEGORY_AUTOMATED_AB_VARIANT = 'automated_ab_variant'; + public const SUBCATEGORY_WEB_INTERACTIVE = 'web_interactive'; + public const SUBCATEGORY_PORTAL_CONTENT = 'portal_content'; + public const SUBCATEGORY_PAGE_INSTANCE_LAYOUT = 'page_instance_layout'; + public const SUBCATEGORY_KB_ARTICLE_INSTANCE_LAYOUT = 'kb_article_instance_layout'; + public const SUBCATEGORY_KB_LISTING = 'kb_listing'; + public const SUBCATEGORY_KB_SEARCH_RESULTS = 'kb_search_results'; + public const SUBCATEGORY_KB_SUPPORT_FORM = 'kb_support_form'; + public const SUBCATEGORY_CASE_STUDY = 'case_study'; + public const SUBCATEGORY_CASE_STUDY_LISTING = 'case_study_listing'; + public const SUBCATEGORY_CASE_STUDY_INSTANCE_LAYOUT = 'case_study_instance_layout'; + public const SUBCATEGORY_UNKNOWN = 'UNKNOWN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_AF, + self::LANGUAGE_AF_NA, + self::LANGUAGE_AF_ZA, + self::LANGUAGE_AGQ, + self::LANGUAGE_AGQ_CM, + self::LANGUAGE_AK, + self::LANGUAGE_AK_GH, + self::LANGUAGE_AM, + self::LANGUAGE_AM_ET, + self::LANGUAGE_ANN, + self::LANGUAGE_ANN_NG, + self::LANGUAGE_AR, + self::LANGUAGE_AR_001, + self::LANGUAGE_AR_AE, + self::LANGUAGE_AR_BH, + self::LANGUAGE_AR_DJ, + self::LANGUAGE_AR_DZ, + self::LANGUAGE_AR_EG, + self::LANGUAGE_AR_EH, + self::LANGUAGE_AR_ER, + self::LANGUAGE_AR_IL, + self::LANGUAGE_AR_IQ, + self::LANGUAGE_AR_JO, + self::LANGUAGE_AR_KM, + self::LANGUAGE_AR_KW, + self::LANGUAGE_AR_LB, + self::LANGUAGE_AR_LY, + self::LANGUAGE_AR_MA, + self::LANGUAGE_AR_MR, + self::LANGUAGE_AR_OM, + self::LANGUAGE_AR_PS, + self::LANGUAGE_AR_QA, + self::LANGUAGE_AR_SA, + self::LANGUAGE_AR_SD, + self::LANGUAGE_AR_SO, + self::LANGUAGE_AR_SS, + self::LANGUAGE_AR_SY, + self::LANGUAGE_AR_TD, + self::LANGUAGE_AR_TN, + self::LANGUAGE_AR_YE, + self::LANGUAGE__AS, + self::LANGUAGE_ASA, + self::LANGUAGE_ASA_TZ, + self::LANGUAGE_AST, + self::LANGUAGE_AST_ES, + self::LANGUAGE_AS_IN, + self::LANGUAGE_AZ, + self::LANGUAGE_AZ_AZ, + self::LANGUAGE_BAS, + self::LANGUAGE_BAS_CM, + self::LANGUAGE_BE, + self::LANGUAGE_BEM, + self::LANGUAGE_BEM_ZM, + self::LANGUAGE_BEZ, + self::LANGUAGE_BEZ_TZ, + self::LANGUAGE_BE_BY, + self::LANGUAGE_BG, + self::LANGUAGE_BGC, + self::LANGUAGE_BGC_IN, + self::LANGUAGE_BG_BG, + self::LANGUAGE_BHO, + self::LANGUAGE_BHO_IN, + self::LANGUAGE_BM, + self::LANGUAGE_BM_ML, + self::LANGUAGE_BN, + self::LANGUAGE_BN_BD, + self::LANGUAGE_BN_IN, + self::LANGUAGE_BO, + self::LANGUAGE_BO_CN, + self::LANGUAGE_BO_IN, + self::LANGUAGE_BR, + self::LANGUAGE_BRX, + self::LANGUAGE_BRX_IN, + self::LANGUAGE_BR_FR, + self::LANGUAGE_BS, + self::LANGUAGE_BS_BA, + self::LANGUAGE_CA, + self::LANGUAGE_CA_AD, + self::LANGUAGE_CA_ES, + self::LANGUAGE_CA_FR, + self::LANGUAGE_CA_IT, + self::LANGUAGE_CCP, + self::LANGUAGE_CCP_BD, + self::LANGUAGE_CCP_IN, + self::LANGUAGE_CE, + self::LANGUAGE_CEB, + self::LANGUAGE_CEB_PH, + self::LANGUAGE_CE_RU, + self::LANGUAGE_CGG, + self::LANGUAGE_CGG_UG, + self::LANGUAGE_CHR, + self::LANGUAGE_CHR_US, + self::LANGUAGE_CKB, + self::LANGUAGE_CKB_IQ, + self::LANGUAGE_CKB_IR, + self::LANGUAGE_CS, + self::LANGUAGE_CS_CZ, + self::LANGUAGE_CU, + self::LANGUAGE_CU_RU, + self::LANGUAGE_CV, + self::LANGUAGE_CV_RU, + self::LANGUAGE_CY, + self::LANGUAGE_CY_GB, + self::LANGUAGE_DA, + self::LANGUAGE_DAV, + self::LANGUAGE_DAV_KE, + self::LANGUAGE_DA_DK, + self::LANGUAGE_DA_GL, + self::LANGUAGE_DE, + self::LANGUAGE_DE_AT, + self::LANGUAGE_DE_BE, + self::LANGUAGE_DE_CH, + self::LANGUAGE_DE_DE, + self::LANGUAGE_DE_GR, + self::LANGUAGE_DE_IT, + self::LANGUAGE_DE_LI, + self::LANGUAGE_DE_LU, + self::LANGUAGE_DJE, + self::LANGUAGE_DJE_NE, + self::LANGUAGE_DOI, + self::LANGUAGE_DOI_IN, + self::LANGUAGE_DSB, + self::LANGUAGE_DSB_DE, + self::LANGUAGE_DUA, + self::LANGUAGE_DUA_CM, + self::LANGUAGE_DYO, + self::LANGUAGE_DYO_SN, + self::LANGUAGE_DZ, + self::LANGUAGE_DZ_BT, + self::LANGUAGE_EBU, + self::LANGUAGE_EBU_KE, + self::LANGUAGE_EE, + self::LANGUAGE_EE_GH, + self::LANGUAGE_EE_TG, + self::LANGUAGE_EL, + self::LANGUAGE_EL_CY, + self::LANGUAGE_EL_GR, + self::LANGUAGE_EN, + self::LANGUAGE_EN_001, + self::LANGUAGE_EN_150, + self::LANGUAGE_EN_AE, + self::LANGUAGE_EN_AG, + self::LANGUAGE_EN_AI, + self::LANGUAGE_EN_AS, + self::LANGUAGE_EN_AT, + self::LANGUAGE_EN_AU, + self::LANGUAGE_EN_BB, + self::LANGUAGE_EN_BE, + self::LANGUAGE_EN_BI, + self::LANGUAGE_EN_BM, + self::LANGUAGE_EN_BS, + self::LANGUAGE_EN_BW, + self::LANGUAGE_EN_BZ, + self::LANGUAGE_EN_CA, + self::LANGUAGE_EN_CC, + self::LANGUAGE_EN_CH, + self::LANGUAGE_EN_CK, + self::LANGUAGE_EN_CM, + self::LANGUAGE_EN_CN, + self::LANGUAGE_EN_CX, + self::LANGUAGE_EN_CY, + self::LANGUAGE_EN_DE, + self::LANGUAGE_EN_DG, + self::LANGUAGE_EN_DK, + self::LANGUAGE_EN_DM, + self::LANGUAGE_EN_EE, + self::LANGUAGE_EN_ER, + self::LANGUAGE_EN_FI, + self::LANGUAGE_EN_FJ, + self::LANGUAGE_EN_FK, + self::LANGUAGE_EN_FM, + self::LANGUAGE_EN_FR, + self::LANGUAGE_EN_GB, + self::LANGUAGE_EN_GD, + self::LANGUAGE_EN_GG, + self::LANGUAGE_EN_GH, + self::LANGUAGE_EN_GI, + self::LANGUAGE_EN_GM, + self::LANGUAGE_EN_GU, + self::LANGUAGE_EN_GY, + self::LANGUAGE_EN_HK, + self::LANGUAGE_EN_IE, + self::LANGUAGE_EN_IL, + self::LANGUAGE_EN_IM, + self::LANGUAGE_EN_IN, + self::LANGUAGE_EN_IO, + self::LANGUAGE_EN_JE, + self::LANGUAGE_EN_JM, + self::LANGUAGE_EN_KE, + self::LANGUAGE_EN_KI, + self::LANGUAGE_EN_KN, + self::LANGUAGE_EN_KY, + self::LANGUAGE_EN_LC, + self::LANGUAGE_EN_LR, + self::LANGUAGE_EN_LS, + self::LANGUAGE_EN_LU, + self::LANGUAGE_EN_MG, + self::LANGUAGE_EN_MH, + self::LANGUAGE_EN_MO, + self::LANGUAGE_EN_MP, + self::LANGUAGE_EN_MS, + self::LANGUAGE_EN_MT, + self::LANGUAGE_EN_MU, + self::LANGUAGE_EN_MV, + self::LANGUAGE_EN_MW, + self::LANGUAGE_EN_MX, + self::LANGUAGE_EN_MY, + self::LANGUAGE_EN_NA, + self::LANGUAGE_EN_NF, + self::LANGUAGE_EN_NG, + self::LANGUAGE_EN_NL, + self::LANGUAGE_EN_NR, + self::LANGUAGE_EN_NU, + self::LANGUAGE_EN_NZ, + self::LANGUAGE_EN_PG, + self::LANGUAGE_EN_PH, + self::LANGUAGE_EN_PK, + self::LANGUAGE_EN_PN, + self::LANGUAGE_EN_PR, + self::LANGUAGE_EN_PW, + self::LANGUAGE_EN_RW, + self::LANGUAGE_EN_SB, + self::LANGUAGE_EN_SC, + self::LANGUAGE_EN_SD, + self::LANGUAGE_EN_SE, + self::LANGUAGE_EN_SG, + self::LANGUAGE_EN_SH, + self::LANGUAGE_EN_SI, + self::LANGUAGE_EN_SL, + self::LANGUAGE_EN_SS, + self::LANGUAGE_EN_SX, + self::LANGUAGE_EN_SZ, + self::LANGUAGE_EN_TC, + self::LANGUAGE_EN_TK, + self::LANGUAGE_EN_TO, + self::LANGUAGE_EN_TT, + self::LANGUAGE_EN_TV, + self::LANGUAGE_EN_TZ, + self::LANGUAGE_EN_UG, + self::LANGUAGE_EN_UM, + self::LANGUAGE_EN_US, + self::LANGUAGE_EN_VC, + self::LANGUAGE_EN_VG, + self::LANGUAGE_EN_VI, + self::LANGUAGE_EN_VU, + self::LANGUAGE_EN_WS, + self::LANGUAGE_EN_ZA, + self::LANGUAGE_EN_ZM, + self::LANGUAGE_EN_ZW, + self::LANGUAGE_EO, + self::LANGUAGE_EO_001, + self::LANGUAGE_ES, + self::LANGUAGE_ES_419, + self::LANGUAGE_ES_AR, + self::LANGUAGE_ES_BO, + self::LANGUAGE_ES_BR, + self::LANGUAGE_ES_BZ, + self::LANGUAGE_ES_CL, + self::LANGUAGE_ES_CO, + self::LANGUAGE_ES_CR, + self::LANGUAGE_ES_CU, + self::LANGUAGE_ES_DO, + self::LANGUAGE_ES_EA, + self::LANGUAGE_ES_EC, + self::LANGUAGE_ES_ES, + self::LANGUAGE_ES_GQ, + self::LANGUAGE_ES_GT, + self::LANGUAGE_ES_HN, + self::LANGUAGE_ES_IC, + self::LANGUAGE_ES_MX, + self::LANGUAGE_ES_NI, + self::LANGUAGE_ES_PA, + self::LANGUAGE_ES_PE, + self::LANGUAGE_ES_PH, + self::LANGUAGE_ES_PR, + self::LANGUAGE_ES_PY, + self::LANGUAGE_ES_SV, + self::LANGUAGE_ES_US, + self::LANGUAGE_ES_UY, + self::LANGUAGE_ES_VE, + self::LANGUAGE_ET, + self::LANGUAGE_ET_EE, + self::LANGUAGE_EU, + self::LANGUAGE_EU_ES, + self::LANGUAGE_EWO, + self::LANGUAGE_EWO_CM, + self::LANGUAGE_FA, + self::LANGUAGE_FA_AF, + self::LANGUAGE_FA_IR, + self::LANGUAGE_FF, + self::LANGUAGE_FF_BF, + self::LANGUAGE_FF_CM, + self::LANGUAGE_FF_GH, + self::LANGUAGE_FF_GM, + self::LANGUAGE_FF_GN, + self::LANGUAGE_FF_GW, + self::LANGUAGE_FF_LR, + self::LANGUAGE_FF_MR, + self::LANGUAGE_FF_NE, + self::LANGUAGE_FF_NG, + self::LANGUAGE_FF_SL, + self::LANGUAGE_FF_SN, + self::LANGUAGE_FI, + self::LANGUAGE_FIL, + self::LANGUAGE_FIL_PH, + self::LANGUAGE_FI_FI, + self::LANGUAGE_FO, + self::LANGUAGE_FO_DK, + self::LANGUAGE_FO_FO, + self::LANGUAGE_FR, + self::LANGUAGE_FRR, + self::LANGUAGE_FRR_DE, + self::LANGUAGE_FR_BE, + self::LANGUAGE_FR_BF, + self::LANGUAGE_FR_BI, + self::LANGUAGE_FR_BJ, + self::LANGUAGE_FR_BL, + self::LANGUAGE_FR_CA, + self::LANGUAGE_FR_CD, + self::LANGUAGE_FR_CF, + self::LANGUAGE_FR_CG, + self::LANGUAGE_FR_CH, + self::LANGUAGE_FR_CI, + self::LANGUAGE_FR_CM, + self::LANGUAGE_FR_DJ, + self::LANGUAGE_FR_DZ, + self::LANGUAGE_FR_FR, + self::LANGUAGE_FR_GA, + self::LANGUAGE_FR_GF, + self::LANGUAGE_FR_GN, + self::LANGUAGE_FR_GP, + self::LANGUAGE_FR_GQ, + self::LANGUAGE_FR_HT, + self::LANGUAGE_FR_KM, + self::LANGUAGE_FR_LU, + self::LANGUAGE_FR_MA, + self::LANGUAGE_FR_MC, + self::LANGUAGE_FR_MF, + self::LANGUAGE_FR_MG, + self::LANGUAGE_FR_ML, + self::LANGUAGE_FR_MQ, + self::LANGUAGE_FR_MR, + self::LANGUAGE_FR_MU, + self::LANGUAGE_FR_NC, + self::LANGUAGE_FR_NE, + self::LANGUAGE_FR_PF, + self::LANGUAGE_FR_PM, + self::LANGUAGE_FR_RE, + self::LANGUAGE_FR_RW, + self::LANGUAGE_FR_SC, + self::LANGUAGE_FR_SN, + self::LANGUAGE_FR_SY, + self::LANGUAGE_FR_TD, + self::LANGUAGE_FR_TG, + self::LANGUAGE_FR_TN, + self::LANGUAGE_FR_VU, + self::LANGUAGE_FR_WF, + self::LANGUAGE_FR_YT, + self::LANGUAGE_FUR, + self::LANGUAGE_FUR_IT, + self::LANGUAGE_FY, + self::LANGUAGE_FY_NL, + self::LANGUAGE_GA, + self::LANGUAGE_GA_GB, + self::LANGUAGE_GA_IE, + self::LANGUAGE_GD, + self::LANGUAGE_GD_GB, + self::LANGUAGE_GL, + self::LANGUAGE_GL_ES, + self::LANGUAGE_GSW, + self::LANGUAGE_GSW_CH, + self::LANGUAGE_GSW_FR, + self::LANGUAGE_GSW_LI, + self::LANGUAGE_GU, + self::LANGUAGE_GUZ, + self::LANGUAGE_GUZ_KE, + self::LANGUAGE_GU_IN, + self::LANGUAGE_GV, + self::LANGUAGE_GV_IM, + self::LANGUAGE_HA, + self::LANGUAGE_HAW, + self::LANGUAGE_HAW_US, + self::LANGUAGE_HA_GH, + self::LANGUAGE_HA_NE, + self::LANGUAGE_HA_NG, + self::LANGUAGE_HE, + self::LANGUAGE_HI, + self::LANGUAGE_HI_IN, + self::LANGUAGE_HR, + self::LANGUAGE_HR_BA, + self::LANGUAGE_HR_HR, + self::LANGUAGE_HSB, + self::LANGUAGE_HSB_DE, + self::LANGUAGE_HU, + self::LANGUAGE_HU_HU, + self::LANGUAGE_HY, + self::LANGUAGE_HY_AM, + self::LANGUAGE_IA, + self::LANGUAGE_IA_001, + self::LANGUAGE_ID, + self::LANGUAGE_IG, + self::LANGUAGE_IG_NG, + self::LANGUAGE_II, + self::LANGUAGE_II_CN, + self::LANGUAGE_ID_ID, + self::LANGUAGE_IS, + self::LANGUAGE_IS_IS, + self::LANGUAGE_IT, + self::LANGUAGE_IT_CH, + self::LANGUAGE_IT_IT, + self::LANGUAGE_IT_SM, + self::LANGUAGE_IT_VA, + self::LANGUAGE_HE_IL, + self::LANGUAGE_JA, + self::LANGUAGE_JA_JP, + self::LANGUAGE_JGO, + self::LANGUAGE_JGO_CM, + self::LANGUAGE_YI, + self::LANGUAGE_YI_001, + self::LANGUAGE_JMC, + self::LANGUAGE_JMC_TZ, + self::LANGUAGE_JV, + self::LANGUAGE_JV_ID, + self::LANGUAGE_KA, + self::LANGUAGE_KAB, + self::LANGUAGE_KAB_DZ, + self::LANGUAGE_KAM, + self::LANGUAGE_KAM_KE, + self::LANGUAGE_KA_GE, + self::LANGUAGE_KDE, + self::LANGUAGE_KDE_TZ, + self::LANGUAGE_KEA, + self::LANGUAGE_KEA_CV, + self::LANGUAGE_KGP, + self::LANGUAGE_KGP_BR, + self::LANGUAGE_KHQ, + self::LANGUAGE_KHQ_ML, + self::LANGUAGE_KI, + self::LANGUAGE_KI_KE, + self::LANGUAGE_KK, + self::LANGUAGE_KKJ, + self::LANGUAGE_KKJ_CM, + self::LANGUAGE_KK_KZ, + self::LANGUAGE_KL, + self::LANGUAGE_KLN, + self::LANGUAGE_KLN_KE, + self::LANGUAGE_KL_GL, + self::LANGUAGE_KM, + self::LANGUAGE_KM_KH, + self::LANGUAGE_KN, + self::LANGUAGE_KN_IN, + self::LANGUAGE_KO, + self::LANGUAGE_KOK, + self::LANGUAGE_KOK_IN, + self::LANGUAGE_KO_KP, + self::LANGUAGE_KO_KR, + self::LANGUAGE_KS, + self::LANGUAGE_KSB, + self::LANGUAGE_KSB_TZ, + self::LANGUAGE_KSF, + self::LANGUAGE_KSF_CM, + self::LANGUAGE_KSH, + self::LANGUAGE_KSH_DE, + self::LANGUAGE_KS_IN, + self::LANGUAGE_KU, + self::LANGUAGE_KU_TR, + self::LANGUAGE_KW, + self::LANGUAGE_KW_GB, + self::LANGUAGE_KY, + self::LANGUAGE_KY_KG, + self::LANGUAGE_LAG, + self::LANGUAGE_LAG_TZ, + self::LANGUAGE_LB, + self::LANGUAGE_LB_LU, + self::LANGUAGE_LG, + self::LANGUAGE_LG_UG, + self::LANGUAGE_LKT, + self::LANGUAGE_LKT_US, + self::LANGUAGE_LN, + self::LANGUAGE_LN_AO, + self::LANGUAGE_LN_CD, + self::LANGUAGE_LN_CF, + self::LANGUAGE_LN_CG, + self::LANGUAGE_LO, + self::LANGUAGE_LO_LA, + self::LANGUAGE_LRC, + self::LANGUAGE_LRC_IQ, + self::LANGUAGE_LRC_IR, + self::LANGUAGE_LT, + self::LANGUAGE_LT_LT, + self::LANGUAGE_LU, + self::LANGUAGE_LUO, + self::LANGUAGE_LUO_KE, + self::LANGUAGE_LUY, + self::LANGUAGE_LUY_KE, + self::LANGUAGE_LU_CD, + self::LANGUAGE_LV, + self::LANGUAGE_LV_LV, + self::LANGUAGE_MAI, + self::LANGUAGE_MAI_IN, + self::LANGUAGE_MAS, + self::LANGUAGE_MAS_KE, + self::LANGUAGE_MAS_TZ, + self::LANGUAGE_MDF, + self::LANGUAGE_MDF_RU, + self::LANGUAGE_MER, + self::LANGUAGE_MER_KE, + self::LANGUAGE_MFE, + self::LANGUAGE_MFE_MU, + self::LANGUAGE_MG, + self::LANGUAGE_MGH, + self::LANGUAGE_MGH_MZ, + self::LANGUAGE_MGO, + self::LANGUAGE_MGO_CM, + self::LANGUAGE_MG_MG, + self::LANGUAGE_MI, + self::LANGUAGE_MI_NZ, + self::LANGUAGE_MK, + self::LANGUAGE_MK_MK, + self::LANGUAGE_ML, + self::LANGUAGE_ML_IN, + self::LANGUAGE_MN, + self::LANGUAGE_MNI, + self::LANGUAGE_MNI_IN, + self::LANGUAGE_MN_MN, + self::LANGUAGE_MR, + self::LANGUAGE_MR_IN, + self::LANGUAGE_MS, + self::LANGUAGE_MS_BN, + self::LANGUAGE_MS_ID, + self::LANGUAGE_MS_MY, + self::LANGUAGE_MS_SG, + self::LANGUAGE_MT, + self::LANGUAGE_MT_MT, + self::LANGUAGE_MUA, + self::LANGUAGE_MUA_CM, + self::LANGUAGE_MY, + self::LANGUAGE_MY_MM, + self::LANGUAGE_MZN, + self::LANGUAGE_MZN_IR, + self::LANGUAGE_NAQ, + self::LANGUAGE_NAQ_NA, + self::LANGUAGE_NB, + self::LANGUAGE_NB_NO, + self::LANGUAGE_NB_SJ, + self::LANGUAGE_ND, + self::LANGUAGE_NDS, + self::LANGUAGE_NDS_DE, + self::LANGUAGE_NDS_NL, + self::LANGUAGE_ND_ZW, + self::LANGUAGE_NE, + self::LANGUAGE_NE_IN, + self::LANGUAGE_NE_NP, + self::LANGUAGE_NL, + self::LANGUAGE_NL_AW, + self::LANGUAGE_NL_BE, + self::LANGUAGE_NL_BQ, + self::LANGUAGE_NL_CH, + self::LANGUAGE_NL_CW, + self::LANGUAGE_NL_LU, + self::LANGUAGE_NL_NL, + self::LANGUAGE_NL_SR, + self::LANGUAGE_NL_SX, + self::LANGUAGE_NMG, + self::LANGUAGE_NMG_CM, + self::LANGUAGE_NN, + self::LANGUAGE_NNH, + self::LANGUAGE_NNH_CM, + self::LANGUAGE_NN_NO, + self::LANGUAGE_NO, + self::LANGUAGE_NO_NO, + self::LANGUAGE_NUS, + self::LANGUAGE_NUS_SS, + self::LANGUAGE_NYN, + self::LANGUAGE_NYN_UG, + self::LANGUAGE_OC, + self::LANGUAGE_OC_ES, + self::LANGUAGE_OC_FR, + self::LANGUAGE_OM, + self::LANGUAGE_OM_ET, + self::LANGUAGE_OM_KE, + self::LANGUAGE__OR, + self::LANGUAGE_OR_IN, + self::LANGUAGE_OS, + self::LANGUAGE_OS_GE, + self::LANGUAGE_OS_RU, + self::LANGUAGE_PA, + self::LANGUAGE_PA_IN, + self::LANGUAGE_PA_PK, + self::LANGUAGE_PCM, + self::LANGUAGE_PCM_NG, + self::LANGUAGE_PIS, + self::LANGUAGE_PIS_SB, + self::LANGUAGE_PL, + self::LANGUAGE_PL_PL, + self::LANGUAGE_PRG, + self::LANGUAGE_PRG_001, + self::LANGUAGE_PS, + self::LANGUAGE_PS_AF, + self::LANGUAGE_PS_PK, + self::LANGUAGE_PT, + self::LANGUAGE_PT_AO, + self::LANGUAGE_PT_BR, + self::LANGUAGE_PT_CH, + self::LANGUAGE_PT_CV, + self::LANGUAGE_PT_GQ, + self::LANGUAGE_PT_GW, + self::LANGUAGE_PT_LU, + self::LANGUAGE_PT_MO, + self::LANGUAGE_PT_MZ, + self::LANGUAGE_PT_PT, + self::LANGUAGE_PT_ST, + self::LANGUAGE_PT_TL, + self::LANGUAGE_QU, + self::LANGUAGE_QU_BO, + self::LANGUAGE_QU_EC, + self::LANGUAGE_QU_PE, + self::LANGUAGE_RAJ, + self::LANGUAGE_RAJ_IN, + self::LANGUAGE_RM, + self::LANGUAGE_RM_CH, + self::LANGUAGE_RN, + self::LANGUAGE_RN_BI, + self::LANGUAGE_RO, + self::LANGUAGE_ROF, + self::LANGUAGE_ROF_TZ, + self::LANGUAGE_RO_MD, + self::LANGUAGE_RO_RO, + self::LANGUAGE_RU, + self::LANGUAGE_RU_BY, + self::LANGUAGE_RU_KG, + self::LANGUAGE_RU_KZ, + self::LANGUAGE_RU_MD, + self::LANGUAGE_RU_RU, + self::LANGUAGE_RU_UA, + self::LANGUAGE_RW, + self::LANGUAGE_RWK, + self::LANGUAGE_RWK_TZ, + self::LANGUAGE_RW_RW, + self::LANGUAGE_SA, + self::LANGUAGE_SAH, + self::LANGUAGE_SAH_RU, + self::LANGUAGE_SAQ, + self::LANGUAGE_SAQ_KE, + self::LANGUAGE_SAT, + self::LANGUAGE_SAT_IN, + self::LANGUAGE_SA_IN, + self::LANGUAGE_SBP, + self::LANGUAGE_SBP_TZ, + self::LANGUAGE_SC, + self::LANGUAGE_SC_IT, + self::LANGUAGE_SD, + self::LANGUAGE_SD_IN, + self::LANGUAGE_SD_PK, + self::LANGUAGE_SE, + self::LANGUAGE_SEH, + self::LANGUAGE_SEH_MZ, + self::LANGUAGE_SES, + self::LANGUAGE_SES_ML, + self::LANGUAGE_SE_FI, + self::LANGUAGE_SE_NO, + self::LANGUAGE_SE_SE, + self::LANGUAGE_SG, + self::LANGUAGE_SG_CF, + self::LANGUAGE_SHI, + self::LANGUAGE_SHI_MA, + self::LANGUAGE_SI, + self::LANGUAGE_SI_LK, + self::LANGUAGE_SK, + self::LANGUAGE_SK_SK, + self::LANGUAGE_SL, + self::LANGUAGE_SL_SI, + self::LANGUAGE_SMN, + self::LANGUAGE_SMN_FI, + self::LANGUAGE_SMS, + self::LANGUAGE_SMS_FI, + self::LANGUAGE_SN, + self::LANGUAGE_SN_ZW, + self::LANGUAGE_SO, + self::LANGUAGE_SO_DJ, + self::LANGUAGE_SO_ET, + self::LANGUAGE_SO_KE, + self::LANGUAGE_SO_SO, + self::LANGUAGE_SQ, + self::LANGUAGE_SQ_AL, + self::LANGUAGE_SQ_MK, + self::LANGUAGE_SQ_XK, + self::LANGUAGE_SR, + self::LANGUAGE_SR_BA, + self::LANGUAGE_SR_CS, + self::LANGUAGE_SR_ME, + self::LANGUAGE_SR_RS, + self::LANGUAGE_SR_XK, + self::LANGUAGE_SU, + self::LANGUAGE_SU_ID, + self::LANGUAGE_SV, + self::LANGUAGE_SV_AX, + self::LANGUAGE_SV_FI, + self::LANGUAGE_SV_SE, + self::LANGUAGE_SW, + self::LANGUAGE_SW_CD, + self::LANGUAGE_SW_KE, + self::LANGUAGE_SW_TZ, + self::LANGUAGE_SW_UG, + self::LANGUAGE_SY, + self::LANGUAGE_TA, + self::LANGUAGE_TA_IN, + self::LANGUAGE_TA_LK, + self::LANGUAGE_TA_MY, + self::LANGUAGE_TA_SG, + self::LANGUAGE_TE, + self::LANGUAGE_TEO, + self::LANGUAGE_TEO_KE, + self::LANGUAGE_TEO_UG, + self::LANGUAGE_TE_IN, + self::LANGUAGE_TG, + self::LANGUAGE_TG_TJ, + self::LANGUAGE_TH, + self::LANGUAGE_TH_TH, + self::LANGUAGE_TI, + self::LANGUAGE_TI_ER, + self::LANGUAGE_TI_ET, + self::LANGUAGE_TK, + self::LANGUAGE_TK_TM, + self::LANGUAGE_TL, + self::LANGUAGE_TO, + self::LANGUAGE_TOK, + self::LANGUAGE_TOK_001, + self::LANGUAGE_TO_TO, + self::LANGUAGE_TR, + self::LANGUAGE_TR_CY, + self::LANGUAGE_TR_TR, + self::LANGUAGE_TT, + self::LANGUAGE_TT_RU, + self::LANGUAGE_TWQ, + self::LANGUAGE_TWQ_NE, + self::LANGUAGE_TZM, + self::LANGUAGE_TZM_MA, + self::LANGUAGE_UG, + self::LANGUAGE_UG_CN, + self::LANGUAGE_UK, + self::LANGUAGE_UK_UA, + self::LANGUAGE_UR, + self::LANGUAGE_UR_IN, + self::LANGUAGE_UR_PK, + self::LANGUAGE_UZ, + self::LANGUAGE_UZ_AF, + self::LANGUAGE_UZ_UZ, + self::LANGUAGE_VAI, + self::LANGUAGE_VAI_LR, + self::LANGUAGE_VI, + self::LANGUAGE_VI_VN, + self::LANGUAGE_VO, + self::LANGUAGE_VO_001, + self::LANGUAGE_VUN, + self::LANGUAGE_VUN_TZ, + self::LANGUAGE_WAE, + self::LANGUAGE_WAE_CH, + self::LANGUAGE_WO, + self::LANGUAGE_WO_SN, + self::LANGUAGE_XH, + self::LANGUAGE_XH_ZA, + self::LANGUAGE_XOG, + self::LANGUAGE_XOG_UG, + self::LANGUAGE_YAV, + self::LANGUAGE_YAV_CM, + self::LANGUAGE_YO, + self::LANGUAGE_YO_BJ, + self::LANGUAGE_YO_NG, + self::LANGUAGE_YRL, + self::LANGUAGE_YRL_BR, + self::LANGUAGE_YRL_CO, + self::LANGUAGE_YRL_VE, + self::LANGUAGE_YUE, + self::LANGUAGE_YUE_CN, + self::LANGUAGE_YUE_HK, + self::LANGUAGE_ZGH, + self::LANGUAGE_ZGH_MA, + self::LANGUAGE_ZH, + self::LANGUAGE_ZH_CN, + self::LANGUAGE_ZH_HANS, + self::LANGUAGE_ZH_HANT, + self::LANGUAGE_ZH_HK, + self::LANGUAGE_ZH_MO, + self::LANGUAGE_ZH_SG, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_ZU, + self::LANGUAGE_ZU_ZA, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_AUTOMATED, + self::STATE_AUTOMATED_DRAFT, + self::STATE_AUTOMATED_SENDING, + self::STATE_AUTOMATED_FOR_FORM, + self::STATE_AUTOMATED_FOR_FORM_BUFFER, + self::STATE_AUTOMATED_FOR_FORM_DRAFT, + self::STATE_AUTOMATED_FOR_FORM_LEGACY, + self::STATE_BLOG_EMAIL_DRAFT, + self::STATE_BLOG_EMAIL_PUBLISHED, + self::STATE_DRAFT, + self::STATE_DRAFT_AB, + self::STATE_DRAFT_AB_VARIANT, + self::STATE_ERROR, + self::STATE_LOSER_AB_VARIANT, + self::STATE_PAGE_STUB, + self::STATE_PRE_PROCESSING, + self::STATE_PROCESSING, + self::STATE_PUBLISHED, + self::STATE_PUBLISHED_AB, + self::STATE_PUBLISHED_AB_VARIANT, + self::STATE_PUBLISHED_OR_SCHEDULED, + self::STATE_RSS_TO_EMAIL_DRAFT, + self::STATE_RSS_TO_EMAIL_PUBLISHED, + self::STATE_SCHEDULED, + self::STATE_SCHEDULED_AB, + self::STATE_SCHEDULED_OR_PUBLISHED, + self::STATE_AUTOMATED_AB, + self::STATE_AUTOMATED_AB_VARIANT, + self::STATE_AUTOMATED_DRAFT_AB, + self::STATE_AUTOMATED_DRAFT_ABVARIANT, + self::STATE_AUTOMATED_LOSER_ABVARIANT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSubcategoryAllowableValues() + { + return [ + self::SUBCATEGORY_AB_MASTER, + self::SUBCATEGORY_AB_VARIANT, + self::SUBCATEGORY_AB_LOSER_VARIANT, + self::SUBCATEGORY_PAGE_STUB, + self::SUBCATEGORY_LANDING_PAGE, + self::SUBCATEGORY_SITE_PAGE, + self::SUBCATEGORY_LEGACY_PAGE, + self::SUBCATEGORY_AB_MASTER_SITE_PAGE, + self::SUBCATEGORY_AB_VARIANT_SITE_PAGE, + self::SUBCATEGORY_AB_LOSER_VARIANT_SITE_PAGE, + self::SUBCATEGORY_PERFORMABLE_LANDING_PAGE, + self::SUBCATEGORY_PERFORMABLE_LANDING_PAGE_CUTOVER, + self::SUBCATEGORY_STAGED_PAGE, + self::SUBCATEGORY_AUTOMATED, + self::SUBCATEGORY_AUTOMATED_FOR_DEAL, + self::SUBCATEGORY_AUTOMATED_FOR_FORM, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_LEGACY, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_BUFFER, + self::SUBCATEGORY_AUTOMATED_FOR_FORM_DRAFT, + self::SUBCATEGORY_RSS_TO_EMAIL, + self::SUBCATEGORY_RSS_TO_EMAIL_CHILD, + self::SUBCATEGORY_BLOG_EMAIL, + self::SUBCATEGORY_BLOG_EMAIL_CHILD, + self::SUBCATEGORY_OPTIN_EMAIL, + self::SUBCATEGORY_OPTIN_FOLLOWUP_EMAIL, + self::SUBCATEGORY_BATCH, + self::SUBCATEGORY_RESUBSCRIBE_EMAIL, + self::SUBCATEGORY_UNSUBSCRIBE_CONFIRMATION_EMAIL, + self::SUBCATEGORY_RESUBSCRIBE_CONFIRMATION_EMAIL, + self::SUBCATEGORY_SINGLE_SEND_API, + self::SUBCATEGORY_MARKETING_SINGLE_SEND_API, + self::SUBCATEGORY_SMTP_TOKEN, + self::SUBCATEGORY_LOCALTIME, + self::SUBCATEGORY_AUTOMATED_FOR_TICKET, + self::SUBCATEGORY_AUTOMATED_FOR_LEADFLOW, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CES, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_NPS, + self::SUBCATEGORY_AUTOMATED_FOR_FEEDBACK_CUSTOM, + self::SUBCATEGORY_MEMBERSHIP_REGISTRATION, + self::SUBCATEGORY_MEMBERSHIP_PASSWORD_SAVED, + self::SUBCATEGORY_MEMBERSHIP_PASSWORD_RESET, + self::SUBCATEGORY_MEMBERSHIP_OTP_LOGIN, + self::SUBCATEGORY_MEMBERSHIP_PASSWORDLESS_AUTH, + self::SUBCATEGORY_MEMBERSHIP_EMAIL_VERIFICATION, + self::SUBCATEGORY_MEMBERSHIP_REGISTRATION_FOLLOW_UP, + self::SUBCATEGORY_MEMBERSHIP_VERIFICATION, + self::SUBCATEGORY_MEMBERSHIP_FOLLOW_UP, + self::SUBCATEGORY_TICKET_CLOSED_KICKBACK_EMAIL, + self::SUBCATEGORY_TICKET_OPENED_KICKBACK_EMAIL, + self::SUBCATEGORY_AUTOMATED_FOR_CUSTOM_SURVEY, + self::SUBCATEGORY_DISCARDABLE_STUB, + self::SUBCATEGORY_NORMAL_BLOG_POST, + self::SUBCATEGORY_LEGACY_BLOG_POST, + self::SUBCATEGORY_IMPORTED_BLOG_POST, + self::SUBCATEGORY_AUTOMATED_AB_MASTER, + self::SUBCATEGORY_AUTOMATED_AB_VARIANT, + self::SUBCATEGORY_WEB_INTERACTIVE, + self::SUBCATEGORY_PORTAL_CONTENT, + self::SUBCATEGORY_PAGE_INSTANCE_LAYOUT, + self::SUBCATEGORY_KB_ARTICLE_INSTANCE_LAYOUT, + self::SUBCATEGORY_KB_LISTING, + self::SUBCATEGORY_KB_SEARCH_RESULTS, + self::SUBCATEGORY_KB_SUPPORT_FORM, + self::SUBCATEGORY_CASE_STUDY, + self::SUBCATEGORY_CASE_STUDY_LISTING, + self::SUBCATEGORY_CASE_STUDY_INSTANCE_LAYOUT, + self::SUBCATEGORY_UNKNOWN, + ]; + } + + /** + * 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('rss_data', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('testing', $data ?? [], null); + $this->setIfExists('publish_date', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('business_unit_id', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('webversion', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('subscription_details', $data ?? [], null); + $this->setIfExists('active_domain', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('jitter_send_time', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('subcategory', $data ?? [], null); + $this->setIfExists('send_on_publish', $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 = []; + + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSubcategoryAllowableValues(); + if (!is_null($this->container['subcategory']) && !in_array($this->container['subcategory'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'subcategory', must be one of '%s'", + $this->container['subcategory'], + implode("', '", $allowedValues) + ); + } + + 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 rss_data + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null + */ + public function getRssData() + { + return $this->container['rss_data']; + } + + /** + * Sets rss_data + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null $rss_data rss_data + * + * @return self + */ + public function setRssData($rss_data) + { + if (is_null($rss_data)) { + throw new \InvalidArgumentException('non-nullable rss_data cannot be null'); + } + $this->container['rss_data'] = $rss_data; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject The subject of the email. + * + * @return self + */ + public function setSubject($subject) + { + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets testing + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null + */ + public function getTesting() + { + return $this->container['testing']; + } + + /** + * Sets testing + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null $testing testing + * + * @return self + */ + public function setTesting($testing) + { + if (is_null($testing)) { + throw new \InvalidArgumentException('non-nullable testing cannot be null'); + } + $this->container['testing'] = $testing; + + return $this; + } + + /** + * Gets publish_date + * + * @return \DateTime|null + */ + public function getPublishDate() + { + return $this->container['publish_date']; + } + + /** + * Sets publish_date + * + * @param \DateTime|null $publish_date The date and time the email is scheduled for, in ISO8601 representation. This is only used in local time or scheduled emails. + * + * @return self + */ + public function setPublishDate($publish_date) + { + if (is_null($publish_date)) { + throw new \InvalidArgumentException('non-nullable publish_date cannot be null'); + } + $this->container['publish_date'] = $publish_date; + + return $this; + } + + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets business_unit_id + * + * @return int|null + */ + public function getBusinessUnitId() + { + return $this->container['business_unit_id']; + } + + /** + * Sets business_unit_id + * + * @param int|null $business_unit_id business_unit_id + * + * @return self + */ + public function setBusinessUnitId($business_unit_id) + { + if (is_null($business_unit_id)) { + throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); + } + $this->container['business_unit_id'] = $business_unit_id; + + return $this; + } + + /** + * Gets content + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets webversion + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null + */ + public function getWebversion() + { + return $this->container['webversion']; + } + + /** + * Sets webversion + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null $webversion webversion + * + * @return self + */ + public function setWebversion($webversion) + { + if (is_null($webversion)) { + throw new \InvalidArgumentException('non-nullable webversion cannot be null'); + } + $this->container['webversion'] = $webversion; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived Determines if the email is archived or not. + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets subscription_details + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null + */ + public function getSubscriptionDetails() + { + return $this->container['subscription_details']; + } + + /** + * Sets subscription_details + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null $subscription_details subscription_details + * + * @return self + */ + public function setSubscriptionDetails($subscription_details) + { + if (is_null($subscription_details)) { + throw new \InvalidArgumentException('non-nullable subscription_details cannot be null'); + } + $this->container['subscription_details'] = $subscription_details; + + return $this; + } + + /** + * Gets active_domain + * + * @return string|null + */ + public function getActiveDomain() + { + return $this->container['active_domain']; + } + + /** + * Sets active_domain + * + * @param string|null $active_domain The active domain of the email. + * + * @return self + */ + public function setActiveDomain($active_domain) + { + if (is_null($active_domain)) { + throw new \InvalidArgumentException('non-nullable active_domain cannot be null'); + } + $this->container['active_domain'] = $active_domain; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the email, as displayed on the email dashboard. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign The ID of the campaign this email is associated to. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + throw new \InvalidArgumentException('non-nullable campaign cannot be null'); + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets from + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails|null $from from + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets jitter_send_time + * + * @return bool|null + */ + public function getJitterSendTime() + { + return $this->container['jitter_send_time']; + } + + /** + * Sets jitter_send_time + * + * @param bool|null $jitter_send_time jitter_send_time + * + * @return self + */ + public function setJitterSendTime($jitter_send_time) + { + if (is_null($jitter_send_time)) { + throw new \InvalidArgumentException('non-nullable jitter_send_time cannot be null'); + } + $this->container['jitter_send_time'] = $jitter_send_time; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state The email state. + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = $this->getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails|null $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets subcategory + * + * @return string|null + */ + public function getSubcategory() + { + return $this->container['subcategory']; + } + + /** + * Sets subcategory + * + * @param string|null $subcategory The email subcategory. + * + * @return self + */ + public function setSubcategory($subcategory) + { + if (is_null($subcategory)) { + throw new \InvalidArgumentException('non-nullable subcategory cannot be null'); + } + $allowedValues = $this->getSubcategoryAllowableValues(); + if (!in_array($subcategory, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'subcategory', must be one of '%s'", + $subcategory, + implode("', '", $allowedValues) + ) + ); + } + $this->container['subcategory'] = $subcategory; + + return $this; + } + + /** + * Gets send_on_publish + * + * @return bool|null + */ + public function getSendOnPublish() + { + return $this->container['send_on_publish']; + } + + /** + * Sets send_on_publish + * + * @param bool|null $send_on_publish Determines whether the email will be sent immediately on publish. + * + * @return self + */ + public function setSendOnPublish($send_on_publish) + { + if (is_null($send_on_publish)) { + throw new \InvalidArgumentException('non-nullable send_on_publish cannot be null'); + } + $this->container['send_on_publish'] = $send_on_publish; + + 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/codegen/Marketing/Emails/Model/Error.php b/codegen/Marketing/Emails/Model/Error.php new file mode 100644 index 000000000..a3f8ebe48 --- /dev/null +++ b/codegen/Marketing/Emails/Model/Error.php @@ -0,0 +1,622 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'context' => 'array', + 'correlation_id' => 'string', + 'links' => 'array', + 'message' => 'string', + 'category' => 'string', + 'errors' => '\HubSpot\Client\Marketing\Emails\Model\ErrorDetail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'correlation_id' => 'uuid', + 'links' => null, + 'message' => null, + 'category' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'correlation_id' => 'correlationId', + 'links' => 'links', + 'message' => 'message', + 'category' => 'category', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'correlation_id' => 'setCorrelationId', + 'links' => 'setLinks', + 'message' => 'setMessage', + 'category' => 'setCategory', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'correlation_id' => 'getCorrelationId', + 'links' => 'getLinks', + 'message' => 'getMessage', + 'category' => 'getCategory', + 'errors' => 'getErrors' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $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['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' 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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets correlation_id + * + * @return string + */ + public function getCorrelationId() + { + return $this->container['correlation_id']; + } + + /** + * Sets correlation_id + * + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return self + */ + public function setCorrelationId($correlation_id) + { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } + $this->container['correlation_id'] = $correlation_id; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Marketing\Emails\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Marketing\Emails\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @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/codegen/Marketing/Emails/Model/ErrorDetail.php b/codegen/Marketing/Emails/Model/ErrorDetail.php new file mode 100644 index 000000000..f74372909 --- /dev/null +++ b/codegen/Marketing/Emails/Model/ErrorDetail.php @@ -0,0 +1,548 @@ + + */ +class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'code' => 'string', + 'in' => 'string', + 'context' => 'array', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'code' => null, + 'in' => null, + 'context' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => 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 = [ + 'sub_category' => 'subCategory', + 'code' => 'code', + 'in' => 'in', + 'context' => 'context', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'code' => 'setCode', + 'in' => 'setIn', + 'context' => 'setContext', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'code' => 'getCode', + 'in' => 'getIn', + 'context' => 'getContext', + '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('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $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['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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The status code associated with the error detail + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets in + * + * @return string|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string|null $in The name of the field or parameter in which the error was found. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @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/codegen/Marketing/Emails/Model/ForwardPaging.php b/codegen/Marketing/Emails/Model/ForwardPaging.php new file mode 100644 index 000000000..356f53eb4 --- /dev/null +++ b/codegen/Marketing/Emails/Model/ForwardPaging.php @@ -0,0 +1,409 @@ + + */ +class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Marketing\Emails\Model\NextPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => 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 = [ + 'next' => 'next' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext' + ]; + + /** + * 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('next', $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 next + * + * @return \HubSpot\Client\Marketing\Emails\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Marketing\Emails\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + 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/codegen/Marketing/Emails/Model/Interval.php b/codegen/Marketing/Emails/Model/Interval.php new file mode 100644 index 000000000..db3f7de49 --- /dev/null +++ b/codegen/Marketing/Emails/Model/Interval.php @@ -0,0 +1,449 @@ + + */ +class Interval implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Interval'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start' => '\DateTime', + 'end' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start' => 'date-time', + 'end' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start' => false, + 'end' => 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 = [ + 'start' => 'start', + 'end' => 'end' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start' => 'setStart', + 'end' => 'setEnd' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start' => 'getStart', + 'end' => 'getEnd' + ]; + + /** + * 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('start', $data ?? [], null); + $this->setIfExists('end', $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['start'] === null) { + $invalidProperties[] = "'start' can't be null"; + } + if ($this->container['end'] === null) { + $invalidProperties[] = "'end' 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 start + * + * @return \DateTime + */ + public function getStart() + { + return $this->container['start']; + } + + /** + * Sets start + * + * @param \DateTime $start start + * + * @return self + */ + public function setStart($start) + { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } + $this->container['start'] = $start; + + return $this; + } + + /** + * Gets end + * + * @return \DateTime + */ + public function getEnd() + { + return $this->container['end']; + } + + /** + * Sets end + * + * @param \DateTime $end end + * + * @return self + */ + public function setEnd($end) + { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } + $this->container['end'] = $end; + + 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/codegen/Marketing/Emails/Model/ModelInterface.php b/codegen/Marketing/Emails/Model/ModelInterface.php new file mode 100644 index 000000000..b360cad34 --- /dev/null +++ b/codegen/Marketing/Emails/Model/ModelInterface.php @@ -0,0 +1,111 @@ + + */ +class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NextPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'link' => 'string', + 'after' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'link' => null, + 'after' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => 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 = [ + 'link' => 'link', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'link' => 'setLink', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'link' => 'getLink', + 'after' => 'getAfter' + ]; + + /** + * 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('link', $data ?? [], null); + $this->setIfExists('after', $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['after'] === null) { + $invalidProperties[] = "'after' 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 link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link The link to the next page. + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + return $this; + } + + /** + * Gets after + * + * @return string + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string $after The cursor token value to get the next set of results. Use this value as query parameter (&after=...) to obtain the next page. + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } + $this->container['after'] = $after; + + 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/codegen/Marketing/Emails/Model/Paging.php b/codegen/Marketing/Emails/Model/Paging.php new file mode 100644 index 000000000..d082af488 --- /dev/null +++ b/codegen/Marketing/Emails/Model/Paging.php @@ -0,0 +1,447 @@ + + */ +class Paging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Paging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Marketing\Emails\Model\NextPage', + 'prev' => '\HubSpot\Client\Marketing\Emails\Model\PreviousPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null, + 'prev' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => 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 = [ + 'next' => 'next', + 'prev' => 'prev' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext', + 'prev' => 'setPrev' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext', + 'prev' => 'getPrev' + ]; + + /** + * 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('next', $data ?? [], null); + $this->setIfExists('prev', $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['next'] === null) { + $invalidProperties[] = "'next' 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 next + * + * @return \HubSpot\Client\Marketing\Emails\Model\NextPage + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Marketing\Emails\Model\NextPage $next next + * + * @return self + */ + public function setNext($next) + { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + return $this; + } + + /** + * Gets prev + * + * @return \HubSpot\Client\Marketing\Emails\Model\PreviousPage|null + */ + public function getPrev() + { + return $this->container['prev']; + } + + /** + * Sets prev + * + * @param \HubSpot\Client\Marketing\Emails\Model\PreviousPage|null $prev prev + * + * @return self + */ + public function setPrev($prev) + { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } + $this->container['prev'] = $prev; + + 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/codegen/Marketing/Emails/Model/PreviousPage.php b/codegen/Marketing/Emails/Model/PreviousPage.php new file mode 100644 index 000000000..367dcd946 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PreviousPage.php @@ -0,0 +1,447 @@ + + */ +class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PreviousPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'before' => 'string', + 'link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'before' => null, + 'link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => 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 = [ + 'before' => 'before', + 'link' => 'link' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'before' => 'setBefore', + 'link' => 'setLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'before' => 'getBefore', + 'link' => 'getLink' + ]; + + /** + * 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('before', $data ?? [], null); + $this->setIfExists('link', $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['before'] === null) { + $invalidProperties[] = "'before' 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 before + * + * @return string + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param string $before The cursor token value to get the previous set of results. Use this value as query parameter (&before=...) to obtain the previous page. + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link The link to the previous page. + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + 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/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php b/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php new file mode 100644 index 000000000..39955fd7e --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php @@ -0,0 +1,477 @@ + + */ +class PublicButtonStyleSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicButtonStyleSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'background_color' => 'object', + 'font_style' => '\HubSpot\Client\Marketing\Emails\Model\PublicFontStyle', + 'corner_radius' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'background_color' => null, + 'font_style' => null, + 'corner_radius' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'background_color' => false, + 'font_style' => false, + 'corner_radius' => 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 = [ + 'background_color' => 'backgroundColor', + 'font_style' => 'fontStyle', + 'corner_radius' => 'cornerRadius' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'background_color' => 'setBackgroundColor', + 'font_style' => 'setFontStyle', + 'corner_radius' => 'setCornerRadius' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'background_color' => 'getBackgroundColor', + 'font_style' => 'getFontStyle', + 'corner_radius' => 'getCornerRadius' + ]; + + /** + * 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('background_color', $data ?? [], null); + $this->setIfExists('font_style', $data ?? [], null); + $this->setIfExists('corner_radius', $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 background_color + * + * @return object|null + */ + public function getBackgroundColor() + { + return $this->container['background_color']; + } + + /** + * Sets background_color + * + * @param object|null $background_color background_color + * + * @return self + */ + public function setBackgroundColor($background_color) + { + if (is_null($background_color)) { + throw new \InvalidArgumentException('non-nullable background_color cannot be null'); + } + $this->container['background_color'] = $background_color; + + return $this; + } + + /** + * Gets font_style + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null + */ + public function getFontStyle() + { + return $this->container['font_style']; + } + + /** + * Sets font_style + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null $font_style font_style + * + * @return self + */ + public function setFontStyle($font_style) + { + if (is_null($font_style)) { + throw new \InvalidArgumentException('non-nullable font_style cannot be null'); + } + $this->container['font_style'] = $font_style; + + return $this; + } + + /** + * Gets corner_radius + * + * @return int|null + */ + public function getCornerRadius() + { + return $this->container['corner_radius']; + } + + /** + * Sets corner_radius + * + * @param int|null $corner_radius corner_radius + * + * @return self + */ + public function setCornerRadius($corner_radius) + { + if (is_null($corner_radius)) { + throw new \InvalidArgumentException('non-nullable corner_radius cannot be null'); + } + $this->container['corner_radius'] = $corner_radius; + + 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/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php b/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php new file mode 100644 index 000000000..2707683c4 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php @@ -0,0 +1,477 @@ + + */ +class PublicDividerStyleSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDividerStyleSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'color' => 'object', + 'line_type' => 'string', + 'height' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'color' => null, + 'line_type' => null, + 'height' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'color' => false, + 'line_type' => false, + 'height' => 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 = [ + 'color' => 'color', + 'line_type' => 'lineType', + 'height' => 'height' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'color' => 'setColor', + 'line_type' => 'setLineType', + 'height' => 'setHeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'color' => 'getColor', + 'line_type' => 'getLineType', + 'height' => 'getHeight' + ]; + + /** + * 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('color', $data ?? [], null); + $this->setIfExists('line_type', $data ?? [], null); + $this->setIfExists('height', $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 color + * + * @return object|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param object|null $color color + * + * @return self + */ + public function setColor($color) + { + if (is_null($color)) { + throw new \InvalidArgumentException('non-nullable color cannot be null'); + } + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets line_type + * + * @return string|null + */ + public function getLineType() + { + return $this->container['line_type']; + } + + /** + * Sets line_type + * + * @param string|null $line_type line_type + * + * @return self + */ + public function setLineType($line_type) + { + if (is_null($line_type)) { + throw new \InvalidArgumentException('non-nullable line_type cannot be null'); + } + $this->container['line_type'] = $line_type; + + return $this; + } + + /** + * Gets height + * + * @return int|null + */ + public function getHeight() + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return self + */ + public function setHeight($height) + { + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + 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/codegen/Marketing/Emails/Model/PublicEmail.php b/codegen/Marketing/Emails/Model/PublicEmail.php new file mode 100644 index 000000000..49737686f --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmail.php @@ -0,0 +1,3383 @@ + + */ +class PublicEmail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'feedback_survey_id' => 'string', + 'subject' => 'string', + 'publish_date' => '\DateTime', + 'is_transactional' => 'bool', + 'language' => 'string', + 'type' => 'string', + 'content' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailContent', + 'business_unit_id' => 'string', + 'webversion' => '\HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails', + 'workflow_names' => 'string[]', + 'archived' => 'bool', + 'created_at' => '\DateTime', + 'stats' => '\HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData', + 'jitter_send_time' => 'bool', + 'from' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails', + 'id' => 'string', + 'state' => 'string', + 'created_by_id' => 'string', + 'updated_at' => '\DateTime', + 'rss_data' => '\HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails', + 'published_at' => '\DateTime', + 'published_by_id' => 'string', + 'is_published' => 'bool', + 'testing' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails', + 'updated_by_id' => 'string', + 'folder_id' => 'int', + 'subscription_details' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails', + 'deleted_at' => '\DateTime', + 'name' => 'string', + 'active_domain' => 'string', + 'campaign' => 'string', + 'to' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails', + 'subcategory' => 'string', + 'campaign_name' => 'string', + 'send_on_publish' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'feedback_survey_id' => null, + 'subject' => null, + 'publish_date' => 'date-time', + 'is_transactional' => null, + 'language' => null, + 'type' => null, + 'content' => null, + 'business_unit_id' => null, + 'webversion' => null, + 'workflow_names' => null, + 'archived' => null, + 'created_at' => 'date-time', + 'stats' => null, + 'jitter_send_time' => null, + 'from' => null, + 'id' => null, + 'state' => null, + 'created_by_id' => null, + 'updated_at' => 'date-time', + 'rss_data' => null, + 'published_at' => 'date-time', + 'published_by_id' => null, + 'is_published' => null, + 'testing' => null, + 'updated_by_id' => null, + 'folder_id' => 'int64', + 'subscription_details' => null, + 'deleted_at' => 'date-time', + 'name' => null, + 'active_domain' => null, + 'campaign' => null, + 'to' => null, + 'subcategory' => null, + 'campaign_name' => null, + 'send_on_publish' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'feedback_survey_id' => false, + 'subject' => false, + 'publish_date' => false, + 'is_transactional' => false, + 'language' => false, + 'type' => false, + 'content' => false, + 'business_unit_id' => false, + 'webversion' => false, + 'workflow_names' => false, + 'archived' => false, + 'created_at' => false, + 'stats' => false, + 'jitter_send_time' => false, + 'from' => false, + 'id' => false, + 'state' => false, + 'created_by_id' => false, + 'updated_at' => false, + 'rss_data' => false, + 'published_at' => false, + 'published_by_id' => false, + 'is_published' => false, + 'testing' => false, + 'updated_by_id' => false, + 'folder_id' => false, + 'subscription_details' => false, + 'deleted_at' => false, + 'name' => false, + 'active_domain' => false, + 'campaign' => false, + 'to' => false, + 'subcategory' => false, + 'campaign_name' => false, + 'send_on_publish' => 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 = [ + 'feedback_survey_id' => 'feedbackSurveyId', + 'subject' => 'subject', + 'publish_date' => 'publishDate', + 'is_transactional' => 'isTransactional', + 'language' => 'language', + 'type' => 'type', + 'content' => 'content', + 'business_unit_id' => 'businessUnitId', + 'webversion' => 'webversion', + 'workflow_names' => 'workflowNames', + 'archived' => 'archived', + 'created_at' => 'createdAt', + 'stats' => 'stats', + 'jitter_send_time' => 'jitterSendTime', + 'from' => 'from', + 'id' => 'id', + 'state' => 'state', + 'created_by_id' => 'createdById', + 'updated_at' => 'updatedAt', + 'rss_data' => 'rssData', + 'published_at' => 'publishedAt', + 'published_by_id' => 'publishedById', + 'is_published' => 'isPublished', + 'testing' => 'testing', + 'updated_by_id' => 'updatedById', + 'folder_id' => 'folderId', + 'subscription_details' => 'subscriptionDetails', + 'deleted_at' => 'deletedAt', + 'name' => 'name', + 'active_domain' => 'activeDomain', + 'campaign' => 'campaign', + 'to' => 'to', + 'subcategory' => 'subcategory', + 'campaign_name' => 'campaignName', + 'send_on_publish' => 'sendOnPublish' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'feedback_survey_id' => 'setFeedbackSurveyId', + 'subject' => 'setSubject', + 'publish_date' => 'setPublishDate', + 'is_transactional' => 'setIsTransactional', + 'language' => 'setLanguage', + 'type' => 'setType', + 'content' => 'setContent', + 'business_unit_id' => 'setBusinessUnitId', + 'webversion' => 'setWebversion', + 'workflow_names' => 'setWorkflowNames', + 'archived' => 'setArchived', + 'created_at' => 'setCreatedAt', + 'stats' => 'setStats', + 'jitter_send_time' => 'setJitterSendTime', + 'from' => 'setFrom', + 'id' => 'setId', + 'state' => 'setState', + 'created_by_id' => 'setCreatedById', + 'updated_at' => 'setUpdatedAt', + 'rss_data' => 'setRssData', + 'published_at' => 'setPublishedAt', + 'published_by_id' => 'setPublishedById', + 'is_published' => 'setIsPublished', + 'testing' => 'setTesting', + 'updated_by_id' => 'setUpdatedById', + 'folder_id' => 'setFolderId', + 'subscription_details' => 'setSubscriptionDetails', + 'deleted_at' => 'setDeletedAt', + 'name' => 'setName', + 'active_domain' => 'setActiveDomain', + 'campaign' => 'setCampaign', + 'to' => 'setTo', + 'subcategory' => 'setSubcategory', + 'campaign_name' => 'setCampaignName', + 'send_on_publish' => 'setSendOnPublish' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'feedback_survey_id' => 'getFeedbackSurveyId', + 'subject' => 'getSubject', + 'publish_date' => 'getPublishDate', + 'is_transactional' => 'getIsTransactional', + 'language' => 'getLanguage', + 'type' => 'getType', + 'content' => 'getContent', + 'business_unit_id' => 'getBusinessUnitId', + 'webversion' => 'getWebversion', + 'workflow_names' => 'getWorkflowNames', + 'archived' => 'getArchived', + 'created_at' => 'getCreatedAt', + 'stats' => 'getStats', + 'jitter_send_time' => 'getJitterSendTime', + 'from' => 'getFrom', + 'id' => 'getId', + 'state' => 'getState', + 'created_by_id' => 'getCreatedById', + 'updated_at' => 'getUpdatedAt', + 'rss_data' => 'getRssData', + 'published_at' => 'getPublishedAt', + 'published_by_id' => 'getPublishedById', + 'is_published' => 'getIsPublished', + 'testing' => 'getTesting', + 'updated_by_id' => 'getUpdatedById', + 'folder_id' => 'getFolderId', + 'subscription_details' => 'getSubscriptionDetails', + 'deleted_at' => 'getDeletedAt', + 'name' => 'getName', + 'active_domain' => 'getActiveDomain', + 'campaign' => 'getCampaign', + 'to' => 'getTo', + 'subcategory' => 'getSubcategory', + 'campaign_name' => 'getCampaignName', + 'send_on_publish' => 'getSendOnPublish' + ]; + + /** + * 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 LANGUAGE_AF = 'af'; + public const LANGUAGE_AF_NA = 'af-na'; + public const LANGUAGE_AF_ZA = 'af-za'; + public const LANGUAGE_AGQ = 'agq'; + public const LANGUAGE_AGQ_CM = 'agq-cm'; + public const LANGUAGE_AK = 'ak'; + public const LANGUAGE_AK_GH = 'ak-gh'; + public const LANGUAGE_AM = 'am'; + public const LANGUAGE_AM_ET = 'am-et'; + public const LANGUAGE_ANN = 'ann'; + public const LANGUAGE_ANN_NG = 'ann-ng'; + public const LANGUAGE_AR = 'ar'; + public const LANGUAGE_AR_001 = 'ar-001'; + public const LANGUAGE_AR_AE = 'ar-ae'; + public const LANGUAGE_AR_BH = 'ar-bh'; + public const LANGUAGE_AR_DJ = 'ar-dj'; + public const LANGUAGE_AR_DZ = 'ar-dz'; + public const LANGUAGE_AR_EG = 'ar-eg'; + public const LANGUAGE_AR_EH = 'ar-eh'; + public const LANGUAGE_AR_ER = 'ar-er'; + public const LANGUAGE_AR_IL = 'ar-il'; + public const LANGUAGE_AR_IQ = 'ar-iq'; + public const LANGUAGE_AR_JO = 'ar-jo'; + public const LANGUAGE_AR_KM = 'ar-km'; + public const LANGUAGE_AR_KW = 'ar-kw'; + public const LANGUAGE_AR_LB = 'ar-lb'; + public const LANGUAGE_AR_LY = 'ar-ly'; + public const LANGUAGE_AR_MA = 'ar-ma'; + public const LANGUAGE_AR_MR = 'ar-mr'; + public const LANGUAGE_AR_OM = 'ar-om'; + public const LANGUAGE_AR_PS = 'ar-ps'; + public const LANGUAGE_AR_QA = 'ar-qa'; + public const LANGUAGE_AR_SA = 'ar-sa'; + public const LANGUAGE_AR_SD = 'ar-sd'; + public const LANGUAGE_AR_SO = 'ar-so'; + public const LANGUAGE_AR_SS = 'ar-ss'; + public const LANGUAGE_AR_SY = 'ar-sy'; + public const LANGUAGE_AR_TD = 'ar-td'; + public const LANGUAGE_AR_TN = 'ar-tn'; + public const LANGUAGE_AR_YE = 'ar-ye'; + public const LANGUAGE__AS = 'as'; + public const LANGUAGE_ASA = 'asa'; + public const LANGUAGE_ASA_TZ = 'asa-tz'; + public const LANGUAGE_AST = 'ast'; + public const LANGUAGE_AST_ES = 'ast-es'; + public const LANGUAGE_AS_IN = 'as-in'; + public const LANGUAGE_AZ = 'az'; + public const LANGUAGE_AZ_AZ = 'az-az'; + public const LANGUAGE_BAS = 'bas'; + public const LANGUAGE_BAS_CM = 'bas-cm'; + public const LANGUAGE_BE = 'be'; + public const LANGUAGE_BEM = 'bem'; + public const LANGUAGE_BEM_ZM = 'bem-zm'; + public const LANGUAGE_BEZ = 'bez'; + public const LANGUAGE_BEZ_TZ = 'bez-tz'; + public const LANGUAGE_BE_BY = 'be-by'; + public const LANGUAGE_BG = 'bg'; + public const LANGUAGE_BGC = 'bgc'; + public const LANGUAGE_BGC_IN = 'bgc-in'; + public const LANGUAGE_BG_BG = 'bg-bg'; + public const LANGUAGE_BHO = 'bho'; + public const LANGUAGE_BHO_IN = 'bho-in'; + public const LANGUAGE_BM = 'bm'; + public const LANGUAGE_BM_ML = 'bm-ml'; + public const LANGUAGE_BN = 'bn'; + public const LANGUAGE_BN_BD = 'bn-bd'; + public const LANGUAGE_BN_IN = 'bn-in'; + public const LANGUAGE_BO = 'bo'; + public const LANGUAGE_BO_CN = 'bo-cn'; + public const LANGUAGE_BO_IN = 'bo-in'; + public const LANGUAGE_BR = 'br'; + public const LANGUAGE_BRX = 'brx'; + public const LANGUAGE_BRX_IN = 'brx-in'; + public const LANGUAGE_BR_FR = 'br-fr'; + public const LANGUAGE_BS = 'bs'; + public const LANGUAGE_BS_BA = 'bs-ba'; + public const LANGUAGE_CA = 'ca'; + public const LANGUAGE_CA_AD = 'ca-ad'; + public const LANGUAGE_CA_ES = 'ca-es'; + public const LANGUAGE_CA_FR = 'ca-fr'; + public const LANGUAGE_CA_IT = 'ca-it'; + public const LANGUAGE_CCP = 'ccp'; + public const LANGUAGE_CCP_BD = 'ccp-bd'; + public const LANGUAGE_CCP_IN = 'ccp-in'; + public const LANGUAGE_CE = 'ce'; + public const LANGUAGE_CEB = 'ceb'; + public const LANGUAGE_CEB_PH = 'ceb-ph'; + public const LANGUAGE_CE_RU = 'ce-ru'; + public const LANGUAGE_CGG = 'cgg'; + public const LANGUAGE_CGG_UG = 'cgg-ug'; + public const LANGUAGE_CHR = 'chr'; + public const LANGUAGE_CHR_US = 'chr-us'; + public const LANGUAGE_CKB = 'ckb'; + public const LANGUAGE_CKB_IQ = 'ckb-iq'; + public const LANGUAGE_CKB_IR = 'ckb-ir'; + public const LANGUAGE_CS = 'cs'; + public const LANGUAGE_CS_CZ = 'cs-cz'; + public const LANGUAGE_CU = 'cu'; + public const LANGUAGE_CU_RU = 'cu-ru'; + public const LANGUAGE_CV = 'cv'; + public const LANGUAGE_CV_RU = 'cv-ru'; + public const LANGUAGE_CY = 'cy'; + public const LANGUAGE_CY_GB = 'cy-gb'; + public const LANGUAGE_DA = 'da'; + public const LANGUAGE_DAV = 'dav'; + public const LANGUAGE_DAV_KE = 'dav-ke'; + public const LANGUAGE_DA_DK = 'da-dk'; + public const LANGUAGE_DA_GL = 'da-gl'; + public const LANGUAGE_DE = 'de'; + public const LANGUAGE_DE_AT = 'de-at'; + public const LANGUAGE_DE_BE = 'de-be'; + public const LANGUAGE_DE_CH = 'de-ch'; + public const LANGUAGE_DE_DE = 'de-de'; + public const LANGUAGE_DE_GR = 'de-gr'; + public const LANGUAGE_DE_IT = 'de-it'; + public const LANGUAGE_DE_LI = 'de-li'; + public const LANGUAGE_DE_LU = 'de-lu'; + public const LANGUAGE_DJE = 'dje'; + public const LANGUAGE_DJE_NE = 'dje-ne'; + public const LANGUAGE_DOI = 'doi'; + public const LANGUAGE_DOI_IN = 'doi-in'; + public const LANGUAGE_DSB = 'dsb'; + public const LANGUAGE_DSB_DE = 'dsb-de'; + public const LANGUAGE_DUA = 'dua'; + public const LANGUAGE_DUA_CM = 'dua-cm'; + public const LANGUAGE_DYO = 'dyo'; + public const LANGUAGE_DYO_SN = 'dyo-sn'; + public const LANGUAGE_DZ = 'dz'; + public const LANGUAGE_DZ_BT = 'dz-bt'; + public const LANGUAGE_EBU = 'ebu'; + public const LANGUAGE_EBU_KE = 'ebu-ke'; + public const LANGUAGE_EE = 'ee'; + public const LANGUAGE_EE_GH = 'ee-gh'; + public const LANGUAGE_EE_TG = 'ee-tg'; + public const LANGUAGE_EL = 'el'; + public const LANGUAGE_EL_CY = 'el-cy'; + public const LANGUAGE_EL_GR = 'el-gr'; + public const LANGUAGE_EN = 'en'; + public const LANGUAGE_EN_001 = 'en-001'; + public const LANGUAGE_EN_150 = 'en-150'; + public const LANGUAGE_EN_AE = 'en-ae'; + public const LANGUAGE_EN_AG = 'en-ag'; + public const LANGUAGE_EN_AI = 'en-ai'; + public const LANGUAGE_EN_AS = 'en-as'; + public const LANGUAGE_EN_AT = 'en-at'; + public const LANGUAGE_EN_AU = 'en-au'; + public const LANGUAGE_EN_BB = 'en-bb'; + public const LANGUAGE_EN_BE = 'en-be'; + public const LANGUAGE_EN_BI = 'en-bi'; + public const LANGUAGE_EN_BM = 'en-bm'; + public const LANGUAGE_EN_BS = 'en-bs'; + public const LANGUAGE_EN_BW = 'en-bw'; + public const LANGUAGE_EN_BZ = 'en-bz'; + public const LANGUAGE_EN_CA = 'en-ca'; + public const LANGUAGE_EN_CC = 'en-cc'; + public const LANGUAGE_EN_CH = 'en-ch'; + public const LANGUAGE_EN_CK = 'en-ck'; + public const LANGUAGE_EN_CM = 'en-cm'; + public const LANGUAGE_EN_CN = 'en-cn'; + public const LANGUAGE_EN_CX = 'en-cx'; + public const LANGUAGE_EN_CY = 'en-cy'; + public const LANGUAGE_EN_DE = 'en-de'; + public const LANGUAGE_EN_DG = 'en-dg'; + public const LANGUAGE_EN_DK = 'en-dk'; + public const LANGUAGE_EN_DM = 'en-dm'; + public const LANGUAGE_EN_EE = 'en-ee'; + public const LANGUAGE_EN_ER = 'en-er'; + public const LANGUAGE_EN_FI = 'en-fi'; + public const LANGUAGE_EN_FJ = 'en-fj'; + public const LANGUAGE_EN_FK = 'en-fk'; + public const LANGUAGE_EN_FM = 'en-fm'; + public const LANGUAGE_EN_FR = 'en-fr'; + public const LANGUAGE_EN_GB = 'en-gb'; + public const LANGUAGE_EN_GD = 'en-gd'; + public const LANGUAGE_EN_GG = 'en-gg'; + public const LANGUAGE_EN_GH = 'en-gh'; + public const LANGUAGE_EN_GI = 'en-gi'; + public const LANGUAGE_EN_GM = 'en-gm'; + public const LANGUAGE_EN_GU = 'en-gu'; + public const LANGUAGE_EN_GY = 'en-gy'; + public const LANGUAGE_EN_HK = 'en-hk'; + public const LANGUAGE_EN_IE = 'en-ie'; + public const LANGUAGE_EN_IL = 'en-il'; + public const LANGUAGE_EN_IM = 'en-im'; + public const LANGUAGE_EN_IN = 'en-in'; + public const LANGUAGE_EN_IO = 'en-io'; + public const LANGUAGE_EN_JE = 'en-je'; + public const LANGUAGE_EN_JM = 'en-jm'; + public const LANGUAGE_EN_KE = 'en-ke'; + public const LANGUAGE_EN_KI = 'en-ki'; + public const LANGUAGE_EN_KN = 'en-kn'; + public const LANGUAGE_EN_KY = 'en-ky'; + public const LANGUAGE_EN_LC = 'en-lc'; + public const LANGUAGE_EN_LR = 'en-lr'; + public const LANGUAGE_EN_LS = 'en-ls'; + public const LANGUAGE_EN_LU = 'en-lu'; + public const LANGUAGE_EN_MG = 'en-mg'; + public const LANGUAGE_EN_MH = 'en-mh'; + public const LANGUAGE_EN_MO = 'en-mo'; + public const LANGUAGE_EN_MP = 'en-mp'; + public const LANGUAGE_EN_MS = 'en-ms'; + public const LANGUAGE_EN_MT = 'en-mt'; + public const LANGUAGE_EN_MU = 'en-mu'; + public const LANGUAGE_EN_MV = 'en-mv'; + public const LANGUAGE_EN_MW = 'en-mw'; + public const LANGUAGE_EN_MX = 'en-mx'; + public const LANGUAGE_EN_MY = 'en-my'; + public const LANGUAGE_EN_NA = 'en-na'; + public const LANGUAGE_EN_NF = 'en-nf'; + public const LANGUAGE_EN_NG = 'en-ng'; + public const LANGUAGE_EN_NL = 'en-nl'; + public const LANGUAGE_EN_NR = 'en-nr'; + public const LANGUAGE_EN_NU = 'en-nu'; + public const LANGUAGE_EN_NZ = 'en-nz'; + public const LANGUAGE_EN_PG = 'en-pg'; + public const LANGUAGE_EN_PH = 'en-ph'; + public const LANGUAGE_EN_PK = 'en-pk'; + public const LANGUAGE_EN_PN = 'en-pn'; + public const LANGUAGE_EN_PR = 'en-pr'; + public const LANGUAGE_EN_PW = 'en-pw'; + public const LANGUAGE_EN_RW = 'en-rw'; + public const LANGUAGE_EN_SB = 'en-sb'; + public const LANGUAGE_EN_SC = 'en-sc'; + public const LANGUAGE_EN_SD = 'en-sd'; + public const LANGUAGE_EN_SE = 'en-se'; + public const LANGUAGE_EN_SG = 'en-sg'; + public const LANGUAGE_EN_SH = 'en-sh'; + public const LANGUAGE_EN_SI = 'en-si'; + public const LANGUAGE_EN_SL = 'en-sl'; + public const LANGUAGE_EN_SS = 'en-ss'; + public const LANGUAGE_EN_SX = 'en-sx'; + public const LANGUAGE_EN_SZ = 'en-sz'; + public const LANGUAGE_EN_TC = 'en-tc'; + public const LANGUAGE_EN_TK = 'en-tk'; + public const LANGUAGE_EN_TO = 'en-to'; + public const LANGUAGE_EN_TT = 'en-tt'; + public const LANGUAGE_EN_TV = 'en-tv'; + public const LANGUAGE_EN_TZ = 'en-tz'; + public const LANGUAGE_EN_UG = 'en-ug'; + public const LANGUAGE_EN_UM = 'en-um'; + public const LANGUAGE_EN_US = 'en-us'; + public const LANGUAGE_EN_VC = 'en-vc'; + public const LANGUAGE_EN_VG = 'en-vg'; + public const LANGUAGE_EN_VI = 'en-vi'; + public const LANGUAGE_EN_VU = 'en-vu'; + public const LANGUAGE_EN_WS = 'en-ws'; + public const LANGUAGE_EN_ZA = 'en-za'; + public const LANGUAGE_EN_ZM = 'en-zm'; + public const LANGUAGE_EN_ZW = 'en-zw'; + public const LANGUAGE_EO = 'eo'; + public const LANGUAGE_EO_001 = 'eo-001'; + public const LANGUAGE_ES = 'es'; + public const LANGUAGE_ES_419 = 'es-419'; + public const LANGUAGE_ES_AR = 'es-ar'; + public const LANGUAGE_ES_BO = 'es-bo'; + public const LANGUAGE_ES_BR = 'es-br'; + public const LANGUAGE_ES_BZ = 'es-bz'; + public const LANGUAGE_ES_CL = 'es-cl'; + public const LANGUAGE_ES_CO = 'es-co'; + public const LANGUAGE_ES_CR = 'es-cr'; + public const LANGUAGE_ES_CU = 'es-cu'; + public const LANGUAGE_ES_DO = 'es-do'; + public const LANGUAGE_ES_EA = 'es-ea'; + public const LANGUAGE_ES_EC = 'es-ec'; + public const LANGUAGE_ES_ES = 'es-es'; + public const LANGUAGE_ES_GQ = 'es-gq'; + public const LANGUAGE_ES_GT = 'es-gt'; + public const LANGUAGE_ES_HN = 'es-hn'; + public const LANGUAGE_ES_IC = 'es-ic'; + public const LANGUAGE_ES_MX = 'es-mx'; + public const LANGUAGE_ES_NI = 'es-ni'; + public const LANGUAGE_ES_PA = 'es-pa'; + public const LANGUAGE_ES_PE = 'es-pe'; + public const LANGUAGE_ES_PH = 'es-ph'; + public const LANGUAGE_ES_PR = 'es-pr'; + public const LANGUAGE_ES_PY = 'es-py'; + public const LANGUAGE_ES_SV = 'es-sv'; + public const LANGUAGE_ES_US = 'es-us'; + public const LANGUAGE_ES_UY = 'es-uy'; + public const LANGUAGE_ES_VE = 'es-ve'; + public const LANGUAGE_ET = 'et'; + public const LANGUAGE_ET_EE = 'et-ee'; + public const LANGUAGE_EU = 'eu'; + public const LANGUAGE_EU_ES = 'eu-es'; + public const LANGUAGE_EWO = 'ewo'; + public const LANGUAGE_EWO_CM = 'ewo-cm'; + public const LANGUAGE_FA = 'fa'; + public const LANGUAGE_FA_AF = 'fa-af'; + public const LANGUAGE_FA_IR = 'fa-ir'; + public const LANGUAGE_FF = 'ff'; + public const LANGUAGE_FF_BF = 'ff-bf'; + public const LANGUAGE_FF_CM = 'ff-cm'; + public const LANGUAGE_FF_GH = 'ff-gh'; + public const LANGUAGE_FF_GM = 'ff-gm'; + public const LANGUAGE_FF_GN = 'ff-gn'; + public const LANGUAGE_FF_GW = 'ff-gw'; + public const LANGUAGE_FF_LR = 'ff-lr'; + public const LANGUAGE_FF_MR = 'ff-mr'; + public const LANGUAGE_FF_NE = 'ff-ne'; + public const LANGUAGE_FF_NG = 'ff-ng'; + public const LANGUAGE_FF_SL = 'ff-sl'; + public const LANGUAGE_FF_SN = 'ff-sn'; + public const LANGUAGE_FI = 'fi'; + public const LANGUAGE_FIL = 'fil'; + public const LANGUAGE_FIL_PH = 'fil-ph'; + public const LANGUAGE_FI_FI = 'fi-fi'; + public const LANGUAGE_FO = 'fo'; + public const LANGUAGE_FO_DK = 'fo-dk'; + public const LANGUAGE_FO_FO = 'fo-fo'; + public const LANGUAGE_FR = 'fr'; + public const LANGUAGE_FRR = 'frr'; + public const LANGUAGE_FRR_DE = 'frr-de'; + public const LANGUAGE_FR_BE = 'fr-be'; + public const LANGUAGE_FR_BF = 'fr-bf'; + public const LANGUAGE_FR_BI = 'fr-bi'; + public const LANGUAGE_FR_BJ = 'fr-bj'; + public const LANGUAGE_FR_BL = 'fr-bl'; + public const LANGUAGE_FR_CA = 'fr-ca'; + public const LANGUAGE_FR_CD = 'fr-cd'; + public const LANGUAGE_FR_CF = 'fr-cf'; + public const LANGUAGE_FR_CG = 'fr-cg'; + public const LANGUAGE_FR_CH = 'fr-ch'; + public const LANGUAGE_FR_CI = 'fr-ci'; + public const LANGUAGE_FR_CM = 'fr-cm'; + public const LANGUAGE_FR_DJ = 'fr-dj'; + public const LANGUAGE_FR_DZ = 'fr-dz'; + public const LANGUAGE_FR_FR = 'fr-fr'; + public const LANGUAGE_FR_GA = 'fr-ga'; + public const LANGUAGE_FR_GF = 'fr-gf'; + public const LANGUAGE_FR_GN = 'fr-gn'; + public const LANGUAGE_FR_GP = 'fr-gp'; + public const LANGUAGE_FR_GQ = 'fr-gq'; + public const LANGUAGE_FR_HT = 'fr-ht'; + public const LANGUAGE_FR_KM = 'fr-km'; + public const LANGUAGE_FR_LU = 'fr-lu'; + public const LANGUAGE_FR_MA = 'fr-ma'; + public const LANGUAGE_FR_MC = 'fr-mc'; + public const LANGUAGE_FR_MF = 'fr-mf'; + public const LANGUAGE_FR_MG = 'fr-mg'; + public const LANGUAGE_FR_ML = 'fr-ml'; + public const LANGUAGE_FR_MQ = 'fr-mq'; + public const LANGUAGE_FR_MR = 'fr-mr'; + public const LANGUAGE_FR_MU = 'fr-mu'; + public const LANGUAGE_FR_NC = 'fr-nc'; + public const LANGUAGE_FR_NE = 'fr-ne'; + public const LANGUAGE_FR_PF = 'fr-pf'; + public const LANGUAGE_FR_PM = 'fr-pm'; + public const LANGUAGE_FR_RE = 'fr-re'; + public const LANGUAGE_FR_RW = 'fr-rw'; + public const LANGUAGE_FR_SC = 'fr-sc'; + public const LANGUAGE_FR_SN = 'fr-sn'; + public const LANGUAGE_FR_SY = 'fr-sy'; + public const LANGUAGE_FR_TD = 'fr-td'; + public const LANGUAGE_FR_TG = 'fr-tg'; + public const LANGUAGE_FR_TN = 'fr-tn'; + public const LANGUAGE_FR_VU = 'fr-vu'; + public const LANGUAGE_FR_WF = 'fr-wf'; + public const LANGUAGE_FR_YT = 'fr-yt'; + public const LANGUAGE_FUR = 'fur'; + public const LANGUAGE_FUR_IT = 'fur-it'; + public const LANGUAGE_FY = 'fy'; + public const LANGUAGE_FY_NL = 'fy-nl'; + public const LANGUAGE_GA = 'ga'; + public const LANGUAGE_GA_GB = 'ga-gb'; + public const LANGUAGE_GA_IE = 'ga-ie'; + public const LANGUAGE_GD = 'gd'; + public const LANGUAGE_GD_GB = 'gd-gb'; + public const LANGUAGE_GL = 'gl'; + public const LANGUAGE_GL_ES = 'gl-es'; + public const LANGUAGE_GSW = 'gsw'; + public const LANGUAGE_GSW_CH = 'gsw-ch'; + public const LANGUAGE_GSW_FR = 'gsw-fr'; + public const LANGUAGE_GSW_LI = 'gsw-li'; + public const LANGUAGE_GU = 'gu'; + public const LANGUAGE_GUZ = 'guz'; + public const LANGUAGE_GUZ_KE = 'guz-ke'; + public const LANGUAGE_GU_IN = 'gu-in'; + public const LANGUAGE_GV = 'gv'; + public const LANGUAGE_GV_IM = 'gv-im'; + public const LANGUAGE_HA = 'ha'; + public const LANGUAGE_HAW = 'haw'; + public const LANGUAGE_HAW_US = 'haw-us'; + public const LANGUAGE_HA_GH = 'ha-gh'; + public const LANGUAGE_HA_NE = 'ha-ne'; + public const LANGUAGE_HA_NG = 'ha-ng'; + public const LANGUAGE_HE = 'he'; + public const LANGUAGE_HI = 'hi'; + public const LANGUAGE_HI_IN = 'hi-in'; + public const LANGUAGE_HR = 'hr'; + public const LANGUAGE_HR_BA = 'hr-ba'; + public const LANGUAGE_HR_HR = 'hr-hr'; + public const LANGUAGE_HSB = 'hsb'; + public const LANGUAGE_HSB_DE = 'hsb-de'; + public const LANGUAGE_HU = 'hu'; + public const LANGUAGE_HU_HU = 'hu-hu'; + public const LANGUAGE_HY = 'hy'; + public const LANGUAGE_HY_AM = 'hy-am'; + public const LANGUAGE_IA = 'ia'; + public const LANGUAGE_IA_001 = 'ia-001'; + public const LANGUAGE_ID = 'id'; + public const LANGUAGE_IG = 'ig'; + public const LANGUAGE_IG_NG = 'ig-ng'; + public const LANGUAGE_II = 'ii'; + public const LANGUAGE_II_CN = 'ii-cn'; + public const LANGUAGE_ID_ID = 'id-id'; + public const LANGUAGE_IS = 'is'; + public const LANGUAGE_IS_IS = 'is-is'; + public const LANGUAGE_IT = 'it'; + public const LANGUAGE_IT_CH = 'it-ch'; + public const LANGUAGE_IT_IT = 'it-it'; + public const LANGUAGE_IT_SM = 'it-sm'; + public const LANGUAGE_IT_VA = 'it-va'; + public const LANGUAGE_HE_IL = 'he-il'; + public const LANGUAGE_JA = 'ja'; + public const LANGUAGE_JA_JP = 'ja-jp'; + public const LANGUAGE_JGO = 'jgo'; + public const LANGUAGE_JGO_CM = 'jgo-cm'; + public const LANGUAGE_YI = 'yi'; + public const LANGUAGE_YI_001 = 'yi-001'; + public const LANGUAGE_JMC = 'jmc'; + public const LANGUAGE_JMC_TZ = 'jmc-tz'; + public const LANGUAGE_JV = 'jv'; + public const LANGUAGE_JV_ID = 'jv-id'; + public const LANGUAGE_KA = 'ka'; + public const LANGUAGE_KAB = 'kab'; + public const LANGUAGE_KAB_DZ = 'kab-dz'; + public const LANGUAGE_KAM = 'kam'; + public const LANGUAGE_KAM_KE = 'kam-ke'; + public const LANGUAGE_KA_GE = 'ka-ge'; + public const LANGUAGE_KDE = 'kde'; + public const LANGUAGE_KDE_TZ = 'kde-tz'; + public const LANGUAGE_KEA = 'kea'; + public const LANGUAGE_KEA_CV = 'kea-cv'; + public const LANGUAGE_KGP = 'kgp'; + public const LANGUAGE_KGP_BR = 'kgp-br'; + public const LANGUAGE_KHQ = 'khq'; + public const LANGUAGE_KHQ_ML = 'khq-ml'; + public const LANGUAGE_KI = 'ki'; + public const LANGUAGE_KI_KE = 'ki-ke'; + public const LANGUAGE_KK = 'kk'; + public const LANGUAGE_KKJ = 'kkj'; + public const LANGUAGE_KKJ_CM = 'kkj-cm'; + public const LANGUAGE_KK_KZ = 'kk-kz'; + public const LANGUAGE_KL = 'kl'; + public const LANGUAGE_KLN = 'kln'; + public const LANGUAGE_KLN_KE = 'kln-ke'; + public const LANGUAGE_KL_GL = 'kl-gl'; + public const LANGUAGE_KM = 'km'; + public const LANGUAGE_KM_KH = 'km-kh'; + public const LANGUAGE_KN = 'kn'; + public const LANGUAGE_KN_IN = 'kn-in'; + public const LANGUAGE_KO = 'ko'; + public const LANGUAGE_KOK = 'kok'; + public const LANGUAGE_KOK_IN = 'kok-in'; + public const LANGUAGE_KO_KP = 'ko-kp'; + public const LANGUAGE_KO_KR = 'ko-kr'; + public const LANGUAGE_KS = 'ks'; + public const LANGUAGE_KSB = 'ksb'; + public const LANGUAGE_KSB_TZ = 'ksb-tz'; + public const LANGUAGE_KSF = 'ksf'; + public const LANGUAGE_KSF_CM = 'ksf-cm'; + public const LANGUAGE_KSH = 'ksh'; + public const LANGUAGE_KSH_DE = 'ksh-de'; + public const LANGUAGE_KS_IN = 'ks-in'; + public const LANGUAGE_KU = 'ku'; + public const LANGUAGE_KU_TR = 'ku-tr'; + public const LANGUAGE_KW = 'kw'; + public const LANGUAGE_KW_GB = 'kw-gb'; + public const LANGUAGE_KY = 'ky'; + public const LANGUAGE_KY_KG = 'ky-kg'; + public const LANGUAGE_LAG = 'lag'; + public const LANGUAGE_LAG_TZ = 'lag-tz'; + public const LANGUAGE_LB = 'lb'; + public const LANGUAGE_LB_LU = 'lb-lu'; + public const LANGUAGE_LG = 'lg'; + public const LANGUAGE_LG_UG = 'lg-ug'; + public const LANGUAGE_LKT = 'lkt'; + public const LANGUAGE_LKT_US = 'lkt-us'; + public const LANGUAGE_LN = 'ln'; + public const LANGUAGE_LN_AO = 'ln-ao'; + public const LANGUAGE_LN_CD = 'ln-cd'; + public const LANGUAGE_LN_CF = 'ln-cf'; + public const LANGUAGE_LN_CG = 'ln-cg'; + public const LANGUAGE_LO = 'lo'; + public const LANGUAGE_LO_LA = 'lo-la'; + public const LANGUAGE_LRC = 'lrc'; + public const LANGUAGE_LRC_IQ = 'lrc-iq'; + public const LANGUAGE_LRC_IR = 'lrc-ir'; + public const LANGUAGE_LT = 'lt'; + public const LANGUAGE_LT_LT = 'lt-lt'; + public const LANGUAGE_LU = 'lu'; + public const LANGUAGE_LUO = 'luo'; + public const LANGUAGE_LUO_KE = 'luo-ke'; + public const LANGUAGE_LUY = 'luy'; + public const LANGUAGE_LUY_KE = 'luy-ke'; + public const LANGUAGE_LU_CD = 'lu-cd'; + public const LANGUAGE_LV = 'lv'; + public const LANGUAGE_LV_LV = 'lv-lv'; + public const LANGUAGE_MAI = 'mai'; + public const LANGUAGE_MAI_IN = 'mai-in'; + public const LANGUAGE_MAS = 'mas'; + public const LANGUAGE_MAS_KE = 'mas-ke'; + public const LANGUAGE_MAS_TZ = 'mas-tz'; + public const LANGUAGE_MDF = 'mdf'; + public const LANGUAGE_MDF_RU = 'mdf-ru'; + public const LANGUAGE_MER = 'mer'; + public const LANGUAGE_MER_KE = 'mer-ke'; + public const LANGUAGE_MFE = 'mfe'; + public const LANGUAGE_MFE_MU = 'mfe-mu'; + public const LANGUAGE_MG = 'mg'; + public const LANGUAGE_MGH = 'mgh'; + public const LANGUAGE_MGH_MZ = 'mgh-mz'; + public const LANGUAGE_MGO = 'mgo'; + public const LANGUAGE_MGO_CM = 'mgo-cm'; + public const LANGUAGE_MG_MG = 'mg-mg'; + public const LANGUAGE_MI = 'mi'; + public const LANGUAGE_MI_NZ = 'mi-nz'; + public const LANGUAGE_MK = 'mk'; + public const LANGUAGE_MK_MK = 'mk-mk'; + public const LANGUAGE_ML = 'ml'; + public const LANGUAGE_ML_IN = 'ml-in'; + public const LANGUAGE_MN = 'mn'; + public const LANGUAGE_MNI = 'mni'; + public const LANGUAGE_MNI_IN = 'mni-in'; + public const LANGUAGE_MN_MN = 'mn-mn'; + public const LANGUAGE_MR = 'mr'; + public const LANGUAGE_MR_IN = 'mr-in'; + public const LANGUAGE_MS = 'ms'; + public const LANGUAGE_MS_BN = 'ms-bn'; + public const LANGUAGE_MS_ID = 'ms-id'; + public const LANGUAGE_MS_MY = 'ms-my'; + public const LANGUAGE_MS_SG = 'ms-sg'; + public const LANGUAGE_MT = 'mt'; + public const LANGUAGE_MT_MT = 'mt-mt'; + public const LANGUAGE_MUA = 'mua'; + public const LANGUAGE_MUA_CM = 'mua-cm'; + public const LANGUAGE_MY = 'my'; + public const LANGUAGE_MY_MM = 'my-mm'; + public const LANGUAGE_MZN = 'mzn'; + public const LANGUAGE_MZN_IR = 'mzn-ir'; + public const LANGUAGE_NAQ = 'naq'; + public const LANGUAGE_NAQ_NA = 'naq-na'; + public const LANGUAGE_NB = 'nb'; + public const LANGUAGE_NB_NO = 'nb-no'; + public const LANGUAGE_NB_SJ = 'nb-sj'; + public const LANGUAGE_ND = 'nd'; + public const LANGUAGE_NDS = 'nds'; + public const LANGUAGE_NDS_DE = 'nds-de'; + public const LANGUAGE_NDS_NL = 'nds-nl'; + public const LANGUAGE_ND_ZW = 'nd-zw'; + public const LANGUAGE_NE = 'ne'; + public const LANGUAGE_NE_IN = 'ne-in'; + public const LANGUAGE_NE_NP = 'ne-np'; + public const LANGUAGE_NL = 'nl'; + public const LANGUAGE_NL_AW = 'nl-aw'; + public const LANGUAGE_NL_BE = 'nl-be'; + public const LANGUAGE_NL_BQ = 'nl-bq'; + public const LANGUAGE_NL_CH = 'nl-ch'; + public const LANGUAGE_NL_CW = 'nl-cw'; + public const LANGUAGE_NL_LU = 'nl-lu'; + public const LANGUAGE_NL_NL = 'nl-nl'; + public const LANGUAGE_NL_SR = 'nl-sr'; + public const LANGUAGE_NL_SX = 'nl-sx'; + public const LANGUAGE_NMG = 'nmg'; + public const LANGUAGE_NMG_CM = 'nmg-cm'; + public const LANGUAGE_NN = 'nn'; + public const LANGUAGE_NNH = 'nnh'; + public const LANGUAGE_NNH_CM = 'nnh-cm'; + public const LANGUAGE_NN_NO = 'nn-no'; + public const LANGUAGE_NO = 'no'; + public const LANGUAGE_NO_NO = 'no-no'; + public const LANGUAGE_NUS = 'nus'; + public const LANGUAGE_NUS_SS = 'nus-ss'; + public const LANGUAGE_NYN = 'nyn'; + public const LANGUAGE_NYN_UG = 'nyn-ug'; + public const LANGUAGE_OC = 'oc'; + public const LANGUAGE_OC_ES = 'oc-es'; + public const LANGUAGE_OC_FR = 'oc-fr'; + public const LANGUAGE_OM = 'om'; + public const LANGUAGE_OM_ET = 'om-et'; + public const LANGUAGE_OM_KE = 'om-ke'; + public const LANGUAGE__OR = 'or'; + public const LANGUAGE_OR_IN = 'or-in'; + public const LANGUAGE_OS = 'os'; + public const LANGUAGE_OS_GE = 'os-ge'; + public const LANGUAGE_OS_RU = 'os-ru'; + public const LANGUAGE_PA = 'pa'; + public const LANGUAGE_PA_IN = 'pa-in'; + public const LANGUAGE_PA_PK = 'pa-pk'; + public const LANGUAGE_PCM = 'pcm'; + public const LANGUAGE_PCM_NG = 'pcm-ng'; + public const LANGUAGE_PIS = 'pis'; + public const LANGUAGE_PIS_SB = 'pis-sb'; + public const LANGUAGE_PL = 'pl'; + public const LANGUAGE_PL_PL = 'pl-pl'; + public const LANGUAGE_PRG = 'prg'; + public const LANGUAGE_PRG_001 = 'prg-001'; + public const LANGUAGE_PS = 'ps'; + public const LANGUAGE_PS_AF = 'ps-af'; + public const LANGUAGE_PS_PK = 'ps-pk'; + public const LANGUAGE_PT = 'pt'; + public const LANGUAGE_PT_AO = 'pt-ao'; + public const LANGUAGE_PT_BR = 'pt-br'; + public const LANGUAGE_PT_CH = 'pt-ch'; + public const LANGUAGE_PT_CV = 'pt-cv'; + public const LANGUAGE_PT_GQ = 'pt-gq'; + public const LANGUAGE_PT_GW = 'pt-gw'; + public const LANGUAGE_PT_LU = 'pt-lu'; + public const LANGUAGE_PT_MO = 'pt-mo'; + public const LANGUAGE_PT_MZ = 'pt-mz'; + public const LANGUAGE_PT_PT = 'pt-pt'; + public const LANGUAGE_PT_ST = 'pt-st'; + public const LANGUAGE_PT_TL = 'pt-tl'; + public const LANGUAGE_QU = 'qu'; + public const LANGUAGE_QU_BO = 'qu-bo'; + public const LANGUAGE_QU_EC = 'qu-ec'; + public const LANGUAGE_QU_PE = 'qu-pe'; + public const LANGUAGE_RAJ = 'raj'; + public const LANGUAGE_RAJ_IN = 'raj-in'; + public const LANGUAGE_RM = 'rm'; + public const LANGUAGE_RM_CH = 'rm-ch'; + public const LANGUAGE_RN = 'rn'; + public const LANGUAGE_RN_BI = 'rn-bi'; + public const LANGUAGE_RO = 'ro'; + public const LANGUAGE_ROF = 'rof'; + public const LANGUAGE_ROF_TZ = 'rof-tz'; + public const LANGUAGE_RO_MD = 'ro-md'; + public const LANGUAGE_RO_RO = 'ro-ro'; + public const LANGUAGE_RU = 'ru'; + public const LANGUAGE_RU_BY = 'ru-by'; + public const LANGUAGE_RU_KG = 'ru-kg'; + public const LANGUAGE_RU_KZ = 'ru-kz'; + public const LANGUAGE_RU_MD = 'ru-md'; + public const LANGUAGE_RU_RU = 'ru-ru'; + public const LANGUAGE_RU_UA = 'ru-ua'; + public const LANGUAGE_RW = 'rw'; + public const LANGUAGE_RWK = 'rwk'; + public const LANGUAGE_RWK_TZ = 'rwk-tz'; + public const LANGUAGE_RW_RW = 'rw-rw'; + public const LANGUAGE_SA = 'sa'; + public const LANGUAGE_SAH = 'sah'; + public const LANGUAGE_SAH_RU = 'sah-ru'; + public const LANGUAGE_SAQ = 'saq'; + public const LANGUAGE_SAQ_KE = 'saq-ke'; + public const LANGUAGE_SAT = 'sat'; + public const LANGUAGE_SAT_IN = 'sat-in'; + public const LANGUAGE_SA_IN = 'sa-in'; + public const LANGUAGE_SBP = 'sbp'; + public const LANGUAGE_SBP_TZ = 'sbp-tz'; + public const LANGUAGE_SC = 'sc'; + public const LANGUAGE_SC_IT = 'sc-it'; + public const LANGUAGE_SD = 'sd'; + public const LANGUAGE_SD_IN = 'sd-in'; + public const LANGUAGE_SD_PK = 'sd-pk'; + public const LANGUAGE_SE = 'se'; + public const LANGUAGE_SEH = 'seh'; + public const LANGUAGE_SEH_MZ = 'seh-mz'; + public const LANGUAGE_SES = 'ses'; + public const LANGUAGE_SES_ML = 'ses-ml'; + public const LANGUAGE_SE_FI = 'se-fi'; + public const LANGUAGE_SE_NO = 'se-no'; + public const LANGUAGE_SE_SE = 'se-se'; + public const LANGUAGE_SG = 'sg'; + public const LANGUAGE_SG_CF = 'sg-cf'; + public const LANGUAGE_SHI = 'shi'; + public const LANGUAGE_SHI_MA = 'shi-ma'; + public const LANGUAGE_SI = 'si'; + public const LANGUAGE_SI_LK = 'si-lk'; + public const LANGUAGE_SK = 'sk'; + public const LANGUAGE_SK_SK = 'sk-sk'; + public const LANGUAGE_SL = 'sl'; + public const LANGUAGE_SL_SI = 'sl-si'; + public const LANGUAGE_SMN = 'smn'; + public const LANGUAGE_SMN_FI = 'smn-fi'; + public const LANGUAGE_SMS = 'sms'; + public const LANGUAGE_SMS_FI = 'sms-fi'; + public const LANGUAGE_SN = 'sn'; + public const LANGUAGE_SN_ZW = 'sn-zw'; + public const LANGUAGE_SO = 'so'; + public const LANGUAGE_SO_DJ = 'so-dj'; + public const LANGUAGE_SO_ET = 'so-et'; + public const LANGUAGE_SO_KE = 'so-ke'; + public const LANGUAGE_SO_SO = 'so-so'; + public const LANGUAGE_SQ = 'sq'; + public const LANGUAGE_SQ_AL = 'sq-al'; + public const LANGUAGE_SQ_MK = 'sq-mk'; + public const LANGUAGE_SQ_XK = 'sq-xk'; + public const LANGUAGE_SR = 'sr'; + public const LANGUAGE_SR_BA = 'sr-ba'; + public const LANGUAGE_SR_CS = 'sr-cs'; + public const LANGUAGE_SR_ME = 'sr-me'; + public const LANGUAGE_SR_RS = 'sr-rs'; + public const LANGUAGE_SR_XK = 'sr-xk'; + public const LANGUAGE_SU = 'su'; + public const LANGUAGE_SU_ID = 'su-id'; + public const LANGUAGE_SV = 'sv'; + public const LANGUAGE_SV_AX = 'sv-ax'; + public const LANGUAGE_SV_FI = 'sv-fi'; + public const LANGUAGE_SV_SE = 'sv-se'; + public const LANGUAGE_SW = 'sw'; + public const LANGUAGE_SW_CD = 'sw-cd'; + public const LANGUAGE_SW_KE = 'sw-ke'; + public const LANGUAGE_SW_TZ = 'sw-tz'; + public const LANGUAGE_SW_UG = 'sw-ug'; + public const LANGUAGE_SY = 'sy'; + public const LANGUAGE_TA = 'ta'; + public const LANGUAGE_TA_IN = 'ta-in'; + public const LANGUAGE_TA_LK = 'ta-lk'; + public const LANGUAGE_TA_MY = 'ta-my'; + public const LANGUAGE_TA_SG = 'ta-sg'; + public const LANGUAGE_TE = 'te'; + public const LANGUAGE_TEO = 'teo'; + public const LANGUAGE_TEO_KE = 'teo-ke'; + public const LANGUAGE_TEO_UG = 'teo-ug'; + public const LANGUAGE_TE_IN = 'te-in'; + public const LANGUAGE_TG = 'tg'; + public const LANGUAGE_TG_TJ = 'tg-tj'; + public const LANGUAGE_TH = 'th'; + public const LANGUAGE_TH_TH = 'th-th'; + public const LANGUAGE_TI = 'ti'; + public const LANGUAGE_TI_ER = 'ti-er'; + public const LANGUAGE_TI_ET = 'ti-et'; + public const LANGUAGE_TK = 'tk'; + public const LANGUAGE_TK_TM = 'tk-tm'; + public const LANGUAGE_TL = 'tl'; + public const LANGUAGE_TO = 'to'; + public const LANGUAGE_TOK = 'tok'; + public const LANGUAGE_TOK_001 = 'tok-001'; + public const LANGUAGE_TO_TO = 'to-to'; + public const LANGUAGE_TR = 'tr'; + public const LANGUAGE_TR_CY = 'tr-cy'; + public const LANGUAGE_TR_TR = 'tr-tr'; + public const LANGUAGE_TT = 'tt'; + public const LANGUAGE_TT_RU = 'tt-ru'; + public const LANGUAGE_TWQ = 'twq'; + public const LANGUAGE_TWQ_NE = 'twq-ne'; + public const LANGUAGE_TZM = 'tzm'; + public const LANGUAGE_TZM_MA = 'tzm-ma'; + public const LANGUAGE_UG = 'ug'; + public const LANGUAGE_UG_CN = 'ug-cn'; + public const LANGUAGE_UK = 'uk'; + public const LANGUAGE_UK_UA = 'uk-ua'; + public const LANGUAGE_UR = 'ur'; + public const LANGUAGE_UR_IN = 'ur-in'; + public const LANGUAGE_UR_PK = 'ur-pk'; + public const LANGUAGE_UZ = 'uz'; + public const LANGUAGE_UZ_AF = 'uz-af'; + public const LANGUAGE_UZ_UZ = 'uz-uz'; + public const LANGUAGE_VAI = 'vai'; + public const LANGUAGE_VAI_LR = 'vai-lr'; + public const LANGUAGE_VI = 'vi'; + public const LANGUAGE_VI_VN = 'vi-vn'; + public const LANGUAGE_VO = 'vo'; + public const LANGUAGE_VO_001 = 'vo-001'; + public const LANGUAGE_VUN = 'vun'; + public const LANGUAGE_VUN_TZ = 'vun-tz'; + public const LANGUAGE_WAE = 'wae'; + public const LANGUAGE_WAE_CH = 'wae-ch'; + public const LANGUAGE_WO = 'wo'; + public const LANGUAGE_WO_SN = 'wo-sn'; + public const LANGUAGE_XH = 'xh'; + public const LANGUAGE_XH_ZA = 'xh-za'; + public const LANGUAGE_XOG = 'xog'; + public const LANGUAGE_XOG_UG = 'xog-ug'; + public const LANGUAGE_YAV = 'yav'; + public const LANGUAGE_YAV_CM = 'yav-cm'; + public const LANGUAGE_YO = 'yo'; + public const LANGUAGE_YO_BJ = 'yo-bj'; + public const LANGUAGE_YO_NG = 'yo-ng'; + public const LANGUAGE_YRL = 'yrl'; + public const LANGUAGE_YRL_BR = 'yrl-br'; + public const LANGUAGE_YRL_CO = 'yrl-co'; + public const LANGUAGE_YRL_VE = 'yrl-ve'; + public const LANGUAGE_YUE = 'yue'; + public const LANGUAGE_YUE_CN = 'yue-cn'; + public const LANGUAGE_YUE_HK = 'yue-hk'; + public const LANGUAGE_ZGH = 'zgh'; + public const LANGUAGE_ZGH_MA = 'zgh-ma'; + public const LANGUAGE_ZH = 'zh'; + public const LANGUAGE_ZH_CN = 'zh-cn'; + public const LANGUAGE_ZH_HANS = 'zh-hans'; + public const LANGUAGE_ZH_HANT = 'zh-hant'; + public const LANGUAGE_ZH_HK = 'zh-hk'; + public const LANGUAGE_ZH_MO = 'zh-mo'; + public const LANGUAGE_ZH_SG = 'zh-sg'; + public const LANGUAGE_ZH_TW = 'zh-tw'; + public const LANGUAGE_ZU = 'zu'; + public const LANGUAGE_ZU_ZA = 'zu-za'; + public const TYPE_AB_EMAIL = 'AB_EMAIL'; + public const TYPE_BATCH_EMAIL = 'BATCH_EMAIL'; + public const TYPE_LOCALTIME_EMAIL = 'LOCALTIME_EMAIL'; + public const TYPE_AUTOMATED_AB_EMAIL = 'AUTOMATED_AB_EMAIL'; + public const TYPE_BLOG_EMAIL = 'BLOG_EMAIL'; + public const TYPE_BLOG_EMAIL_CHILD = 'BLOG_EMAIL_CHILD'; + public const TYPE_RSS_EMAIL = 'RSS_EMAIL'; + public const TYPE_RSS_EMAIL_CHILD = 'RSS_EMAIL_CHILD'; + public const TYPE_RESUBSCRIBE_EMAIL = 'RESUBSCRIBE_EMAIL'; + public const TYPE_OPTIN_EMAIL = 'OPTIN_EMAIL'; + public const TYPE_OPTIN_FOLLOWUP_EMAIL = 'OPTIN_FOLLOWUP_EMAIL'; + public const TYPE_AUTOMATED_EMAIL = 'AUTOMATED_EMAIL'; + public const TYPE_FEEDBACK_CES_EMAIL = 'FEEDBACK_CES_EMAIL'; + public const TYPE_FEEDBACK_CUSTOM_EMAIL = 'FEEDBACK_CUSTOM_EMAIL'; + public const TYPE_FEEDBACK_CUSTOM_SURVEY_EMAIL = 'FEEDBACK_CUSTOM_SURVEY_EMAIL'; + public const TYPE_FEEDBACK_NPS_EMAIL = 'FEEDBACK_NPS_EMAIL'; + public const TYPE_FOLLOWUP_EMAIL = 'FOLLOWUP_EMAIL'; + public const TYPE_LEADFLOW_EMAIL = 'LEADFLOW_EMAIL'; + public const TYPE_SINGLE_SEND_API = 'SINGLE_SEND_API'; + public const TYPE_MARKETING_SINGLE_SEND_API = 'MARKETING_SINGLE_SEND_API'; + public const TYPE_SMTP_TOKEN = 'SMTP_TOKEN'; + public const TYPE_TICKET_EMAIL = 'TICKET_EMAIL'; + public const TYPE_MEMBERSHIP_REGISTRATION_EMAIL = 'MEMBERSHIP_REGISTRATION_EMAIL'; + public const TYPE_MEMBERSHIP_PASSWORD_SAVED_EMAIL = 'MEMBERSHIP_PASSWORD_SAVED_EMAIL'; + public const TYPE_MEMBERSHIP_PASSWORD_RESET_EMAIL = 'MEMBERSHIP_PASSWORD_RESET_EMAIL'; + public const TYPE_MEMBERSHIP_EMAIL_VERIFICATION_EMAIL = 'MEMBERSHIP_EMAIL_VERIFICATION_EMAIL'; + public const TYPE_MEMBERSHIP_PASSWORDLESS_AUTH_EMAIL = 'MEMBERSHIP_PASSWORDLESS_AUTH_EMAIL'; + public const TYPE_MEMBERSHIP_REGISTRATION_FOLLOW_UP_EMAIL = 'MEMBERSHIP_REGISTRATION_FOLLOW_UP_EMAIL'; + public const TYPE_MEMBERSHIP_OTP_LOGIN_EMAIL = 'MEMBERSHIP_OTP_LOGIN_EMAIL'; + public const TYPE_MEMBERSHIP_FOLLOW_UP_EMAIL = 'MEMBERSHIP_FOLLOW_UP_EMAIL'; + public const TYPE_MEMBERSHIP_VERIFICATION_EMAIL = 'MEMBERSHIP_VERIFICATION_EMAIL'; + public const STATE_AUTOMATED = 'AUTOMATED'; + public const STATE_AUTOMATED_DRAFT = 'AUTOMATED_DRAFT'; + public const STATE_AUTOMATED_SENDING = 'AUTOMATED_SENDING'; + public const STATE_AUTOMATED_FOR_FORM = 'AUTOMATED_FOR_FORM'; + public const STATE_AUTOMATED_FOR_FORM_BUFFER = 'AUTOMATED_FOR_FORM_BUFFER'; + public const STATE_AUTOMATED_FOR_FORM_DRAFT = 'AUTOMATED_FOR_FORM_DRAFT'; + public const STATE_AUTOMATED_FOR_FORM_LEGACY = 'AUTOMATED_FOR_FORM_LEGACY'; + public const STATE_BLOG_EMAIL_DRAFT = 'BLOG_EMAIL_DRAFT'; + public const STATE_BLOG_EMAIL_PUBLISHED = 'BLOG_EMAIL_PUBLISHED'; + public const STATE_DRAFT = 'DRAFT'; + public const STATE_DRAFT_AB = 'DRAFT_AB'; + public const STATE_DRAFT_AB_VARIANT = 'DRAFT_AB_VARIANT'; + public const STATE_ERROR = 'ERROR'; + public const STATE_LOSER_AB_VARIANT = 'LOSER_AB_VARIANT'; + public const STATE_PAGE_STUB = 'PAGE_STUB'; + public const STATE_PRE_PROCESSING = 'PRE_PROCESSING'; + public const STATE_PROCESSING = 'PROCESSING'; + public const STATE_PUBLISHED = 'PUBLISHED'; + public const STATE_PUBLISHED_AB = 'PUBLISHED_AB'; + public const STATE_PUBLISHED_AB_VARIANT = 'PUBLISHED_AB_VARIANT'; + public const STATE_PUBLISHED_OR_SCHEDULED = 'PUBLISHED_OR_SCHEDULED'; + public const STATE_RSS_TO_EMAIL_DRAFT = 'RSS_TO_EMAIL_DRAFT'; + public const STATE_RSS_TO_EMAIL_PUBLISHED = 'RSS_TO_EMAIL_PUBLISHED'; + public const STATE_SCHEDULED = 'SCHEDULED'; + public const STATE_SCHEDULED_AB = 'SCHEDULED_AB'; + public const STATE_SCHEDULED_OR_PUBLISHED = 'SCHEDULED_OR_PUBLISHED'; + public const STATE_AUTOMATED_AB = 'AUTOMATED_AB'; + public const STATE_AUTOMATED_AB_VARIANT = 'AUTOMATED_AB_VARIANT'; + public const STATE_AUTOMATED_DRAFT_AB = 'AUTOMATED_DRAFT_AB'; + public const STATE_AUTOMATED_DRAFT_ABVARIANT = 'AUTOMATED_DRAFT_ABVARIANT'; + public const STATE_AUTOMATED_LOSER_ABVARIANT = 'AUTOMATED_LOSER_ABVARIANT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_AF, + self::LANGUAGE_AF_NA, + self::LANGUAGE_AF_ZA, + self::LANGUAGE_AGQ, + self::LANGUAGE_AGQ_CM, + self::LANGUAGE_AK, + self::LANGUAGE_AK_GH, + self::LANGUAGE_AM, + self::LANGUAGE_AM_ET, + self::LANGUAGE_ANN, + self::LANGUAGE_ANN_NG, + self::LANGUAGE_AR, + self::LANGUAGE_AR_001, + self::LANGUAGE_AR_AE, + self::LANGUAGE_AR_BH, + self::LANGUAGE_AR_DJ, + self::LANGUAGE_AR_DZ, + self::LANGUAGE_AR_EG, + self::LANGUAGE_AR_EH, + self::LANGUAGE_AR_ER, + self::LANGUAGE_AR_IL, + self::LANGUAGE_AR_IQ, + self::LANGUAGE_AR_JO, + self::LANGUAGE_AR_KM, + self::LANGUAGE_AR_KW, + self::LANGUAGE_AR_LB, + self::LANGUAGE_AR_LY, + self::LANGUAGE_AR_MA, + self::LANGUAGE_AR_MR, + self::LANGUAGE_AR_OM, + self::LANGUAGE_AR_PS, + self::LANGUAGE_AR_QA, + self::LANGUAGE_AR_SA, + self::LANGUAGE_AR_SD, + self::LANGUAGE_AR_SO, + self::LANGUAGE_AR_SS, + self::LANGUAGE_AR_SY, + self::LANGUAGE_AR_TD, + self::LANGUAGE_AR_TN, + self::LANGUAGE_AR_YE, + self::LANGUAGE__AS, + self::LANGUAGE_ASA, + self::LANGUAGE_ASA_TZ, + self::LANGUAGE_AST, + self::LANGUAGE_AST_ES, + self::LANGUAGE_AS_IN, + self::LANGUAGE_AZ, + self::LANGUAGE_AZ_AZ, + self::LANGUAGE_BAS, + self::LANGUAGE_BAS_CM, + self::LANGUAGE_BE, + self::LANGUAGE_BEM, + self::LANGUAGE_BEM_ZM, + self::LANGUAGE_BEZ, + self::LANGUAGE_BEZ_TZ, + self::LANGUAGE_BE_BY, + self::LANGUAGE_BG, + self::LANGUAGE_BGC, + self::LANGUAGE_BGC_IN, + self::LANGUAGE_BG_BG, + self::LANGUAGE_BHO, + self::LANGUAGE_BHO_IN, + self::LANGUAGE_BM, + self::LANGUAGE_BM_ML, + self::LANGUAGE_BN, + self::LANGUAGE_BN_BD, + self::LANGUAGE_BN_IN, + self::LANGUAGE_BO, + self::LANGUAGE_BO_CN, + self::LANGUAGE_BO_IN, + self::LANGUAGE_BR, + self::LANGUAGE_BRX, + self::LANGUAGE_BRX_IN, + self::LANGUAGE_BR_FR, + self::LANGUAGE_BS, + self::LANGUAGE_BS_BA, + self::LANGUAGE_CA, + self::LANGUAGE_CA_AD, + self::LANGUAGE_CA_ES, + self::LANGUAGE_CA_FR, + self::LANGUAGE_CA_IT, + self::LANGUAGE_CCP, + self::LANGUAGE_CCP_BD, + self::LANGUAGE_CCP_IN, + self::LANGUAGE_CE, + self::LANGUAGE_CEB, + self::LANGUAGE_CEB_PH, + self::LANGUAGE_CE_RU, + self::LANGUAGE_CGG, + self::LANGUAGE_CGG_UG, + self::LANGUAGE_CHR, + self::LANGUAGE_CHR_US, + self::LANGUAGE_CKB, + self::LANGUAGE_CKB_IQ, + self::LANGUAGE_CKB_IR, + self::LANGUAGE_CS, + self::LANGUAGE_CS_CZ, + self::LANGUAGE_CU, + self::LANGUAGE_CU_RU, + self::LANGUAGE_CV, + self::LANGUAGE_CV_RU, + self::LANGUAGE_CY, + self::LANGUAGE_CY_GB, + self::LANGUAGE_DA, + self::LANGUAGE_DAV, + self::LANGUAGE_DAV_KE, + self::LANGUAGE_DA_DK, + self::LANGUAGE_DA_GL, + self::LANGUAGE_DE, + self::LANGUAGE_DE_AT, + self::LANGUAGE_DE_BE, + self::LANGUAGE_DE_CH, + self::LANGUAGE_DE_DE, + self::LANGUAGE_DE_GR, + self::LANGUAGE_DE_IT, + self::LANGUAGE_DE_LI, + self::LANGUAGE_DE_LU, + self::LANGUAGE_DJE, + self::LANGUAGE_DJE_NE, + self::LANGUAGE_DOI, + self::LANGUAGE_DOI_IN, + self::LANGUAGE_DSB, + self::LANGUAGE_DSB_DE, + self::LANGUAGE_DUA, + self::LANGUAGE_DUA_CM, + self::LANGUAGE_DYO, + self::LANGUAGE_DYO_SN, + self::LANGUAGE_DZ, + self::LANGUAGE_DZ_BT, + self::LANGUAGE_EBU, + self::LANGUAGE_EBU_KE, + self::LANGUAGE_EE, + self::LANGUAGE_EE_GH, + self::LANGUAGE_EE_TG, + self::LANGUAGE_EL, + self::LANGUAGE_EL_CY, + self::LANGUAGE_EL_GR, + self::LANGUAGE_EN, + self::LANGUAGE_EN_001, + self::LANGUAGE_EN_150, + self::LANGUAGE_EN_AE, + self::LANGUAGE_EN_AG, + self::LANGUAGE_EN_AI, + self::LANGUAGE_EN_AS, + self::LANGUAGE_EN_AT, + self::LANGUAGE_EN_AU, + self::LANGUAGE_EN_BB, + self::LANGUAGE_EN_BE, + self::LANGUAGE_EN_BI, + self::LANGUAGE_EN_BM, + self::LANGUAGE_EN_BS, + self::LANGUAGE_EN_BW, + self::LANGUAGE_EN_BZ, + self::LANGUAGE_EN_CA, + self::LANGUAGE_EN_CC, + self::LANGUAGE_EN_CH, + self::LANGUAGE_EN_CK, + self::LANGUAGE_EN_CM, + self::LANGUAGE_EN_CN, + self::LANGUAGE_EN_CX, + self::LANGUAGE_EN_CY, + self::LANGUAGE_EN_DE, + self::LANGUAGE_EN_DG, + self::LANGUAGE_EN_DK, + self::LANGUAGE_EN_DM, + self::LANGUAGE_EN_EE, + self::LANGUAGE_EN_ER, + self::LANGUAGE_EN_FI, + self::LANGUAGE_EN_FJ, + self::LANGUAGE_EN_FK, + self::LANGUAGE_EN_FM, + self::LANGUAGE_EN_FR, + self::LANGUAGE_EN_GB, + self::LANGUAGE_EN_GD, + self::LANGUAGE_EN_GG, + self::LANGUAGE_EN_GH, + self::LANGUAGE_EN_GI, + self::LANGUAGE_EN_GM, + self::LANGUAGE_EN_GU, + self::LANGUAGE_EN_GY, + self::LANGUAGE_EN_HK, + self::LANGUAGE_EN_IE, + self::LANGUAGE_EN_IL, + self::LANGUAGE_EN_IM, + self::LANGUAGE_EN_IN, + self::LANGUAGE_EN_IO, + self::LANGUAGE_EN_JE, + self::LANGUAGE_EN_JM, + self::LANGUAGE_EN_KE, + self::LANGUAGE_EN_KI, + self::LANGUAGE_EN_KN, + self::LANGUAGE_EN_KY, + self::LANGUAGE_EN_LC, + self::LANGUAGE_EN_LR, + self::LANGUAGE_EN_LS, + self::LANGUAGE_EN_LU, + self::LANGUAGE_EN_MG, + self::LANGUAGE_EN_MH, + self::LANGUAGE_EN_MO, + self::LANGUAGE_EN_MP, + self::LANGUAGE_EN_MS, + self::LANGUAGE_EN_MT, + self::LANGUAGE_EN_MU, + self::LANGUAGE_EN_MV, + self::LANGUAGE_EN_MW, + self::LANGUAGE_EN_MX, + self::LANGUAGE_EN_MY, + self::LANGUAGE_EN_NA, + self::LANGUAGE_EN_NF, + self::LANGUAGE_EN_NG, + self::LANGUAGE_EN_NL, + self::LANGUAGE_EN_NR, + self::LANGUAGE_EN_NU, + self::LANGUAGE_EN_NZ, + self::LANGUAGE_EN_PG, + self::LANGUAGE_EN_PH, + self::LANGUAGE_EN_PK, + self::LANGUAGE_EN_PN, + self::LANGUAGE_EN_PR, + self::LANGUAGE_EN_PW, + self::LANGUAGE_EN_RW, + self::LANGUAGE_EN_SB, + self::LANGUAGE_EN_SC, + self::LANGUAGE_EN_SD, + self::LANGUAGE_EN_SE, + self::LANGUAGE_EN_SG, + self::LANGUAGE_EN_SH, + self::LANGUAGE_EN_SI, + self::LANGUAGE_EN_SL, + self::LANGUAGE_EN_SS, + self::LANGUAGE_EN_SX, + self::LANGUAGE_EN_SZ, + self::LANGUAGE_EN_TC, + self::LANGUAGE_EN_TK, + self::LANGUAGE_EN_TO, + self::LANGUAGE_EN_TT, + self::LANGUAGE_EN_TV, + self::LANGUAGE_EN_TZ, + self::LANGUAGE_EN_UG, + self::LANGUAGE_EN_UM, + self::LANGUAGE_EN_US, + self::LANGUAGE_EN_VC, + self::LANGUAGE_EN_VG, + self::LANGUAGE_EN_VI, + self::LANGUAGE_EN_VU, + self::LANGUAGE_EN_WS, + self::LANGUAGE_EN_ZA, + self::LANGUAGE_EN_ZM, + self::LANGUAGE_EN_ZW, + self::LANGUAGE_EO, + self::LANGUAGE_EO_001, + self::LANGUAGE_ES, + self::LANGUAGE_ES_419, + self::LANGUAGE_ES_AR, + self::LANGUAGE_ES_BO, + self::LANGUAGE_ES_BR, + self::LANGUAGE_ES_BZ, + self::LANGUAGE_ES_CL, + self::LANGUAGE_ES_CO, + self::LANGUAGE_ES_CR, + self::LANGUAGE_ES_CU, + self::LANGUAGE_ES_DO, + self::LANGUAGE_ES_EA, + self::LANGUAGE_ES_EC, + self::LANGUAGE_ES_ES, + self::LANGUAGE_ES_GQ, + self::LANGUAGE_ES_GT, + self::LANGUAGE_ES_HN, + self::LANGUAGE_ES_IC, + self::LANGUAGE_ES_MX, + self::LANGUAGE_ES_NI, + self::LANGUAGE_ES_PA, + self::LANGUAGE_ES_PE, + self::LANGUAGE_ES_PH, + self::LANGUAGE_ES_PR, + self::LANGUAGE_ES_PY, + self::LANGUAGE_ES_SV, + self::LANGUAGE_ES_US, + self::LANGUAGE_ES_UY, + self::LANGUAGE_ES_VE, + self::LANGUAGE_ET, + self::LANGUAGE_ET_EE, + self::LANGUAGE_EU, + self::LANGUAGE_EU_ES, + self::LANGUAGE_EWO, + self::LANGUAGE_EWO_CM, + self::LANGUAGE_FA, + self::LANGUAGE_FA_AF, + self::LANGUAGE_FA_IR, + self::LANGUAGE_FF, + self::LANGUAGE_FF_BF, + self::LANGUAGE_FF_CM, + self::LANGUAGE_FF_GH, + self::LANGUAGE_FF_GM, + self::LANGUAGE_FF_GN, + self::LANGUAGE_FF_GW, + self::LANGUAGE_FF_LR, + self::LANGUAGE_FF_MR, + self::LANGUAGE_FF_NE, + self::LANGUAGE_FF_NG, + self::LANGUAGE_FF_SL, + self::LANGUAGE_FF_SN, + self::LANGUAGE_FI, + self::LANGUAGE_FIL, + self::LANGUAGE_FIL_PH, + self::LANGUAGE_FI_FI, + self::LANGUAGE_FO, + self::LANGUAGE_FO_DK, + self::LANGUAGE_FO_FO, + self::LANGUAGE_FR, + self::LANGUAGE_FRR, + self::LANGUAGE_FRR_DE, + self::LANGUAGE_FR_BE, + self::LANGUAGE_FR_BF, + self::LANGUAGE_FR_BI, + self::LANGUAGE_FR_BJ, + self::LANGUAGE_FR_BL, + self::LANGUAGE_FR_CA, + self::LANGUAGE_FR_CD, + self::LANGUAGE_FR_CF, + self::LANGUAGE_FR_CG, + self::LANGUAGE_FR_CH, + self::LANGUAGE_FR_CI, + self::LANGUAGE_FR_CM, + self::LANGUAGE_FR_DJ, + self::LANGUAGE_FR_DZ, + self::LANGUAGE_FR_FR, + self::LANGUAGE_FR_GA, + self::LANGUAGE_FR_GF, + self::LANGUAGE_FR_GN, + self::LANGUAGE_FR_GP, + self::LANGUAGE_FR_GQ, + self::LANGUAGE_FR_HT, + self::LANGUAGE_FR_KM, + self::LANGUAGE_FR_LU, + self::LANGUAGE_FR_MA, + self::LANGUAGE_FR_MC, + self::LANGUAGE_FR_MF, + self::LANGUAGE_FR_MG, + self::LANGUAGE_FR_ML, + self::LANGUAGE_FR_MQ, + self::LANGUAGE_FR_MR, + self::LANGUAGE_FR_MU, + self::LANGUAGE_FR_NC, + self::LANGUAGE_FR_NE, + self::LANGUAGE_FR_PF, + self::LANGUAGE_FR_PM, + self::LANGUAGE_FR_RE, + self::LANGUAGE_FR_RW, + self::LANGUAGE_FR_SC, + self::LANGUAGE_FR_SN, + self::LANGUAGE_FR_SY, + self::LANGUAGE_FR_TD, + self::LANGUAGE_FR_TG, + self::LANGUAGE_FR_TN, + self::LANGUAGE_FR_VU, + self::LANGUAGE_FR_WF, + self::LANGUAGE_FR_YT, + self::LANGUAGE_FUR, + self::LANGUAGE_FUR_IT, + self::LANGUAGE_FY, + self::LANGUAGE_FY_NL, + self::LANGUAGE_GA, + self::LANGUAGE_GA_GB, + self::LANGUAGE_GA_IE, + self::LANGUAGE_GD, + self::LANGUAGE_GD_GB, + self::LANGUAGE_GL, + self::LANGUAGE_GL_ES, + self::LANGUAGE_GSW, + self::LANGUAGE_GSW_CH, + self::LANGUAGE_GSW_FR, + self::LANGUAGE_GSW_LI, + self::LANGUAGE_GU, + self::LANGUAGE_GUZ, + self::LANGUAGE_GUZ_KE, + self::LANGUAGE_GU_IN, + self::LANGUAGE_GV, + self::LANGUAGE_GV_IM, + self::LANGUAGE_HA, + self::LANGUAGE_HAW, + self::LANGUAGE_HAW_US, + self::LANGUAGE_HA_GH, + self::LANGUAGE_HA_NE, + self::LANGUAGE_HA_NG, + self::LANGUAGE_HE, + self::LANGUAGE_HI, + self::LANGUAGE_HI_IN, + self::LANGUAGE_HR, + self::LANGUAGE_HR_BA, + self::LANGUAGE_HR_HR, + self::LANGUAGE_HSB, + self::LANGUAGE_HSB_DE, + self::LANGUAGE_HU, + self::LANGUAGE_HU_HU, + self::LANGUAGE_HY, + self::LANGUAGE_HY_AM, + self::LANGUAGE_IA, + self::LANGUAGE_IA_001, + self::LANGUAGE_ID, + self::LANGUAGE_IG, + self::LANGUAGE_IG_NG, + self::LANGUAGE_II, + self::LANGUAGE_II_CN, + self::LANGUAGE_ID_ID, + self::LANGUAGE_IS, + self::LANGUAGE_IS_IS, + self::LANGUAGE_IT, + self::LANGUAGE_IT_CH, + self::LANGUAGE_IT_IT, + self::LANGUAGE_IT_SM, + self::LANGUAGE_IT_VA, + self::LANGUAGE_HE_IL, + self::LANGUAGE_JA, + self::LANGUAGE_JA_JP, + self::LANGUAGE_JGO, + self::LANGUAGE_JGO_CM, + self::LANGUAGE_YI, + self::LANGUAGE_YI_001, + self::LANGUAGE_JMC, + self::LANGUAGE_JMC_TZ, + self::LANGUAGE_JV, + self::LANGUAGE_JV_ID, + self::LANGUAGE_KA, + self::LANGUAGE_KAB, + self::LANGUAGE_KAB_DZ, + self::LANGUAGE_KAM, + self::LANGUAGE_KAM_KE, + self::LANGUAGE_KA_GE, + self::LANGUAGE_KDE, + self::LANGUAGE_KDE_TZ, + self::LANGUAGE_KEA, + self::LANGUAGE_KEA_CV, + self::LANGUAGE_KGP, + self::LANGUAGE_KGP_BR, + self::LANGUAGE_KHQ, + self::LANGUAGE_KHQ_ML, + self::LANGUAGE_KI, + self::LANGUAGE_KI_KE, + self::LANGUAGE_KK, + self::LANGUAGE_KKJ, + self::LANGUAGE_KKJ_CM, + self::LANGUAGE_KK_KZ, + self::LANGUAGE_KL, + self::LANGUAGE_KLN, + self::LANGUAGE_KLN_KE, + self::LANGUAGE_KL_GL, + self::LANGUAGE_KM, + self::LANGUAGE_KM_KH, + self::LANGUAGE_KN, + self::LANGUAGE_KN_IN, + self::LANGUAGE_KO, + self::LANGUAGE_KOK, + self::LANGUAGE_KOK_IN, + self::LANGUAGE_KO_KP, + self::LANGUAGE_KO_KR, + self::LANGUAGE_KS, + self::LANGUAGE_KSB, + self::LANGUAGE_KSB_TZ, + self::LANGUAGE_KSF, + self::LANGUAGE_KSF_CM, + self::LANGUAGE_KSH, + self::LANGUAGE_KSH_DE, + self::LANGUAGE_KS_IN, + self::LANGUAGE_KU, + self::LANGUAGE_KU_TR, + self::LANGUAGE_KW, + self::LANGUAGE_KW_GB, + self::LANGUAGE_KY, + self::LANGUAGE_KY_KG, + self::LANGUAGE_LAG, + self::LANGUAGE_LAG_TZ, + self::LANGUAGE_LB, + self::LANGUAGE_LB_LU, + self::LANGUAGE_LG, + self::LANGUAGE_LG_UG, + self::LANGUAGE_LKT, + self::LANGUAGE_LKT_US, + self::LANGUAGE_LN, + self::LANGUAGE_LN_AO, + self::LANGUAGE_LN_CD, + self::LANGUAGE_LN_CF, + self::LANGUAGE_LN_CG, + self::LANGUAGE_LO, + self::LANGUAGE_LO_LA, + self::LANGUAGE_LRC, + self::LANGUAGE_LRC_IQ, + self::LANGUAGE_LRC_IR, + self::LANGUAGE_LT, + self::LANGUAGE_LT_LT, + self::LANGUAGE_LU, + self::LANGUAGE_LUO, + self::LANGUAGE_LUO_KE, + self::LANGUAGE_LUY, + self::LANGUAGE_LUY_KE, + self::LANGUAGE_LU_CD, + self::LANGUAGE_LV, + self::LANGUAGE_LV_LV, + self::LANGUAGE_MAI, + self::LANGUAGE_MAI_IN, + self::LANGUAGE_MAS, + self::LANGUAGE_MAS_KE, + self::LANGUAGE_MAS_TZ, + self::LANGUAGE_MDF, + self::LANGUAGE_MDF_RU, + self::LANGUAGE_MER, + self::LANGUAGE_MER_KE, + self::LANGUAGE_MFE, + self::LANGUAGE_MFE_MU, + self::LANGUAGE_MG, + self::LANGUAGE_MGH, + self::LANGUAGE_MGH_MZ, + self::LANGUAGE_MGO, + self::LANGUAGE_MGO_CM, + self::LANGUAGE_MG_MG, + self::LANGUAGE_MI, + self::LANGUAGE_MI_NZ, + self::LANGUAGE_MK, + self::LANGUAGE_MK_MK, + self::LANGUAGE_ML, + self::LANGUAGE_ML_IN, + self::LANGUAGE_MN, + self::LANGUAGE_MNI, + self::LANGUAGE_MNI_IN, + self::LANGUAGE_MN_MN, + self::LANGUAGE_MR, + self::LANGUAGE_MR_IN, + self::LANGUAGE_MS, + self::LANGUAGE_MS_BN, + self::LANGUAGE_MS_ID, + self::LANGUAGE_MS_MY, + self::LANGUAGE_MS_SG, + self::LANGUAGE_MT, + self::LANGUAGE_MT_MT, + self::LANGUAGE_MUA, + self::LANGUAGE_MUA_CM, + self::LANGUAGE_MY, + self::LANGUAGE_MY_MM, + self::LANGUAGE_MZN, + self::LANGUAGE_MZN_IR, + self::LANGUAGE_NAQ, + self::LANGUAGE_NAQ_NA, + self::LANGUAGE_NB, + self::LANGUAGE_NB_NO, + self::LANGUAGE_NB_SJ, + self::LANGUAGE_ND, + self::LANGUAGE_NDS, + self::LANGUAGE_NDS_DE, + self::LANGUAGE_NDS_NL, + self::LANGUAGE_ND_ZW, + self::LANGUAGE_NE, + self::LANGUAGE_NE_IN, + self::LANGUAGE_NE_NP, + self::LANGUAGE_NL, + self::LANGUAGE_NL_AW, + self::LANGUAGE_NL_BE, + self::LANGUAGE_NL_BQ, + self::LANGUAGE_NL_CH, + self::LANGUAGE_NL_CW, + self::LANGUAGE_NL_LU, + self::LANGUAGE_NL_NL, + self::LANGUAGE_NL_SR, + self::LANGUAGE_NL_SX, + self::LANGUAGE_NMG, + self::LANGUAGE_NMG_CM, + self::LANGUAGE_NN, + self::LANGUAGE_NNH, + self::LANGUAGE_NNH_CM, + self::LANGUAGE_NN_NO, + self::LANGUAGE_NO, + self::LANGUAGE_NO_NO, + self::LANGUAGE_NUS, + self::LANGUAGE_NUS_SS, + self::LANGUAGE_NYN, + self::LANGUAGE_NYN_UG, + self::LANGUAGE_OC, + self::LANGUAGE_OC_ES, + self::LANGUAGE_OC_FR, + self::LANGUAGE_OM, + self::LANGUAGE_OM_ET, + self::LANGUAGE_OM_KE, + self::LANGUAGE__OR, + self::LANGUAGE_OR_IN, + self::LANGUAGE_OS, + self::LANGUAGE_OS_GE, + self::LANGUAGE_OS_RU, + self::LANGUAGE_PA, + self::LANGUAGE_PA_IN, + self::LANGUAGE_PA_PK, + self::LANGUAGE_PCM, + self::LANGUAGE_PCM_NG, + self::LANGUAGE_PIS, + self::LANGUAGE_PIS_SB, + self::LANGUAGE_PL, + self::LANGUAGE_PL_PL, + self::LANGUAGE_PRG, + self::LANGUAGE_PRG_001, + self::LANGUAGE_PS, + self::LANGUAGE_PS_AF, + self::LANGUAGE_PS_PK, + self::LANGUAGE_PT, + self::LANGUAGE_PT_AO, + self::LANGUAGE_PT_BR, + self::LANGUAGE_PT_CH, + self::LANGUAGE_PT_CV, + self::LANGUAGE_PT_GQ, + self::LANGUAGE_PT_GW, + self::LANGUAGE_PT_LU, + self::LANGUAGE_PT_MO, + self::LANGUAGE_PT_MZ, + self::LANGUAGE_PT_PT, + self::LANGUAGE_PT_ST, + self::LANGUAGE_PT_TL, + self::LANGUAGE_QU, + self::LANGUAGE_QU_BO, + self::LANGUAGE_QU_EC, + self::LANGUAGE_QU_PE, + self::LANGUAGE_RAJ, + self::LANGUAGE_RAJ_IN, + self::LANGUAGE_RM, + self::LANGUAGE_RM_CH, + self::LANGUAGE_RN, + self::LANGUAGE_RN_BI, + self::LANGUAGE_RO, + self::LANGUAGE_ROF, + self::LANGUAGE_ROF_TZ, + self::LANGUAGE_RO_MD, + self::LANGUAGE_RO_RO, + self::LANGUAGE_RU, + self::LANGUAGE_RU_BY, + self::LANGUAGE_RU_KG, + self::LANGUAGE_RU_KZ, + self::LANGUAGE_RU_MD, + self::LANGUAGE_RU_RU, + self::LANGUAGE_RU_UA, + self::LANGUAGE_RW, + self::LANGUAGE_RWK, + self::LANGUAGE_RWK_TZ, + self::LANGUAGE_RW_RW, + self::LANGUAGE_SA, + self::LANGUAGE_SAH, + self::LANGUAGE_SAH_RU, + self::LANGUAGE_SAQ, + self::LANGUAGE_SAQ_KE, + self::LANGUAGE_SAT, + self::LANGUAGE_SAT_IN, + self::LANGUAGE_SA_IN, + self::LANGUAGE_SBP, + self::LANGUAGE_SBP_TZ, + self::LANGUAGE_SC, + self::LANGUAGE_SC_IT, + self::LANGUAGE_SD, + self::LANGUAGE_SD_IN, + self::LANGUAGE_SD_PK, + self::LANGUAGE_SE, + self::LANGUAGE_SEH, + self::LANGUAGE_SEH_MZ, + self::LANGUAGE_SES, + self::LANGUAGE_SES_ML, + self::LANGUAGE_SE_FI, + self::LANGUAGE_SE_NO, + self::LANGUAGE_SE_SE, + self::LANGUAGE_SG, + self::LANGUAGE_SG_CF, + self::LANGUAGE_SHI, + self::LANGUAGE_SHI_MA, + self::LANGUAGE_SI, + self::LANGUAGE_SI_LK, + self::LANGUAGE_SK, + self::LANGUAGE_SK_SK, + self::LANGUAGE_SL, + self::LANGUAGE_SL_SI, + self::LANGUAGE_SMN, + self::LANGUAGE_SMN_FI, + self::LANGUAGE_SMS, + self::LANGUAGE_SMS_FI, + self::LANGUAGE_SN, + self::LANGUAGE_SN_ZW, + self::LANGUAGE_SO, + self::LANGUAGE_SO_DJ, + self::LANGUAGE_SO_ET, + self::LANGUAGE_SO_KE, + self::LANGUAGE_SO_SO, + self::LANGUAGE_SQ, + self::LANGUAGE_SQ_AL, + self::LANGUAGE_SQ_MK, + self::LANGUAGE_SQ_XK, + self::LANGUAGE_SR, + self::LANGUAGE_SR_BA, + self::LANGUAGE_SR_CS, + self::LANGUAGE_SR_ME, + self::LANGUAGE_SR_RS, + self::LANGUAGE_SR_XK, + self::LANGUAGE_SU, + self::LANGUAGE_SU_ID, + self::LANGUAGE_SV, + self::LANGUAGE_SV_AX, + self::LANGUAGE_SV_FI, + self::LANGUAGE_SV_SE, + self::LANGUAGE_SW, + self::LANGUAGE_SW_CD, + self::LANGUAGE_SW_KE, + self::LANGUAGE_SW_TZ, + self::LANGUAGE_SW_UG, + self::LANGUAGE_SY, + self::LANGUAGE_TA, + self::LANGUAGE_TA_IN, + self::LANGUAGE_TA_LK, + self::LANGUAGE_TA_MY, + self::LANGUAGE_TA_SG, + self::LANGUAGE_TE, + self::LANGUAGE_TEO, + self::LANGUAGE_TEO_KE, + self::LANGUAGE_TEO_UG, + self::LANGUAGE_TE_IN, + self::LANGUAGE_TG, + self::LANGUAGE_TG_TJ, + self::LANGUAGE_TH, + self::LANGUAGE_TH_TH, + self::LANGUAGE_TI, + self::LANGUAGE_TI_ER, + self::LANGUAGE_TI_ET, + self::LANGUAGE_TK, + self::LANGUAGE_TK_TM, + self::LANGUAGE_TL, + self::LANGUAGE_TO, + self::LANGUAGE_TOK, + self::LANGUAGE_TOK_001, + self::LANGUAGE_TO_TO, + self::LANGUAGE_TR, + self::LANGUAGE_TR_CY, + self::LANGUAGE_TR_TR, + self::LANGUAGE_TT, + self::LANGUAGE_TT_RU, + self::LANGUAGE_TWQ, + self::LANGUAGE_TWQ_NE, + self::LANGUAGE_TZM, + self::LANGUAGE_TZM_MA, + self::LANGUAGE_UG, + self::LANGUAGE_UG_CN, + self::LANGUAGE_UK, + self::LANGUAGE_UK_UA, + self::LANGUAGE_UR, + self::LANGUAGE_UR_IN, + self::LANGUAGE_UR_PK, + self::LANGUAGE_UZ, + self::LANGUAGE_UZ_AF, + self::LANGUAGE_UZ_UZ, + self::LANGUAGE_VAI, + self::LANGUAGE_VAI_LR, + self::LANGUAGE_VI, + self::LANGUAGE_VI_VN, + self::LANGUAGE_VO, + self::LANGUAGE_VO_001, + self::LANGUAGE_VUN, + self::LANGUAGE_VUN_TZ, + self::LANGUAGE_WAE, + self::LANGUAGE_WAE_CH, + self::LANGUAGE_WO, + self::LANGUAGE_WO_SN, + self::LANGUAGE_XH, + self::LANGUAGE_XH_ZA, + self::LANGUAGE_XOG, + self::LANGUAGE_XOG_UG, + self::LANGUAGE_YAV, + self::LANGUAGE_YAV_CM, + self::LANGUAGE_YO, + self::LANGUAGE_YO_BJ, + self::LANGUAGE_YO_NG, + self::LANGUAGE_YRL, + self::LANGUAGE_YRL_BR, + self::LANGUAGE_YRL_CO, + self::LANGUAGE_YRL_VE, + self::LANGUAGE_YUE, + self::LANGUAGE_YUE_CN, + self::LANGUAGE_YUE_HK, + self::LANGUAGE_ZGH, + self::LANGUAGE_ZGH_MA, + self::LANGUAGE_ZH, + self::LANGUAGE_ZH_CN, + self::LANGUAGE_ZH_HANS, + self::LANGUAGE_ZH_HANT, + self::LANGUAGE_ZH_HK, + self::LANGUAGE_ZH_MO, + self::LANGUAGE_ZH_SG, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_ZU, + self::LANGUAGE_ZU_ZA, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AB_EMAIL, + self::TYPE_BATCH_EMAIL, + self::TYPE_LOCALTIME_EMAIL, + self::TYPE_AUTOMATED_AB_EMAIL, + self::TYPE_BLOG_EMAIL, + self::TYPE_BLOG_EMAIL_CHILD, + self::TYPE_RSS_EMAIL, + self::TYPE_RSS_EMAIL_CHILD, + self::TYPE_RESUBSCRIBE_EMAIL, + self::TYPE_OPTIN_EMAIL, + self::TYPE_OPTIN_FOLLOWUP_EMAIL, + self::TYPE_AUTOMATED_EMAIL, + self::TYPE_FEEDBACK_CES_EMAIL, + self::TYPE_FEEDBACK_CUSTOM_EMAIL, + self::TYPE_FEEDBACK_CUSTOM_SURVEY_EMAIL, + self::TYPE_FEEDBACK_NPS_EMAIL, + self::TYPE_FOLLOWUP_EMAIL, + self::TYPE_LEADFLOW_EMAIL, + self::TYPE_SINGLE_SEND_API, + self::TYPE_MARKETING_SINGLE_SEND_API, + self::TYPE_SMTP_TOKEN, + self::TYPE_TICKET_EMAIL, + self::TYPE_MEMBERSHIP_REGISTRATION_EMAIL, + self::TYPE_MEMBERSHIP_PASSWORD_SAVED_EMAIL, + self::TYPE_MEMBERSHIP_PASSWORD_RESET_EMAIL, + self::TYPE_MEMBERSHIP_EMAIL_VERIFICATION_EMAIL, + self::TYPE_MEMBERSHIP_PASSWORDLESS_AUTH_EMAIL, + self::TYPE_MEMBERSHIP_REGISTRATION_FOLLOW_UP_EMAIL, + self::TYPE_MEMBERSHIP_OTP_LOGIN_EMAIL, + self::TYPE_MEMBERSHIP_FOLLOW_UP_EMAIL, + self::TYPE_MEMBERSHIP_VERIFICATION_EMAIL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_AUTOMATED, + self::STATE_AUTOMATED_DRAFT, + self::STATE_AUTOMATED_SENDING, + self::STATE_AUTOMATED_FOR_FORM, + self::STATE_AUTOMATED_FOR_FORM_BUFFER, + self::STATE_AUTOMATED_FOR_FORM_DRAFT, + self::STATE_AUTOMATED_FOR_FORM_LEGACY, + self::STATE_BLOG_EMAIL_DRAFT, + self::STATE_BLOG_EMAIL_PUBLISHED, + self::STATE_DRAFT, + self::STATE_DRAFT_AB, + self::STATE_DRAFT_AB_VARIANT, + self::STATE_ERROR, + self::STATE_LOSER_AB_VARIANT, + self::STATE_PAGE_STUB, + self::STATE_PRE_PROCESSING, + self::STATE_PROCESSING, + self::STATE_PUBLISHED, + self::STATE_PUBLISHED_AB, + self::STATE_PUBLISHED_AB_VARIANT, + self::STATE_PUBLISHED_OR_SCHEDULED, + self::STATE_RSS_TO_EMAIL_DRAFT, + self::STATE_RSS_TO_EMAIL_PUBLISHED, + self::STATE_SCHEDULED, + self::STATE_SCHEDULED_AB, + self::STATE_SCHEDULED_OR_PUBLISHED, + self::STATE_AUTOMATED_AB, + self::STATE_AUTOMATED_AB_VARIANT, + self::STATE_AUTOMATED_DRAFT_AB, + self::STATE_AUTOMATED_DRAFT_ABVARIANT, + self::STATE_AUTOMATED_LOSER_ABVARIANT, + ]; + } + + /** + * 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('feedback_survey_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('publish_date', $data ?? [], null); + $this->setIfExists('is_transactional', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('business_unit_id', $data ?? [], null); + $this->setIfExists('webversion', $data ?? [], null); + $this->setIfExists('workflow_names', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('stats', $data ?? [], null); + $this->setIfExists('jitter_send_time', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('created_by_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('rss_data', $data ?? [], null); + $this->setIfExists('published_at', $data ?? [], null); + $this->setIfExists('published_by_id', $data ?? [], null); + $this->setIfExists('is_published', $data ?? [], null); + $this->setIfExists('testing', $data ?? [], null); + $this->setIfExists('updated_by_id', $data ?? [], null); + $this->setIfExists('folder_id', $data ?? [], null); + $this->setIfExists('subscription_details', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('active_domain', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('subcategory', $data ?? [], null); + $this->setIfExists('campaign_name', $data ?? [], null); + $this->setIfExists('send_on_publish', $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['subject'] === null) { + $invalidProperties[] = "'subject' can't be null"; + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + $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) + ); + } + + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['subcategory'] === null) { + $invalidProperties[] = "'subcategory' can't be null"; + } + if ($this->container['send_on_publish'] === null) { + $invalidProperties[] = "'send_on_publish' 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 feedback_survey_id + * + * @return string|null + */ + public function getFeedbackSurveyId() + { + return $this->container['feedback_survey_id']; + } + + /** + * Sets feedback_survey_id + * + * @param string|null $feedback_survey_id The ID of the feedback survey linked to the email. + * + * @return self + */ + public function setFeedbackSurveyId($feedback_survey_id) + { + if (is_null($feedback_survey_id)) { + throw new \InvalidArgumentException('non-nullable feedback_survey_id cannot be null'); + } + $this->container['feedback_survey_id'] = $feedback_survey_id; + + return $this; + } + + /** + * Gets subject + * + * @return string + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string $subject The subject of the email. + * + * @return self + */ + public function setSubject($subject) + { + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets publish_date + * + * @return \DateTime|null + */ + public function getPublishDate() + { + return $this->container['publish_date']; + } + + /** + * Sets publish_date + * + * @param \DateTime|null $publish_date The date and time the email is scheduled for, in ISO8601 representation. This is only used in local time or scheduled emails. + * + * @return self + */ + public function setPublishDate($publish_date) + { + if (is_null($publish_date)) { + throw new \InvalidArgumentException('non-nullable publish_date cannot be null'); + } + $this->container['publish_date'] = $publish_date; + + return $this; + } + + /** + * Gets is_transactional + * + * @return bool|null + */ + public function getIsTransactional() + { + return $this->container['is_transactional']; + } + + /** + * Sets is_transactional + * + * @param bool|null $is_transactional Returns whether the email is a transactional email or not. This is read only. + * + * @return self + */ + public function setIsTransactional($is_transactional) + { + if (is_null($is_transactional)) { + throw new \InvalidArgumentException('non-nullable is_transactional cannot be null'); + } + $this->container['is_transactional'] = $is_transactional; + + return $this; + } + + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The email type, this is derived from other properties on the email such as subcategory. + * + * @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 content + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailContent $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets business_unit_id + * + * @return string|null + */ + public function getBusinessUnitId() + { + return $this->container['business_unit_id']; + } + + /** + * Sets business_unit_id + * + * @param string|null $business_unit_id business_unit_id + * + * @return self + */ + public function setBusinessUnitId($business_unit_id) + { + if (is_null($business_unit_id)) { + throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); + } + $this->container['business_unit_id'] = $business_unit_id; + + return $this; + } + + /** + * Gets webversion + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null + */ + public function getWebversion() + { + return $this->container['webversion']; + } + + /** + * Sets webversion + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicWebversionDetails|null $webversion webversion + * + * @return self + */ + public function setWebversion($webversion) + { + if (is_null($webversion)) { + throw new \InvalidArgumentException('non-nullable webversion cannot be null'); + } + $this->container['webversion'] = $webversion; + + return $this; + } + + /** + * Gets workflow_names + * + * @return string[]|null + */ + public function getWorkflowNames() + { + return $this->container['workflow_names']; + } + + /** + * Sets workflow_names + * + * @param string[]|null $workflow_names workflow_names + * + * @return self + */ + public function setWorkflowNames($workflow_names) + { + if (is_null($workflow_names)) { + throw new \InvalidArgumentException('non-nullable workflow_names cannot be null'); + } + $this->container['workflow_names'] = $workflow_names; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived Determines if the email is archived or not. + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at The date and time of the email's creation, in ISO8601 representation. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets stats + * + * @return \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null + */ + public function getStats() + { + return $this->container['stats']; + } + + /** + * Sets stats + * + * @param \HubSpot\Client\Marketing\Emails\Model\EmailStatisticsData|null $stats stats + * + * @return self + */ + public function setStats($stats) + { + if (is_null($stats)) { + throw new \InvalidArgumentException('non-nullable stats cannot be null'); + } + $this->container['stats'] = $stats; + + return $this; + } + + /** + * Gets jitter_send_time + * + * @return bool|null + */ + public function getJitterSendTime() + { + return $this->container['jitter_send_time']; + } + + /** + * Sets jitter_send_time + * + * @param bool|null $jitter_send_time jitter_send_time + * + * @return self + */ + public function setJitterSendTime($jitter_send_time) + { + if (is_null($jitter_send_time)) { + throw new \InvalidArgumentException('non-nullable jitter_send_time cannot be null'); + } + $this->container['jitter_send_time'] = $jitter_send_time; + + return $this; + } + + /** + * Gets from + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailFromDetails $from from + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The email ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state The email state. + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = $this->getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets created_by_id + * + * @return string|null + */ + public function getCreatedById() + { + return $this->container['created_by_id']; + } + + /** + * Sets created_by_id + * + * @param string|null $created_by_id The id of the user who created the email. + * + * @return self + */ + public function setCreatedById($created_by_id) + { + if (is_null($created_by_id)) { + throw new \InvalidArgumentException('non-nullable created_by_id cannot be null'); + } + $this->container['created_by_id'] = $created_by_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at The date and time of the last update to the email, in ISO8601 representation. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets rss_data + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null + */ + public function getRssData() + { + return $this->container['rss_data']; + } + + /** + * Sets rss_data + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicRssEmailDetails|null $rss_data rss_data + * + * @return self + */ + public function setRssData($rss_data) + { + if (is_null($rss_data)) { + throw new \InvalidArgumentException('non-nullable rss_data cannot be null'); + } + $this->container['rss_data'] = $rss_data; + + return $this; + } + + /** + * Gets published_at + * + * @return \DateTime|null + */ + public function getPublishedAt() + { + return $this->container['published_at']; + } + + /** + * Sets published_at + * + * @param \DateTime|null $published_at The date and time the email was published at, in ISO8601 representation. + * + * @return self + */ + public function setPublishedAt($published_at) + { + if (is_null($published_at)) { + throw new \InvalidArgumentException('non-nullable published_at cannot be null'); + } + $this->container['published_at'] = $published_at; + + return $this; + } + + /** + * Gets published_by_id + * + * @return string|null + */ + public function getPublishedById() + { + return $this->container['published_by_id']; + } + + /** + * Sets published_by_id + * + * @param string|null $published_by_id published_by_id + * + * @return self + */ + public function setPublishedById($published_by_id) + { + if (is_null($published_by_id)) { + throw new \InvalidArgumentException('non-nullable published_by_id cannot be null'); + } + $this->container['published_by_id'] = $published_by_id; + + return $this; + } + + /** + * Gets is_published + * + * @return bool|null + */ + public function getIsPublished() + { + return $this->container['is_published']; + } + + /** + * Sets is_published + * + * @param bool|null $is_published Returns the published status of the email. This is read only. + * + * @return self + */ + public function setIsPublished($is_published) + { + if (is_null($is_published)) { + throw new \InvalidArgumentException('non-nullable is_published cannot be null'); + } + $this->container['is_published'] = $is_published; + + return $this; + } + + /** + * Gets testing + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null + */ + public function getTesting() + { + return $this->container['testing']; + } + + /** + * Sets testing + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailTestingDetails|null $testing testing + * + * @return self + */ + public function setTesting($testing) + { + if (is_null($testing)) { + throw new \InvalidArgumentException('non-nullable testing cannot be null'); + } + $this->container['testing'] = $testing; + + return $this; + } + + /** + * Gets updated_by_id + * + * @return string|null + */ + public function getUpdatedById() + { + return $this->container['updated_by_id']; + } + + /** + * Sets updated_by_id + * + * @param string|null $updated_by_id The id of the user who last updated the email. + * + * @return self + */ + public function setUpdatedById($updated_by_id) + { + if (is_null($updated_by_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_id cannot be null'); + } + $this->container['updated_by_id'] = $updated_by_id; + + return $this; + } + + /** + * Gets folder_id + * + * @return int|null + */ + public function getFolderId() + { + return $this->container['folder_id']; + } + + /** + * Sets folder_id + * + * @param int|null $folder_id folder_id + * + * @return self + */ + public function setFolderId($folder_id) + { + if (is_null($folder_id)) { + throw new \InvalidArgumentException('non-nullable folder_id cannot be null'); + } + $this->container['folder_id'] = $folder_id; + + return $this; + } + + /** + * Gets subscription_details + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null + */ + public function getSubscriptionDetails() + { + return $this->container['subscription_details']; + } + + /** + * Sets subscription_details + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailSubscriptionDetails|null $subscription_details subscription_details + * + * @return self + */ + public function setSubscriptionDetails($subscription_details) + { + if (is_null($subscription_details)) { + throw new \InvalidArgumentException('non-nullable subscription_details cannot be null'); + } + $this->container['subscription_details'] = $subscription_details; + + return $this; + } + + /** + * Gets deleted_at + * + * @return \DateTime|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param \DateTime|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the email, as displayed on the email dashboard. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets active_domain + * + * @return string|null + */ + public function getActiveDomain() + { + return $this->container['active_domain']; + } + + /** + * Sets active_domain + * + * @param string|null $active_domain The active domain of the email. + * + * @return self + */ + public function setActiveDomain($active_domain) + { + if (is_null($active_domain)) { + throw new \InvalidArgumentException('non-nullable active_domain cannot be null'); + } + $this->container['active_domain'] = $active_domain; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign The campaign id on the email. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + throw new \InvalidArgumentException('non-nullable campaign cannot be null'); + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailToDetails $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets subcategory + * + * @return string + */ + public function getSubcategory() + { + return $this->container['subcategory']; + } + + /** + * Sets subcategory + * + * @param string $subcategory The email subcategory. + * + * @return self + */ + public function setSubcategory($subcategory) + { + if (is_null($subcategory)) { + throw new \InvalidArgumentException('non-nullable subcategory cannot be null'); + } + $this->container['subcategory'] = $subcategory; + + return $this; + } + + /** + * Gets campaign_name + * + * @return string|null + */ + public function getCampaignName() + { + return $this->container['campaign_name']; + } + + /** + * Sets campaign_name + * + * @param string|null $campaign_name campaign_name + * + * @return self + */ + public function setCampaignName($campaign_name) + { + if (is_null($campaign_name)) { + throw new \InvalidArgumentException('non-nullable campaign_name cannot be null'); + } + $this->container['campaign_name'] = $campaign_name; + + return $this; + } + + /** + * Gets send_on_publish + * + * @return bool + */ + public function getSendOnPublish() + { + return $this->container['send_on_publish']; + } + + /** + * Sets send_on_publish + * + * @param bool $send_on_publish Determines whether the email will be sent immediately on publish. + * + * @return self + */ + public function setSendOnPublish($send_on_publish) + { + if (is_null($send_on_publish)) { + throw new \InvalidArgumentException('non-nullable send_on_publish cannot be null'); + } + $this->container['send_on_publish'] = $send_on_publish; + + 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/codegen/Marketing/Emails/Model/PublicEmailContent.php b/codegen/Marketing/Emails/Model/PublicEmailContent.php new file mode 100644 index 000000000..c7208dac1 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailContent.php @@ -0,0 +1,648 @@ + + */ +class PublicEmailContent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailContent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'smart_fields' => 'array', + 'theme_settings_values' => 'array', + 'flex_areas' => 'array', + 'widgets' => 'array', + 'plain_text_version' => 'string', + 'template_path' => 'string', + 'widget_containers' => 'array', + 'style_settings' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailStyleSettings' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'smart_fields' => null, + 'theme_settings_values' => null, + 'flex_areas' => null, + 'widgets' => null, + 'plain_text_version' => null, + 'template_path' => null, + 'widget_containers' => null, + 'style_settings' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'smart_fields' => false, + 'theme_settings_values' => false, + 'flex_areas' => false, + 'widgets' => false, + 'plain_text_version' => false, + 'template_path' => false, + 'widget_containers' => false, + 'style_settings' => 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 = [ + 'smart_fields' => 'smartFields', + 'theme_settings_values' => 'themeSettingsValues', + 'flex_areas' => 'flexAreas', + 'widgets' => 'widgets', + 'plain_text_version' => 'plainTextVersion', + 'template_path' => 'templatePath', + 'widget_containers' => 'widgetContainers', + 'style_settings' => 'styleSettings' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'smart_fields' => 'setSmartFields', + 'theme_settings_values' => 'setThemeSettingsValues', + 'flex_areas' => 'setFlexAreas', + 'widgets' => 'setWidgets', + 'plain_text_version' => 'setPlainTextVersion', + 'template_path' => 'setTemplatePath', + 'widget_containers' => 'setWidgetContainers', + 'style_settings' => 'setStyleSettings' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'smart_fields' => 'getSmartFields', + 'theme_settings_values' => 'getThemeSettingsValues', + 'flex_areas' => 'getFlexAreas', + 'widgets' => 'getWidgets', + 'plain_text_version' => 'getPlainTextVersion', + 'template_path' => 'getTemplatePath', + 'widget_containers' => 'getWidgetContainers', + 'style_settings' => 'getStyleSettings' + ]; + + /** + * 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('smart_fields', $data ?? [], null); + $this->setIfExists('theme_settings_values', $data ?? [], null); + $this->setIfExists('flex_areas', $data ?? [], null); + $this->setIfExists('widgets', $data ?? [], null); + $this->setIfExists('plain_text_version', $data ?? [], null); + $this->setIfExists('template_path', $data ?? [], null); + $this->setIfExists('widget_containers', $data ?? [], null); + $this->setIfExists('style_settings', $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 smart_fields + * + * @return array|null + */ + public function getSmartFields() + { + return $this->container['smart_fields']; + } + + /** + * Sets smart_fields + * + * @param array|null $smart_fields + * + * @return self + */ + public function setSmartFields($smart_fields) + { + if (is_null($smart_fields)) { + throw new \InvalidArgumentException('non-nullable smart_fields cannot be null'); + } + $this->container['smart_fields'] = $smart_fields; + + return $this; + } + + /** + * Gets theme_settings_values + * + * @return array|null + */ + public function getThemeSettingsValues() + { + return $this->container['theme_settings_values']; + } + + /** + * Sets theme_settings_values + * + * @param array|null $theme_settings_values + * + * @return self + */ + public function setThemeSettingsValues($theme_settings_values) + { + if (is_null($theme_settings_values)) { + throw new \InvalidArgumentException('non-nullable theme_settings_values cannot be null'); + } + $this->container['theme_settings_values'] = $theme_settings_values; + + return $this; + } + + /** + * Gets flex_areas + * + * @return array|null + */ + public function getFlexAreas() + { + return $this->container['flex_areas']; + } + + /** + * Sets flex_areas + * + * @param array|null $flex_areas + * + * @return self + */ + public function setFlexAreas($flex_areas) + { + if (is_null($flex_areas)) { + throw new \InvalidArgumentException('non-nullable flex_areas cannot be null'); + } + $this->container['flex_areas'] = $flex_areas; + + return $this; + } + + /** + * Gets widgets + * + * @return array|null + */ + public function getWidgets() + { + return $this->container['widgets']; + } + + /** + * Sets widgets + * + * @param array|null $widgets + * + * @return self + */ + public function setWidgets($widgets) + { + if (is_null($widgets)) { + throw new \InvalidArgumentException('non-nullable widgets cannot be null'); + } + $this->container['widgets'] = $widgets; + + return $this; + } + + /** + * Gets plain_text_version + * + * @return string|null + */ + public function getPlainTextVersion() + { + return $this->container['plain_text_version']; + } + + /** + * Sets plain_text_version + * + * @param string|null $plain_text_version + * + * @return self + */ + public function setPlainTextVersion($plain_text_version) + { + if (is_null($plain_text_version)) { + throw new \InvalidArgumentException('non-nullable plain_text_version cannot be null'); + } + $this->container['plain_text_version'] = $plain_text_version; + + return $this; + } + + /** + * Gets template_path + * + * @return string|null + */ + public function getTemplatePath() + { + return $this->container['template_path']; + } + + /** + * Sets template_path + * + * @param string|null $template_path + * + * @return self + */ + public function setTemplatePath($template_path) + { + if (is_null($template_path)) { + throw new \InvalidArgumentException('non-nullable template_path cannot be null'); + } + $this->container['template_path'] = $template_path; + + return $this; + } + + /** + * Gets widget_containers + * + * @return array|null + */ + public function getWidgetContainers() + { + return $this->container['widget_containers']; + } + + /** + * Sets widget_containers + * + * @param array|null $widget_containers + * + * @return self + */ + public function setWidgetContainers($widget_containers) + { + if (is_null($widget_containers)) { + throw new \InvalidArgumentException('non-nullable widget_containers cannot be null'); + } + $this->container['widget_containers'] = $widget_containers; + + return $this; + } + + /** + * Gets style_settings + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailStyleSettings|null + */ + public function getStyleSettings() + { + return $this->container['style_settings']; + } + + /** + * Sets style_settings + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailStyleSettings|null $style_settings style_settings + * + * @return self + */ + public function setStyleSettings($style_settings) + { + if (is_null($style_settings)) { + throw new \InvalidArgumentException('non-nullable style_settings cannot be null'); + } + $this->container['style_settings'] = $style_settings; + + 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/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php b/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php new file mode 100644 index 000000000..5305fd44b --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php @@ -0,0 +1,478 @@ + + */ +class PublicEmailFromDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailFromDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_reply_to' => 'string', + 'from_name' => 'string', + 'reply_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_reply_to' => null, + 'from_name' => null, + 'reply_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_reply_to' => false, + 'from_name' => false, + 'reply_to' => 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 = [ + 'custom_reply_to' => 'customReplyTo', + 'from_name' => 'fromName', + 'reply_to' => 'replyTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_reply_to' => 'setCustomReplyTo', + 'from_name' => 'setFromName', + 'reply_to' => 'setReplyTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_reply_to' => 'getCustomReplyTo', + 'from_name' => 'getFromName', + 'reply_to' => 'getReplyTo' + ]; + + /** + * 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('custom_reply_to', $data ?? [], null); + $this->setIfExists('from_name', $data ?? [], null); + $this->setIfExists('reply_to', $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 custom_reply_to + * + * @return string|null + */ + public function getCustomReplyTo() + { + return $this->container['custom_reply_to']; + } + + /** + * Sets custom_reply_to + * + * @param string|null $custom_reply_to The reply to recipients will see. + * + * @return self + */ + public function setCustomReplyTo($custom_reply_to) + { + if (is_null($custom_reply_to)) { + throw new \InvalidArgumentException('non-nullable custom_reply_to cannot be null'); + } + $this->container['custom_reply_to'] = $custom_reply_to; + + return $this; + } + + /** + * Gets from_name + * + * @return string|null + */ + public function getFromName() + { + return $this->container['from_name']; + } + + /** + * Sets from_name + * + * @param string|null $from_name The name recipients will see. + * + * @return self + */ + public function setFromName($from_name) + { + if (is_null($from_name)) { + throw new \InvalidArgumentException('non-nullable from_name cannot be null'); + } + $this->container['from_name'] = $from_name; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo() + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to The from address and reply to email address (if no customReplyTo defined) recipients will see. + * + * @return self + */ + public function setReplyTo($reply_to) + { + if (is_null($reply_to)) { + throw new \InvalidArgumentException('non-nullable reply_to cannot be null'); + } + $this->container['reply_to'] = $reply_to; + + 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/codegen/Marketing/Emails/Model/PublicEmailRecipients.php b/codegen/Marketing/Emails/Model/PublicEmailRecipients.php new file mode 100644 index 000000000..d2bddbacf --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailRecipients.php @@ -0,0 +1,444 @@ + + */ +class PublicEmailRecipients implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailRecipients'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'include' => 'string[]', + 'exclude' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'include' => null, + 'exclude' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'include' => false, + 'exclude' => 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 = [ + 'include' => 'include', + 'exclude' => 'exclude' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'include' => 'setInclude', + 'exclude' => 'setExclude' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'include' => 'getInclude', + 'exclude' => 'getExclude' + ]; + + /** + * 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('include', $data ?? [], null); + $this->setIfExists('exclude', $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 include + * + * @return string[]|null + */ + public function getInclude() + { + return $this->container['include']; + } + + /** + * Sets include + * + * @param string[]|null $include Included IDs. + * + * @return self + */ + public function setInclude($include) + { + if (is_null($include)) { + throw new \InvalidArgumentException('non-nullable include cannot be null'); + } + $this->container['include'] = $include; + + return $this; + } + + /** + * Gets exclude + * + * @return string[]|null + */ + public function getExclude() + { + return $this->container['exclude']; + } + + /** + * Sets exclude + * + * @param string[]|null $exclude Excluded IDs. + * + * @return self + */ + public function setExclude($exclude) + { + if (is_null($exclude)) { + throw new \InvalidArgumentException('non-nullable exclude cannot be null'); + } + $this->container['exclude'] = $exclude; + + 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/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php b/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php new file mode 100644 index 000000000..2e22f82eb --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php @@ -0,0 +1,1395 @@ + + */ +class PublicEmailStyleSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailStyleSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_body_padding' => 'string', + 'color_picker_favorite5' => 'string', + 'body_color' => 'string', + 'color_picker_favorite6' => 'string', + 'background_image' => 'string', + 'email_body_width' => 'string', + 'secondary_font' => 'string', + 'primary_accent_color' => 'string', + 'color_picker_favorite3' => 'string', + 'primary_font_line_height' => 'string', + 'color_picker_favorite4' => 'string', + 'secondary_font_color' => 'string', + 'color_picker_favorite1' => 'string', + 'color_picker_favorite2' => 'string', + 'body_border_color' => 'string', + 'body_border_width' => 'int', + 'links_font' => '\HubSpot\Client\Marketing\Emails\Model\PublicFontStyle', + 'background_color' => 'string', + 'background_image_type' => 'string', + 'divider_style_settings' => '\HubSpot\Client\Marketing\Emails\Model\PublicDividerStyleSettings', + 'secondary_accent_color' => 'string', + 'secondary_font_line_height' => 'string', + 'primary_font_size' => 'int', + 'secondary_font_size' => 'int', + 'primary_font_color' => 'string', + 'heading_one_font' => '\HubSpot\Client\Marketing\Emails\Model\PublicFontStyle', + 'primary_font' => 'string', + 'heading_two_font' => '\HubSpot\Client\Marketing\Emails\Model\PublicFontStyle', + 'button_style_settings' => '\HubSpot\Client\Marketing\Emails\Model\PublicButtonStyleSettings', + 'body_border_color_choice' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_body_padding' => null, + 'color_picker_favorite5' => null, + 'body_color' => null, + 'color_picker_favorite6' => null, + 'background_image' => null, + 'email_body_width' => null, + 'secondary_font' => null, + 'primary_accent_color' => null, + 'color_picker_favorite3' => null, + 'primary_font_line_height' => null, + 'color_picker_favorite4' => null, + 'secondary_font_color' => null, + 'color_picker_favorite1' => null, + 'color_picker_favorite2' => null, + 'body_border_color' => null, + 'body_border_width' => 'int32', + 'links_font' => null, + 'background_color' => null, + 'background_image_type' => null, + 'divider_style_settings' => null, + 'secondary_accent_color' => null, + 'secondary_font_line_height' => null, + 'primary_font_size' => 'int32', + 'secondary_font_size' => 'int32', + 'primary_font_color' => null, + 'heading_one_font' => null, + 'primary_font' => null, + 'heading_two_font' => null, + 'button_style_settings' => null, + 'body_border_color_choice' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_body_padding' => false, + 'color_picker_favorite5' => false, + 'body_color' => false, + 'color_picker_favorite6' => false, + 'background_image' => false, + 'email_body_width' => false, + 'secondary_font' => false, + 'primary_accent_color' => false, + 'color_picker_favorite3' => false, + 'primary_font_line_height' => false, + 'color_picker_favorite4' => false, + 'secondary_font_color' => false, + 'color_picker_favorite1' => false, + 'color_picker_favorite2' => false, + 'body_border_color' => false, + 'body_border_width' => false, + 'links_font' => false, + 'background_color' => false, + 'background_image_type' => false, + 'divider_style_settings' => false, + 'secondary_accent_color' => false, + 'secondary_font_line_height' => false, + 'primary_font_size' => false, + 'secondary_font_size' => false, + 'primary_font_color' => false, + 'heading_one_font' => false, + 'primary_font' => false, + 'heading_two_font' => false, + 'button_style_settings' => false, + 'body_border_color_choice' => 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 = [ + 'email_body_padding' => 'emailBodyPadding', + 'color_picker_favorite5' => 'colorPickerFavorite5', + 'body_color' => 'bodyColor', + 'color_picker_favorite6' => 'colorPickerFavorite6', + 'background_image' => 'backgroundImage', + 'email_body_width' => 'emailBodyWidth', + 'secondary_font' => 'secondaryFont', + 'primary_accent_color' => 'primaryAccentColor', + 'color_picker_favorite3' => 'colorPickerFavorite3', + 'primary_font_line_height' => 'primaryFontLineHeight', + 'color_picker_favorite4' => 'colorPickerFavorite4', + 'secondary_font_color' => 'secondaryFontColor', + 'color_picker_favorite1' => 'colorPickerFavorite1', + 'color_picker_favorite2' => 'colorPickerFavorite2', + 'body_border_color' => 'bodyBorderColor', + 'body_border_width' => 'bodyBorderWidth', + 'links_font' => 'linksFont', + 'background_color' => 'backgroundColor', + 'background_image_type' => 'backgroundImageType', + 'divider_style_settings' => 'dividerStyleSettings', + 'secondary_accent_color' => 'secondaryAccentColor', + 'secondary_font_line_height' => 'secondaryFontLineHeight', + 'primary_font_size' => 'primaryFontSize', + 'secondary_font_size' => 'secondaryFontSize', + 'primary_font_color' => 'primaryFontColor', + 'heading_one_font' => 'headingOneFont', + 'primary_font' => 'primaryFont', + 'heading_two_font' => 'headingTwoFont', + 'button_style_settings' => 'buttonStyleSettings', + 'body_border_color_choice' => 'bodyBorderColorChoice' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_body_padding' => 'setEmailBodyPadding', + 'color_picker_favorite5' => 'setColorPickerFavorite5', + 'body_color' => 'setBodyColor', + 'color_picker_favorite6' => 'setColorPickerFavorite6', + 'background_image' => 'setBackgroundImage', + 'email_body_width' => 'setEmailBodyWidth', + 'secondary_font' => 'setSecondaryFont', + 'primary_accent_color' => 'setPrimaryAccentColor', + 'color_picker_favorite3' => 'setColorPickerFavorite3', + 'primary_font_line_height' => 'setPrimaryFontLineHeight', + 'color_picker_favorite4' => 'setColorPickerFavorite4', + 'secondary_font_color' => 'setSecondaryFontColor', + 'color_picker_favorite1' => 'setColorPickerFavorite1', + 'color_picker_favorite2' => 'setColorPickerFavorite2', + 'body_border_color' => 'setBodyBorderColor', + 'body_border_width' => 'setBodyBorderWidth', + 'links_font' => 'setLinksFont', + 'background_color' => 'setBackgroundColor', + 'background_image_type' => 'setBackgroundImageType', + 'divider_style_settings' => 'setDividerStyleSettings', + 'secondary_accent_color' => 'setSecondaryAccentColor', + 'secondary_font_line_height' => 'setSecondaryFontLineHeight', + 'primary_font_size' => 'setPrimaryFontSize', + 'secondary_font_size' => 'setSecondaryFontSize', + 'primary_font_color' => 'setPrimaryFontColor', + 'heading_one_font' => 'setHeadingOneFont', + 'primary_font' => 'setPrimaryFont', + 'heading_two_font' => 'setHeadingTwoFont', + 'button_style_settings' => 'setButtonStyleSettings', + 'body_border_color_choice' => 'setBodyBorderColorChoice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_body_padding' => 'getEmailBodyPadding', + 'color_picker_favorite5' => 'getColorPickerFavorite5', + 'body_color' => 'getBodyColor', + 'color_picker_favorite6' => 'getColorPickerFavorite6', + 'background_image' => 'getBackgroundImage', + 'email_body_width' => 'getEmailBodyWidth', + 'secondary_font' => 'getSecondaryFont', + 'primary_accent_color' => 'getPrimaryAccentColor', + 'color_picker_favorite3' => 'getColorPickerFavorite3', + 'primary_font_line_height' => 'getPrimaryFontLineHeight', + 'color_picker_favorite4' => 'getColorPickerFavorite4', + 'secondary_font_color' => 'getSecondaryFontColor', + 'color_picker_favorite1' => 'getColorPickerFavorite1', + 'color_picker_favorite2' => 'getColorPickerFavorite2', + 'body_border_color' => 'getBodyBorderColor', + 'body_border_width' => 'getBodyBorderWidth', + 'links_font' => 'getLinksFont', + 'background_color' => 'getBackgroundColor', + 'background_image_type' => 'getBackgroundImageType', + 'divider_style_settings' => 'getDividerStyleSettings', + 'secondary_accent_color' => 'getSecondaryAccentColor', + 'secondary_font_line_height' => 'getSecondaryFontLineHeight', + 'primary_font_size' => 'getPrimaryFontSize', + 'secondary_font_size' => 'getSecondaryFontSize', + 'primary_font_color' => 'getPrimaryFontColor', + 'heading_one_font' => 'getHeadingOneFont', + 'primary_font' => 'getPrimaryFont', + 'heading_two_font' => 'getHeadingTwoFont', + 'button_style_settings' => 'getButtonStyleSettings', + 'body_border_color_choice' => 'getBodyBorderColorChoice' + ]; + + /** + * 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('email_body_padding', $data ?? [], null); + $this->setIfExists('color_picker_favorite5', $data ?? [], null); + $this->setIfExists('body_color', $data ?? [], null); + $this->setIfExists('color_picker_favorite6', $data ?? [], null); + $this->setIfExists('background_image', $data ?? [], null); + $this->setIfExists('email_body_width', $data ?? [], null); + $this->setIfExists('secondary_font', $data ?? [], null); + $this->setIfExists('primary_accent_color', $data ?? [], null); + $this->setIfExists('color_picker_favorite3', $data ?? [], null); + $this->setIfExists('primary_font_line_height', $data ?? [], null); + $this->setIfExists('color_picker_favorite4', $data ?? [], null); + $this->setIfExists('secondary_font_color', $data ?? [], null); + $this->setIfExists('color_picker_favorite1', $data ?? [], null); + $this->setIfExists('color_picker_favorite2', $data ?? [], null); + $this->setIfExists('body_border_color', $data ?? [], null); + $this->setIfExists('body_border_width', $data ?? [], null); + $this->setIfExists('links_font', $data ?? [], null); + $this->setIfExists('background_color', $data ?? [], null); + $this->setIfExists('background_image_type', $data ?? [], null); + $this->setIfExists('divider_style_settings', $data ?? [], null); + $this->setIfExists('secondary_accent_color', $data ?? [], null); + $this->setIfExists('secondary_font_line_height', $data ?? [], null); + $this->setIfExists('primary_font_size', $data ?? [], null); + $this->setIfExists('secondary_font_size', $data ?? [], null); + $this->setIfExists('primary_font_color', $data ?? [], null); + $this->setIfExists('heading_one_font', $data ?? [], null); + $this->setIfExists('primary_font', $data ?? [], null); + $this->setIfExists('heading_two_font', $data ?? [], null); + $this->setIfExists('button_style_settings', $data ?? [], null); + $this->setIfExists('body_border_color_choice', $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 email_body_padding + * + * @return string|null + */ + public function getEmailBodyPadding() + { + return $this->container['email_body_padding']; + } + + /** + * Sets email_body_padding + * + * @param string|null $email_body_padding email_body_padding + * + * @return self + */ + public function setEmailBodyPadding($email_body_padding) + { + if (is_null($email_body_padding)) { + throw new \InvalidArgumentException('non-nullable email_body_padding cannot be null'); + } + $this->container['email_body_padding'] = $email_body_padding; + + return $this; + } + + /** + * Gets color_picker_favorite5 + * + * @return string|null + */ + public function getColorPickerFavorite5() + { + return $this->container['color_picker_favorite5']; + } + + /** + * Sets color_picker_favorite5 + * + * @param string|null $color_picker_favorite5 color_picker_favorite5 + * + * @return self + */ + public function setColorPickerFavorite5($color_picker_favorite5) + { + if (is_null($color_picker_favorite5)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite5 cannot be null'); + } + $this->container['color_picker_favorite5'] = $color_picker_favorite5; + + return $this; + } + + /** + * Gets body_color + * + * @return string|null + */ + public function getBodyColor() + { + return $this->container['body_color']; + } + + /** + * Sets body_color + * + * @param string|null $body_color body_color + * + * @return self + */ + public function setBodyColor($body_color) + { + if (is_null($body_color)) { + throw new \InvalidArgumentException('non-nullable body_color cannot be null'); + } + $this->container['body_color'] = $body_color; + + return $this; + } + + /** + * Gets color_picker_favorite6 + * + * @return string|null + */ + public function getColorPickerFavorite6() + { + return $this->container['color_picker_favorite6']; + } + + /** + * Sets color_picker_favorite6 + * + * @param string|null $color_picker_favorite6 color_picker_favorite6 + * + * @return self + */ + public function setColorPickerFavorite6($color_picker_favorite6) + { + if (is_null($color_picker_favorite6)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite6 cannot be null'); + } + $this->container['color_picker_favorite6'] = $color_picker_favorite6; + + return $this; + } + + /** + * Gets background_image + * + * @return string|null + */ + public function getBackgroundImage() + { + return $this->container['background_image']; + } + + /** + * Sets background_image + * + * @param string|null $background_image background_image + * + * @return self + */ + public function setBackgroundImage($background_image) + { + if (is_null($background_image)) { + throw new \InvalidArgumentException('non-nullable background_image cannot be null'); + } + $this->container['background_image'] = $background_image; + + return $this; + } + + /** + * Gets email_body_width + * + * @return string|null + */ + public function getEmailBodyWidth() + { + return $this->container['email_body_width']; + } + + /** + * Sets email_body_width + * + * @param string|null $email_body_width email_body_width + * + * @return self + */ + public function setEmailBodyWidth($email_body_width) + { + if (is_null($email_body_width)) { + throw new \InvalidArgumentException('non-nullable email_body_width cannot be null'); + } + $this->container['email_body_width'] = $email_body_width; + + return $this; + } + + /** + * Gets secondary_font + * + * @return string|null + */ + public function getSecondaryFont() + { + return $this->container['secondary_font']; + } + + /** + * Sets secondary_font + * + * @param string|null $secondary_font secondary_font + * + * @return self + */ + public function setSecondaryFont($secondary_font) + { + if (is_null($secondary_font)) { + throw new \InvalidArgumentException('non-nullable secondary_font cannot be null'); + } + $this->container['secondary_font'] = $secondary_font; + + return $this; + } + + /** + * Gets primary_accent_color + * + * @return string|null + */ + public function getPrimaryAccentColor() + { + return $this->container['primary_accent_color']; + } + + /** + * Sets primary_accent_color + * + * @param string|null $primary_accent_color primary_accent_color + * + * @return self + */ + public function setPrimaryAccentColor($primary_accent_color) + { + if (is_null($primary_accent_color)) { + throw new \InvalidArgumentException('non-nullable primary_accent_color cannot be null'); + } + $this->container['primary_accent_color'] = $primary_accent_color; + + return $this; + } + + /** + * Gets color_picker_favorite3 + * + * @return string|null + */ + public function getColorPickerFavorite3() + { + return $this->container['color_picker_favorite3']; + } + + /** + * Sets color_picker_favorite3 + * + * @param string|null $color_picker_favorite3 color_picker_favorite3 + * + * @return self + */ + public function setColorPickerFavorite3($color_picker_favorite3) + { + if (is_null($color_picker_favorite3)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite3 cannot be null'); + } + $this->container['color_picker_favorite3'] = $color_picker_favorite3; + + return $this; + } + + /** + * Gets primary_font_line_height + * + * @return string|null + */ + public function getPrimaryFontLineHeight() + { + return $this->container['primary_font_line_height']; + } + + /** + * Sets primary_font_line_height + * + * @param string|null $primary_font_line_height primary_font_line_height + * + * @return self + */ + public function setPrimaryFontLineHeight($primary_font_line_height) + { + if (is_null($primary_font_line_height)) { + throw new \InvalidArgumentException('non-nullable primary_font_line_height cannot be null'); + } + $this->container['primary_font_line_height'] = $primary_font_line_height; + + return $this; + } + + /** + * Gets color_picker_favorite4 + * + * @return string|null + */ + public function getColorPickerFavorite4() + { + return $this->container['color_picker_favorite4']; + } + + /** + * Sets color_picker_favorite4 + * + * @param string|null $color_picker_favorite4 color_picker_favorite4 + * + * @return self + */ + public function setColorPickerFavorite4($color_picker_favorite4) + { + if (is_null($color_picker_favorite4)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite4 cannot be null'); + } + $this->container['color_picker_favorite4'] = $color_picker_favorite4; + + return $this; + } + + /** + * Gets secondary_font_color + * + * @return string|null + */ + public function getSecondaryFontColor() + { + return $this->container['secondary_font_color']; + } + + /** + * Sets secondary_font_color + * + * @param string|null $secondary_font_color secondary_font_color + * + * @return self + */ + public function setSecondaryFontColor($secondary_font_color) + { + if (is_null($secondary_font_color)) { + throw new \InvalidArgumentException('non-nullable secondary_font_color cannot be null'); + } + $this->container['secondary_font_color'] = $secondary_font_color; + + return $this; + } + + /** + * Gets color_picker_favorite1 + * + * @return string|null + */ + public function getColorPickerFavorite1() + { + return $this->container['color_picker_favorite1']; + } + + /** + * Sets color_picker_favorite1 + * + * @param string|null $color_picker_favorite1 color_picker_favorite1 + * + * @return self + */ + public function setColorPickerFavorite1($color_picker_favorite1) + { + if (is_null($color_picker_favorite1)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite1 cannot be null'); + } + $this->container['color_picker_favorite1'] = $color_picker_favorite1; + + return $this; + } + + /** + * Gets color_picker_favorite2 + * + * @return string|null + */ + public function getColorPickerFavorite2() + { + return $this->container['color_picker_favorite2']; + } + + /** + * Sets color_picker_favorite2 + * + * @param string|null $color_picker_favorite2 color_picker_favorite2 + * + * @return self + */ + public function setColorPickerFavorite2($color_picker_favorite2) + { + if (is_null($color_picker_favorite2)) { + throw new \InvalidArgumentException('non-nullable color_picker_favorite2 cannot be null'); + } + $this->container['color_picker_favorite2'] = $color_picker_favorite2; + + return $this; + } + + /** + * Gets body_border_color + * + * @return string|null + */ + public function getBodyBorderColor() + { + return $this->container['body_border_color']; + } + + /** + * Sets body_border_color + * + * @param string|null $body_border_color body_border_color + * + * @return self + */ + public function setBodyBorderColor($body_border_color) + { + if (is_null($body_border_color)) { + throw new \InvalidArgumentException('non-nullable body_border_color cannot be null'); + } + $this->container['body_border_color'] = $body_border_color; + + return $this; + } + + /** + * Gets body_border_width + * + * @return int|null + */ + public function getBodyBorderWidth() + { + return $this->container['body_border_width']; + } + + /** + * Sets body_border_width + * + * @param int|null $body_border_width body_border_width + * + * @return self + */ + public function setBodyBorderWidth($body_border_width) + { + if (is_null($body_border_width)) { + throw new \InvalidArgumentException('non-nullable body_border_width cannot be null'); + } + $this->container['body_border_width'] = $body_border_width; + + return $this; + } + + /** + * Gets links_font + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null + */ + public function getLinksFont() + { + return $this->container['links_font']; + } + + /** + * Sets links_font + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null $links_font links_font + * + * @return self + */ + public function setLinksFont($links_font) + { + if (is_null($links_font)) { + throw new \InvalidArgumentException('non-nullable links_font cannot be null'); + } + $this->container['links_font'] = $links_font; + + return $this; + } + + /** + * Gets background_color + * + * @return string|null + */ + public function getBackgroundColor() + { + return $this->container['background_color']; + } + + /** + * Sets background_color + * + * @param string|null $background_color background_color + * + * @return self + */ + public function setBackgroundColor($background_color) + { + if (is_null($background_color)) { + throw new \InvalidArgumentException('non-nullable background_color cannot be null'); + } + $this->container['background_color'] = $background_color; + + return $this; + } + + /** + * Gets background_image_type + * + * @return string|null + */ + public function getBackgroundImageType() + { + return $this->container['background_image_type']; + } + + /** + * Sets background_image_type + * + * @param string|null $background_image_type background_image_type + * + * @return self + */ + public function setBackgroundImageType($background_image_type) + { + if (is_null($background_image_type)) { + throw new \InvalidArgumentException('non-nullable background_image_type cannot be null'); + } + $this->container['background_image_type'] = $background_image_type; + + return $this; + } + + /** + * Gets divider_style_settings + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicDividerStyleSettings|null + */ + public function getDividerStyleSettings() + { + return $this->container['divider_style_settings']; + } + + /** + * Sets divider_style_settings + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicDividerStyleSettings|null $divider_style_settings divider_style_settings + * + * @return self + */ + public function setDividerStyleSettings($divider_style_settings) + { + if (is_null($divider_style_settings)) { + throw new \InvalidArgumentException('non-nullable divider_style_settings cannot be null'); + } + $this->container['divider_style_settings'] = $divider_style_settings; + + return $this; + } + + /** + * Gets secondary_accent_color + * + * @return string|null + */ + public function getSecondaryAccentColor() + { + return $this->container['secondary_accent_color']; + } + + /** + * Sets secondary_accent_color + * + * @param string|null $secondary_accent_color secondary_accent_color + * + * @return self + */ + public function setSecondaryAccentColor($secondary_accent_color) + { + if (is_null($secondary_accent_color)) { + throw new \InvalidArgumentException('non-nullable secondary_accent_color cannot be null'); + } + $this->container['secondary_accent_color'] = $secondary_accent_color; + + return $this; + } + + /** + * Gets secondary_font_line_height + * + * @return string|null + */ + public function getSecondaryFontLineHeight() + { + return $this->container['secondary_font_line_height']; + } + + /** + * Sets secondary_font_line_height + * + * @param string|null $secondary_font_line_height secondary_font_line_height + * + * @return self + */ + public function setSecondaryFontLineHeight($secondary_font_line_height) + { + if (is_null($secondary_font_line_height)) { + throw new \InvalidArgumentException('non-nullable secondary_font_line_height cannot be null'); + } + $this->container['secondary_font_line_height'] = $secondary_font_line_height; + + return $this; + } + + /** + * Gets primary_font_size + * + * @return int|null + */ + public function getPrimaryFontSize() + { + return $this->container['primary_font_size']; + } + + /** + * Sets primary_font_size + * + * @param int|null $primary_font_size primary_font_size + * + * @return self + */ + public function setPrimaryFontSize($primary_font_size) + { + if (is_null($primary_font_size)) { + throw new \InvalidArgumentException('non-nullable primary_font_size cannot be null'); + } + $this->container['primary_font_size'] = $primary_font_size; + + return $this; + } + + /** + * Gets secondary_font_size + * + * @return int|null + */ + public function getSecondaryFontSize() + { + return $this->container['secondary_font_size']; + } + + /** + * Sets secondary_font_size + * + * @param int|null $secondary_font_size secondary_font_size + * + * @return self + */ + public function setSecondaryFontSize($secondary_font_size) + { + if (is_null($secondary_font_size)) { + throw new \InvalidArgumentException('non-nullable secondary_font_size cannot be null'); + } + $this->container['secondary_font_size'] = $secondary_font_size; + + return $this; + } + + /** + * Gets primary_font_color + * + * @return string|null + */ + public function getPrimaryFontColor() + { + return $this->container['primary_font_color']; + } + + /** + * Sets primary_font_color + * + * @param string|null $primary_font_color primary_font_color + * + * @return self + */ + public function setPrimaryFontColor($primary_font_color) + { + if (is_null($primary_font_color)) { + throw new \InvalidArgumentException('non-nullable primary_font_color cannot be null'); + } + $this->container['primary_font_color'] = $primary_font_color; + + return $this; + } + + /** + * Gets heading_one_font + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null + */ + public function getHeadingOneFont() + { + return $this->container['heading_one_font']; + } + + /** + * Sets heading_one_font + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null $heading_one_font heading_one_font + * + * @return self + */ + public function setHeadingOneFont($heading_one_font) + { + if (is_null($heading_one_font)) { + throw new \InvalidArgumentException('non-nullable heading_one_font cannot be null'); + } + $this->container['heading_one_font'] = $heading_one_font; + + return $this; + } + + /** + * Gets primary_font + * + * @return string|null + */ + public function getPrimaryFont() + { + return $this->container['primary_font']; + } + + /** + * Sets primary_font + * + * @param string|null $primary_font primary_font + * + * @return self + */ + public function setPrimaryFont($primary_font) + { + if (is_null($primary_font)) { + throw new \InvalidArgumentException('non-nullable primary_font cannot be null'); + } + $this->container['primary_font'] = $primary_font; + + return $this; + } + + /** + * Gets heading_two_font + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null + */ + public function getHeadingTwoFont() + { + return $this->container['heading_two_font']; + } + + /** + * Sets heading_two_font + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicFontStyle|null $heading_two_font heading_two_font + * + * @return self + */ + public function setHeadingTwoFont($heading_two_font) + { + if (is_null($heading_two_font)) { + throw new \InvalidArgumentException('non-nullable heading_two_font cannot be null'); + } + $this->container['heading_two_font'] = $heading_two_font; + + return $this; + } + + /** + * Gets button_style_settings + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicButtonStyleSettings|null + */ + public function getButtonStyleSettings() + { + return $this->container['button_style_settings']; + } + + /** + * Sets button_style_settings + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicButtonStyleSettings|null $button_style_settings button_style_settings + * + * @return self + */ + public function setButtonStyleSettings($button_style_settings) + { + if (is_null($button_style_settings)) { + throw new \InvalidArgumentException('non-nullable button_style_settings cannot be null'); + } + $this->container['button_style_settings'] = $button_style_settings; + + return $this; + } + + /** + * Gets body_border_color_choice + * + * @return string|null + */ + public function getBodyBorderColorChoice() + { + return $this->container['body_border_color_choice']; + } + + /** + * Sets body_border_color_choice + * + * @param string|null $body_border_color_choice body_border_color_choice + * + * @return self + */ + public function setBodyBorderColorChoice($body_border_color_choice) + { + if (is_null($body_border_color_choice)) { + throw new \InvalidArgumentException('non-nullable body_border_color_choice cannot be null'); + } + $this->container['body_border_color_choice'] = $body_border_color_choice; + + 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/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php b/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php new file mode 100644 index 000000000..7197aaa95 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php @@ -0,0 +1,478 @@ + + */ +class PublicEmailSubscriptionDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailSubscriptionDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'office_location_id' => 'string', + 'preferences_group_id' => 'string', + 'subscription_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'office_location_id' => null, + 'preferences_group_id' => null, + 'subscription_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'office_location_id' => false, + 'preferences_group_id' => false, + 'subscription_id' => 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 = [ + 'office_location_id' => 'officeLocationId', + 'preferences_group_id' => 'preferencesGroupId', + 'subscription_id' => 'subscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'office_location_id' => 'setOfficeLocationId', + 'preferences_group_id' => 'setPreferencesGroupId', + 'subscription_id' => 'setSubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'office_location_id' => 'getOfficeLocationId', + 'preferences_group_id' => 'getPreferencesGroupId', + 'subscription_id' => 'getSubscriptionId' + ]; + + /** + * 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('office_location_id', $data ?? [], null); + $this->setIfExists('preferences_group_id', $data ?? [], null); + $this->setIfExists('subscription_id', $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 office_location_id + * + * @return string|null + */ + public function getOfficeLocationId() + { + return $this->container['office_location_id']; + } + + /** + * Sets office_location_id + * + * @param string|null $office_location_id ID of the selected office location. + * + * @return self + */ + public function setOfficeLocationId($office_location_id) + { + if (is_null($office_location_id)) { + throw new \InvalidArgumentException('non-nullable office_location_id cannot be null'); + } + $this->container['office_location_id'] = $office_location_id; + + return $this; + } + + /** + * Gets preferences_group_id + * + * @return string|null + */ + public function getPreferencesGroupId() + { + return $this->container['preferences_group_id']; + } + + /** + * Sets preferences_group_id + * + * @param string|null $preferences_group_id + * + * @return self + */ + public function setPreferencesGroupId($preferences_group_id) + { + if (is_null($preferences_group_id)) { + throw new \InvalidArgumentException('non-nullable preferences_group_id cannot be null'); + } + $this->container['preferences_group_id'] = $preferences_group_id; + + return $this; + } + + /** + * Gets subscription_id + * + * @return string|null + */ + public function getSubscriptionId() + { + return $this->container['subscription_id']; + } + + /** + * Sets subscription_id + * + * @param string|null $subscription_id ID of the subscription. + * + * @return self + */ + public function setSubscriptionId($subscription_id) + { + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + } + $this->container['subscription_id'] = $subscription_id; + + 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/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php b/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php new file mode 100644 index 000000000..09c7c2a22 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php @@ -0,0 +1,788 @@ + + */ +class PublicEmailTestingDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailTestingDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ab_sampling_default' => 'string', + 'ab_sample_size_default' => 'string', + 'ab_status' => 'string', + 'ab_test_percentage' => 'int', + 'hours_to_wait' => 'int', + 'test_id' => 'string', + 'ab_success_metric' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ab_sampling_default' => null, + 'ab_sample_size_default' => null, + 'ab_status' => null, + 'ab_test_percentage' => 'int32', + 'hours_to_wait' => 'int32', + 'test_id' => null, + 'ab_success_metric' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ab_sampling_default' => false, + 'ab_sample_size_default' => false, + 'ab_status' => false, + 'ab_test_percentage' => false, + 'hours_to_wait' => false, + 'test_id' => false, + 'ab_success_metric' => 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 = [ + 'ab_sampling_default' => 'abSamplingDefault', + 'ab_sample_size_default' => 'abSampleSizeDefault', + 'ab_status' => 'abStatus', + 'ab_test_percentage' => 'abTestPercentage', + 'hours_to_wait' => 'hoursToWait', + 'test_id' => 'testId', + 'ab_success_metric' => 'abSuccessMetric' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ab_sampling_default' => 'setAbSamplingDefault', + 'ab_sample_size_default' => 'setAbSampleSizeDefault', + 'ab_status' => 'setAbStatus', + 'ab_test_percentage' => 'setAbTestPercentage', + 'hours_to_wait' => 'setHoursToWait', + 'test_id' => 'setTestId', + 'ab_success_metric' => 'setAbSuccessMetric' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ab_sampling_default' => 'getAbSamplingDefault', + 'ab_sample_size_default' => 'getAbSampleSizeDefault', + 'ab_status' => 'getAbStatus', + 'ab_test_percentage' => 'getAbTestPercentage', + 'hours_to_wait' => 'getHoursToWait', + 'test_id' => 'getTestId', + 'ab_success_metric' => 'getAbSuccessMetric' + ]; + + /** + * 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 AB_SAMPLING_DEFAULT_MASTER = 'master'; + public const AB_SAMPLING_DEFAULT_VARIANT = 'variant'; + public const AB_SAMPLING_DEFAULT_LOSER_VARIANT = 'loser_variant'; + public const AB_SAMPLING_DEFAULT_MAB_MASTER = 'mab_master'; + public const AB_SAMPLING_DEFAULT_MAB_VARIANT = 'mab_variant'; + public const AB_SAMPLING_DEFAULT_AUTOMATED_MASTER = 'automated_master'; + public const AB_SAMPLING_DEFAULT_AUTOMATED_VARIANT = 'automated_variant'; + public const AB_SAMPLING_DEFAULT_AUTOMATED_LOSER_VARIANT = 'automated_loser_variant'; + public const AB_SAMPLE_SIZE_DEFAULT_MASTER = 'master'; + public const AB_SAMPLE_SIZE_DEFAULT_VARIANT = 'variant'; + public const AB_SAMPLE_SIZE_DEFAULT_LOSER_VARIANT = 'loser_variant'; + public const AB_SAMPLE_SIZE_DEFAULT_MAB_MASTER = 'mab_master'; + public const AB_SAMPLE_SIZE_DEFAULT_MAB_VARIANT = 'mab_variant'; + public const AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_MASTER = 'automated_master'; + public const AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_VARIANT = 'automated_variant'; + public const AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_LOSER_VARIANT = 'automated_loser_variant'; + public const AB_STATUS_MASTER = 'master'; + public const AB_STATUS_VARIANT = 'variant'; + public const AB_STATUS_LOSER_VARIANT = 'loser_variant'; + public const AB_STATUS_MAB_MASTER = 'mab_master'; + public const AB_STATUS_MAB_VARIANT = 'mab_variant'; + public const AB_STATUS_AUTOMATED_MASTER = 'automated_master'; + public const AB_STATUS_AUTOMATED_VARIANT = 'automated_variant'; + public const AB_STATUS_AUTOMATED_LOSER_VARIANT = 'automated_loser_variant'; + public const AB_SUCCESS_METRIC_CLICKS_BY_OPENS = 'CLICKS_BY_OPENS'; + public const AB_SUCCESS_METRIC_CLICKS_BY_DELIVERED = 'CLICKS_BY_DELIVERED'; + public const AB_SUCCESS_METRIC_OPENS_BY_DELIVERED = 'OPENS_BY_DELIVERED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAbSamplingDefaultAllowableValues() + { + return [ + self::AB_SAMPLING_DEFAULT_MASTER, + self::AB_SAMPLING_DEFAULT_VARIANT, + self::AB_SAMPLING_DEFAULT_LOSER_VARIANT, + self::AB_SAMPLING_DEFAULT_MAB_MASTER, + self::AB_SAMPLING_DEFAULT_MAB_VARIANT, + self::AB_SAMPLING_DEFAULT_AUTOMATED_MASTER, + self::AB_SAMPLING_DEFAULT_AUTOMATED_VARIANT, + self::AB_SAMPLING_DEFAULT_AUTOMATED_LOSER_VARIANT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAbSampleSizeDefaultAllowableValues() + { + return [ + self::AB_SAMPLE_SIZE_DEFAULT_MASTER, + self::AB_SAMPLE_SIZE_DEFAULT_VARIANT, + self::AB_SAMPLE_SIZE_DEFAULT_LOSER_VARIANT, + self::AB_SAMPLE_SIZE_DEFAULT_MAB_MASTER, + self::AB_SAMPLE_SIZE_DEFAULT_MAB_VARIANT, + self::AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_MASTER, + self::AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_VARIANT, + self::AB_SAMPLE_SIZE_DEFAULT_AUTOMATED_LOSER_VARIANT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAbStatusAllowableValues() + { + return [ + self::AB_STATUS_MASTER, + self::AB_STATUS_VARIANT, + self::AB_STATUS_LOSER_VARIANT, + self::AB_STATUS_MAB_MASTER, + self::AB_STATUS_MAB_VARIANT, + self::AB_STATUS_AUTOMATED_MASTER, + self::AB_STATUS_AUTOMATED_VARIANT, + self::AB_STATUS_AUTOMATED_LOSER_VARIANT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAbSuccessMetricAllowableValues() + { + return [ + self::AB_SUCCESS_METRIC_CLICKS_BY_OPENS, + self::AB_SUCCESS_METRIC_CLICKS_BY_DELIVERED, + self::AB_SUCCESS_METRIC_OPENS_BY_DELIVERED, + ]; + } + + /** + * 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('ab_sampling_default', $data ?? [], null); + $this->setIfExists('ab_sample_size_default', $data ?? [], null); + $this->setIfExists('ab_status', $data ?? [], null); + $this->setIfExists('ab_test_percentage', $data ?? [], null); + $this->setIfExists('hours_to_wait', $data ?? [], null); + $this->setIfExists('test_id', $data ?? [], null); + $this->setIfExists('ab_success_metric', $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 = []; + + $allowedValues = $this->getAbSamplingDefaultAllowableValues(); + if (!is_null($this->container['ab_sampling_default']) && !in_array($this->container['ab_sampling_default'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'ab_sampling_default', must be one of '%s'", + $this->container['ab_sampling_default'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAbSampleSizeDefaultAllowableValues(); + if (!is_null($this->container['ab_sample_size_default']) && !in_array($this->container['ab_sample_size_default'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'ab_sample_size_default', must be one of '%s'", + $this->container['ab_sample_size_default'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAbStatusAllowableValues(); + if (!is_null($this->container['ab_status']) && !in_array($this->container['ab_status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'ab_status', must be one of '%s'", + $this->container['ab_status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAbSuccessMetricAllowableValues(); + if (!is_null($this->container['ab_success_metric']) && !in_array($this->container['ab_success_metric'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'ab_success_metric', must be one of '%s'", + $this->container['ab_success_metric'], + implode("', '", $allowedValues) + ); + } + + 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 ab_sampling_default + * + * @return string|null + */ + public function getAbSamplingDefault() + { + return $this->container['ab_sampling_default']; + } + + /** + * Sets ab_sampling_default + * + * @param string|null $ab_sampling_default Version of the email that should be sent if the results are inconclusive after the test period, master or variant. + * + * @return self + */ + public function setAbSamplingDefault($ab_sampling_default) + { + if (is_null($ab_sampling_default)) { + throw new \InvalidArgumentException('non-nullable ab_sampling_default cannot be null'); + } + $allowedValues = $this->getAbSamplingDefaultAllowableValues(); + if (!in_array($ab_sampling_default, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'ab_sampling_default', must be one of '%s'", + $ab_sampling_default, + implode("', '", $allowedValues) + ) + ); + } + $this->container['ab_sampling_default'] = $ab_sampling_default; + + return $this; + } + + /** + * Gets ab_sample_size_default + * + * @return string|null + */ + public function getAbSampleSizeDefault() + { + return $this->container['ab_sample_size_default']; + } + + /** + * Sets ab_sample_size_default + * + * @param string|null $ab_sample_size_default Version of the email that should be sent if there are too few recipients to conduct an AB test. + * + * @return self + */ + public function setAbSampleSizeDefault($ab_sample_size_default) + { + if (is_null($ab_sample_size_default)) { + throw new \InvalidArgumentException('non-nullable ab_sample_size_default cannot be null'); + } + $allowedValues = $this->getAbSampleSizeDefaultAllowableValues(); + if (!in_array($ab_sample_size_default, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'ab_sample_size_default', must be one of '%s'", + $ab_sample_size_default, + implode("', '", $allowedValues) + ) + ); + } + $this->container['ab_sample_size_default'] = $ab_sample_size_default; + + return $this; + } + + /** + * Gets ab_status + * + * @return string|null + */ + public function getAbStatus() + { + return $this->container['ab_status']; + } + + /** + * Sets ab_status + * + * @param string|null $ab_status Status of the AB test. + * + * @return self + */ + public function setAbStatus($ab_status) + { + if (is_null($ab_status)) { + throw new \InvalidArgumentException('non-nullable ab_status cannot be null'); + } + $allowedValues = $this->getAbStatusAllowableValues(); + if (!in_array($ab_status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'ab_status', must be one of '%s'", + $ab_status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['ab_status'] = $ab_status; + + return $this; + } + + /** + * Gets ab_test_percentage + * + * @return int|null + */ + public function getAbTestPercentage() + { + return $this->container['ab_test_percentage']; + } + + /** + * Sets ab_test_percentage + * + * @param int|null $ab_test_percentage The size of your test group. + * + * @return self + */ + public function setAbTestPercentage($ab_test_percentage) + { + if (is_null($ab_test_percentage)) { + throw new \InvalidArgumentException('non-nullable ab_test_percentage cannot be null'); + } + $this->container['ab_test_percentage'] = $ab_test_percentage; + + return $this; + } + + /** + * Gets hours_to_wait + * + * @return int|null + */ + public function getHoursToWait() + { + return $this->container['hours_to_wait']; + } + + /** + * Sets hours_to_wait + * + * @param int|null $hours_to_wait Time limit on gathering test results. After this time is up, the winning version will be sent to the remaining contacts. + * + * @return self + */ + public function setHoursToWait($hours_to_wait) + { + if (is_null($hours_to_wait)) { + throw new \InvalidArgumentException('non-nullable hours_to_wait cannot be null'); + } + $this->container['hours_to_wait'] = $hours_to_wait; + + return $this; + } + + /** + * Gets test_id + * + * @return string|null + */ + public function getTestId() + { + return $this->container['test_id']; + } + + /** + * Sets test_id + * + * @param string|null $test_id The ID of the AB test. + * + * @return self + */ + public function setTestId($test_id) + { + if (is_null($test_id)) { + throw new \InvalidArgumentException('non-nullable test_id cannot be null'); + } + $this->container['test_id'] = $test_id; + + return $this; + } + + /** + * Gets ab_success_metric + * + * @return string|null + */ + public function getAbSuccessMetric() + { + return $this->container['ab_success_metric']; + } + + /** + * Sets ab_success_metric + * + * @param string|null $ab_success_metric Metric to determine the version that will be sent to the remaining contacts. + * + * @return self + */ + public function setAbSuccessMetric($ab_success_metric) + { + if (is_null($ab_success_metric)) { + throw new \InvalidArgumentException('non-nullable ab_success_metric cannot be null'); + } + $allowedValues = $this->getAbSuccessMetricAllowableValues(); + if (!in_array($ab_success_metric, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'ab_success_metric', must be one of '%s'", + $ab_success_metric, + implode("', '", $allowedValues) + ) + ); + } + $this->container['ab_success_metric'] = $ab_success_metric; + + 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/codegen/Marketing/Emails/Model/PublicEmailToDetails.php b/codegen/Marketing/Emails/Model/PublicEmailToDetails.php new file mode 100644 index 000000000..4f3a227c9 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicEmailToDetails.php @@ -0,0 +1,546 @@ + + */ +class PublicEmailToDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicEmailToDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contact_ils_lists' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients', + 'limit_send_frequency' => 'bool', + 'suppress_graymail' => 'bool', + 'contact_ids' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients', + 'contact_lists' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contact_ils_lists' => null, + 'limit_send_frequency' => null, + 'suppress_graymail' => null, + 'contact_ids' => null, + 'contact_lists' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contact_ils_lists' => false, + 'limit_send_frequency' => false, + 'suppress_graymail' => false, + 'contact_ids' => false, + 'contact_lists' => 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 = [ + 'contact_ils_lists' => 'contactIlsLists', + 'limit_send_frequency' => 'limitSendFrequency', + 'suppress_graymail' => 'suppressGraymail', + 'contact_ids' => 'contactIds', + 'contact_lists' => 'contactLists' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contact_ils_lists' => 'setContactIlsLists', + 'limit_send_frequency' => 'setLimitSendFrequency', + 'suppress_graymail' => 'setSuppressGraymail', + 'contact_ids' => 'setContactIds', + 'contact_lists' => 'setContactLists' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contact_ils_lists' => 'getContactIlsLists', + 'limit_send_frequency' => 'getLimitSendFrequency', + 'suppress_graymail' => 'getSuppressGraymail', + 'contact_ids' => 'getContactIds', + 'contact_lists' => 'getContactLists' + ]; + + /** + * 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('contact_ils_lists', $data ?? [], null); + $this->setIfExists('limit_send_frequency', $data ?? [], null); + $this->setIfExists('suppress_graymail', $data ?? [], null); + $this->setIfExists('contact_ids', $data ?? [], null); + $this->setIfExists('contact_lists', $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 contact_ils_lists + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null + */ + public function getContactIlsLists() + { + return $this->container['contact_ils_lists']; + } + + /** + * Sets contact_ils_lists + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null $contact_ils_lists contact_ils_lists + * + * @return self + */ + public function setContactIlsLists($contact_ils_lists) + { + if (is_null($contact_ils_lists)) { + throw new \InvalidArgumentException('non-nullable contact_ils_lists cannot be null'); + } + $this->container['contact_ils_lists'] = $contact_ils_lists; + + return $this; + } + + /** + * Gets limit_send_frequency + * + * @return bool|null + */ + public function getLimitSendFrequency() + { + return $this->container['limit_send_frequency']; + } + + /** + * Sets limit_send_frequency + * + * @param bool|null $limit_send_frequency + * + * @return self + */ + public function setLimitSendFrequency($limit_send_frequency) + { + if (is_null($limit_send_frequency)) { + throw new \InvalidArgumentException('non-nullable limit_send_frequency cannot be null'); + } + $this->container['limit_send_frequency'] = $limit_send_frequency; + + return $this; + } + + /** + * Gets suppress_graymail + * + * @return bool|null + */ + public function getSuppressGraymail() + { + return $this->container['suppress_graymail']; + } + + /** + * Sets suppress_graymail + * + * @param bool|null $suppress_graymail + * + * @return self + */ + public function setSuppressGraymail($suppress_graymail) + { + if (is_null($suppress_graymail)) { + throw new \InvalidArgumentException('non-nullable suppress_graymail cannot be null'); + } + $this->container['suppress_graymail'] = $suppress_graymail; + + return $this; + } + + /** + * Gets contact_ids + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null + */ + public function getContactIds() + { + return $this->container['contact_ids']; + } + + /** + * Sets contact_ids + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null $contact_ids contact_ids + * + * @return self + */ + public function setContactIds($contact_ids) + { + if (is_null($contact_ids)) { + throw new \InvalidArgumentException('non-nullable contact_ids cannot be null'); + } + $this->container['contact_ids'] = $contact_ids; + + return $this; + } + + /** + * Gets contact_lists + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null + */ + public function getContactLists() + { + return $this->container['contact_lists']; + } + + /** + * Sets contact_lists + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmailRecipients|null $contact_lists contact_lists + * + * @return self + */ + public function setContactLists($contact_lists) + { + if (is_null($contact_lists)) { + throw new \InvalidArgumentException('non-nullable contact_lists cannot be null'); + } + $this->container['contact_lists'] = $contact_lists; + + 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/codegen/Marketing/Emails/Model/PublicFontStyle.php b/codegen/Marketing/Emails/Model/PublicFontStyle.php new file mode 100644 index 000000000..ebb600a0c --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicFontStyle.php @@ -0,0 +1,579 @@ + + */ +class PublicFontStyle implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicFontStyle'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'size' => 'int', + 'color' => 'string', + 'underline' => 'bool', + 'bold' => 'bool', + 'italic' => 'bool', + 'font' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'size' => 'int32', + 'color' => null, + 'underline' => null, + 'bold' => null, + 'italic' => null, + 'font' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'size' => false, + 'color' => false, + 'underline' => false, + 'bold' => false, + 'italic' => false, + 'font' => 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 = [ + 'size' => 'size', + 'color' => 'color', + 'underline' => 'underline', + 'bold' => 'bold', + 'italic' => 'italic', + 'font' => 'font' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'size' => 'setSize', + 'color' => 'setColor', + 'underline' => 'setUnderline', + 'bold' => 'setBold', + 'italic' => 'setItalic', + 'font' => 'setFont' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'size' => 'getSize', + 'color' => 'getColor', + 'underline' => 'getUnderline', + 'bold' => 'getBold', + 'italic' => 'getItalic', + 'font' => 'getFont' + ]; + + /** + * 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('size', $data ?? [], null); + $this->setIfExists('color', $data ?? [], null); + $this->setIfExists('underline', $data ?? [], null); + $this->setIfExists('bold', $data ?? [], null); + $this->setIfExists('italic', $data ?? [], null); + $this->setIfExists('font', $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 size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets color + * + * @return string|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string|null $color color + * + * @return self + */ + public function setColor($color) + { + if (is_null($color)) { + throw new \InvalidArgumentException('non-nullable color cannot be null'); + } + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets underline + * + * @return bool|null + */ + public function getUnderline() + { + return $this->container['underline']; + } + + /** + * Sets underline + * + * @param bool|null $underline underline + * + * @return self + */ + public function setUnderline($underline) + { + if (is_null($underline)) { + throw new \InvalidArgumentException('non-nullable underline cannot be null'); + } + $this->container['underline'] = $underline; + + return $this; + } + + /** + * Gets bold + * + * @return bool|null + */ + public function getBold() + { + return $this->container['bold']; + } + + /** + * Sets bold + * + * @param bool|null $bold bold + * + * @return self + */ + public function setBold($bold) + { + if (is_null($bold)) { + throw new \InvalidArgumentException('non-nullable bold cannot be null'); + } + $this->container['bold'] = $bold; + + return $this; + } + + /** + * Gets italic + * + * @return bool|null + */ + public function getItalic() + { + return $this->container['italic']; + } + + /** + * Sets italic + * + * @param bool|null $italic italic + * + * @return self + */ + public function setItalic($italic) + { + if (is_null($italic)) { + throw new \InvalidArgumentException('non-nullable italic cannot be null'); + } + $this->container['italic'] = $italic; + + return $this; + } + + /** + * Gets font + * + * @return string|null + */ + public function getFont() + { + return $this->container['font']; + } + + /** + * Sets font + * + * @param string|null $font font + * + * @return self + */ + public function setFont($font) + { + if (is_null($font)) { + throw new \InvalidArgumentException('non-nullable font cannot be null'); + } + $this->container['font'] = $font; + + 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/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php b/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php new file mode 100644 index 000000000..48bd59d9f --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php @@ -0,0 +1,682 @@ + + */ +class PublicRssEmailDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicRssEmailDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'blog_image_max_width' => 'int', + 'blog_email_type' => 'string', + 'hubspot_blog_id' => 'string', + 'rss_entry_template' => 'string', + 'timing' => 'array', + 'max_entries' => 'int', + 'use_headline_as_subject' => 'bool', + 'blog_layout' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'blog_image_max_width' => 'int32', + 'blog_email_type' => null, + 'hubspot_blog_id' => null, + 'rss_entry_template' => null, + 'timing' => null, + 'max_entries' => 'int32', + 'use_headline_as_subject' => null, + 'blog_layout' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'blog_image_max_width' => false, + 'blog_email_type' => false, + 'hubspot_blog_id' => false, + 'rss_entry_template' => false, + 'timing' => false, + 'max_entries' => false, + 'use_headline_as_subject' => false, + 'blog_layout' => false, + 'url' => 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 = [ + 'blog_image_max_width' => 'blogImageMaxWidth', + 'blog_email_type' => 'blogEmailType', + 'hubspot_blog_id' => 'hubspotBlogId', + 'rss_entry_template' => 'rssEntryTemplate', + 'timing' => 'timing', + 'max_entries' => 'maxEntries', + 'use_headline_as_subject' => 'useHeadlineAsSubject', + 'blog_layout' => 'blogLayout', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'blog_image_max_width' => 'setBlogImageMaxWidth', + 'blog_email_type' => 'setBlogEmailType', + 'hubspot_blog_id' => 'setHubspotBlogId', + 'rss_entry_template' => 'setRssEntryTemplate', + 'timing' => 'setTiming', + 'max_entries' => 'setMaxEntries', + 'use_headline_as_subject' => 'setUseHeadlineAsSubject', + 'blog_layout' => 'setBlogLayout', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'blog_image_max_width' => 'getBlogImageMaxWidth', + 'blog_email_type' => 'getBlogEmailType', + 'hubspot_blog_id' => 'getHubspotBlogId', + 'rss_entry_template' => 'getRssEntryTemplate', + 'timing' => 'getTiming', + 'max_entries' => 'getMaxEntries', + 'use_headline_as_subject' => 'getUseHeadlineAsSubject', + 'blog_layout' => 'getBlogLayout', + 'url' => 'getUrl' + ]; + + /** + * 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('blog_image_max_width', $data ?? [], null); + $this->setIfExists('blog_email_type', $data ?? [], null); + $this->setIfExists('hubspot_blog_id', $data ?? [], null); + $this->setIfExists('rss_entry_template', $data ?? [], null); + $this->setIfExists('timing', $data ?? [], null); + $this->setIfExists('max_entries', $data ?? [], null); + $this->setIfExists('use_headline_as_subject', $data ?? [], null); + $this->setIfExists('blog_layout', $data ?? [], null); + $this->setIfExists('url', $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 blog_image_max_width + * + * @return int|null + */ + public function getBlogImageMaxWidth() + { + return $this->container['blog_image_max_width']; + } + + /** + * Sets blog_image_max_width + * + * @param int|null $blog_image_max_width + * + * @return self + */ + public function setBlogImageMaxWidth($blog_image_max_width) + { + if (is_null($blog_image_max_width)) { + throw new \InvalidArgumentException('non-nullable blog_image_max_width cannot be null'); + } + $this->container['blog_image_max_width'] = $blog_image_max_width; + + return $this; + } + + /** + * Gets blog_email_type + * + * @return string|null + */ + public function getBlogEmailType() + { + return $this->container['blog_email_type']; + } + + /** + * Sets blog_email_type + * + * @param string|null $blog_email_type + * + * @return self + */ + public function setBlogEmailType($blog_email_type) + { + if (is_null($blog_email_type)) { + throw new \InvalidArgumentException('non-nullable blog_email_type cannot be null'); + } + $this->container['blog_email_type'] = $blog_email_type; + + return $this; + } + + /** + * Gets hubspot_blog_id + * + * @return string|null + */ + public function getHubspotBlogId() + { + return $this->container['hubspot_blog_id']; + } + + /** + * Sets hubspot_blog_id + * + * @param string|null $hubspot_blog_id + * + * @return self + */ + public function setHubspotBlogId($hubspot_blog_id) + { + if (is_null($hubspot_blog_id)) { + throw new \InvalidArgumentException('non-nullable hubspot_blog_id cannot be null'); + } + $this->container['hubspot_blog_id'] = $hubspot_blog_id; + + return $this; + } + + /** + * Gets rss_entry_template + * + * @return string|null + */ + public function getRssEntryTemplate() + { + return $this->container['rss_entry_template']; + } + + /** + * Sets rss_entry_template + * + * @param string|null $rss_entry_template + * + * @return self + */ + public function setRssEntryTemplate($rss_entry_template) + { + if (is_null($rss_entry_template)) { + throw new \InvalidArgumentException('non-nullable rss_entry_template cannot be null'); + } + $this->container['rss_entry_template'] = $rss_entry_template; + + return $this; + } + + /** + * Gets timing + * + * @return array|null + */ + public function getTiming() + { + return $this->container['timing']; + } + + /** + * Sets timing + * + * @param array|null $timing + * + * @return self + */ + public function setTiming($timing) + { + if (is_null($timing)) { + throw new \InvalidArgumentException('non-nullable timing cannot be null'); + } + $this->container['timing'] = $timing; + + return $this; + } + + /** + * Gets max_entries + * + * @return int|null + */ + public function getMaxEntries() + { + return $this->container['max_entries']; + } + + /** + * Sets max_entries + * + * @param int|null $max_entries + * + * @return self + */ + public function setMaxEntries($max_entries) + { + if (is_null($max_entries)) { + throw new \InvalidArgumentException('non-nullable max_entries cannot be null'); + } + $this->container['max_entries'] = $max_entries; + + return $this; + } + + /** + * Gets use_headline_as_subject + * + * @return bool|null + */ + public function getUseHeadlineAsSubject() + { + return $this->container['use_headline_as_subject']; + } + + /** + * Sets use_headline_as_subject + * + * @param bool|null $use_headline_as_subject + * + * @return self + */ + public function setUseHeadlineAsSubject($use_headline_as_subject) + { + if (is_null($use_headline_as_subject)) { + throw new \InvalidArgumentException('non-nullable use_headline_as_subject cannot be null'); + } + $this->container['use_headline_as_subject'] = $use_headline_as_subject; + + return $this; + } + + /** + * Gets blog_layout + * + * @return string|null + */ + public function getBlogLayout() + { + return $this->container['blog_layout']; + } + + /** + * Sets blog_layout + * + * @param string|null $blog_layout + * + * @return self + */ + public function setBlogLayout($blog_layout) + { + if (is_null($blog_layout)) { + throw new \InvalidArgumentException('non-nullable blog_layout cannot be null'); + } + $this->container['blog_layout'] = $blog_layout; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + 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/codegen/Marketing/Emails/Model/PublicWebversionDetails.php b/codegen/Marketing/Emails/Model/PublicWebversionDetails.php new file mode 100644 index 000000000..062188774 --- /dev/null +++ b/codegen/Marketing/Emails/Model/PublicWebversionDetails.php @@ -0,0 +1,715 @@ + + */ +class PublicWebversionDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicWebversionDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'domain' => 'string', + 'redirect_to_page_id' => 'string', + 'is_page_redirected' => 'bool', + 'redirect_to_url' => 'string', + 'title' => 'string', + 'meta_description' => 'string', + 'page_expiry_enabled' => 'bool', + 'slug' => 'string', + 'url' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'domain' => null, + 'redirect_to_page_id' => null, + 'is_page_redirected' => null, + 'redirect_to_url' => null, + 'title' => null, + 'meta_description' => null, + 'page_expiry_enabled' => null, + 'slug' => null, + 'url' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'domain' => false, + 'redirect_to_page_id' => false, + 'is_page_redirected' => false, + 'redirect_to_url' => false, + 'title' => false, + 'meta_description' => false, + 'page_expiry_enabled' => false, + 'slug' => false, + 'url' => false, + 'expires_at' => 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 = [ + 'domain' => 'domain', + 'redirect_to_page_id' => 'redirectToPageId', + 'is_page_redirected' => 'isPageRedirected', + 'redirect_to_url' => 'redirectToUrl', + 'title' => 'title', + 'meta_description' => 'metaDescription', + 'page_expiry_enabled' => 'pageExpiryEnabled', + 'slug' => 'slug', + 'url' => 'url', + 'expires_at' => 'expiresAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'domain' => 'setDomain', + 'redirect_to_page_id' => 'setRedirectToPageId', + 'is_page_redirected' => 'setIsPageRedirected', + 'redirect_to_url' => 'setRedirectToUrl', + 'title' => 'setTitle', + 'meta_description' => 'setMetaDescription', + 'page_expiry_enabled' => 'setPageExpiryEnabled', + 'slug' => 'setSlug', + 'url' => 'setUrl', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'domain' => 'getDomain', + 'redirect_to_page_id' => 'getRedirectToPageId', + 'is_page_redirected' => 'getIsPageRedirected', + 'redirect_to_url' => 'getRedirectToUrl', + 'title' => 'getTitle', + 'meta_description' => 'getMetaDescription', + 'page_expiry_enabled' => 'getPageExpiryEnabled', + 'slug' => 'getSlug', + 'url' => 'getUrl', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * 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('domain', $data ?? [], null); + $this->setIfExists('redirect_to_page_id', $data ?? [], null); + $this->setIfExists('is_page_redirected', $data ?? [], null); + $this->setIfExists('redirect_to_url', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('meta_description', $data ?? [], null); + $this->setIfExists('page_expiry_enabled', $data ?? [], null); + $this->setIfExists('slug', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('expires_at', $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 domain + * + * @return string|null + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string|null $domain + * + * @return self + */ + public function setDomain($domain) + { + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets redirect_to_page_id + * + * @return string|null + */ + public function getRedirectToPageId() + { + return $this->container['redirect_to_page_id']; + } + + /** + * Sets redirect_to_page_id + * + * @param string|null $redirect_to_page_id + * + * @return self + */ + public function setRedirectToPageId($redirect_to_page_id) + { + if (is_null($redirect_to_page_id)) { + throw new \InvalidArgumentException('non-nullable redirect_to_page_id cannot be null'); + } + $this->container['redirect_to_page_id'] = $redirect_to_page_id; + + return $this; + } + + /** + * Gets is_page_redirected + * + * @return bool|null + */ + public function getIsPageRedirected() + { + return $this->container['is_page_redirected']; + } + + /** + * Sets is_page_redirected + * + * @param bool|null $is_page_redirected is_page_redirected + * + * @return self + */ + public function setIsPageRedirected($is_page_redirected) + { + if (is_null($is_page_redirected)) { + throw new \InvalidArgumentException('non-nullable is_page_redirected cannot be null'); + } + $this->container['is_page_redirected'] = $is_page_redirected; + + return $this; + } + + /** + * Gets redirect_to_url + * + * @return string|null + */ + public function getRedirectToUrl() + { + return $this->container['redirect_to_url']; + } + + /** + * Sets redirect_to_url + * + * @param string|null $redirect_to_url + * + * @return self + */ + public function setRedirectToUrl($redirect_to_url) + { + if (is_null($redirect_to_url)) { + throw new \InvalidArgumentException('non-nullable redirect_to_url cannot be null'); + } + $this->container['redirect_to_url'] = $redirect_to_url; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $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 meta_description + * + * @return string|null + */ + public function getMetaDescription() + { + return $this->container['meta_description']; + } + + /** + * Sets meta_description + * + * @param string|null $meta_description + * + * @return self + */ + public function setMetaDescription($meta_description) + { + if (is_null($meta_description)) { + throw new \InvalidArgumentException('non-nullable meta_description cannot be null'); + } + $this->container['meta_description'] = $meta_description; + + return $this; + } + + /** + * Gets page_expiry_enabled + * + * @return bool|null + */ + public function getPageExpiryEnabled() + { + return $this->container['page_expiry_enabled']; + } + + /** + * Sets page_expiry_enabled + * + * @param bool|null $page_expiry_enabled page_expiry_enabled + * + * @return self + */ + public function setPageExpiryEnabled($page_expiry_enabled) + { + if (is_null($page_expiry_enabled)) { + throw new \InvalidArgumentException('non-nullable page_expiry_enabled cannot be null'); + } + $this->container['page_expiry_enabled'] = $page_expiry_enabled; + + return $this; + } + + /** + * Gets slug + * + * @return string|null + */ + public function getSlug() + { + return $this->container['slug']; + } + + /** + * Sets slug + * + * @param string|null $slug + * + * @return self + */ + public function setSlug($slug) + { + if (is_null($slug)) { + throw new \InvalidArgumentException('non-nullable slug cannot be null'); + } + $this->container['slug'] = $slug; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + 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/codegen/Marketing/Emails/Model/VersionPublicEmail.php b/codegen/Marketing/Emails/Model/VersionPublicEmail.php new file mode 100644 index 000000000..4887d06bb --- /dev/null +++ b/codegen/Marketing/Emails/Model/VersionPublicEmail.php @@ -0,0 +1,524 @@ + + */ +class VersionPublicEmail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VersionPublicEmail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user' => '\HubSpot\Client\Marketing\Emails\Model\VersionUser', + 'object' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmail', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'user' => null, + 'object' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user' => false, + 'object' => false, + 'updated_at' => 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 = [ + 'id' => 'id', + 'user' => 'user', + 'object' => 'object', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user' => 'setUser', + 'object' => 'setObject', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user' => 'getUser', + 'object' => 'getObject', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('updated_at', $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['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of this marketing email version. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user + * + * @return \HubSpot\Client\Marketing\Emails\Model\VersionUser + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param \HubSpot\Client\Marketing\Emails\Model\VersionUser $user user + * + * @return self + */ + public function setUser($user) + { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets object + * + * @return \HubSpot\Client\Marketing\Emails\Model\PublicEmail + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmail $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + 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/codegen/Marketing/Emails/Model/VersionUser.php b/codegen/Marketing/Emails/Model/VersionUser.php new file mode 100644 index 000000000..f9efe1899 --- /dev/null +++ b/codegen/Marketing/Emails/Model/VersionUser.php @@ -0,0 +1,487 @@ + + */ +class VersionUser implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VersionUser'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'full_name' => 'string', + 'id' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'full_name' => null, + 'id' => null, + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'full_name' => false, + 'id' => false, + 'email' => 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 = [ + 'full_name' => 'fullName', + 'id' => 'id', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'full_name' => 'setFullName', + 'id' => 'setId', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'full_name' => 'getFullName', + 'id' => 'getId', + 'email' => 'getEmail' + ]; + + /** + * 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('full_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email', $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['full_name'] === null) { + $invalidProperties[] = "'full_name' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' 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 full_name + * + * @return string + */ + public function getFullName() + { + return $this->container['full_name']; + } + + /** + * Sets full_name + * + * @param string $full_name The user's full name. + * + * @return self + */ + public function setFullName($full_name) + { + if (is_null($full_name)) { + throw new \InvalidArgumentException('non-nullable full_name cannot be null'); + } + $this->container['full_name'] = $full_name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email The user email. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + 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/codegen/Marketing/Emails/ObjectSerializer.php b/codegen/Marketing/Emails/ObjectSerializer.php new file mode 100644 index 000000000..0618fe5d1 --- /dev/null +++ b/codegen/Marketing/Emails/ObjectSerializer.php @@ -0,0 +1,567 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\HubSpot\Client\Marketing\Emails\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} From 938151ea15b0fb58dfbf1c2a209d273630129029 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 15:35:38 +0300 Subject: [PATCH 2/9] Codegen: CRM objects Deal Splits --- .../Crm/Objects/DealSplits/Api/BatchApi.php | 906 ++++++++++++++++++ .../Crm/Objects/DealSplits/ApiException.php | 119 +++ .../Crm/Objects/DealSplits/Configuration.php | 531 ++++++++++ .../Crm/Objects/DealSplits/HeaderSelector.php | 245 +++++ .../Model/BatchInputPublicObjectId.php | 412 ++++++++ .../Model/BatchResponseDealToDealSplits.php | 629 ++++++++++++ ...atchResponseDealToDealSplitsWithErrors.php | 697 ++++++++++++++ .../DealSplits/Model/DealToDealSplits.php | 449 +++++++++ .../Crm/Objects/DealSplits/Model/Error.php | 622 ++++++++++++ .../Objects/DealSplits/Model/ErrorDetail.php | 548 +++++++++++ .../DealSplits/Model/ModelInterface.php | 111 +++ .../DealSplits/Model/PublicDealSplitInput.php | 449 +++++++++ .../PublicDealSplitsBatchCreateRequest.php | 412 ++++++++ .../Model/PublicDealSplitsCreateRequest.php | 449 +++++++++ .../DealSplits/Model/PublicObjectId.php | 412 ++++++++ .../DealSplits/Model/SimplePublicObject.php | 625 ++++++++++++ .../DealSplits/Model/StandardError.php | 665 +++++++++++++ .../DealSplits/Model/ValueWithTimestamp.php | 588 ++++++++++++ .../Objects/DealSplits/ObjectSerializer.php | 567 +++++++++++ 19 files changed, 9436 insertions(+) create mode 100644 codegen/Crm/Objects/DealSplits/Api/BatchApi.php create mode 100644 codegen/Crm/Objects/DealSplits/ApiException.php create mode 100644 codegen/Crm/Objects/DealSplits/Configuration.php create mode 100644 codegen/Crm/Objects/DealSplits/HeaderSelector.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/Error.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/ModelInterface.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/PublicDealSplitInput.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/StandardError.php create mode 100644 codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php create mode 100644 codegen/Crm/Objects/DealSplits/ObjectSerializer.php diff --git a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php new file mode 100644 index 000000000..456078b9f --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php @@ -0,0 +1,906 @@ + [ + 'application/json', + ], + 'upsert' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation read + * + * Read a batch of deal split objects by their associated deal object internal ID + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchInputPublicObjectId $batch_input_public_object_id batch_input_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\DealSplits\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits|\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors|\HubSpot\Client\Crm\Objects\DealSplits\Model\Error + */ + public function read($batch_input_public_object_id, string $contentType = self::contentTypes['read'][0]) + { + list($response) = $this->readWithHttpInfo($batch_input_public_object_id, $contentType); + return $response; + } + + /** + * Operation readWithHttpInfo + * + * Read a batch of deal split objects by their associated deal object internal ID + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchInputPublicObjectId $batch_input_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\DealSplits\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits|\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors|\HubSpot\Client\Crm\Objects\DealSplits\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function readWithHttpInfo($batch_input_public_object_id, string $contentType = self::contentTypes['read'][0]) + { + $request = $this->readRequest($batch_input_public_object_id, $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 ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\Error' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; + 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(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation readAsync + * + * Read a batch of deal split objects by their associated deal object internal ID + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchInputPublicObjectId $batch_input_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsync($batch_input_public_object_id, string $contentType = self::contentTypes['read'][0]) + { + return $this->readAsyncWithHttpInfo($batch_input_public_object_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation readAsyncWithHttpInfo + * + * Read a batch of deal split objects by their associated deal object internal ID + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchInputPublicObjectId $batch_input_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsyncWithHttpInfo($batch_input_public_object_id, string $contentType = self::contentTypes['read'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; + $request = $this->readRequest($batch_input_public_object_id, $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 'read' + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchInputPublicObjectId $batch_input_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function readRequest($batch_input_public_object_id, string $contentType = self::contentTypes['read'][0]) + { + + // verify the required parameter 'batch_input_public_object_id' is set + if ($batch_input_public_object_id === null || (is_array($batch_input_public_object_id) && count($batch_input_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_object_id when calling read' + ); + } + + + $resourcePath = '/crm/v3/objects/deals/splits/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_public_object_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id)); + } else { + $httpBody = $batch_input_public_object_id; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsert + * + * Create or replace deal splits for deals with the provided IDs. Deal split percentages for each deal must sum up to 1.0 (100%) and may have up to 8 decimal places + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsBatchCreateRequest $public_deal_splits_batch_create_request public_deal_splits_batch_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\DealSplits\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits|\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors|\HubSpot\Client\Crm\Objects\DealSplits\Model\Error + */ + public function upsert($public_deal_splits_batch_create_request, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($public_deal_splits_batch_create_request, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or replace deal splits for deals with the provided IDs. Deal split percentages for each deal must sum up to 1.0 (100%) and may have up to 8 decimal places + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsBatchCreateRequest $public_deal_splits_batch_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\DealSplits\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits|\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors|\HubSpot\Client\Crm\Objects\DealSplits\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($public_deal_splits_batch_create_request, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($public_deal_splits_batch_create_request, $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 ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\DealSplits\Model\Error' !== '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, '\HubSpot\Client\Crm\Objects\DealSplits\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; + 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(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplitsWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\DealSplits\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or replace deal splits for deals with the provided IDs. Deal split percentages for each deal must sum up to 1.0 (100%) and may have up to 8 decimal places + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsBatchCreateRequest $public_deal_splits_batch_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($public_deal_splits_batch_create_request, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($public_deal_splits_batch_create_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or replace deal splits for deals with the provided IDs. Deal split percentages for each deal must sum up to 1.0 (100%) and may have up to 8 decimal places + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsBatchCreateRequest $public_deal_splits_batch_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($public_deal_splits_batch_create_request, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; + $request = $this->upsertRequest($public_deal_splits_batch_create_request, $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 'upsert' + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsBatchCreateRequest $public_deal_splits_batch_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($public_deal_splits_batch_create_request, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'public_deal_splits_batch_create_request' is set + if ($public_deal_splits_batch_create_request === null || (is_array($public_deal_splits_batch_create_request) && count($public_deal_splits_batch_create_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_deal_splits_batch_create_request when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/deals/splits/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_deal_splits_batch_create_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_deal_splits_batch_create_request)); + } else { + $httpBody = $public_deal_splits_batch_create_request; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/DealSplits/ApiException.php b/codegen/Crm/Objects/DealSplits/ApiException.php new file mode 100644 index 000000000..102f86b43 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen/Crm/Objects/DealSplits/Configuration.php b/codegen/Crm/Objects/DealSplits/Configuration.php new file mode 100644 index 000000000..a4a60c3a7 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Configuration.php @@ -0,0 +1,531 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (HubSpot\Client\Crm\Objects\DealSplits) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.hubapi.com", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/codegen/Crm/Objects/DealSplits/HeaderSelector.php b/codegen/Crm/Objects/DealSplits/HeaderSelector.php new file mode 100644 index 000000000..42e7291c3 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/HeaderSelector.php @@ -0,0 +1,245 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php b/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php new file mode 100644 index 000000000..6b12776e0 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class BatchInputPublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\PublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php new file mode 100644 index 000000000..133ca900b --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseDealToDealSplits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseDealToDealSplits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php new file mode 100644 index 000000000..67479f388 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseDealToDealSplitsWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseDealToDealSplitsWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[]', + 'errors' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\DealToDealSplits[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php b/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php new file mode 100644 index 000000000..a9d977dad --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php @@ -0,0 +1,449 @@ + + */ +class DealToDealSplits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DealToDealSplits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'splits' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\SimplePublicObject[]', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'splits' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'splits' => false, + 'id' => 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 = [ + 'splits' => 'splits', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'splits' => 'setSplits', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'splits' => 'getSplits', + 'id' => 'getId' + ]; + + /** + * 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('splits', $data ?? [], null); + $this->setIfExists('id', $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['splits'] === null) { + $invalidProperties[] = "'splits' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' 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 splits + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\SimplePublicObject[] + */ + public function getSplits() + { + return $this->container['splits']; + } + + /** + * Sets splits + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\SimplePublicObject[] $splits splits + * + * @return self + */ + public function setSplits($splits) + { + if (is_null($splits)) { + throw new \InvalidArgumentException('non-nullable splits cannot be null'); + } + $this->container['splits'] = $splits; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Objects/DealSplits/Model/Error.php b/codegen/Crm/Objects/DealSplits/Model/Error.php new file mode 100644 index 000000000..3dc56c854 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/Error.php @@ -0,0 +1,622 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'context' => 'array', + 'correlation_id' => 'string', + 'links' => 'array', + 'message' => 'string', + 'category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'correlation_id' => 'uuid', + 'links' => null, + 'message' => null, + 'category' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'correlation_id' => 'correlationId', + 'links' => 'links', + 'message' => 'message', + 'category' => 'category', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'correlation_id' => 'setCorrelationId', + 'links' => 'setLinks', + 'message' => 'setMessage', + 'category' => 'setCategory', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'correlation_id' => 'getCorrelationId', + 'links' => 'getLinks', + 'message' => 'getMessage', + 'category' => 'getCategory', + 'errors' => 'getErrors' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $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['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' 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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets correlation_id + * + * @return string + */ + public function getCorrelationId() + { + return $this->container['correlation_id']; + } + + /** + * Sets correlation_id + * + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return self + */ + public function setCorrelationId($correlation_id) + { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } + $this->container['correlation_id'] = $correlation_id; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @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/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php b/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php new file mode 100644 index 000000000..a8b902977 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php @@ -0,0 +1,548 @@ + + */ +class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'code' => 'string', + 'in' => 'string', + 'context' => 'array', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'code' => null, + 'in' => null, + 'context' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => 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 = [ + 'sub_category' => 'subCategory', + 'code' => 'code', + 'in' => 'in', + 'context' => 'context', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'code' => 'setCode', + 'in' => 'setIn', + 'context' => 'setContext', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'code' => 'getCode', + 'in' => 'getIn', + 'context' => 'getContext', + '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('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $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['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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The status code associated with the error detail + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets in + * + * @return string|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string|null $in The name of the field or parameter in which the error was found. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @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/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php b/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php new file mode 100644 index 000000000..21686a24c --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php @@ -0,0 +1,111 @@ + + */ +class PublicDealSplitInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDealSplitInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'percentage' => 'float', + 'owner_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'percentage' => null, + 'owner_id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'percentage' => false, + 'owner_id' => 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 = [ + 'percentage' => 'percentage', + 'owner_id' => 'ownerId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'percentage' => 'setPercentage', + 'owner_id' => 'setOwnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'percentage' => 'getPercentage', + 'owner_id' => 'getOwnerId' + ]; + + /** + * 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('percentage', $data ?? [], null); + $this->setIfExists('owner_id', $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['percentage'] === null) { + $invalidProperties[] = "'percentage' can't be null"; + } + if ($this->container['owner_id'] === null) { + $invalidProperties[] = "'owner_id' 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 percentage + * + * @return float + */ + public function getPercentage() + { + return $this->container['percentage']; + } + + /** + * Sets percentage + * + * @param float $percentage percentage + * + * @return self + */ + public function setPercentage($percentage) + { + if (is_null($percentage)) { + throw new \InvalidArgumentException('non-nullable percentage cannot be null'); + } + $this->container['percentage'] = $percentage; + + return $this; + } + + /** + * Gets owner_id + * + * @return int + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + 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/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php new file mode 100644 index 000000000..1c228be91 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php @@ -0,0 +1,412 @@ + + */ +class PublicDealSplitsBatchCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDealSplitsBatchCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsCreateRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsCreateRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitsCreateRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php new file mode 100644 index 000000000..4d533cccc --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php @@ -0,0 +1,449 @@ + + */ +class PublicDealSplitsCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDealSplitsCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'splits' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitInput[]', + 'id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'splits' => null, + 'id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'splits' => false, + 'id' => 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 = [ + 'splits' => 'splits', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'splits' => 'setSplits', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'splits' => 'getSplits', + 'id' => 'getId' + ]; + + /** + * 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('splits', $data ?? [], null); + $this->setIfExists('id', $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['splits'] === null) { + $invalidProperties[] = "'splits' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' 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 splits + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitInput[] + */ + public function getSplits() + { + return $this->container['splits']; + } + + /** + * Sets splits + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\PublicDealSplitInput[] $splits splits + * + * @return self + */ + public function setSplits($splits) + { + if (is_null($splits)) { + throw new \InvalidArgumentException('non-nullable splits cannot be null'); + } + $this->container['splits'] = $splits; + + return $this; + } + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php b/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php new file mode 100644 index 000000000..1118a7c57 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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['id'] === null) { + $invalidProperties[] = "'id' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php new file mode 100644 index 000000000..449a77c5f --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php @@ -0,0 +1,625 @@ + + */ +class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'properties_with_history' => 'array', + 'id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'properties_with_history' => null, + 'id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => 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 = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $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['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' 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 created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + 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/codegen/Crm/Objects/DealSplits/Model/StandardError.php b/codegen/Crm/Objects/DealSplits/Model/StandardError.php new file mode 100644 index 000000000..f6704d70c --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/StandardError.php @@ -0,0 +1,665 @@ + + */ +class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StandardError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'object', + 'context' => 'array', + 'links' => 'array', + 'id' => 'string', + 'category' => 'string', + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'links' => null, + 'id' => null, + 'category' => null, + 'message' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'links' => 'links', + 'id' => 'id', + 'category' => 'category', + 'message' => 'message', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'links' => 'setLinks', + 'id' => 'setId', + 'category' => 'setCategory', + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'links' => 'getLinks', + 'id' => 'getId', + 'category' => 'getCategory', + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' 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 sub_category + * + * @return object|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param object|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets links + * + * @return array + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The id of the error + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message The error message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\DealSplits\Model\ErrorDetail[] $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php new file mode 100644 index 000000000..6bbdbda92 --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php @@ -0,0 +1,588 @@ + + */ +class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValueWithTimestamp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'source_id' => 'string', + 'source_type' => 'string', + 'source_label' => 'string', + 'updated_by_user_id' => 'int', + 'value' => 'string', + 'timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'source_id' => null, + 'source_type' => null, + 'source_label' => null, + 'updated_by_user_id' => 'int32', + 'value' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => 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 = [ + 'source_id' => 'sourceId', + 'source_type' => 'sourceType', + 'source_label' => 'sourceLabel', + 'updated_by_user_id' => 'updatedByUserId', + 'value' => 'value', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'source_id' => 'setSourceId', + 'source_type' => 'setSourceType', + 'source_label' => 'setSourceLabel', + 'updated_by_user_id' => 'setUpdatedByUserId', + 'value' => 'setValue', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'source_id' => 'getSourceId', + 'source_type' => 'getSourceType', + 'source_label' => 'getSourceLabel', + 'updated_by_user_id' => 'getUpdatedByUserId', + 'value' => 'getValue', + 'timestamp' => 'getTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $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['source_type'] === null) { + $invalidProperties[] = "'source_type' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' 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 source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets source_type + * + * @return string + */ + public function getSourceType() + { + return $this->container['source_type']; + } + + /** + * Sets source_type + * + * @param string $source_type source_type + * + * @return self + */ + public function setSourceType($source_type) + { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } + $this->container['source_type'] = $source_type; + + return $this; + } + + /** + * Gets source_label + * + * @return string|null + */ + public function getSourceLabel() + { + return $this->container['source_label']; + } + + /** + * Sets source_label + * + * @param string|null $source_label source_label + * + * @return self + */ + public function setSourceLabel($source_label) + { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } + $this->container['source_label'] = $source_label; + + return $this; + } + + /** + * Gets updated_by_user_id + * + * @return int|null + */ + public function getUpdatedByUserId() + { + return $this->container['updated_by_user_id']; + } + + /** + * Sets updated_by_user_id + * + * @param int|null $updated_by_user_id updated_by_user_id + * + * @return self + */ + public function setUpdatedByUserId($updated_by_user_id) + { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } + $this->container['updated_by_user_id'] = $updated_by_user_id; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @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 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/codegen/Crm/Objects/DealSplits/ObjectSerializer.php b/codegen/Crm/Objects/DealSplits/ObjectSerializer.php new file mode 100644 index 000000000..7044c658f --- /dev/null +++ b/codegen/Crm/Objects/DealSplits/ObjectSerializer.php @@ -0,0 +1,567 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\HubSpot\Client\Crm\Objects\DealSplits\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} From f084a2fcb29d361407cc80d3b08780171a41c897 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 15:42:29 +0300 Subject: [PATCH 3/9] Codegen: CRM Commerce Invoices --- .../Crm/Commerce/Invoices/Api/BasicApi.php | 1958 +++++++++++++++++ .../Crm/Commerce/Invoices/Api/BatchApi.php | 1930 ++++++++++++++++ .../Crm/Commerce/Invoices/Api/SearchApi.php | 488 ++++ .../Crm/Commerce/Invoices/ApiException.php | 119 + .../Crm/Commerce/Invoices/Configuration.php | 531 +++++ .../Crm/Commerce/Invoices/HeaderSelector.php | 245 +++ .../Commerce/Invoices/Model/AssociatedId.php | 449 ++++ .../Invoices/Model/AssociationSpec.php | 485 ++++ ...BatchInputSimplePublicObjectBatchInput.php | 412 ++++ ...tSimplePublicObjectBatchInputForCreate.php | 412 ++++ ...nputSimplePublicObjectBatchInputUpsert.php | 412 ++++ .../Model/BatchInputSimplePublicObjectId.php | 412 ++++ .../BatchReadInputSimplePublicObjectId.php | 520 +++++ .../Model/BatchResponseSimplePublicObject.php | 629 ++++++ ...chResponseSimplePublicObjectWithErrors.php | 697 ++++++ .../BatchResponseSimplePublicUpsertObject.php | 629 ++++++ ...onseSimplePublicUpsertObjectWithErrors.php | 697 ++++++ .../Model/CollectionResponseAssociatedId.php | 446 ++++ ...licObjectWithAssociationsForwardPaging.php | 446 ++++ ...thTotalSimplePublicObjectForwardPaging.php | 483 ++++ codegen/Crm/Commerce/Invoices/Model/Error.php | 622 ++++++ .../Commerce/Invoices/Model/ErrorDetail.php | 548 +++++ .../Crm/Commerce/Invoices/Model/Filter.php | 607 +++++ .../Commerce/Invoices/Model/FilterGroup.php | 412 ++++ .../Commerce/Invoices/Model/ForwardPaging.php | 409 ++++ .../Invoices/Model/ModelInterface.php | 111 + .../Crm/Commerce/Invoices/Model/NextPage.php | 446 ++++ .../Crm/Commerce/Invoices/Model/Paging.php | 443 ++++ .../Commerce/Invoices/Model/PreviousPage.php | 446 ++++ .../Model/PublicAssociationsForObject.php | 449 ++++ .../Invoices/Model/PublicObjectId.php | 412 ++++ .../Model/PublicObjectSearchRequest.php | 579 +++++ .../Invoices/Model/SimplePublicObject.php | 659 ++++++ .../Model/SimplePublicObjectBatchInput.php | 517 +++++ .../SimplePublicObjectBatchInputForCreate.php | 480 ++++ .../SimplePublicObjectBatchInputUpsert.php | 517 +++++ .../Invoices/Model/SimplePublicObjectId.php | 412 ++++ .../Model/SimplePublicObjectInput.php | 412 ++++ .../SimplePublicObjectInputForCreate.php | 446 ++++ .../SimplePublicObjectWithAssociations.php | 693 ++++++ .../Model/SimplePublicUpsertObject.php | 696 ++++++ .../Commerce/Invoices/Model/StandardError.php | 665 ++++++ .../Invoices/Model/ValueWithTimestamp.php | 588 +++++ .../Commerce/Invoices/ObjectSerializer.php | 567 +++++ 44 files changed, 24536 insertions(+) create mode 100644 codegen/Crm/Commerce/Invoices/Api/BasicApi.php create mode 100644 codegen/Crm/Commerce/Invoices/Api/BatchApi.php create mode 100644 codegen/Crm/Commerce/Invoices/Api/SearchApi.php create mode 100644 codegen/Crm/Commerce/Invoices/ApiException.php create mode 100644 codegen/Crm/Commerce/Invoices/Configuration.php create mode 100644 codegen/Crm/Commerce/Invoices/HeaderSelector.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/AssociatedId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/Error.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/Filter.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/FilterGroup.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/ModelInterface.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/NextPage.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/Paging.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/PreviousPage.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/StandardError.php create mode 100644 codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php create mode 100644 codegen/Crm/Commerce/Invoices/ObjectSerializer.php diff --git a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php new file mode 100644 index 000000000..48f9d36a0 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php @@ -0,0 +1,1958 @@ + [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Archive + * + * @param string $invoice_id invoice_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archive($invoice_id, string $contentType = self::contentTypes['archive'][0]) + { + $this->archiveWithHttpInfo($invoice_id, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Archive + * + * @param string $invoice_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($invoice_id, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($invoice_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive + * + * @param string $invoice_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($invoice_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($invoice_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive + * + * @param string $invoice_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($invoice_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($invoice_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param string $invoice_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($invoice_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'invoice_id' is set + if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $invoice_id when calling archive' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/{invoiceId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($invoice_id !== null) { + $resourcePath = str_replace( + '{' . 'invoiceId' . '}', + ObjectSerializer::toPathValue($invoice_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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 create + * + * Create + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($simple_public_object_input_for_create, $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 201: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; + $request = $this->createRequest($simple_public_object_input_for_create, $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 'create' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'simple_public_object_input_for_create' is set + if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input_for_create when calling create' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($simple_public_object_input_for_create)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + } else { + $httpBody = $simple_public_object_input_for_create; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getById + * + * Read + * + * @param string $invoice_id invoice_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function getById($invoice_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + list($response) = $this->getByIdWithHttpInfo($invoice_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + return $response; + } + + /** + * Operation getByIdWithHttpInfo + * + * Read + * + * @param string $invoice_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getByIdWithHttpInfo($invoice_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + $request = $this->getByIdRequest($invoice_id, $properties, $properties_with_history, $associations, $archived, $id_property, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getByIdAsync + * + * Read + * + * @param string $invoice_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsync($invoice_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + return $this->getByIdAsyncWithHttpInfo($invoice_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getByIdAsyncWithHttpInfo + * + * Read + * + * @param string $invoice_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsyncWithHttpInfo($invoice_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations'; + $request = $this->getByIdRequest($invoice_id, $properties, $properties_with_history, $associations, $archived, $id_property, $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 'getById' + * + * @param string $invoice_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getByIdRequest($invoice_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + + // verify the required parameter 'invoice_id' is set + if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $invoice_id when calling getById' + ); + } + + + + + + + + $resourcePath = '/crm/v3/objects/invoices/{invoiceId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties, + 'properties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $associations, + 'associations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_property, + 'idProperty', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($invoice_id !== null) { + $resourcePath = str_replace( + '{' . 'invoiceId' . '}', + ObjectSerializer::toPathValue($invoice_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPage + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + return $response; + } + + /** + * Operation getPageWithHttpInfo + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPageAsync + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPageAsyncWithHttpInfo + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $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 'getPage' + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + + + + + + + + + $resourcePath = '/crm/v3/objects/invoices'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties, + 'properties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $associations, + 'associations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update + * + * @param string $invoice_id invoice_id (required) + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function update($invoice_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($invoice_id, $simple_public_object_input, $id_property, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update + * + * @param string $invoice_id (required) + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($invoice_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($invoice_id, $simple_public_object_input, $id_property, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update + * + * @param string $invoice_id (required) + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($invoice_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($invoice_id, $simple_public_object_input, $id_property, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update + * + * @param string $invoice_id (required) + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($invoice_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; + $request = $this->updateRequest($invoice_id, $simple_public_object_input, $id_property, $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 'update' + * + * @param string $invoice_id (required) + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($invoice_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'invoice_id' is set + if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $invoice_id when calling update' + ); + } + + // verify the required parameter 'simple_public_object_input' is set + if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input when calling update' + ); + } + + + + $resourcePath = '/crm/v3/objects/invoices/{invoiceId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_property, + 'idProperty', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($invoice_id !== null) { + $resourcePath = str_replace( + '{' . 'invoiceId' . '}', + ObjectSerializer::toPathValue($invoice_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($simple_public_object_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + } else { + $httpBody = $simple_public_object_input; + } + } 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 OAuth (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( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php new file mode 100644 index 000000000..c8936ab0f --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php @@ -0,0 +1,1930 @@ + [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + 'upsert' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Archive a batch of invoices by ID + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Archive a batch of invoices by ID + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($batch_input_simple_public_object_id, $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive a batch of invoices by ID + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive a batch of invoices by ID + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_id' is set + if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_id when calling archive' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + } else { + $httpBody = $batch_input_simple_public_object_id; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create a batch of invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create a batch of invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $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 201: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create a batch of invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create a batch of invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $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 'create' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_for_create)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_for_create; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation read + * + * Read a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); + return $response; + } + + /** + * Operation readWithHttpInfo + * + * Read a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation readAsync + * + * Read a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation readAsyncWithHttpInfo + * + * Read a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $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 'read' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + + // verify the required parameter 'batch_read_input_simple_public_object_id' is set + if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_read_input_simple_public_object_id when calling read' + ); + } + + + + $resourcePath = '/crm/v3/objects/invoices/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_read_input_simple_public_object_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + } else { + $httpBody = $batch_read_input_simple_public_object_id; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update a batch of invoices by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $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 'update' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set + if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input when calling update' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsert + * + * Create or update a batch of invoices by unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function upsert($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or update a batch of invoices by unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or update a batch of invoices by unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or update a batch of invoices by unique property values + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $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 'upsert' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_upsert' is set + if ($batch_input_simple_public_object_batch_input_upsert === null || (is_array($batch_input_simple_public_object_batch_input_upsert) && count($batch_input_simple_public_object_batch_input_upsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_upsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_upsert; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php new file mode 100644 index 000000000..e7fb792e5 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php @@ -0,0 +1,488 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation doSearch + * + * Search for invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error + */ + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) + { + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); + return $response; + } + + /** + * Operation doSearchWithHttpInfo + * + * Search for invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) + { + $request = $this->doSearchRequest($public_object_search_request, $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 ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== '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, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + 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(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation doSearchAsync + * + * Search for invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) + { + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation doSearchAsyncWithHttpInfo + * + * Search for invoices + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) + { + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + $request = $this->doSearchRequest($public_object_search_request, $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 'doSearch' + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) + { + + // verify the required parameter 'public_object_search_request' is set + if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_object_search_request when calling doSearch' + ); + } + + + $resourcePath = '/crm/v3/objects/invoices/search'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_object_search_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + } else { + $httpBody = $public_object_search_request; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Commerce/Invoices/ApiException.php b/codegen/Crm/Commerce/Invoices/ApiException.php new file mode 100644 index 000000000..0e1e3c871 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen/Crm/Commerce/Invoices/Configuration.php b/codegen/Crm/Commerce/Invoices/Configuration.php new file mode 100644 index 000000000..8d8821a53 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Configuration.php @@ -0,0 +1,531 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (HubSpot\Client\Crm\Commerce\Invoices) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.hubapi.com", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/codegen/Crm/Commerce/Invoices/HeaderSelector.php b/codegen/Crm/Commerce/Invoices/HeaderSelector.php new file mode 100644 index 000000000..319381090 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/HeaderSelector.php @@ -0,0 +1,245 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php new file mode 100644 index 000000000..06fc48d36 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php @@ -0,0 +1,449 @@ + + */ +class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociatedId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $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['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + 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/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php new file mode 100644 index 000000000..ac22199d3 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php @@ -0,0 +1,485 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => 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 = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * 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 ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * 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('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $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['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' 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 association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } + $this->container['association_type_id'] = $association_type_id; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php new file mode 100644 index 000000000..7715d9eda --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInput[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInput[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInput[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..016eaa656 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputForCreate[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputForCreate[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php new file mode 100644 index 000000000..6844c7f86 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputUpsert[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputUpsert[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php new file mode 100644 index 000000000..728608f0a --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => 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 = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * 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('inputs', $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['inputs'] === null) { + $invalidProperties[] = "'inputs' 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 inputs + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php new file mode 100644 index 000000000..59a49f640 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php @@ -0,0 +1,520 @@ + + */ +class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchReadInputSimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties_with_history' => 'string[]', + 'id_property' => 'string', + 'inputs' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[]', + 'properties' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties_with_history' => null, + 'id_property' => null, + 'inputs' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => 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 = [ + 'properties_with_history' => 'propertiesWithHistory', + 'id_property' => 'idProperty', + 'inputs' => 'inputs', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties_with_history' => 'setPropertiesWithHistory', + 'id_property' => 'setIdProperty', + 'inputs' => 'setInputs', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties_with_history' => 'getPropertiesWithHistory', + 'id_property' => 'getIdProperty', + 'inputs' => 'getInputs', + 'properties' => 'getProperties' + ]; + + /** + * 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('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $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['properties_with_history'] === null) { + $invalidProperties[] = "'properties_with_history' can't be null"; + } + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' 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 properties_with_history + * + * @return string[] + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param string[] $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + + /** + * Gets properties + * + * @return string[] + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param string[] $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php new file mode 100644 index 000000000..e835aa05b --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php new file mode 100644 index 000000000..462713d8a --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[]', + 'errors' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php new file mode 100644 index 000000000..75c1ec9f2 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php new file mode 100644 index 000000000..d42718ddf --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[]', + 'errors' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => 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 = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php new file mode 100644 index 000000000..e36935046 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php @@ -0,0 +1,446 @@ + + */ +class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseAssociatedId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paging' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\Paging', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\AssociatedId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => 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 = [ + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * 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('paging', $data ?? [], null); + $this->setIfExists('results', $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['results'] === null) { + $invalidProperties[] = "'results' 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 paging + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\Paging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\Paging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\AssociatedId[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\AssociatedId[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php new file mode 100644 index 000000000..0f3180fb6 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -0,0 +1,446 @@ + + */ +class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paging' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => 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 = [ + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * 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('paging', $data ?? [], null); + $this->setIfExists('results', $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['results'] === null) { + $invalidProperties[] = "'results' 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 paging + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php new file mode 100644 index 000000000..790d93629 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -0,0 +1,483 @@ + + */ +class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'paging' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => 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 = [ + 'total' => 'total', + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * 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('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $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['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' 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 total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + 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/codegen/Crm/Commerce/Invoices/Model/Error.php b/codegen/Crm/Commerce/Invoices/Model/Error.php new file mode 100644 index 000000000..d53994f79 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/Error.php @@ -0,0 +1,622 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'context' => 'array', + 'correlation_id' => 'string', + 'links' => 'array', + 'message' => 'string', + 'category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'correlation_id' => 'uuid', + 'links' => null, + 'message' => null, + 'category' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'correlation_id' => 'correlationId', + 'links' => 'links', + 'message' => 'message', + 'category' => 'category', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'correlation_id' => 'setCorrelationId', + 'links' => 'setLinks', + 'message' => 'setMessage', + 'category' => 'setCategory', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'correlation_id' => 'getCorrelationId', + 'links' => 'getLinks', + 'message' => 'getMessage', + 'category' => 'getCategory', + 'errors' => 'getErrors' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $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['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' 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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets correlation_id + * + * @return string + */ + public function getCorrelationId() + { + return $this->container['correlation_id']; + } + + /** + * Sets correlation_id + * + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return self + */ + public function setCorrelationId($correlation_id) + { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } + $this->container['correlation_id'] = $correlation_id; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @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/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php b/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php new file mode 100644 index 000000000..bfa3909ee --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php @@ -0,0 +1,548 @@ + + */ +class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'code' => 'string', + 'in' => 'string', + 'context' => 'array', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'code' => null, + 'in' => null, + 'context' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => 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 = [ + 'sub_category' => 'subCategory', + 'code' => 'code', + 'in' => 'in', + 'context' => 'context', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'code' => 'setCode', + 'in' => 'setIn', + 'context' => 'setContext', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'code' => 'getCode', + 'in' => 'getIn', + 'context' => 'getContext', + '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('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $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['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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The status code associated with the error detail + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets in + * + * @return string|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string|null $in The name of the field or parameter in which the error was found. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @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/codegen/Crm/Commerce/Invoices/Model/Filter.php b/codegen/Crm/Commerce/Invoices/Model/Filter.php new file mode 100644 index 000000000..db212f1f5 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/Filter.php @@ -0,0 +1,607 @@ + + */ +class Filter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Filter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'high_value' => 'string', + 'property_name' => 'string', + 'values' => 'string[]', + 'value' => 'string', + 'operator' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'high_value' => null, + 'property_name' => null, + 'values' => null, + 'value' => null, + 'operator' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => 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 = [ + 'high_value' => 'highValue', + 'property_name' => 'propertyName', + 'values' => 'values', + 'value' => 'value', + 'operator' => 'operator' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'high_value' => 'setHighValue', + 'property_name' => 'setPropertyName', + 'values' => 'setValues', + 'value' => 'setValue', + 'operator' => 'setOperator' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'high_value' => 'getHighValue', + 'property_name' => 'getPropertyName', + 'values' => 'getValues', + 'value' => 'getValue', + 'operator' => 'getOperator' + ]; + + /** + * 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 OPERATOR_EQ = 'EQ'; + public const OPERATOR_NEQ = 'NEQ'; + public const OPERATOR_LT = 'LT'; + public const OPERATOR_LTE = 'LTE'; + public const OPERATOR_GT = 'GT'; + public const OPERATOR_GTE = 'GTE'; + public const OPERATOR_BETWEEN = 'BETWEEN'; + public const OPERATOR_IN = 'IN'; + public const OPERATOR_NOT_IN = 'NOT_IN'; + public const OPERATOR_HAS_PROPERTY = 'HAS_PROPERTY'; + public const OPERATOR_NOT_HAS_PROPERTY = 'NOT_HAS_PROPERTY'; + public const OPERATOR_CONTAINS_TOKEN = 'CONTAINS_TOKEN'; + public const OPERATOR_NOT_CONTAINS_TOKEN = 'NOT_CONTAINS_TOKEN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperatorAllowableValues() + { + return [ + self::OPERATOR_EQ, + self::OPERATOR_NEQ, + self::OPERATOR_LT, + self::OPERATOR_LTE, + self::OPERATOR_GT, + self::OPERATOR_GTE, + self::OPERATOR_BETWEEN, + self::OPERATOR_IN, + self::OPERATOR_NOT_IN, + self::OPERATOR_HAS_PROPERTY, + self::OPERATOR_NOT_HAS_PROPERTY, + self::OPERATOR_CONTAINS_TOKEN, + self::OPERATOR_NOT_CONTAINS_TOKEN, + ]; + } + + /** + * 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('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $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['property_name'] === null) { + $invalidProperties[] = "'property_name' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!is_null($this->container['operator']) && !in_array($this->container['operator'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operator', must be one of '%s'", + $this->container['operator'], + implode("', '", $allowedValues) + ); + } + + 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 high_value + * + * @return string|null + */ + public function getHighValue() + { + return $this->container['high_value']; + } + + /** + * Sets high_value + * + * @param string|null $high_value high_value + * + * @return self + */ + public function setHighValue($high_value) + { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } + $this->container['high_value'] = $high_value; + + return $this; + } + + /** + * Gets property_name + * + * @return string + */ + public function getPropertyName() + { + return $this->container['property_name']; + } + + /** + * Sets property_name + * + * @param string $property_name property_name + * + * @return self + */ + public function setPropertyName($property_name) + { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } + $this->container['property_name'] = $property_name; + + return $this; + } + + /** + * Gets values + * + * @return string[]|null + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param string[]|null $values values + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + + /** + * Gets value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value value + * + * @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 operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator null + * + * @return self + */ + public function setOperator($operator) + { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!in_array($operator, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operator'] = $operator; + + 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/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php b/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php new file mode 100644 index 000000000..f86db0929 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php @@ -0,0 +1,412 @@ + + */ +class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FilterGroup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filters' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\Filter[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => 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 = [ + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filters' => 'getFilters' + ]; + + /** + * 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('filters', $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['filters'] === null) { + $invalidProperties[] = "'filters' 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 filters + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\Filter[] + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\Filter[] $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php new file mode 100644 index 000000000..af647683e --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php @@ -0,0 +1,409 @@ + + */ +class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => 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 = [ + 'next' => 'next' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext' + ]; + + /** + * 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('next', $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 next + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + 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/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php b/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php new file mode 100644 index 000000000..07b2c54b2 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php @@ -0,0 +1,111 @@ + + */ +class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NextPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'link' => 'string', + 'after' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'link' => null, + 'after' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => 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 = [ + 'link' => 'link', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'link' => 'setLink', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'link' => 'getLink', + 'after' => 'getAfter' + ]; + + /** + * 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('link', $data ?? [], null); + $this->setIfExists('after', $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['after'] === null) { + $invalidProperties[] = "'after' 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 link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link link + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + return $this; + } + + /** + * Gets after + * + * @return string + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string $after after + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } + $this->container['after'] = $after; + + 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/codegen/Crm/Commerce/Invoices/Model/Paging.php b/codegen/Crm/Commerce/Invoices/Model/Paging.php new file mode 100644 index 000000000..66946fd40 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/Paging.php @@ -0,0 +1,443 @@ + + */ +class Paging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Paging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage', + 'prev' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\PreviousPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null, + 'prev' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => 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 = [ + 'next' => 'next', + 'prev' => 'prev' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext', + 'prev' => 'setPrev' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext', + 'prev' => 'getPrev' + ]; + + /** + * 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('next', $data ?? [], null); + $this->setIfExists('prev', $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 next + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + return $this; + } + + /** + * Gets prev + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\PreviousPage|null + */ + public function getPrev() + { + return $this->container['prev']; + } + + /** + * Sets prev + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PreviousPage|null $prev prev + * + * @return self + */ + public function setPrev($prev) + { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } + $this->container['prev'] = $prev; + + 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/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php b/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php new file mode 100644 index 000000000..f029cccf4 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php @@ -0,0 +1,446 @@ + + */ +class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PreviousPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'before' => 'string', + 'link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'before' => null, + 'link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => 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 = [ + 'before' => 'before', + 'link' => 'link' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'before' => 'setBefore', + 'link' => 'setLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'before' => 'getBefore', + 'link' => 'getLink' + ]; + + /** + * 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('before', $data ?? [], null); + $this->setIfExists('link', $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['before'] === null) { + $invalidProperties[] = "'before' 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 before + * + * @return string + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param string $before before + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link link + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + 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/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php b/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php new file mode 100644 index 000000000..e61daef3e --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php @@ -0,0 +1,449 @@ + + */ +class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationsForObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'types' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\AssociationSpec[]', + 'to' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'types' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => 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 = [ + 'types' => 'types', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'types' => 'setTypes', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'types' => 'getTypes', + 'to' => 'getTo' + ]; + + /** + * 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('types', $data ?? [], null); + $this->setIfExists('to', $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['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' 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 types + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\AssociationSpec[] + */ + public function getTypes() + { + return $this->container['types']; + } + + /** + * Sets types + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\AssociationSpec[] $types types + * + * @return self + */ + public function setTypes($types) + { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } + $this->container['types'] = $types; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectId + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectId $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + 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/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php new file mode 100644 index 000000000..6bdc25d87 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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['id'] === null) { + $invalidProperties[] = "'id' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php b/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php new file mode 100644 index 000000000..e83c07596 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php @@ -0,0 +1,579 @@ + + */ +class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicObjectSearchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'limit' => 'int', + 'after' => 'string', + 'sorts' => 'string[]', + 'properties' => 'string[]', + 'filter_groups' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\FilterGroup[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'limit' => 'int32', + 'after' => null, + 'sorts' => null, + 'properties' => null, + 'filter_groups' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => 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 = [ + 'query' => 'query', + 'limit' => 'limit', + 'after' => 'after', + 'sorts' => 'sorts', + 'properties' => 'properties', + 'filter_groups' => 'filterGroups' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'limit' => 'setLimit', + 'after' => 'setAfter', + 'sorts' => 'setSorts', + 'properties' => 'setProperties', + 'filter_groups' => 'setFilterGroups' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'limit' => 'getLimit', + 'after' => 'getAfter', + 'sorts' => 'getSorts', + 'properties' => 'getProperties', + 'filter_groups' => 'getFilterGroups' + ]; + + /** + * 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('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $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 query + * + * @return string|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets limit + * + * @return int|null + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int|null $limit limit + * + * @return self + */ + public function setLimit($limit) + { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets after + * + * @return string|null + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string|null $after after + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } + $this->container['after'] = $after; + + return $this; + } + + /** + * Gets sorts + * + * @return string[]|null + */ + public function getSorts() + { + return $this->container['sorts']; + } + + /** + * Sets sorts + * + * @param string[]|null $sorts sorts + * + * @return self + */ + public function setSorts($sorts) + { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } + $this->container['sorts'] = $sorts; + + return $this; + } + + /** + * Gets properties + * + * @return string[]|null + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param string[]|null $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets filter_groups + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\FilterGroup[]|null + */ + public function getFilterGroups() + { + return $this->container['filter_groups']; + } + + /** + * Sets filter_groups + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\FilterGroup[]|null $filter_groups filter_groups + * + * @return self + */ + public function setFilterGroups($filter_groups) + { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } + $this->container['filter_groups'] = $filter_groups; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php new file mode 100644 index 000000000..ef11ce71d --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php @@ -0,0 +1,659 @@ + + */ +class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'properties_with_history' => 'array', + 'id' => 'string', + 'object_write_trace_id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'properties_with_history' => null, + 'id' => null, + 'object_write_trace_id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'object_write_trace_id' => false, + 'properties' => false, + 'updated_at' => 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 = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $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['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' 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 created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php new file mode 100644 index 000000000..d126424ca --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => 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 = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * 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('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $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['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' 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 id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property The name of a property whose values are unique for this object + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..62a1f8690 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => 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 = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $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['properties'] === null) { + $invalidProperties[] = "'properties' 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 associations + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php new file mode 100644 index 000000000..fa61f4249 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => 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 = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * 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('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $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['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' 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 id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property The name of a property whose values are unique for this object + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php new file mode 100644 index 000000000..05eb67904 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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['id'] === null) { + $invalidProperties[] = "'id' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php new file mode 100644 index 000000000..29e30786f --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php @@ -0,0 +1,412 @@ + + */ +class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => 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 = [ + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties' => 'getProperties' + ]; + + /** + * 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('properties', $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['properties'] === null) { + $invalidProperties[] = "'properties' 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 properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php new file mode 100644 index 000000000..72f7abfd5 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php @@ -0,0 +1,446 @@ + + */ +class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => 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 = [ + 'associations' => 'associations', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'properties' => 'getProperties' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('properties', $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['properties'] === null) { + $invalidProperties[] = "'properties' 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 associations + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php new file mode 100644 index 000000000..5d93ca069 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php @@ -0,0 +1,693 @@ + + */ +class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectWithAssociations'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => 'array', + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'properties_with_history' => 'array', + 'id' => 'string', + 'object_write_trace_id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'properties_with_history' => null, + 'id' => null, + 'object_write_trace_id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'object_write_trace_id' => false, + 'properties' => false, + 'updated_at' => 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 = [ + 'associations' => 'associations', + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $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['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' 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 associations + * + * @return array|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param array|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + 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/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php new file mode 100644 index 000000000..7f00f2541 --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php @@ -0,0 +1,696 @@ + + */ +class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'new' => 'bool', + 'properties_with_history' => 'array', + 'id' => 'string', + 'object_write_trace_id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'new' => null, + 'properties_with_history' => null, + 'id' => null, + 'object_write_trace_id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'new' => false, + 'properties_with_history' => false, + 'id' => false, + 'object_write_trace_id' => false, + 'properties' => false, + 'updated_at' => 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 = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'new' => 'new', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'new' => 'setNew', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'new' => 'getNew', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('new', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $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['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['new'] === null) { + $invalidProperties[] = "'new' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' 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 created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets new + * + * @return bool + */ + public function getNew() + { + return $this->container['new']; + } + + /** + * Sets new + * + * @param bool $new new + * + * @return self + */ + public function setNew($new) + { + if (is_null($new)) { + throw new \InvalidArgumentException('non-nullable new cannot be null'); + } + $this->container['new'] = $new; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + 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/codegen/Crm/Commerce/Invoices/Model/StandardError.php b/codegen/Crm/Commerce/Invoices/Model/StandardError.php new file mode 100644 index 000000000..e039248fc --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/StandardError.php @@ -0,0 +1,665 @@ + + */ +class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StandardError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'object', + 'context' => 'array', + 'links' => 'array', + 'id' => 'string', + 'category' => 'string', + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'links' => null, + 'id' => null, + 'category' => null, + 'message' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'links' => 'links', + 'id' => 'id', + 'category' => 'category', + 'message' => 'message', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'links' => 'setLinks', + 'id' => 'setId', + 'category' => 'setCategory', + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'links' => 'getLinks', + 'id' => 'getId', + 'category' => 'getCategory', + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' 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 sub_category + * + * @return object|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param object|null $sub_category sub_category + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array $context context + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets links + * + * @return array + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\ErrorDetail[] $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php new file mode 100644 index 000000000..075ea497c --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php @@ -0,0 +1,588 @@ + + */ +class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValueWithTimestamp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'source_id' => 'string', + 'source_type' => 'string', + 'source_label' => 'string', + 'updated_by_user_id' => 'int', + 'value' => 'string', + 'timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'source_id' => null, + 'source_type' => null, + 'source_label' => null, + 'updated_by_user_id' => 'int32', + 'value' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => 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 = [ + 'source_id' => 'sourceId', + 'source_type' => 'sourceType', + 'source_label' => 'sourceLabel', + 'updated_by_user_id' => 'updatedByUserId', + 'value' => 'value', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'source_id' => 'setSourceId', + 'source_type' => 'setSourceType', + 'source_label' => 'setSourceLabel', + 'updated_by_user_id' => 'setUpdatedByUserId', + 'value' => 'setValue', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'source_id' => 'getSourceId', + 'source_type' => 'getSourceType', + 'source_label' => 'getSourceLabel', + 'updated_by_user_id' => 'getUpdatedByUserId', + 'value' => 'getValue', + 'timestamp' => 'getTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $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['source_type'] === null) { + $invalidProperties[] = "'source_type' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' 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 source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets source_type + * + * @return string + */ + public function getSourceType() + { + return $this->container['source_type']; + } + + /** + * Sets source_type + * + * @param string $source_type source_type + * + * @return self + */ + public function setSourceType($source_type) + { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } + $this->container['source_type'] = $source_type; + + return $this; + } + + /** + * Gets source_label + * + * @return string|null + */ + public function getSourceLabel() + { + return $this->container['source_label']; + } + + /** + * Sets source_label + * + * @param string|null $source_label source_label + * + * @return self + */ + public function setSourceLabel($source_label) + { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } + $this->container['source_label'] = $source_label; + + return $this; + } + + /** + * Gets updated_by_user_id + * + * @return int|null + */ + public function getUpdatedByUserId() + { + return $this->container['updated_by_user_id']; + } + + /** + * Sets updated_by_user_id + * + * @param int|null $updated_by_user_id updated_by_user_id + * + * @return self + */ + public function setUpdatedByUserId($updated_by_user_id) + { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } + $this->container['updated_by_user_id'] = $updated_by_user_id; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @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 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/codegen/Crm/Commerce/Invoices/ObjectSerializer.php b/codegen/Crm/Commerce/Invoices/ObjectSerializer.php new file mode 100644 index 000000000..0bb87b2ac --- /dev/null +++ b/codegen/Crm/Commerce/Invoices/ObjectSerializer.php @@ -0,0 +1,567 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\HubSpot\Client\Crm\Commerce\Invoices\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} From 1d0c405275142fa0c9958e2d60679ce018b23a0b Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 15:49:11 +0300 Subject: [PATCH 4/9] Codegen: CRM Exports --- codegen/Crm/Exports/Api/PublicExportsApi.php | 837 ++++++++++++++++ codegen/Crm/Exports/ApiException.php | 119 +++ codegen/Crm/Exports/Configuration.php | 531 ++++++++++ codegen/Crm/Exports/HeaderSelector.php | 245 +++++ .../ActionResponseWithSingleResultURI.php | 694 +++++++++++++ codegen/Crm/Exports/Model/Error.php | 622 ++++++++++++ codegen/Crm/Exports/Model/ErrorDetail.php | 548 +++++++++++ codegen/Crm/Exports/Model/Filter.php | 603 ++++++++++++ codegen/Crm/Exports/Model/ModelInterface.php | 111 +++ .../Exports/Model/PublicCrmSearchRequest.php | 486 +++++++++ .../Exports/Model/PublicExportListRequest.php | 926 ++++++++++++++++++ .../Crm/Exports/Model/PublicExportRequest.php | 926 ++++++++++++++++++ .../Exports/Model/PublicExportViewRequest.php | 926 ++++++++++++++++++ codegen/Crm/Exports/Model/StandardError.php | 665 +++++++++++++ codegen/Crm/Exports/Model/TaskLocator.php | 446 +++++++++ codegen/Crm/Exports/ObjectSerializer.php | 567 +++++++++++ 16 files changed, 9252 insertions(+) create mode 100644 codegen/Crm/Exports/Api/PublicExportsApi.php create mode 100644 codegen/Crm/Exports/ApiException.php create mode 100644 codegen/Crm/Exports/Configuration.php create mode 100644 codegen/Crm/Exports/HeaderSelector.php create mode 100644 codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php create mode 100644 codegen/Crm/Exports/Model/Error.php create mode 100644 codegen/Crm/Exports/Model/ErrorDetail.php create mode 100644 codegen/Crm/Exports/Model/Filter.php create mode 100644 codegen/Crm/Exports/Model/ModelInterface.php create mode 100644 codegen/Crm/Exports/Model/PublicCrmSearchRequest.php create mode 100644 codegen/Crm/Exports/Model/PublicExportListRequest.php create mode 100644 codegen/Crm/Exports/Model/PublicExportRequest.php create mode 100644 codegen/Crm/Exports/Model/PublicExportViewRequest.php create mode 100644 codegen/Crm/Exports/Model/StandardError.php create mode 100644 codegen/Crm/Exports/Model/TaskLocator.php create mode 100644 codegen/Crm/Exports/ObjectSerializer.php diff --git a/codegen/Crm/Exports/Api/PublicExportsApi.php b/codegen/Crm/Exports/Api/PublicExportsApi.php new file mode 100644 index 000000000..40eda65b1 --- /dev/null +++ b/codegen/Crm/Exports/Api/PublicExportsApi.php @@ -0,0 +1,837 @@ + [ + 'application/json', + ], + 'start' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getStatus + * + * Get the status of the export including the URL to download the file + * + * @param int $task_id task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI|\HubSpot\Client\Crm\Exports\Model\Error + */ + public function getStatus($task_id, string $contentType = self::contentTypes['getStatus'][0]) + { + list($response) = $this->getStatusWithHttpInfo($task_id, $contentType); + return $response; + } + + /** + * Operation getStatusWithHttpInfo + * + * Get the status of the export including the URL to download the file + * + * @param int $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI|\HubSpot\Client\Crm\Exports\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getStatusWithHttpInfo($task_id, string $contentType = self::contentTypes['getStatus'][0]) + { + $request = $this->getStatusRequest($task_id, $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 ('\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI' !== '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, '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Exports\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Exports\Model\Error' !== '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, '\HubSpot\Client\Crm\Exports\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI'; + 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(), + '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Exports\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getStatusAsync + * + * Get the status of the export including the URL to download the file + * + * @param int $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getStatusAsync($task_id, string $contentType = self::contentTypes['getStatus'][0]) + { + return $this->getStatusAsyncWithHttpInfo($task_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getStatusAsyncWithHttpInfo + * + * Get the status of the export including the URL to download the file + * + * @param int $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getStatusAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['getStatus'][0]) + { + $returnType = '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI'; + $request = $this->getStatusRequest($task_id, $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 'getStatus' + * + * @param int $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getStatusRequest($task_id, string $contentType = self::contentTypes['getStatus'][0]) + { + + // verify the required parameter 'task_id' is set + if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $task_id when calling getStatus' + ); + } + + + $resourcePath = '/crm/v3/exports/export/async/tasks/{taskId}/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($task_id !== null) { + $resourcePath = str_replace( + '{' . 'taskId' . '}', + ObjectSerializer::toPathValue($task_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 OAuth (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation start + * + * Start an export + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request public_export_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Exports\Model\TaskLocator|\HubSpot\Client\Crm\Exports\Model\Error + */ + public function start($public_export_request, string $contentType = self::contentTypes['start'][0]) + { + list($response) = $this->startWithHttpInfo($public_export_request, $contentType); + return $response; + } + + /** + * Operation startWithHttpInfo + * + * Start an export + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Exports\Model\TaskLocator|\HubSpot\Client\Crm\Exports\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function startWithHttpInfo($public_export_request, string $contentType = self::contentTypes['start'][0]) + { + $request = $this->startRequest($public_export_request, $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 202: + if ('\HubSpot\Client\Crm\Exports\Model\TaskLocator' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Exports\Model\TaskLocator' !== '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, '\HubSpot\Client\Crm\Exports\Model\TaskLocator', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Exports\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Exports\Model\Error' !== '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, '\HubSpot\Client\Crm\Exports\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Exports\Model\TaskLocator'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Exports\Model\TaskLocator', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Exports\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation startAsync + * + * Start an export + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function startAsync($public_export_request, string $contentType = self::contentTypes['start'][0]) + { + return $this->startAsyncWithHttpInfo($public_export_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation startAsyncWithHttpInfo + * + * Start an export + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function startAsyncWithHttpInfo($public_export_request, string $contentType = self::contentTypes['start'][0]) + { + $returnType = '\HubSpot\Client\Crm\Exports\Model\TaskLocator'; + $request = $this->startRequest($public_export_request, $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 'start' + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function startRequest($public_export_request, string $contentType = self::contentTypes['start'][0]) + { + + // verify the required parameter 'public_export_request' is set + if ($public_export_request === null || (is_array($public_export_request) && count($public_export_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_export_request when calling start' + ); + } + + + $resourcePath = '/crm/v3/exports/export/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_export_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_export_request)); + } else { + $httpBody = $public_export_request; + } + } 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 OAuth (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Exports/ApiException.php b/codegen/Crm/Exports/ApiException.php new file mode 100644 index 000000000..c9726b879 --- /dev/null +++ b/codegen/Crm/Exports/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen/Crm/Exports/Configuration.php b/codegen/Crm/Exports/Configuration.php new file mode 100644 index 000000000..96c02ddaa --- /dev/null +++ b/codegen/Crm/Exports/Configuration.php @@ -0,0 +1,531 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (HubSpot\Client\Crm\Exports) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.hubapi.com", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/codegen/Crm/Exports/HeaderSelector.php b/codegen/Crm/Exports/HeaderSelector.php new file mode 100644 index 000000000..08ba0bc2f --- /dev/null +++ b/codegen/Crm/Exports/HeaderSelector.php @@ -0,0 +1,245 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php b/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php new file mode 100644 index 000000000..d8ca1cae1 --- /dev/null +++ b/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php @@ -0,0 +1,694 @@ + + */ +class ActionResponseWithSingleResultURI implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ActionResponseWithSingleResultURI'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => 'string', + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'errors' => '\HubSpot\Client\Crm\Exports\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'result' => false, + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'errors' => false, + 'status' => 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 = [ + 'result' => 'result', + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * 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('result', $data ?? [], null); + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Exports\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Exports\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Exports/Model/Error.php b/codegen/Crm/Exports/Model/Error.php new file mode 100644 index 000000000..367351c9b --- /dev/null +++ b/codegen/Crm/Exports/Model/Error.php @@ -0,0 +1,622 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'context' => 'array', + 'correlation_id' => 'string', + 'links' => 'array', + 'message' => 'string', + 'category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Exports\Model\ErrorDetail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'correlation_id' => 'uuid', + 'links' => null, + 'message' => null, + 'category' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'correlation_id' => 'correlationId', + 'links' => 'links', + 'message' => 'message', + 'category' => 'category', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'correlation_id' => 'setCorrelationId', + 'links' => 'setLinks', + 'message' => 'setMessage', + 'category' => 'setCategory', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'correlation_id' => 'getCorrelationId', + 'links' => 'getLinks', + 'message' => 'getMessage', + 'category' => 'getCategory', + 'errors' => 'getErrors' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $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['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' 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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets correlation_id + * + * @return string + */ + public function getCorrelationId() + { + return $this->container['correlation_id']; + } + + /** + * Sets correlation_id + * + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return self + */ + public function setCorrelationId($correlation_id) + { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } + $this->container['correlation_id'] = $correlation_id; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Exports\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Exports\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @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/codegen/Crm/Exports/Model/ErrorDetail.php b/codegen/Crm/Exports/Model/ErrorDetail.php new file mode 100644 index 000000000..c88486a22 --- /dev/null +++ b/codegen/Crm/Exports/Model/ErrorDetail.php @@ -0,0 +1,548 @@ + + */ +class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', + 'code' => 'string', + 'in' => 'string', + 'context' => 'array', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'code' => null, + 'in' => null, + 'context' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => 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 = [ + 'sub_category' => 'subCategory', + 'code' => 'code', + 'in' => 'in', + 'context' => 'context', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'code' => 'setCode', + 'in' => 'setIn', + 'context' => 'setContext', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'code' => 'getCode', + 'in' => 'getIn', + 'context' => 'getContext', + '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('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $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['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 sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The status code associated with the error detail + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets in + * + * @return string|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string|null $in The name of the field or parameter in which the error was found. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @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/codegen/Crm/Exports/Model/Filter.php b/codegen/Crm/Exports/Model/Filter.php new file mode 100644 index 000000000..c7d01fee0 --- /dev/null +++ b/codegen/Crm/Exports/Model/Filter.php @@ -0,0 +1,603 @@ + + */ +class Filter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Filter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'high_value' => 'string', + 'property_name' => 'string', + 'values' => 'string[]', + 'value' => 'string', + 'operator' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'high_value' => null, + 'property_name' => null, + 'values' => null, + 'value' => null, + 'operator' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => 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 = [ + 'high_value' => 'highValue', + 'property_name' => 'propertyName', + 'values' => 'values', + 'value' => 'value', + 'operator' => 'operator' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'high_value' => 'setHighValue', + 'property_name' => 'setPropertyName', + 'values' => 'setValues', + 'value' => 'setValue', + 'operator' => 'setOperator' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'high_value' => 'getHighValue', + 'property_name' => 'getPropertyName', + 'values' => 'getValues', + 'value' => 'getValue', + 'operator' => 'getOperator' + ]; + + /** + * 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 OPERATOR_EQ = 'EQ'; + public const OPERATOR_NEQ = 'NEQ'; + public const OPERATOR_LT = 'LT'; + public const OPERATOR_LTE = 'LTE'; + public const OPERATOR_GT = 'GT'; + public const OPERATOR_GTE = 'GTE'; + public const OPERATOR_BETWEEN = 'BETWEEN'; + public const OPERATOR_IN = 'IN'; + public const OPERATOR_NOT_IN = 'NOT_IN'; + public const OPERATOR_HAS_PROPERTY = 'HAS_PROPERTY'; + public const OPERATOR_NOT_HAS_PROPERTY = 'NOT_HAS_PROPERTY'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperatorAllowableValues() + { + return [ + self::OPERATOR_EQ, + self::OPERATOR_NEQ, + self::OPERATOR_LT, + self::OPERATOR_LTE, + self::OPERATOR_GT, + self::OPERATOR_GTE, + self::OPERATOR_BETWEEN, + self::OPERATOR_IN, + self::OPERATOR_NOT_IN, + self::OPERATOR_HAS_PROPERTY, + self::OPERATOR_NOT_HAS_PROPERTY, + ]; + } + + /** + * 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('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $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['property_name'] === null) { + $invalidProperties[] = "'property_name' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!is_null($this->container['operator']) && !in_array($this->container['operator'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operator', must be one of '%s'", + $this->container['operator'], + implode("', '", $allowedValues) + ); + } + + 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 high_value + * + * @return string|null + */ + public function getHighValue() + { + return $this->container['high_value']; + } + + /** + * Sets high_value + * + * @param string|null $high_value high_value + * + * @return self + */ + public function setHighValue($high_value) + { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } + $this->container['high_value'] = $high_value; + + return $this; + } + + /** + * Gets property_name + * + * @return string + */ + public function getPropertyName() + { + return $this->container['property_name']; + } + + /** + * Sets property_name + * + * @param string $property_name property_name + * + * @return self + */ + public function setPropertyName($property_name) + { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } + $this->container['property_name'] = $property_name; + + return $this; + } + + /** + * Gets values + * + * @return string[]|null + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param string[]|null $values values + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + + /** + * Gets value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value value + * + * @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 operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator operator + * + * @return self + */ + public function setOperator($operator) + { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!in_array($operator, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operator'] = $operator; + + 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/codegen/Crm/Exports/Model/ModelInterface.php b/codegen/Crm/Exports/Model/ModelInterface.php new file mode 100644 index 000000000..ddcbed30f --- /dev/null +++ b/codegen/Crm/Exports/Model/ModelInterface.php @@ -0,0 +1,111 @@ + + */ +class PublicCrmSearchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicCrmSearchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'filters' => '\HubSpot\Client\Crm\Exports\Model\Filter[]', + 'sorts' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'filters' => null, + 'sorts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'filters' => false, + 'sorts' => 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 = [ + 'query' => 'query', + 'filters' => 'filters', + 'sorts' => 'sorts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'filters' => 'setFilters', + 'sorts' => 'setSorts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'filters' => 'getFilters', + 'sorts' => 'getSorts' + ]; + + /** + * 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('query', $data ?? [], null); + $this->setIfExists('filters', $data ?? [], null); + $this->setIfExists('sorts', $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['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + if ($this->container['filters'] === null) { + $invalidProperties[] = "'filters' can't be null"; + } + if ($this->container['sorts'] === null) { + $invalidProperties[] = "'sorts' 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 query + * + * @return string + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets filters + * + * @return \HubSpot\Client\Crm\Exports\Model\Filter[] + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \HubSpot\Client\Crm\Exports\Model\Filter[] $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets sorts + * + * @return string[] + */ + public function getSorts() + { + return $this->container['sorts']; + } + + /** + * Sets sorts + * + * @param string[] $sorts sorts + * + * @return self + */ + public function setSorts($sorts) + { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } + $this->container['sorts'] = $sorts; + + 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/codegen/Crm/Exports/Model/PublicExportListRequest.php b/codegen/Crm/Exports/Model/PublicExportListRequest.php new file mode 100644 index 000000000..c50629370 --- /dev/null +++ b/codegen/Crm/Exports/Model/PublicExportListRequest.php @@ -0,0 +1,926 @@ + + */ +class PublicExportListRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicExportListRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'export_type' => 'string', + 'format' => 'string', + 'export_name' => 'string', + 'object_properties' => 'string[]', + 'associated_object_type' => 'string', + 'object_type' => 'string', + 'language' => 'string', + 'export_internal_values_options' => 'string[]', + 'override_associated_objects_per_definition_per_row_limit' => 'bool', + 'public_crm_search_request' => '\HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest', + 'list_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'export_type' => null, + 'format' => null, + 'export_name' => null, + 'object_properties' => null, + 'associated_object_type' => null, + 'object_type' => null, + 'language' => null, + 'export_internal_values_options' => null, + 'override_associated_objects_per_definition_per_row_limit' => null, + 'public_crm_search_request' => null, + 'list_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'export_type' => false, + 'format' => false, + 'export_name' => false, + 'object_properties' => false, + 'associated_object_type' => false, + 'object_type' => false, + 'language' => false, + 'export_internal_values_options' => false, + 'override_associated_objects_per_definition_per_row_limit' => false, + 'public_crm_search_request' => false, + 'list_id' => 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 = [ + 'export_type' => 'exportType', + 'format' => 'format', + 'export_name' => 'exportName', + 'object_properties' => 'objectProperties', + 'associated_object_type' => 'associatedObjectType', + 'object_type' => 'objectType', + 'language' => 'language', + 'export_internal_values_options' => 'exportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'overrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'publicCrmSearchRequest', + 'list_id' => 'listId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'export_type' => 'setExportType', + 'format' => 'setFormat', + 'export_name' => 'setExportName', + 'object_properties' => 'setObjectProperties', + 'associated_object_type' => 'setAssociatedObjectType', + 'object_type' => 'setObjectType', + 'language' => 'setLanguage', + 'export_internal_values_options' => 'setExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'setOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'setPublicCrmSearchRequest', + 'list_id' => 'setListId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'export_type' => 'getExportType', + 'format' => 'getFormat', + 'export_name' => 'getExportName', + 'object_properties' => 'getObjectProperties', + 'associated_object_type' => 'getAssociatedObjectType', + 'object_type' => 'getObjectType', + 'language' => 'getLanguage', + 'export_internal_values_options' => 'getExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'getOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'getPublicCrmSearchRequest', + 'list_id' => 'getListId' + ]; + + /** + * 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 EXPORT_TYPE__LIST = 'LIST'; + public const FORMAT_XLS = 'XLS'; + public const FORMAT_XLSX = 'XLSX'; + public const FORMAT_CSV = 'CSV'; + public const LANGUAGE_EN = 'EN'; + public const LANGUAGE_DE = 'DE'; + public const LANGUAGE_ES = 'ES'; + public const LANGUAGE_FR = 'FR'; + public const LANGUAGE_JA = 'JA'; + public const LANGUAGE_NL = 'NL'; + public const LANGUAGE_PT_BR = 'PT_BR'; + public const LANGUAGE_IT = 'IT'; + public const LANGUAGE_PL = 'PL'; + public const LANGUAGE_SV = 'SV'; + public const LANGUAGE_FI = 'FI'; + public const LANGUAGE_ZH_TW = 'ZH_TW'; + public const LANGUAGE_DA_DK = 'DA_DK'; + public const LANGUAGE_NO = 'NO'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_NAMES = 'NAMES'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_VALUES = 'VALUES'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportTypeAllowableValues() + { + return [ + self::EXPORT_TYPE__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFormatAllowableValues() + { + return [ + self::FORMAT_XLS, + self::FORMAT_XLSX, + self::FORMAT_CSV, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_EN, + self::LANGUAGE_DE, + self::LANGUAGE_ES, + self::LANGUAGE_FR, + self::LANGUAGE_JA, + self::LANGUAGE_NL, + self::LANGUAGE_PT_BR, + self::LANGUAGE_IT, + self::LANGUAGE_PL, + self::LANGUAGE_SV, + self::LANGUAGE_FI, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_DA_DK, + self::LANGUAGE_NO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportInternalValuesOptionsAllowableValues() + { + return [ + self::EXPORT_INTERNAL_VALUES_OPTIONS_NAMES, + self::EXPORT_INTERNAL_VALUES_OPTIONS_VALUES, + ]; + } + + /** + * 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('export_type', $data ?? [], 'LIST'); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('export_name', $data ?? [], null); + $this->setIfExists('object_properties', $data ?? [], null); + $this->setIfExists('associated_object_type', $data ?? [], null); + $this->setIfExists('object_type', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('export_internal_values_options', $data ?? [], null); + $this->setIfExists('override_associated_objects_per_definition_per_row_limit', $data ?? [], null); + $this->setIfExists('public_crm_search_request', $data ?? [], null); + $this->setIfExists('list_id', $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['export_type'] === null) { + $invalidProperties[] = "'export_type' can't be null"; + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!is_null($this->container['export_type']) && !in_array($this->container['export_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'export_type', must be one of '%s'", + $this->container['export_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['format'] === null) { + $invalidProperties[] = "'format' can't be null"; + } + $allowedValues = $this->getFormatAllowableValues(); + if (!is_null($this->container['format']) && !in_array($this->container['format'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'format', must be one of '%s'", + $this->container['format'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_name'] === null) { + $invalidProperties[] = "'export_name' can't be null"; + } + if ($this->container['object_properties'] === null) { + $invalidProperties[] = "'object_properties' can't be null"; + } + if ($this->container['object_type'] === null) { + $invalidProperties[] = "'object_type' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_internal_values_options'] === null) { + $invalidProperties[] = "'export_internal_values_options' can't be null"; + } + if ($this->container['override_associated_objects_per_definition_per_row_limit'] === null) { + $invalidProperties[] = "'override_associated_objects_per_definition_per_row_limit' can't be null"; + } + if ($this->container['list_id'] === null) { + $invalidProperties[] = "'list_id' 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 export_type + * + * @return string + */ + public function getExportType() + { + return $this->container['export_type']; + } + + /** + * Sets export_type + * + * @param string $export_type export_type + * + * @return self + */ + public function setExportType($export_type) + { + if (is_null($export_type)) { + throw new \InvalidArgumentException('non-nullable export_type cannot be null'); + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!in_array($export_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'export_type', must be one of '%s'", + $export_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_type'] = $export_type; + + return $this; + } + + /** + * Gets format + * + * @return string + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string $format format + * + * @return self + */ + public function setFormat($format) + { + if (is_null($format)) { + throw new \InvalidArgumentException('non-nullable format cannot be null'); + } + $allowedValues = $this->getFormatAllowableValues(); + if (!in_array($format, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'format', must be one of '%s'", + $format, + implode("', '", $allowedValues) + ) + ); + } + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets export_name + * + * @return string + */ + public function getExportName() + { + return $this->container['export_name']; + } + + /** + * Sets export_name + * + * @param string $export_name export_name + * + * @return self + */ + public function setExportName($export_name) + { + if (is_null($export_name)) { + throw new \InvalidArgumentException('non-nullable export_name cannot be null'); + } + $this->container['export_name'] = $export_name; + + return $this; + } + + /** + * Gets object_properties + * + * @return string[] + */ + public function getObjectProperties() + { + return $this->container['object_properties']; + } + + /** + * Sets object_properties + * + * @param string[] $object_properties object_properties + * + * @return self + */ + public function setObjectProperties($object_properties) + { + if (is_null($object_properties)) { + throw new \InvalidArgumentException('non-nullable object_properties cannot be null'); + } + $this->container['object_properties'] = $object_properties; + + return $this; + } + + /** + * Gets associated_object_type + * + * @return string|null + */ + public function getAssociatedObjectType() + { + return $this->container['associated_object_type']; + } + + /** + * Sets associated_object_type + * + * @param string|null $associated_object_type associated_object_type + * + * @return self + */ + public function setAssociatedObjectType($associated_object_type) + { + if (is_null($associated_object_type)) { + throw new \InvalidArgumentException('non-nullable associated_object_type cannot be null'); + } + $this->container['associated_object_type'] = $associated_object_type; + + return $this; + } + + /** + * Gets object_type + * + * @return string + */ + public function getObjectType() + { + return $this->container['object_type']; + } + + /** + * Sets object_type + * + * @param string $object_type object_type + * + * @return self + */ + public function setObjectType($object_type) + { + if (is_null($object_type)) { + throw new \InvalidArgumentException('non-nullable object_type cannot be null'); + } + $this->container['object_type'] = $object_type; + + return $this; + } + + /** + * Gets language + * + * @return string + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets export_internal_values_options + * + * @return string[] + */ + public function getExportInternalValuesOptions() + { + return $this->container['export_internal_values_options']; + } + + /** + * Sets export_internal_values_options + * + * @param string[] $export_internal_values_options export_internal_values_options + * + * @return self + */ + public function setExportInternalValuesOptions($export_internal_values_options) + { + if (is_null($export_internal_values_options)) { + throw new \InvalidArgumentException('non-nullable export_internal_values_options cannot be null'); + } + $allowedValues = $this->getExportInternalValuesOptionsAllowableValues(); + if (array_diff($export_internal_values_options, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'export_internal_values_options', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_internal_values_options'] = $export_internal_values_options; + + return $this; + } + + /** + * Gets override_associated_objects_per_definition_per_row_limit + * + * @return bool + */ + public function getOverrideAssociatedObjectsPerDefinitionPerRowLimit() + { + return $this->container['override_associated_objects_per_definition_per_row_limit']; + } + + /** + * Sets override_associated_objects_per_definition_per_row_limit + * + * @param bool $override_associated_objects_per_definition_per_row_limit override_associated_objects_per_definition_per_row_limit + * + * @return self + */ + public function setOverrideAssociatedObjectsPerDefinitionPerRowLimit($override_associated_objects_per_definition_per_row_limit) + { + if (is_null($override_associated_objects_per_definition_per_row_limit)) { + throw new \InvalidArgumentException('non-nullable override_associated_objects_per_definition_per_row_limit cannot be null'); + } + $this->container['override_associated_objects_per_definition_per_row_limit'] = $override_associated_objects_per_definition_per_row_limit; + + return $this; + } + + /** + * Gets public_crm_search_request + * + * @return \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null + */ + public function getPublicCrmSearchRequest() + { + return $this->container['public_crm_search_request']; + } + + /** + * Sets public_crm_search_request + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null $public_crm_search_request public_crm_search_request + * + * @return self + */ + public function setPublicCrmSearchRequest($public_crm_search_request) + { + if (is_null($public_crm_search_request)) { + throw new \InvalidArgumentException('non-nullable public_crm_search_request cannot be null'); + } + $this->container['public_crm_search_request'] = $public_crm_search_request; + + return $this; + } + + /** + * Gets list_id + * + * @return string + */ + public function getListId() + { + return $this->container['list_id']; + } + + /** + * Sets list_id + * + * @param string $list_id list_id + * + * @return self + */ + public function setListId($list_id) + { + if (is_null($list_id)) { + throw new \InvalidArgumentException('non-nullable list_id cannot be null'); + } + $this->container['list_id'] = $list_id; + + 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/codegen/Crm/Exports/Model/PublicExportRequest.php b/codegen/Crm/Exports/Model/PublicExportRequest.php new file mode 100644 index 000000000..fe97027e7 --- /dev/null +++ b/codegen/Crm/Exports/Model/PublicExportRequest.php @@ -0,0 +1,926 @@ + + */ +class PublicExportRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicExportRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'export_type' => 'string', + 'format' => 'string', + 'export_name' => 'string', + 'object_properties' => 'string[]', + 'associated_object_type' => 'string', + 'object_type' => 'string', + 'language' => 'string', + 'export_internal_values_options' => 'string[]', + 'override_associated_objects_per_definition_per_row_limit' => 'bool', + 'list_id' => 'string', + 'public_crm_search_request' => '\HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'export_type' => null, + 'format' => null, + 'export_name' => null, + 'object_properties' => null, + 'associated_object_type' => null, + 'object_type' => null, + 'language' => null, + 'export_internal_values_options' => null, + 'override_associated_objects_per_definition_per_row_limit' => null, + 'list_id' => null, + 'public_crm_search_request' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'export_type' => false, + 'format' => false, + 'export_name' => false, + 'object_properties' => false, + 'associated_object_type' => false, + 'object_type' => false, + 'language' => false, + 'export_internal_values_options' => false, + 'override_associated_objects_per_definition_per_row_limit' => false, + 'list_id' => false, + 'public_crm_search_request' => 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 = [ + 'export_type' => 'exportType', + 'format' => 'format', + 'export_name' => 'exportName', + 'object_properties' => 'objectProperties', + 'associated_object_type' => 'associatedObjectType', + 'object_type' => 'objectType', + 'language' => 'language', + 'export_internal_values_options' => 'exportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'overrideAssociatedObjectsPerDefinitionPerRowLimit', + 'list_id' => 'listId', + 'public_crm_search_request' => 'publicCrmSearchRequest' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'export_type' => 'setExportType', + 'format' => 'setFormat', + 'export_name' => 'setExportName', + 'object_properties' => 'setObjectProperties', + 'associated_object_type' => 'setAssociatedObjectType', + 'object_type' => 'setObjectType', + 'language' => 'setLanguage', + 'export_internal_values_options' => 'setExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'setOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'list_id' => 'setListId', + 'public_crm_search_request' => 'setPublicCrmSearchRequest' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'export_type' => 'getExportType', + 'format' => 'getFormat', + 'export_name' => 'getExportName', + 'object_properties' => 'getObjectProperties', + 'associated_object_type' => 'getAssociatedObjectType', + 'object_type' => 'getObjectType', + 'language' => 'getLanguage', + 'export_internal_values_options' => 'getExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'getOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'list_id' => 'getListId', + 'public_crm_search_request' => 'getPublicCrmSearchRequest' + ]; + + /** + * 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 EXPORT_TYPE__LIST = 'LIST'; + public const FORMAT_XLS = 'XLS'; + public const FORMAT_XLSX = 'XLSX'; + public const FORMAT_CSV = 'CSV'; + public const LANGUAGE_EN = 'EN'; + public const LANGUAGE_DE = 'DE'; + public const LANGUAGE_ES = 'ES'; + public const LANGUAGE_FR = 'FR'; + public const LANGUAGE_JA = 'JA'; + public const LANGUAGE_NL = 'NL'; + public const LANGUAGE_PT_BR = 'PT_BR'; + public const LANGUAGE_IT = 'IT'; + public const LANGUAGE_PL = 'PL'; + public const LANGUAGE_SV = 'SV'; + public const LANGUAGE_FI = 'FI'; + public const LANGUAGE_ZH_TW = 'ZH_TW'; + public const LANGUAGE_DA_DK = 'DA_DK'; + public const LANGUAGE_NO = 'NO'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_NAMES = 'NAMES'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_VALUES = 'VALUES'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportTypeAllowableValues() + { + return [ + self::EXPORT_TYPE__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFormatAllowableValues() + { + return [ + self::FORMAT_XLS, + self::FORMAT_XLSX, + self::FORMAT_CSV, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_EN, + self::LANGUAGE_DE, + self::LANGUAGE_ES, + self::LANGUAGE_FR, + self::LANGUAGE_JA, + self::LANGUAGE_NL, + self::LANGUAGE_PT_BR, + self::LANGUAGE_IT, + self::LANGUAGE_PL, + self::LANGUAGE_SV, + self::LANGUAGE_FI, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_DA_DK, + self::LANGUAGE_NO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportInternalValuesOptionsAllowableValues() + { + return [ + self::EXPORT_INTERNAL_VALUES_OPTIONS_NAMES, + self::EXPORT_INTERNAL_VALUES_OPTIONS_VALUES, + ]; + } + + /** + * 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('export_type', $data ?? [], 'LIST'); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('export_name', $data ?? [], null); + $this->setIfExists('object_properties', $data ?? [], null); + $this->setIfExists('associated_object_type', $data ?? [], null); + $this->setIfExists('object_type', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('export_internal_values_options', $data ?? [], null); + $this->setIfExists('override_associated_objects_per_definition_per_row_limit', $data ?? [], null); + $this->setIfExists('list_id', $data ?? [], null); + $this->setIfExists('public_crm_search_request', $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['export_type'] === null) { + $invalidProperties[] = "'export_type' can't be null"; + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!is_null($this->container['export_type']) && !in_array($this->container['export_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'export_type', must be one of '%s'", + $this->container['export_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['format'] === null) { + $invalidProperties[] = "'format' can't be null"; + } + $allowedValues = $this->getFormatAllowableValues(); + if (!is_null($this->container['format']) && !in_array($this->container['format'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'format', must be one of '%s'", + $this->container['format'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_name'] === null) { + $invalidProperties[] = "'export_name' can't be null"; + } + if ($this->container['object_properties'] === null) { + $invalidProperties[] = "'object_properties' can't be null"; + } + if ($this->container['object_type'] === null) { + $invalidProperties[] = "'object_type' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_internal_values_options'] === null) { + $invalidProperties[] = "'export_internal_values_options' can't be null"; + } + if ($this->container['override_associated_objects_per_definition_per_row_limit'] === null) { + $invalidProperties[] = "'override_associated_objects_per_definition_per_row_limit' can't be null"; + } + if ($this->container['list_id'] === null) { + $invalidProperties[] = "'list_id' 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 export_type + * + * @return string + */ + public function getExportType() + { + return $this->container['export_type']; + } + + /** + * Sets export_type + * + * @param string $export_type export_type + * + * @return self + */ + public function setExportType($export_type) + { + if (is_null($export_type)) { + throw new \InvalidArgumentException('non-nullable export_type cannot be null'); + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!in_array($export_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'export_type', must be one of '%s'", + $export_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_type'] = $export_type; + + return $this; + } + + /** + * Gets format + * + * @return string + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string $format format + * + * @return self + */ + public function setFormat($format) + { + if (is_null($format)) { + throw new \InvalidArgumentException('non-nullable format cannot be null'); + } + $allowedValues = $this->getFormatAllowableValues(); + if (!in_array($format, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'format', must be one of '%s'", + $format, + implode("', '", $allowedValues) + ) + ); + } + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets export_name + * + * @return string + */ + public function getExportName() + { + return $this->container['export_name']; + } + + /** + * Sets export_name + * + * @param string $export_name export_name + * + * @return self + */ + public function setExportName($export_name) + { + if (is_null($export_name)) { + throw new \InvalidArgumentException('non-nullable export_name cannot be null'); + } + $this->container['export_name'] = $export_name; + + return $this; + } + + /** + * Gets object_properties + * + * @return string[] + */ + public function getObjectProperties() + { + return $this->container['object_properties']; + } + + /** + * Sets object_properties + * + * @param string[] $object_properties object_properties + * + * @return self + */ + public function setObjectProperties($object_properties) + { + if (is_null($object_properties)) { + throw new \InvalidArgumentException('non-nullable object_properties cannot be null'); + } + $this->container['object_properties'] = $object_properties; + + return $this; + } + + /** + * Gets associated_object_type + * + * @return string|null + */ + public function getAssociatedObjectType() + { + return $this->container['associated_object_type']; + } + + /** + * Sets associated_object_type + * + * @param string|null $associated_object_type associated_object_type + * + * @return self + */ + public function setAssociatedObjectType($associated_object_type) + { + if (is_null($associated_object_type)) { + throw new \InvalidArgumentException('non-nullable associated_object_type cannot be null'); + } + $this->container['associated_object_type'] = $associated_object_type; + + return $this; + } + + /** + * Gets object_type + * + * @return string + */ + public function getObjectType() + { + return $this->container['object_type']; + } + + /** + * Sets object_type + * + * @param string $object_type object_type + * + * @return self + */ + public function setObjectType($object_type) + { + if (is_null($object_type)) { + throw new \InvalidArgumentException('non-nullable object_type cannot be null'); + } + $this->container['object_type'] = $object_type; + + return $this; + } + + /** + * Gets language + * + * @return string + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets export_internal_values_options + * + * @return string[] + */ + public function getExportInternalValuesOptions() + { + return $this->container['export_internal_values_options']; + } + + /** + * Sets export_internal_values_options + * + * @param string[] $export_internal_values_options export_internal_values_options + * + * @return self + */ + public function setExportInternalValuesOptions($export_internal_values_options) + { + if (is_null($export_internal_values_options)) { + throw new \InvalidArgumentException('non-nullable export_internal_values_options cannot be null'); + } + $allowedValues = $this->getExportInternalValuesOptionsAllowableValues(); + if (array_diff($export_internal_values_options, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'export_internal_values_options', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_internal_values_options'] = $export_internal_values_options; + + return $this; + } + + /** + * Gets override_associated_objects_per_definition_per_row_limit + * + * @return bool + */ + public function getOverrideAssociatedObjectsPerDefinitionPerRowLimit() + { + return $this->container['override_associated_objects_per_definition_per_row_limit']; + } + + /** + * Sets override_associated_objects_per_definition_per_row_limit + * + * @param bool $override_associated_objects_per_definition_per_row_limit override_associated_objects_per_definition_per_row_limit + * + * @return self + */ + public function setOverrideAssociatedObjectsPerDefinitionPerRowLimit($override_associated_objects_per_definition_per_row_limit) + { + if (is_null($override_associated_objects_per_definition_per_row_limit)) { + throw new \InvalidArgumentException('non-nullable override_associated_objects_per_definition_per_row_limit cannot be null'); + } + $this->container['override_associated_objects_per_definition_per_row_limit'] = $override_associated_objects_per_definition_per_row_limit; + + return $this; + } + + /** + * Gets list_id + * + * @return string + */ + public function getListId() + { + return $this->container['list_id']; + } + + /** + * Sets list_id + * + * @param string $list_id list_id + * + * @return self + */ + public function setListId($list_id) + { + if (is_null($list_id)) { + throw new \InvalidArgumentException('non-nullable list_id cannot be null'); + } + $this->container['list_id'] = $list_id; + + return $this; + } + + /** + * Gets public_crm_search_request + * + * @return \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null + */ + public function getPublicCrmSearchRequest() + { + return $this->container['public_crm_search_request']; + } + + /** + * Sets public_crm_search_request + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null $public_crm_search_request public_crm_search_request + * + * @return self + */ + public function setPublicCrmSearchRequest($public_crm_search_request) + { + if (is_null($public_crm_search_request)) { + throw new \InvalidArgumentException('non-nullable public_crm_search_request cannot be null'); + } + $this->container['public_crm_search_request'] = $public_crm_search_request; + + 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/codegen/Crm/Exports/Model/PublicExportViewRequest.php b/codegen/Crm/Exports/Model/PublicExportViewRequest.php new file mode 100644 index 000000000..f302ad82c --- /dev/null +++ b/codegen/Crm/Exports/Model/PublicExportViewRequest.php @@ -0,0 +1,926 @@ + + */ +class PublicExportViewRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicExportViewRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'export_type' => 'string', + 'format' => 'string', + 'export_name' => 'string', + 'object_properties' => 'string[]', + 'associated_object_type' => 'string', + 'object_type' => 'string', + 'language' => 'string', + 'export_internal_values_options' => 'string[]', + 'override_associated_objects_per_definition_per_row_limit' => 'bool', + 'public_crm_search_request' => '\HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest', + 'list_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'export_type' => null, + 'format' => null, + 'export_name' => null, + 'object_properties' => null, + 'associated_object_type' => null, + 'object_type' => null, + 'language' => null, + 'export_internal_values_options' => null, + 'override_associated_objects_per_definition_per_row_limit' => null, + 'public_crm_search_request' => null, + 'list_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'export_type' => false, + 'format' => false, + 'export_name' => false, + 'object_properties' => false, + 'associated_object_type' => false, + 'object_type' => false, + 'language' => false, + 'export_internal_values_options' => false, + 'override_associated_objects_per_definition_per_row_limit' => false, + 'public_crm_search_request' => false, + 'list_id' => 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 = [ + 'export_type' => 'exportType', + 'format' => 'format', + 'export_name' => 'exportName', + 'object_properties' => 'objectProperties', + 'associated_object_type' => 'associatedObjectType', + 'object_type' => 'objectType', + 'language' => 'language', + 'export_internal_values_options' => 'exportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'overrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'publicCrmSearchRequest', + 'list_id' => 'listId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'export_type' => 'setExportType', + 'format' => 'setFormat', + 'export_name' => 'setExportName', + 'object_properties' => 'setObjectProperties', + 'associated_object_type' => 'setAssociatedObjectType', + 'object_type' => 'setObjectType', + 'language' => 'setLanguage', + 'export_internal_values_options' => 'setExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'setOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'setPublicCrmSearchRequest', + 'list_id' => 'setListId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'export_type' => 'getExportType', + 'format' => 'getFormat', + 'export_name' => 'getExportName', + 'object_properties' => 'getObjectProperties', + 'associated_object_type' => 'getAssociatedObjectType', + 'object_type' => 'getObjectType', + 'language' => 'getLanguage', + 'export_internal_values_options' => 'getExportInternalValuesOptions', + 'override_associated_objects_per_definition_per_row_limit' => 'getOverrideAssociatedObjectsPerDefinitionPerRowLimit', + 'public_crm_search_request' => 'getPublicCrmSearchRequest', + 'list_id' => 'getListId' + ]; + + /** + * 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 EXPORT_TYPE_VIEW = 'VIEW'; + public const FORMAT_XLS = 'XLS'; + public const FORMAT_XLSX = 'XLSX'; + public const FORMAT_CSV = 'CSV'; + public const LANGUAGE_EN = 'EN'; + public const LANGUAGE_DE = 'DE'; + public const LANGUAGE_ES = 'ES'; + public const LANGUAGE_FR = 'FR'; + public const LANGUAGE_JA = 'JA'; + public const LANGUAGE_NL = 'NL'; + public const LANGUAGE_PT_BR = 'PT_BR'; + public const LANGUAGE_IT = 'IT'; + public const LANGUAGE_PL = 'PL'; + public const LANGUAGE_SV = 'SV'; + public const LANGUAGE_FI = 'FI'; + public const LANGUAGE_ZH_TW = 'ZH_TW'; + public const LANGUAGE_DA_DK = 'DA_DK'; + public const LANGUAGE_NO = 'NO'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_NAMES = 'NAMES'; + public const EXPORT_INTERNAL_VALUES_OPTIONS_VALUES = 'VALUES'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportTypeAllowableValues() + { + return [ + self::EXPORT_TYPE_VIEW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFormatAllowableValues() + { + return [ + self::FORMAT_XLS, + self::FORMAT_XLSX, + self::FORMAT_CSV, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_EN, + self::LANGUAGE_DE, + self::LANGUAGE_ES, + self::LANGUAGE_FR, + self::LANGUAGE_JA, + self::LANGUAGE_NL, + self::LANGUAGE_PT_BR, + self::LANGUAGE_IT, + self::LANGUAGE_PL, + self::LANGUAGE_SV, + self::LANGUAGE_FI, + self::LANGUAGE_ZH_TW, + self::LANGUAGE_DA_DK, + self::LANGUAGE_NO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportInternalValuesOptionsAllowableValues() + { + return [ + self::EXPORT_INTERNAL_VALUES_OPTIONS_NAMES, + self::EXPORT_INTERNAL_VALUES_OPTIONS_VALUES, + ]; + } + + /** + * 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('export_type', $data ?? [], 'VIEW'); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('export_name', $data ?? [], null); + $this->setIfExists('object_properties', $data ?? [], null); + $this->setIfExists('associated_object_type', $data ?? [], null); + $this->setIfExists('object_type', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('export_internal_values_options', $data ?? [], null); + $this->setIfExists('override_associated_objects_per_definition_per_row_limit', $data ?? [], null); + $this->setIfExists('public_crm_search_request', $data ?? [], null); + $this->setIfExists('list_id', $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['export_type'] === null) { + $invalidProperties[] = "'export_type' can't be null"; + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!is_null($this->container['export_type']) && !in_array($this->container['export_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'export_type', must be one of '%s'", + $this->container['export_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['format'] === null) { + $invalidProperties[] = "'format' can't be null"; + } + $allowedValues = $this->getFormatAllowableValues(); + if (!is_null($this->container['format']) && !in_array($this->container['format'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'format', must be one of '%s'", + $this->container['format'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_name'] === null) { + $invalidProperties[] = "'export_name' can't be null"; + } + if ($this->container['object_properties'] === null) { + $invalidProperties[] = "'object_properties' can't be null"; + } + if ($this->container['object_type'] === null) { + $invalidProperties[] = "'object_type' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['export_internal_values_options'] === null) { + $invalidProperties[] = "'export_internal_values_options' can't be null"; + } + if ($this->container['override_associated_objects_per_definition_per_row_limit'] === null) { + $invalidProperties[] = "'override_associated_objects_per_definition_per_row_limit' can't be null"; + } + if ($this->container['list_id'] === null) { + $invalidProperties[] = "'list_id' 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 export_type + * + * @return string + */ + public function getExportType() + { + return $this->container['export_type']; + } + + /** + * Sets export_type + * + * @param string $export_type export_type + * + * @return self + */ + public function setExportType($export_type) + { + if (is_null($export_type)) { + throw new \InvalidArgumentException('non-nullable export_type cannot be null'); + } + $allowedValues = $this->getExportTypeAllowableValues(); + if (!in_array($export_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'export_type', must be one of '%s'", + $export_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_type'] = $export_type; + + return $this; + } + + /** + * Gets format + * + * @return string + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string $format format + * + * @return self + */ + public function setFormat($format) + { + if (is_null($format)) { + throw new \InvalidArgumentException('non-nullable format cannot be null'); + } + $allowedValues = $this->getFormatAllowableValues(); + if (!in_array($format, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'format', must be one of '%s'", + $format, + implode("', '", $allowedValues) + ) + ); + } + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets export_name + * + * @return string + */ + public function getExportName() + { + return $this->container['export_name']; + } + + /** + * Sets export_name + * + * @param string $export_name export_name + * + * @return self + */ + public function setExportName($export_name) + { + if (is_null($export_name)) { + throw new \InvalidArgumentException('non-nullable export_name cannot be null'); + } + $this->container['export_name'] = $export_name; + + return $this; + } + + /** + * Gets object_properties + * + * @return string[] + */ + public function getObjectProperties() + { + return $this->container['object_properties']; + } + + /** + * Sets object_properties + * + * @param string[] $object_properties object_properties + * + * @return self + */ + public function setObjectProperties($object_properties) + { + if (is_null($object_properties)) { + throw new \InvalidArgumentException('non-nullable object_properties cannot be null'); + } + $this->container['object_properties'] = $object_properties; + + return $this; + } + + /** + * Gets associated_object_type + * + * @return string|null + */ + public function getAssociatedObjectType() + { + return $this->container['associated_object_type']; + } + + /** + * Sets associated_object_type + * + * @param string|null $associated_object_type associated_object_type + * + * @return self + */ + public function setAssociatedObjectType($associated_object_type) + { + if (is_null($associated_object_type)) { + throw new \InvalidArgumentException('non-nullable associated_object_type cannot be null'); + } + $this->container['associated_object_type'] = $associated_object_type; + + return $this; + } + + /** + * Gets object_type + * + * @return string + */ + public function getObjectType() + { + return $this->container['object_type']; + } + + /** + * Sets object_type + * + * @param string $object_type object_type + * + * @return self + */ + public function setObjectType($object_type) + { + if (is_null($object_type)) { + throw new \InvalidArgumentException('non-nullable object_type cannot be null'); + } + $this->container['object_type'] = $object_type; + + return $this; + } + + /** + * Gets language + * + * @return string + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets export_internal_values_options + * + * @return string[] + */ + public function getExportInternalValuesOptions() + { + return $this->container['export_internal_values_options']; + } + + /** + * Sets export_internal_values_options + * + * @param string[] $export_internal_values_options export_internal_values_options + * + * @return self + */ + public function setExportInternalValuesOptions($export_internal_values_options) + { + if (is_null($export_internal_values_options)) { + throw new \InvalidArgumentException('non-nullable export_internal_values_options cannot be null'); + } + $allowedValues = $this->getExportInternalValuesOptionsAllowableValues(); + if (array_diff($export_internal_values_options, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'export_internal_values_options', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['export_internal_values_options'] = $export_internal_values_options; + + return $this; + } + + /** + * Gets override_associated_objects_per_definition_per_row_limit + * + * @return bool + */ + public function getOverrideAssociatedObjectsPerDefinitionPerRowLimit() + { + return $this->container['override_associated_objects_per_definition_per_row_limit']; + } + + /** + * Sets override_associated_objects_per_definition_per_row_limit + * + * @param bool $override_associated_objects_per_definition_per_row_limit override_associated_objects_per_definition_per_row_limit + * + * @return self + */ + public function setOverrideAssociatedObjectsPerDefinitionPerRowLimit($override_associated_objects_per_definition_per_row_limit) + { + if (is_null($override_associated_objects_per_definition_per_row_limit)) { + throw new \InvalidArgumentException('non-nullable override_associated_objects_per_definition_per_row_limit cannot be null'); + } + $this->container['override_associated_objects_per_definition_per_row_limit'] = $override_associated_objects_per_definition_per_row_limit; + + return $this; + } + + /** + * Gets public_crm_search_request + * + * @return \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null + */ + public function getPublicCrmSearchRequest() + { + return $this->container['public_crm_search_request']; + } + + /** + * Sets public_crm_search_request + * + * @param \HubSpot\Client\Crm\Exports\Model\PublicCrmSearchRequest|null $public_crm_search_request public_crm_search_request + * + * @return self + */ + public function setPublicCrmSearchRequest($public_crm_search_request) + { + if (is_null($public_crm_search_request)) { + throw new \InvalidArgumentException('non-nullable public_crm_search_request cannot be null'); + } + $this->container['public_crm_search_request'] = $public_crm_search_request; + + return $this; + } + + /** + * Gets list_id + * + * @return string + */ + public function getListId() + { + return $this->container['list_id']; + } + + /** + * Sets list_id + * + * @param string $list_id list_id + * + * @return self + */ + public function setListId($list_id) + { + if (is_null($list_id)) { + throw new \InvalidArgumentException('non-nullable list_id cannot be null'); + } + $this->container['list_id'] = $list_id; + + 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/codegen/Crm/Exports/Model/StandardError.php b/codegen/Crm/Exports/Model/StandardError.php new file mode 100644 index 000000000..5dc1c38e6 --- /dev/null +++ b/codegen/Crm/Exports/Model/StandardError.php @@ -0,0 +1,665 @@ + + */ +class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StandardError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'object', + 'context' => 'array', + 'links' => 'array', + 'id' => 'string', + 'category' => 'string', + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Exports\Model\ErrorDetail[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_category' => null, + 'context' => null, + 'links' => null, + 'id' => null, + 'category' => null, + 'message' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => 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 = [ + 'sub_category' => 'subCategory', + 'context' => 'context', + 'links' => 'links', + 'id' => 'id', + 'category' => 'category', + 'message' => 'message', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_category' => 'setSubCategory', + 'context' => 'setContext', + 'links' => 'setLinks', + 'id' => 'setId', + 'category' => 'setCategory', + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_category' => 'getSubCategory', + 'context' => 'getContext', + 'links' => 'getLinks', + 'id' => 'getId', + 'category' => 'getCategory', + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * 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('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $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['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' 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 sub_category + * + * @return object|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param object|null $sub_category sub_category + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array $context context + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets links + * + * @return array + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Exports\Model\ErrorDetail[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Exports\Model\ErrorDetail[] $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + 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/codegen/Crm/Exports/Model/TaskLocator.php b/codegen/Crm/Exports/Model/TaskLocator.php new file mode 100644 index 000000000..825cfe40e --- /dev/null +++ b/codegen/Crm/Exports/Model/TaskLocator.php @@ -0,0 +1,446 @@ + + */ +class TaskLocator implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TaskLocator'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'links' => 'array', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'links' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'links' => false, + 'id' => 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 = [ + 'links' => 'links', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'links' => 'setLinks', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'links' => 'getLinks', + 'id' => 'getId' + ]; + + /** + * 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('links', $data ?? [], null); + $this->setIfExists('id', $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['id'] === null) { + $invalidProperties[] = "'id' 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 links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + 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/codegen/Crm/Exports/ObjectSerializer.php b/codegen/Crm/Exports/ObjectSerializer.php new file mode 100644 index 000000000..13d7492cb --- /dev/null +++ b/codegen/Crm/Exports/ObjectSerializer.php @@ -0,0 +1,567 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\HubSpot\Client\Crm\Exports\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} From a0e37d1624e98ab4a08e5e9a1d1867836d030498 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 16:39:53 +0300 Subject: [PATCH 5/9] Add discoveries: CRM Commerce Invoices, Objects Deal Splits, Exports and Marketing Emails --- lib/Discovery/Crm/Commerce/Discovery.php | 10 ++++++ .../Crm/Commerce/Invoices/Discovery.php | 15 +++++++++ lib/Discovery/Crm/Discovery.php | 2 ++ lib/Discovery/Crm/Exports/Discovery.php | 11 +++++++ .../Crm/Objects/DealSplits/Discovery.php | 11 +++++++ lib/Discovery/Crm/Objects/Discovery.php | 29 ++++++++--------- lib/Discovery/Marketing/Discovery.php | 1 + lib/Discovery/Marketing/Emails/Discovery.php | 13 ++++++++ .../Discovery/Crm/Commerce/DiscoverySpec.php | 27 ++++++++++++++++ .../Crm/Commerce/Invoices/DiscoverySpec.php | 31 +++++++++++++++++++ tests/spec/Discovery/Crm/DiscoverySpec.php | 2 ++ .../Discovery/Crm/Exports/DiscoverySpec.php | 27 ++++++++++++++++ .../Crm/Objects/DealSplits/DiscoverySpec.php | 27 ++++++++++++++++ .../Discovery/Crm/Objects/DiscoverySpec.php | 2 ++ .../Discovery/Marketing/DiscoverySpec.php | 1 + .../Marketing/Emails/DiscoverySpec.php | 29 +++++++++++++++++ 16 files changed, 224 insertions(+), 14 deletions(-) create mode 100644 lib/Discovery/Crm/Commerce/Discovery.php create mode 100644 lib/Discovery/Crm/Commerce/Invoices/Discovery.php create mode 100644 lib/Discovery/Crm/Exports/Discovery.php create mode 100644 lib/Discovery/Crm/Objects/DealSplits/Discovery.php create mode 100644 lib/Discovery/Marketing/Emails/Discovery.php create mode 100644 tests/spec/Discovery/Crm/Commerce/DiscoverySpec.php create mode 100644 tests/spec/Discovery/Crm/Commerce/Invoices/DiscoverySpec.php create mode 100644 tests/spec/Discovery/Crm/Exports/DiscoverySpec.php create mode 100644 tests/spec/Discovery/Crm/Objects/DealSplits/DiscoverySpec.php create mode 100644 tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php diff --git a/lib/Discovery/Crm/Commerce/Discovery.php b/lib/Discovery/Crm/Commerce/Discovery.php new file mode 100644 index 000000000..bd72d0f91 --- /dev/null +++ b/lib/Discovery/Crm/Commerce/Discovery.php @@ -0,0 +1,10 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->invoices()->shouldHaveType(InvoicesDiscovery::class); + } +} diff --git a/tests/spec/Discovery/Crm/Commerce/Invoices/DiscoverySpec.php b/tests/spec/Discovery/Crm/Commerce/Invoices/DiscoverySpec.php new file mode 100644 index 000000000..fc687df9a --- /dev/null +++ b/tests/spec/Discovery/Crm/Commerce/Invoices/DiscoverySpec.php @@ -0,0 +1,31 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); + $this->searchApi()->shouldHaveType(SearchApi::class); + } +} diff --git a/tests/spec/Discovery/Crm/DiscoverySpec.php b/tests/spec/Discovery/Crm/DiscoverySpec.php index 546f372db..46a219af3 100644 --- a/tests/spec/Discovery/Crm/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/DiscoverySpec.php @@ -22,9 +22,11 @@ public function it_is_initializable() public function it_creates_clients() { $this->associations()->shouldHaveType(\HubSpot\Discovery\Crm\Associations\Discovery::class); + $this->commerce()->shouldHaveType(\HubSpot\Discovery\Crm\Commerce\Discovery::class); $this->companies()->shouldHaveType(\HubSpot\Discovery\Crm\Companies\Discovery::class); $this->contacts()->shouldHaveType(\HubSpot\Discovery\Crm\Contacts\Discovery::class); $this->deals()->shouldHaveType(\HubSpot\Discovery\Crm\Deals\Discovery::class); + $this->exports()->shouldHaveType(\HubSpot\Discovery\Crm\Exports\Discovery::class); $this->extensions()->shouldHaveType(\HubSpot\Discovery\Crm\Extensions\Discovery::class); $this->imports()->shouldHaveType(\HubSpot\Discovery\Crm\Imports\Discovery::class); $this->lineItems()->shouldHaveType(\HubSpot\Discovery\Crm\LineItems\Discovery::class); diff --git a/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php b/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php new file mode 100644 index 000000000..2226aa60c --- /dev/null +++ b/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php @@ -0,0 +1,27 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->publicExportsApi()->shouldHaveType(PublicExportsApi::class); + } +} diff --git a/tests/spec/Discovery/Crm/Objects/DealSplits/DiscoverySpec.php b/tests/spec/Discovery/Crm/Objects/DealSplits/DiscoverySpec.php new file mode 100644 index 000000000..af8087484 --- /dev/null +++ b/tests/spec/Discovery/Crm/Objects/DealSplits/DiscoverySpec.php @@ -0,0 +1,27 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->batchApi()->shouldHaveType(BatchApi::class); + } +} diff --git a/tests/spec/Discovery/Crm/Objects/DiscoverySpec.php b/tests/spec/Discovery/Crm/Objects/DiscoverySpec.php index 9f2dcf033..2c0b216e9 100644 --- a/tests/spec/Discovery/Crm/Objects/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Objects/DiscoverySpec.php @@ -9,6 +9,7 @@ use HubSpot\Config; use HubSpot\Discovery\Crm\Objects\Calls\Discovery as CallsDiscovery; use HubSpot\Discovery\Crm\Objects\Communications\Discovery as CommunicationsDiscovery; +use HubSpot\Discovery\Crm\Objects\DealSplits\Discovery as DealSplitsDiscovery; use HubSpot\Discovery\Crm\Objects\Discovery; use HubSpot\Discovery\Crm\Objects\Emails\Discovery as EmailsDiscovery; use HubSpot\Discovery\Crm\Objects\FeedbackSubmissions\Discovery as FeedbackSubmissionsDiscovery; @@ -39,6 +40,7 @@ public function it_creates_clients() $this->batchApi()->shouldHaveType(BatchApi::class); $this->calls()->shouldHaveType(CallsDiscovery::class); $this->communications()->shouldHaveType(CommunicationsDiscovery::class); + $this->dealSplits()->shouldHaveType(DealSplitsDiscovery::class); $this->emails()->shouldHaveType(EmailsDiscovery::class); $this->feedbackSubmissions()->shouldHaveType(FeedbackSubmissionsDiscovery::class); $this->goals()->shouldHaveType(GoalsDiscovery::class); diff --git a/tests/spec/Discovery/Marketing/DiscoverySpec.php b/tests/spec/Discovery/Marketing/DiscoverySpec.php index 0e9282efb..95ac2f5e3 100644 --- a/tests/spec/Discovery/Marketing/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/DiscoverySpec.php @@ -21,6 +21,7 @@ public function it_is_initializable() public function it_creates_clients() { + $this->emails()->shouldHaveType(\HubSpot\Discovery\Marketing\Emails\Discovery::class); $this->events()->shouldHaveType(\HubSpot\Discovery\Marketing\Events\Discovery::class); $this->forms()->shouldHaveType(\HubSpot\Discovery\Marketing\Forms\Discovery::class); $this->transactional()->shouldHaveType(\HubSpot\Discovery\Marketing\Transactional\Discovery::class); diff --git a/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php new file mode 100644 index 000000000..d8e754a97 --- /dev/null +++ b/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php @@ -0,0 +1,29 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->marketingEmailsApi()->shouldHaveType(MarketingEmailsApi::class); + $this->statisticsApi()->shouldHaveType(StatisticsApi::class); + } +} From a9f7ea7174ed266fe79c1baf05cc9bcacbba3f8e Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 16:45:09 +0300 Subject: [PATCH 6/9] fix CRM Commerce Invoices --- lib/Discovery/Crm/Commerce/Discovery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Discovery/Crm/Commerce/Discovery.php b/lib/Discovery/Crm/Commerce/Discovery.php index bd72d0f91..a7ea6e080 100644 --- a/lib/Discovery/Crm/Commerce/Discovery.php +++ b/lib/Discovery/Crm/Commerce/Discovery.php @@ -5,6 +5,6 @@ use HubSpot\Discovery\DiscoveryBase; /** - * @method Commerce\Discovery commerce() + * @method Invoices\Discovery invoices() */ class Discovery extends DiscoveryBase {} From 2578140c10fa42a0b80a4f9185b6c43090f7e202 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 16:52:34 +0300 Subject: [PATCH 7/9] CS fix --- .../Crm/Commerce/Invoices/Discovery.php | 6 ++-- lib/Discovery/Crm/Objects/Discovery.php | 30 +++++++++---------- lib/Discovery/Marketing/Events/Discovery.php | 12 ++++---- .../Discovery/Crm/Commerce/DiscoverySpec.php | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/Discovery/Crm/Commerce/Invoices/Discovery.php b/lib/Discovery/Crm/Commerce/Invoices/Discovery.php index 3db3a7d72..bc35da563 100644 --- a/lib/Discovery/Crm/Commerce/Invoices/Discovery.php +++ b/lib/Discovery/Crm/Commerce/Invoices/Discovery.php @@ -8,8 +8,8 @@ use HubSpot\Discovery\DiscoveryBase; /** - * @method BasicApi basicApi() - * @method BatchApi batchApi() - * @method SearchApi searchApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method SearchApi searchApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Objects/Discovery.php b/lib/Discovery/Crm/Objects/Discovery.php index 6367390f5..30cba445f 100644 --- a/lib/Discovery/Crm/Objects/Discovery.php +++ b/lib/Discovery/Crm/Objects/Discovery.php @@ -8,20 +8,20 @@ use HubSpot\Discovery\DiscoveryBase; /** - * @method BasicApi basicApi() - * @method BatchApi batchApi() - * @method Calls\Discovery calls() - * @method Communications\Discovery communications() - * @method DealSplits\Discovery dealSplits() - * @method Emails\Discovery emails() - * @method FeedbackSubmissions\Discovery feedbackSubmissions() - * @method Goals\Discovery goals() - * @method Leads\Discovery leads() - * @method Meetings\Discovery meetings() - * @method Notes\Discovery notes() - * @method PostalMail\Discovery postalMail() - * @method SearchApi searchApi() - * @method Tasks\Discovery tasks() - * @method Taxes\Discovery taxes() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method Calls\Discovery calls() + * @method Communications\Discovery communications() + * @method DealSplits\Discovery dealSplits() + * @method Emails\Discovery emails() + * @method FeedbackSubmissions\Discovery feedbackSubmissions() + * @method Goals\Discovery goals() + * @method Leads\Discovery leads() + * @method Meetings\Discovery meetings() + * @method Notes\Discovery notes() + * @method PostalMail\Discovery postalMail() + * @method SearchApi searchApi() + * @method Tasks\Discovery tasks() + * @method Taxes\Discovery taxes() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Marketing/Events/Discovery.php b/lib/Discovery/Marketing/Events/Discovery.php index b26d43976..d8d533322 100644 --- a/lib/Discovery/Marketing/Events/Discovery.php +++ b/lib/Discovery/Marketing/Events/Discovery.php @@ -11,11 +11,11 @@ use HubSpot\Discovery\DiscoveryBase; /** - * @method AttendanceSubscriberStateChangesApi attendanceSubscriberStateChangesApi() - * @method BasicApi basicApi() - * @method ListAssociationsApi listAssociationsApi() - * @method ParticipantStateApi participantStateApi() - * @method SettingsApi settingsApi() - * @method SubscriberStateChangesApi subscriberStateChangesApi() + * @method AttendanceSubscriberStateChangesApi attendanceSubscriberStateChangesApi() + * @method BasicApi basicApi() + * @method ListAssociationsApi listAssociationsApi() + * @method ParticipantStateApi participantStateApi() + * @method SettingsApi settingsApi() + * @method SubscriberStateChangesApi subscriberStateChangesApi() */ class Discovery extends DiscoveryBase {} diff --git a/tests/spec/Discovery/Crm/Commerce/DiscoverySpec.php b/tests/spec/Discovery/Crm/Commerce/DiscoverySpec.php index 289fe53a0..eb794030b 100644 --- a/tests/spec/Discovery/Crm/Commerce/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Commerce/DiscoverySpec.php @@ -4,8 +4,8 @@ use GuzzleHttp\Client; use HubSpot\Config; -use HubSpot\Discovery\Crm\Commerce\Invoices\Discovery as InvoicesDiscovery; use HubSpot\Discovery\Crm\Commerce\Discovery; +use HubSpot\Discovery\Crm\Commerce\Invoices\Discovery as InvoicesDiscovery; use PhpSpec\ObjectBehavior; class DiscoverySpec extends ObjectBehavior From 676fb616f81fb46449de7edb169f7780fffd6263 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 17:10:25 +0300 Subject: [PATCH 8/9] Codegen: Update generator version only for new clients --- .../Crm/Commerce/Invoices/Api/BasicApi.php | 244 ++++--- .../Crm/Commerce/Invoices/Api/BatchApi.php | 134 ++-- .../Crm/Commerce/Invoices/Api/SearchApi.php | 37 +- .../Crm/Commerce/Invoices/ApiException.php | 8 +- .../Crm/Commerce/Invoices/Configuration.php | 4 +- .../Crm/Commerce/Invoices/HeaderSelector.php | 32 +- .../Commerce/Invoices/Model/AssociatedId.php | 6 +- .../Invoices/Model/AssociationSpec.php | 6 +- ...BatchInputSimplePublicObjectBatchInput.php | 6 +- ...tSimplePublicObjectBatchInputForCreate.php | 6 +- ...nputSimplePublicObjectBatchInputUpsert.php | 6 +- .../Model/BatchInputSimplePublicObjectId.php | 6 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 6 +- ...chResponseSimplePublicObjectWithErrors.php | 6 +- .../BatchResponseSimplePublicUpsertObject.php | 6 +- ...onseSimplePublicUpsertObjectWithErrors.php | 6 +- .../Model/CollectionResponseAssociatedId.php | 6 +- ...licObjectWithAssociationsForwardPaging.php | 6 +- ...thTotalSimplePublicObjectForwardPaging.php | 6 +- codegen/Crm/Commerce/Invoices/Model/Error.php | 6 +- .../Commerce/Invoices/Model/ErrorDetail.php | 6 +- .../Crm/Commerce/Invoices/Model/Filter.php | 6 +- .../Commerce/Invoices/Model/FilterGroup.php | 6 +- .../Commerce/Invoices/Model/ForwardPaging.php | 6 +- .../Invoices/Model/ModelInterface.php | 2 +- .../Crm/Commerce/Invoices/Model/NextPage.php | 6 +- .../Crm/Commerce/Invoices/Model/Paging.php | 6 +- .../Commerce/Invoices/Model/PreviousPage.php | 6 +- .../Model/PublicAssociationsForObject.php | 6 +- .../Invoices/Model/PublicObjectId.php | 6 +- .../Model/PublicObjectSearchRequest.php | 6 +- .../Invoices/Model/SimplePublicObject.php | 6 +- .../Model/SimplePublicObjectBatchInput.php | 6 +- .../SimplePublicObjectBatchInputForCreate.php | 6 +- .../SimplePublicObjectBatchInputUpsert.php | 6 +- .../Invoices/Model/SimplePublicObjectId.php | 6 +- .../Model/SimplePublicObjectInput.php | 6 +- .../SimplePublicObjectInputForCreate.php | 6 +- .../SimplePublicObjectWithAssociations.php | 6 +- .../Model/SimplePublicUpsertObject.php | 6 +- .../Commerce/Invoices/Model/StandardError.php | 6 +- .../Invoices/Model/ValueWithTimestamp.php | 6 +- .../Commerce/Invoices/ObjectSerializer.php | 98 ++- codegen/Crm/Exports/Api/PublicExportsApi.php | 62 +- codegen/Crm/Exports/ApiException.php | 8 +- codegen/Crm/Exports/Configuration.php | 4 +- codegen/Crm/Exports/HeaderSelector.php | 32 +- .../ActionResponseWithSingleResultURI.php | 6 +- codegen/Crm/Exports/Model/Error.php | 6 +- codegen/Crm/Exports/Model/ErrorDetail.php | 6 +- codegen/Crm/Exports/Model/Filter.php | 6 +- codegen/Crm/Exports/Model/ModelInterface.php | 2 +- .../Exports/Model/PublicCrmSearchRequest.php | 6 +- .../Exports/Model/PublicExportListRequest.php | 6 +- .../Crm/Exports/Model/PublicExportRequest.php | 6 +- .../Exports/Model/PublicExportViewRequest.php | 6 +- codegen/Crm/Exports/Model/StandardError.php | 6 +- codegen/Crm/Exports/Model/TaskLocator.php | 6 +- codegen/Crm/Exports/ObjectSerializer.php | 98 ++- .../Crm/Objects/DealSplits/Api/BatchApi.php | 62 +- .../Crm/Objects/DealSplits/ApiException.php | 8 +- .../Crm/Objects/DealSplits/Configuration.php | 4 +- .../Crm/Objects/DealSplits/HeaderSelector.php | 32 +- .../Model/BatchInputPublicObjectId.php | 6 +- .../Model/BatchResponseDealToDealSplits.php | 6 +- ...atchResponseDealToDealSplitsWithErrors.php | 6 +- .../DealSplits/Model/DealToDealSplits.php | 6 +- .../Crm/Objects/DealSplits/Model/Error.php | 6 +- .../Objects/DealSplits/Model/ErrorDetail.php | 6 +- .../DealSplits/Model/ModelInterface.php | 2 +- .../DealSplits/Model/PublicDealSplitInput.php | 6 +- .../PublicDealSplitsBatchCreateRequest.php | 6 +- .../Model/PublicDealSplitsCreateRequest.php | 6 +- .../DealSplits/Model/PublicObjectId.php | 6 +- .../DealSplits/Model/SimplePublicObject.php | 6 +- .../DealSplits/Model/StandardError.php | 6 +- .../DealSplits/Model/ValueWithTimestamp.php | 6 +- .../Objects/DealSplits/ObjectSerializer.php | 98 ++- .../Emails/Api/MarketingEmailsApi.php | 632 ++++++++---------- .../Marketing/Emails/Api/StatisticsApi.php | 142 ++-- codegen/Marketing/Emails/ApiException.php | 8 +- codegen/Marketing/Emails/Configuration.php | 4 +- codegen/Marketing/Emails/HeaderSelector.php | 32 +- .../Emails/Model/AbTestCreateRequestVNext.php | 6 +- .../Emails/Model/AggregateEmailStatistics.php | 6 +- ...ithTotalEmailStatisticIntervalNoPaging.php | 6 +- ...ponseWithTotalPublicEmailForwardPaging.php | 6 +- ...ionResponseWithTotalVersionPublicEmail.php | 6 +- .../Emails/Model/ContentCloneRequestVNext.php | 6 +- .../Emails/Model/EmailCreateRequest.php | 6 +- .../Emails/Model/EmailStatisticInterval.php | 6 +- .../Emails/Model/EmailStatisticsData.php | 6 +- .../Emails/Model/EmailUpdateRequest.php | 6 +- codegen/Marketing/Emails/Model/Error.php | 6 +- .../Marketing/Emails/Model/ErrorDetail.php | 6 +- .../Marketing/Emails/Model/ForwardPaging.php | 6 +- codegen/Marketing/Emails/Model/Interval.php | 6 +- .../Marketing/Emails/Model/ModelInterface.php | 2 +- codegen/Marketing/Emails/Model/NextPage.php | 6 +- codegen/Marketing/Emails/Model/Paging.php | 6 +- .../Marketing/Emails/Model/PreviousPage.php | 6 +- .../Model/PublicButtonStyleSettings.php | 6 +- .../Model/PublicDividerStyleSettings.php | 6 +- .../Marketing/Emails/Model/PublicEmail.php | 6 +- .../Emails/Model/PublicEmailContent.php | 6 +- .../Emails/Model/PublicEmailFromDetails.php | 6 +- .../Emails/Model/PublicEmailRecipients.php | 6 +- .../Emails/Model/PublicEmailStyleSettings.php | 6 +- .../Model/PublicEmailSubscriptionDetails.php | 6 +- .../Model/PublicEmailTestingDetails.php | 6 +- .../Emails/Model/PublicEmailToDetails.php | 6 +- .../Emails/Model/PublicFontStyle.php | 6 +- .../Emails/Model/PublicRssEmailDetails.php | 6 +- .../Emails/Model/PublicWebversionDetails.php | 6 +- .../Emails/Model/VersionPublicEmail.php | 6 +- .../Marketing/Emails/Model/VersionUser.php | 6 +- codegen/Marketing/Emails/ObjectSerializer.php | 98 ++- 118 files changed, 1345 insertions(+), 1090 deletions(-) diff --git a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php index 48f9d36a0..e1a39487a 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($invoice_id, string $contentType = self::con $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $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 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $invoice_id invoice_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($invoice_id, $properties = null, $properties_with_histor * Read * * @param string $invoice_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($invoice_id, $properties = null, $properties $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: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($invoice_id, $properties = null, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($invoice_id, $properties = null, $properties * Read * * @param string $invoice_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $invoice_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $invoice_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($invoice_id, $properties = null, $properties_with * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $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: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $invoice_id invoice_id (required) * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($invoice_id, $simple_public_object_input, $id_property = * * @param string $invoice_id (required) * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($invoice_id, $simple_public_object_input, $id $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: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($invoice_id, $simple_public_object_input, $id ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($invoice_id, $simple_public_object_input, $id * * @param string $invoice_id (required) * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $invoice_id (required) * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $invoice_id (required) * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php index c8936ab0f..7d1b3631a 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_batch_input $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 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ * Read a batch of invoices by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of invoices by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $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: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of invoices by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of invoices by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $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: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $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: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php index e7fb792e5..066a67f44 100644 --- a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -178,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $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: @@ -248,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Commerce/Invoices/ApiException.php b/codegen/Crm/Commerce/Invoices/ApiException.php index 0e1e3c871..1f685770a 100644 --- a/codegen/Crm/Commerce/Invoices/ApiException.php +++ b/codegen/Crm/Commerce/Invoices/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Commerce/Invoices/Configuration.php b/codegen/Crm/Commerce/Invoices/Configuration.php index 8d8821a53..b0d698c39 100644 --- a/codegen/Crm/Commerce/Invoices/Configuration.php +++ b/codegen/Crm/Commerce/Invoices/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Commerce/Invoices/HeaderSelector.php b/codegen/Crm/Commerce/Invoices/HeaderSelector.php index 319381090..28c941917 100644 --- a/codegen/Crm/Commerce/Invoices/HeaderSelector.php +++ b/codegen/Crm/Commerce/Invoices/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php index 06fc48d36..ece184bd9 100644 --- a/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php +++ b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php index ac22199d3..7e50752bb 100644 --- a/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php +++ b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php index 7715d9eda..52bee0cb3 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 016eaa656..742d8d127 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 6844c7f86..e987c210a 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php index 728608f0a..c3fab0bc6 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php index 59a49f640..d32fdbe03 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php index e835aa05b..5380b1432 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php index 462713d8a..2340d055f 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php index 75c1ec9f2..c79e74724 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index d42718ddf..8635da7f5 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php index e36935046..9f2a57e57 100644 --- a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 0f3180fb6..5204a10e9 100644 --- a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 790d93629..176f5c005 100644 --- a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/Error.php b/codegen/Crm/Commerce/Invoices/Model/Error.php index d53994f79..d40a8746d 100644 --- a/codegen/Crm/Commerce/Invoices/Model/Error.php +++ b/codegen/Crm/Commerce/Invoices/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php b/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php index bfa3909ee..72f28813f 100644 --- a/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php +++ b/codegen/Crm/Commerce/Invoices/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/Filter.php b/codegen/Crm/Commerce/Invoices/Model/Filter.php index db212f1f5..a1e45c9ea 100644 --- a/codegen/Crm/Commerce/Invoices/Model/Filter.php +++ b/codegen/Crm/Commerce/Invoices/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php b/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php index f86db0929..124259385 100644 --- a/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php +++ b/codegen/Crm/Commerce/Invoices/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php b/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php index af647683e..19a3fb0d1 100644 --- a/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php +++ b/codegen/Crm/Commerce/Invoices/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php b/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php index 07b2c54b2..ecf62e26d 100644 --- a/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php +++ b/codegen/Crm/Commerce/Invoices/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Commerce/Invoices/Model/NextPage.php b/codegen/Crm/Commerce/Invoices/Model/NextPage.php index 7b44c0259..dd0c50b4d 100644 --- a/codegen/Crm/Commerce/Invoices/Model/NextPage.php +++ b/codegen/Crm/Commerce/Invoices/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/Paging.php b/codegen/Crm/Commerce/Invoices/Model/Paging.php index 66946fd40..03ab64b47 100644 --- a/codegen/Crm/Commerce/Invoices/Model/Paging.php +++ b/codegen/Crm/Commerce/Invoices/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php b/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php index f029cccf4..583b429bc 100644 --- a/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php +++ b/codegen/Crm/Commerce/Invoices/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php b/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php index e61daef3e..d8f9a555c 100644 --- a/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php index 6bdc25d87..30fc6de4d 100644 --- a/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php +++ b/codegen/Crm/Commerce/Invoices/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php b/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php index e83c07596..c6484d76a 100644 --- a/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Commerce/Invoices/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php index ef11ce71d..fe605ed3a 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php index d126424ca..df3885e08 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php index 62a1f8690..e38875898 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php index fa61f4249..728d0251b 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php index 05eb67904..b4b9a8bc5 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php index 29e30786f..1c9f0e9a7 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties', $data ?? [], null); } diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php index 72f7abfd5..15fd717fc 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php index 5d93ca069..9ec9a7040 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php index 7f00f2541..c1d61a700 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/StandardError.php b/codegen/Crm/Commerce/Invoices/Model/StandardError.php index e039248fc..2033d3c31 100644 --- a/codegen/Crm/Commerce/Invoices/Model/StandardError.php +++ b/codegen/Crm/Commerce/Invoices/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php index 075ea497c..da33a5cff 100644 --- a/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Commerce/Invoices/ObjectSerializer.php b/codegen/Crm/Commerce/Invoices/ObjectSerializer.php index 0bb87b2ac..d45ac671d 100644 --- a/codegen/Crm/Commerce/Invoices/ObjectSerializer.php +++ b/codegen/Crm/Commerce/Invoices/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Exports/Api/PublicExportsApi.php b/codegen/Crm/Exports/Api/PublicExportsApi.php index 40eda65b1..9a5e751df 100644 --- a/codegen/Crm/Exports/Api/PublicExportsApi.php +++ b/codegen/Crm/Exports/Api/PublicExportsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class PublicExportsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -181,18 +181,6 @@ public function getStatusWithHttpInfo($task_id, string $contentType = self::cont $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: @@ -251,6 +239,19 @@ public function getStatusWithHttpInfo($task_id, string $contentType = self::cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -527,18 +528,6 @@ public function startWithHttpInfo($public_export_request, string $contentType = $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 202: @@ -597,6 +586,19 @@ public function startWithHttpInfo($public_export_request, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Exports\Model\TaskLocator'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Exports/ApiException.php b/codegen/Crm/Exports/ApiException.php index c9726b879..77c559aa7 100644 --- a/codegen/Crm/Exports/ApiException.php +++ b/codegen/Crm/Exports/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Exports/Configuration.php b/codegen/Crm/Exports/Configuration.php index 96c02ddaa..83e209bd2 100644 --- a/codegen/Crm/Exports/Configuration.php +++ b/codegen/Crm/Exports/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Exports/HeaderSelector.php b/codegen/Crm/Exports/HeaderSelector.php index 08ba0bc2f..0756e1307 100644 --- a/codegen/Crm/Exports/HeaderSelector.php +++ b/codegen/Crm/Exports/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php b/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php index d8ca1cae1..8e987df07 100644 --- a/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php +++ b/codegen/Crm/Exports/Model/ActionResponseWithSingleResultURI.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('result', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/Error.php b/codegen/Crm/Exports/Model/Error.php index 367351c9b..21149fe24 100644 --- a/codegen/Crm/Exports/Model/Error.php +++ b/codegen/Crm/Exports/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/ErrorDetail.php b/codegen/Crm/Exports/Model/ErrorDetail.php index c88486a22..40f0311dc 100644 --- a/codegen/Crm/Exports/Model/ErrorDetail.php +++ b/codegen/Crm/Exports/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/Filter.php b/codegen/Crm/Exports/Model/Filter.php index c7d01fee0..6d3c0694a 100644 --- a/codegen/Crm/Exports/Model/Filter.php +++ b/codegen/Crm/Exports/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -296,10 +296,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/ModelInterface.php b/codegen/Crm/Exports/Model/ModelInterface.php index ddcbed30f..322049a36 100644 --- a/codegen/Crm/Exports/Model/ModelInterface.php +++ b/codegen/Crm/Exports/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Exports/Model/PublicCrmSearchRequest.php b/codegen/Crm/Exports/Model/PublicCrmSearchRequest.php index 4b3a38d5b..d9e1d489f 100644 --- a/codegen/Crm/Exports/Model/PublicCrmSearchRequest.php +++ b/codegen/Crm/Exports/Model/PublicCrmSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('filters', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/PublicExportListRequest.php b/codegen/Crm/Exports/Model/PublicExportListRequest.php index c50629370..b320adaaa 100644 --- a/codegen/Crm/Exports/Model/PublicExportListRequest.php +++ b/codegen/Crm/Exports/Model/PublicExportListRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -383,10 +383,10 @@ public function getExportInternalValuesOptionsAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('export_type', $data ?? [], 'LIST'); $this->setIfExists('format', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/PublicExportRequest.php b/codegen/Crm/Exports/Model/PublicExportRequest.php index fe97027e7..a6dfe3241 100644 --- a/codegen/Crm/Exports/Model/PublicExportRequest.php +++ b/codegen/Crm/Exports/Model/PublicExportRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -383,10 +383,10 @@ public function getExportInternalValuesOptionsAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('export_type', $data ?? [], 'LIST'); $this->setIfExists('format', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/PublicExportViewRequest.php b/codegen/Crm/Exports/Model/PublicExportViewRequest.php index f302ad82c..fbd19cd5e 100644 --- a/codegen/Crm/Exports/Model/PublicExportViewRequest.php +++ b/codegen/Crm/Exports/Model/PublicExportViewRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -383,10 +383,10 @@ public function getExportInternalValuesOptionsAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('export_type', $data ?? [], 'VIEW'); $this->setIfExists('format', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/StandardError.php b/codegen/Crm/Exports/Model/StandardError.php index 5dc1c38e6..6300ce128 100644 --- a/codegen/Crm/Exports/Model/StandardError.php +++ b/codegen/Crm/Exports/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Exports/Model/TaskLocator.php b/codegen/Crm/Exports/Model/TaskLocator.php index 825cfe40e..2f1bdf6a4 100644 --- a/codegen/Crm/Exports/Model/TaskLocator.php +++ b/codegen/Crm/Exports/Model/TaskLocator.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Crm/Exports/ObjectSerializer.php b/codegen/Crm/Exports/ObjectSerializer.php index 13d7492cb..415f1f42f 100644 --- a/codegen/Crm/Exports/ObjectSerializer.php +++ b/codegen/Crm/Exports/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php index 456078b9f..1bc7a755e 100644 --- a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php +++ b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -181,18 +181,6 @@ public function readWithHttpInfo($batch_input_public_object_id, string $contentT $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: @@ -278,6 +266,19 @@ public function readWithHttpInfo($batch_input_public_object_id, string $contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -561,18 +562,6 @@ public function upsertWithHttpInfo($public_deal_splits_batch_create_request, str $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: @@ -658,6 +647,19 @@ public function upsertWithHttpInfo($public_deal_splits_batch_create_request, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\DealSplits\Model\BatchResponseDealToDealSplits'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/DealSplits/ApiException.php b/codegen/Crm/Objects/DealSplits/ApiException.php index 102f86b43..4f24fb6d3 100644 --- a/codegen/Crm/Objects/DealSplits/ApiException.php +++ b/codegen/Crm/Objects/DealSplits/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/DealSplits/Configuration.php b/codegen/Crm/Objects/DealSplits/Configuration.php index a4a60c3a7..597f732a9 100644 --- a/codegen/Crm/Objects/DealSplits/Configuration.php +++ b/codegen/Crm/Objects/DealSplits/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/DealSplits/HeaderSelector.php b/codegen/Crm/Objects/DealSplits/HeaderSelector.php index 42e7291c3..76773f283 100644 --- a/codegen/Crm/Objects/DealSplits/HeaderSelector.php +++ b/codegen/Crm/Objects/DealSplits/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php b/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php index 6b12776e0..7d8e3800c 100644 --- a/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php +++ b/codegen/Crm/Objects/DealSplits/Model/BatchInputPublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php index 133ca900b..ddcbae548 100644 --- a/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php +++ b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplits.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php index 67479f388..6dddfdd8d 100644 --- a/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php +++ b/codegen/Crm/Objects/DealSplits/Model/BatchResponseDealToDealSplitsWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php b/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php index a9d977dad..64b72ae45 100644 --- a/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php +++ b/codegen/Crm/Objects/DealSplits/Model/DealToDealSplits.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('splits', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/Error.php b/codegen/Crm/Objects/DealSplits/Model/Error.php index 3dc56c854..c0a97e7a1 100644 --- a/codegen/Crm/Objects/DealSplits/Model/Error.php +++ b/codegen/Crm/Objects/DealSplits/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php b/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php index a8b902977..02f017951 100644 --- a/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/DealSplits/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php b/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php index 21686a24c..960047d81 100644 --- a/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php +++ b/codegen/Crm/Objects/DealSplits/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitInput.php b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitInput.php index fb5573e15..dc3e40406 100644 --- a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitInput.php +++ b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('percentage', $data ?? [], null); $this->setIfExists('owner_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php index 1c228be91..a7796ccf6 100644 --- a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php +++ b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsBatchCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php index 4d533cccc..01b3123e2 100644 --- a/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php +++ b/codegen/Crm/Objects/DealSplits/Model/PublicDealSplitsCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('splits', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php b/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php index 1118a7c57..e682009f9 100644 --- a/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/DealSplits/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php index 449a77c5f..12579b106 100644 --- a/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/StandardError.php b/codegen/Crm/Objects/DealSplits/Model/StandardError.php index f6704d70c..cf5e8f5dc 100644 --- a/codegen/Crm/Objects/DealSplits/Model/StandardError.php +++ b/codegen/Crm/Objects/DealSplits/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php index 6bbdbda92..2fd868312 100644 --- a/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/DealSplits/ObjectSerializer.php b/codegen/Crm/Objects/DealSplits/ObjectSerializer.php index 7044c658f..e13415781 100644 --- a/codegen/Crm/Objects/DealSplits/ObjectSerializer.php +++ b/codegen/Crm/Objects/DealSplits/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Marketing/Emails/Api/MarketingEmailsApi.php b/codegen/Marketing/Emails/Api/MarketingEmailsApi.php index cb4efe504..ccb8e977d 100644 --- a/codegen/Marketing/Emails/Api/MarketingEmailsApi.php +++ b/codegen/Marketing/Emails/Api/MarketingEmailsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -131,13 +131,13 @@ class MarketingEmailsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -176,7 +176,7 @@ public function getConfig() * Delete a marketing email. * * @param string $email_id The ID of the marketing email to delete. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -194,7 +194,7 @@ public function archive($email_id, $archived = null, string $contentType = self: * Delete a marketing email. * * @param string $email_id The ID of the marketing email to delete. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -227,18 +227,6 @@ public function archiveWithHttpInfo($email_id, $archived = null, string $content $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -263,7 +251,7 @@ public function archiveWithHttpInfo($email_id, $archived = null, string $content * Delete a marketing email. * * @param string $email_id The ID of the marketing email to delete. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -285,7 +273,7 @@ function ($response) { * Delete a marketing email. * * @param string $email_id The ID of the marketing email to delete. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -323,7 +311,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $email_id The ID of the marketing email to delete. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -482,18 +470,6 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con $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: @@ -552,6 +528,19 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -827,18 +816,6 @@ public function createWithHttpInfo($email_create_request, string $contentType = $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 201: @@ -897,6 +874,19 @@ public function createWithHttpInfo($email_create_request, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1172,18 +1162,6 @@ public function createAbTestVariationWithHttpInfo($ab_test_create_request_v_next $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 201: @@ -1242,6 +1220,19 @@ public function createAbTestVariationWithHttpInfo($ab_test_create_request_v_next ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1517,18 +1508,6 @@ public function getAbTestVariationWithHttpInfo($email_id, string $contentType = $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: @@ -1587,6 +1566,19 @@ public function getAbTestVariationWithHttpInfo($email_id, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1813,11 +1805,11 @@ public function getAbTestVariationRequest($email_id, string $contentType = self: * Get the details of a specified marketing email. * * @param string $email_id The marketing email ID. (required) - * @param bool $include_stats Include statistics with email (optional) - * @param bool $marketing_campaign_names marketing_campaign_names (optional) - * @param bool $workflow_names workflow_names (optional) - * @param string[] $included_properties included_properties (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $include_stats Include statistics with email (optional) + * @param bool|null $marketing_campaign_names marketing_campaign_names (optional) + * @param bool|null $workflow_names workflow_names (optional) + * @param string[]|null $included_properties included_properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1836,11 +1828,11 @@ public function getById($email_id, $include_stats = null, $marketing_campaign_na * Get the details of a specified marketing email. * * @param string $email_id The marketing email ID. (required) - * @param bool $include_stats Include statistics with email (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $include_stats Include statistics with email (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1873,18 +1865,6 @@ public function getByIdWithHttpInfo($email_id, $include_stats = null, $marketing $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: @@ -1943,6 +1923,19 @@ public function getByIdWithHttpInfo($email_id, $include_stats = null, $marketing ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2000,11 +1993,11 @@ public function getByIdWithHttpInfo($email_id, $include_stats = null, $marketing * Get the details of a specified marketing email. * * @param string $email_id The marketing email ID. (required) - * @param bool $include_stats Include statistics with email (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $include_stats Include statistics with email (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2026,11 +2019,11 @@ function ($response) { * Get the details of a specified marketing email. * * @param string $email_id The marketing email ID. (required) - * @param bool $include_stats Include statistics with email (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $include_stats Include statistics with email (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2081,11 +2074,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $email_id The marketing email ID. (required) - * @param bool $include_stats Include statistics with email (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $include_stats Include statistics with email (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2284,18 +2277,6 @@ public function getDraftWithHttpInfo($email_id, string $contentType = self::cont $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: @@ -2354,6 +2335,19 @@ public function getDraftWithHttpInfo($email_id, string $contentType = self::cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2579,22 +2573,22 @@ public function getDraftRequest($email_id, string $contentType = self::contentTy * * Get all marketing emails for a HubSpot account. * - * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return emails created after the specified time. (optional) - * @param \DateTime $created_before Only return emails created before the specified time. (optional) - * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $include_stats Include statistics with emails. (optional) - * @param bool $marketing_campaign_names marketing_campaign_names (optional) - * @param bool $workflow_names workflow_names (optional) - * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) - * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) - * @param string[] $included_properties included_properties (optional) - * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param \DateTime|null $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return emails created after the specified time. (optional) + * @param \DateTime|null $created_before Only return emails created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return emails last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $include_stats Include statistics with emails. (optional) + * @param bool|null $marketing_campaign_names marketing_campaign_names (optional) + * @param bool|null $workflow_names workflow_names (optional) + * @param string|null $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool|null $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[]|null $included_properties included_properties (optional) + * @param bool|null $archived Specifies whether to return archived emails. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -2612,22 +2606,22 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get all marketing emails for a HubSpot account. * - * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return emails created after the specified time. (optional) - * @param \DateTime $created_before Only return emails created before the specified time. (optional) - * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $include_stats Include statistics with emails. (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) - * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param \DateTime|null $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return emails created after the specified time. (optional) + * @param \DateTime|null $created_before Only return emails created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return emails last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $include_stats Include statistics with emails. (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string|null $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool|null $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Specifies whether to return archived emails. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -2660,18 +2654,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = 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: @@ -2730,6 +2712,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalPublicEmailForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2786,22 +2781,22 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get all marketing emails for a HubSpot account. * - * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return emails created after the specified time. (optional) - * @param \DateTime $created_before Only return emails created before the specified time. (optional) - * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $include_stats Include statistics with emails. (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) - * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param \DateTime|null $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return emails created after the specified time. (optional) + * @param \DateTime|null $created_before Only return emails created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return emails last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $include_stats Include statistics with emails. (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string|null $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool|null $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Specifies whether to return archived emails. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2822,22 +2817,22 @@ function ($response) { * * Get all marketing emails for a HubSpot account. * - * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return emails created after the specified time. (optional) - * @param \DateTime $created_before Only return emails created before the specified time. (optional) - * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $include_stats Include statistics with emails. (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) - * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param \DateTime|null $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return emails created after the specified time. (optional) + * @param \DateTime|null $created_before Only return emails created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return emails last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $include_stats Include statistics with emails. (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string|null $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool|null $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Specifies whether to return archived emails. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2887,22 +2882,22 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return emails created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return emails created after the specified time. (optional) - * @param \DateTime $created_before Only return emails created before the specified time. (optional) - * @param \DateTime $updated_at Only return emails last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return emails last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return emails last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $include_stats Include statistics with emails. (optional) - * @param bool $marketing_campaign_names (optional) - * @param bool $workflow_names (optional) - * @param string $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) - * @param bool $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) - * @param string[] $included_properties (optional) - * @param bool $archived Specifies whether to return archived emails. Defaults to `false`. (optional) + * @param \DateTime|null $created_at Only return emails created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return emails created after the specified time. (optional) + * @param \DateTime|null $created_before Only return emails created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return emails last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return emails last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return emails last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $include_stats Include statistics with emails. (optional) + * @param bool|null $marketing_campaign_names (optional) + * @param bool|null $workflow_names (optional) + * @param string|null $type Email types to be filtered by. Multiple types can be included. All emails will be returned if not present. (optional) + * @param bool|null $is_published Filter by published/draft emails. All emails will be returned if not present. (optional) + * @param string[]|null $included_properties (optional) + * @param bool|null $archived Specifies whether to return archived emails. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3198,18 +3193,6 @@ public function getRevisionByIdWithHttpInfo($email_id, $revision_id, string $con $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: @@ -3268,6 +3251,19 @@ public function getRevisionByIdWithHttpInfo($email_id, $revision_id, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3512,9 +3508,9 @@ public function getRevisionByIdRequest($email_id, $revision_id, string $contentT * Get revisions of a marketing email * * @param string $email_id The marketing email ID. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -3533,9 +3529,9 @@ public function getRevisions($email_id, $after = null, $before = null, $limit = * Get revisions of a marketing email * * @param string $email_id The marketing email ID. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -3568,18 +3564,6 @@ public function getRevisionsWithHttpInfo($email_id, $after = null, $before = nul $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: @@ -3638,6 +3622,19 @@ public function getRevisionsWithHttpInfo($email_id, $after = null, $before = nul ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalVersionPublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3695,9 +3692,9 @@ public function getRevisionsWithHttpInfo($email_id, $after = null, $before = nul * Get revisions of a marketing email * * @param string $email_id The marketing email ID. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3719,9 +3716,9 @@ function ($response) { * Get revisions of a marketing email * * @param string $email_id The marketing email ID. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3772,9 +3769,9 @@ function ($exception) { * Create request for operation 'getRevisions' * * @param string $email_id The marketing email ID. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before The cursor token value to get the previous set of results. You can get this from the `paging.prev.before` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRevisions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3952,18 +3949,6 @@ public function publishOrSendWithHttpInfo($email_id, string $contentType = self: $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4193,18 +4178,6 @@ public function resetDraftWithHttpInfo($email_id, string $contentType = self::co $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4437,18 +4410,6 @@ public function restoreDraftRevisionWithHttpInfo($email_id, $revision_id, string $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: @@ -4507,6 +4468,19 @@ public function restoreDraftRevisionWithHttpInfo($email_id, $revision_id, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4802,18 +4776,6 @@ public function restoreRevisionWithHttpInfo($email_id, $revision_id, string $con $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5061,18 +5023,6 @@ public function unpublishOrCancelWithHttpInfo($email_id, string $contentType = s $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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5254,7 +5204,7 @@ public function unpublishOrCancelRequest($email_id, string $contentType = self:: * * @param string $email_id The ID of the marketing email that should get updated (required) * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -5274,7 +5224,7 @@ public function update($email_id, $email_update_request, $archived = null, strin * * @param string $email_id The ID of the marketing email that should get updated (required) * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -5307,18 +5257,6 @@ public function updateWithHttpInfo($email_id, $email_update_request, $archived = $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: @@ -5377,6 +5315,19 @@ public function updateWithHttpInfo($email_id, $email_update_request, $archived = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5435,7 +5386,7 @@ public function updateWithHttpInfo($email_id, $email_update_request, $archived = * * @param string $email_id The ID of the marketing email that should get updated (required) * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5458,7 +5409,7 @@ function ($response) { * * @param string $email_id The ID of the marketing email that should get updated (required) * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5510,7 +5461,7 @@ function ($exception) { * * @param string $email_id The ID of the marketing email that should get updated (required) * @param \HubSpot\Client\Marketing\Emails\Model\EmailUpdateRequest $email_update_request A marketing email object with properties that should overwrite the corresponding properties of the marketing email. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5685,18 +5636,6 @@ public function upsertDraftWithHttpInfo($email_id, $email_update_request, string $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: @@ -5755,6 +5694,19 @@ public function upsertDraftWithHttpInfo($email_id, $email_update_request, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\PublicEmail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Emails/Api/StatisticsApi.php b/codegen/Marketing/Emails/Api/StatisticsApi.php index 48e902bdc..a1ee6264a 100644 --- a/codegen/Marketing/Emails/Api/StatisticsApi.php +++ b/codegen/Marketing/Emails/Api/StatisticsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class StatisticsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -130,10 +130,10 @@ public function getConfig() * * Get aggregated statistics. * - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -151,10 +151,10 @@ public function getEmailsList($start_timestamp = null, $end_timestamp = null, $e * * Get aggregated statistics. * - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -187,18 +187,6 @@ public function getEmailsListWithHttpInfo($start_timestamp = null, $end_timestam $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: @@ -257,6 +245,19 @@ public function getEmailsListWithHttpInfo($start_timestamp = null, $end_timestam ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -313,10 +314,10 @@ public function getEmailsListWithHttpInfo($start_timestamp = null, $end_timestam * * Get aggregated statistics. * - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -337,10 +338,10 @@ function ($response) { * * Get aggregated statistics. * - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -390,10 +391,10 @@ function ($exception) { /** * Create request for operation 'getEmailsList' * - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $property Specifies which email properties should be returned. All properties will be returned by default. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -516,10 +517,10 @@ public function getEmailsListRequest($start_timestamp = null, $end_timestamp = n * * Get aggregated statistic intervals. * - * @param string $interval The interval to aggregate statistics for. (optional) - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $interval The interval to aggregate statistics for. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -537,10 +538,10 @@ public function getHistogram($interval = null, $start_timestamp = null, $end_tim * * Get aggregated statistic intervals. * - * @param string $interval The interval to aggregate statistics for. (optional) - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $interval The interval to aggregate statistics for. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -573,18 +574,6 @@ public function getHistogramWithHttpInfo($interval = null, $start_timestamp = nu $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: @@ -643,6 +632,19 @@ public function getHistogramWithHttpInfo($interval = null, $start_timestamp = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -699,10 +701,10 @@ public function getHistogramWithHttpInfo($interval = null, $start_timestamp = nu * * Get aggregated statistic intervals. * - * @param string $interval The interval to aggregate statistics for. (optional) - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $interval The interval to aggregate statistics for. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -723,10 +725,10 @@ function ($response) { * * Get aggregated statistic intervals. * - * @param string $interval The interval to aggregate statistics for. (optional) - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $interval The interval to aggregate statistics for. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -776,10 +778,10 @@ function ($exception) { /** * Create request for operation 'getHistogram' * - * @param string $interval The interval to aggregate statistics for. (optional) - * @param string $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[] $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) + * @param string|null $interval The interval to aggregate statistics for. (optional) + * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) + * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) + * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Marketing/Emails/ApiException.php b/codegen/Marketing/Emails/ApiException.php index 600d585c3..00e17f028 100644 --- a/codegen/Marketing/Emails/ApiException.php +++ b/codegen/Marketing/Emails/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Marketing/Emails/Configuration.php b/codegen/Marketing/Emails/Configuration.php index 957fd6af0..6913fe42a 100644 --- a/codegen/Marketing/Emails/Configuration.php +++ b/codegen/Marketing/Emails/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Marketing/Emails/HeaderSelector.php b/codegen/Marketing/Emails/HeaderSelector.php index a4941006d..d915533f4 100644 --- a/codegen/Marketing/Emails/HeaderSelector.php +++ b/codegen/Marketing/Emails/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php b/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php index 2985008b2..91909ffa7 100644 --- a/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php +++ b/codegen/Marketing/Emails/Model/AbTestCreateRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('variation_name', $data ?? [], null); $this->setIfExists('content_id', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php b/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php index 9c0841663..890e99a03 100644 --- a/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php +++ b/codegen/Marketing/Emails/Model/AggregateEmailStatistics.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('emails', $data ?? [], null); $this->setIfExists('campaign_aggregations', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php index 18fe8ada6..9be4e919e 100644 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php index 45b2e7e6e..ddd3deee9 100644 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php index 9b4c9e70c..d0a880c37 100644 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php +++ b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php b/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php index 3980c09d0..e50c253cf 100644 --- a/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php +++ b/codegen/Marketing/Emails/Model/ContentCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('clone_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/EmailCreateRequest.php b/codegen/Marketing/Emails/Model/EmailCreateRequest.php index 4e6af9e23..ee0c1e356 100644 --- a/codegen/Marketing/Emails/Model/EmailCreateRequest.php +++ b/codegen/Marketing/Emails/Model/EmailCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -2159,10 +2159,10 @@ public function getSubcategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('feedback_survey_id', $data ?? [], null); $this->setIfExists('rss_data', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/EmailStatisticInterval.php b/codegen/Marketing/Emails/Model/EmailStatisticInterval.php index 8d2323fdc..0673132bf 100644 --- a/codegen/Marketing/Emails/Model/EmailStatisticInterval.php +++ b/codegen/Marketing/Emails/Model/EmailStatisticInterval.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('interval', $data ?? [], null); $this->setIfExists('aggregations', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/EmailStatisticsData.php b/codegen/Marketing/Emails/Model/EmailStatisticsData.php index 9aed01c16..8e0762c9b 100644 --- a/codegen/Marketing/Emails/Model/EmailStatisticsData.php +++ b/codegen/Marketing/Emails/Model/EmailStatisticsData.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('device_breakdown', $data ?? [], null); $this->setIfExists('qualifier_stats', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/EmailUpdateRequest.php b/codegen/Marketing/Emails/Model/EmailUpdateRequest.php index 22078a199..66f30de0b 100644 --- a/codegen/Marketing/Emails/Model/EmailUpdateRequest.php +++ b/codegen/Marketing/Emails/Model/EmailUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -2153,10 +2153,10 @@ public function getSubcategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('rss_data', $data ?? [], null); $this->setIfExists('subject', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/Error.php b/codegen/Marketing/Emails/Model/Error.php index a3f8ebe48..a90e2e6d3 100644 --- a/codegen/Marketing/Emails/Model/Error.php +++ b/codegen/Marketing/Emails/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/ErrorDetail.php b/codegen/Marketing/Emails/Model/ErrorDetail.php index f74372909..8f8cc70d7 100644 --- a/codegen/Marketing/Emails/Model/ErrorDetail.php +++ b/codegen/Marketing/Emails/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/ForwardPaging.php b/codegen/Marketing/Emails/Model/ForwardPaging.php index 356f53eb4..e638d2555 100644 --- a/codegen/Marketing/Emails/Model/ForwardPaging.php +++ b/codegen/Marketing/Emails/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Marketing/Emails/Model/Interval.php b/codegen/Marketing/Emails/Model/Interval.php index db3f7de49..e33de10e6 100644 --- a/codegen/Marketing/Emails/Model/Interval.php +++ b/codegen/Marketing/Emails/Model/Interval.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('start', $data ?? [], null); $this->setIfExists('end', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/ModelInterface.php b/codegen/Marketing/Emails/Model/ModelInterface.php index b360cad34..3d1161994 100644 --- a/codegen/Marketing/Emails/Model/ModelInterface.php +++ b/codegen/Marketing/Emails/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Marketing/Emails/Model/NextPage.php b/codegen/Marketing/Emails/Model/NextPage.php index e33a81439..ac110097e 100644 --- a/codegen/Marketing/Emails/Model/NextPage.php +++ b/codegen/Marketing/Emails/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/Paging.php b/codegen/Marketing/Emails/Model/Paging.php index d082af488..9fe9bc2cd 100644 --- a/codegen/Marketing/Emails/Model/Paging.php +++ b/codegen/Marketing/Emails/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PreviousPage.php b/codegen/Marketing/Emails/Model/PreviousPage.php index 367dcd946..b54603068 100644 --- a/codegen/Marketing/Emails/Model/PreviousPage.php +++ b/codegen/Marketing/Emails/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php b/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php index 39955fd7e..56378e027 100644 --- a/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php +++ b/codegen/Marketing/Emails/Model/PublicButtonStyleSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('background_color', $data ?? [], null); $this->setIfExists('font_style', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php b/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php index 2707683c4..9614e5fa0 100644 --- a/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php +++ b/codegen/Marketing/Emails/Model/PublicDividerStyleSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('color', $data ?? [], null); $this->setIfExists('line_type', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmail.php b/codegen/Marketing/Emails/Model/PublicEmail.php index 49737686f..e886dea4f 100644 --- a/codegen/Marketing/Emails/Model/PublicEmail.php +++ b/codegen/Marketing/Emails/Model/PublicEmail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -2177,10 +2177,10 @@ public function getStateAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('feedback_survey_id', $data ?? [], null); $this->setIfExists('subject', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailContent.php b/codegen/Marketing/Emails/Model/PublicEmailContent.php index c7208dac1..2eb08f1eb 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailContent.php +++ b/codegen/Marketing/Emails/Model/PublicEmailContent.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('smart_fields', $data ?? [], null); $this->setIfExists('theme_settings_values', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php b/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php index 5305fd44b..c2e15c21c 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php +++ b/codegen/Marketing/Emails/Model/PublicEmailFromDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('custom_reply_to', $data ?? [], null); $this->setIfExists('from_name', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailRecipients.php b/codegen/Marketing/Emails/Model/PublicEmailRecipients.php index d2bddbacf..c442e10f0 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailRecipients.php +++ b/codegen/Marketing/Emails/Model/PublicEmailRecipients.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include', $data ?? [], null); $this->setIfExists('exclude', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php b/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php index 2e22f82eb..efaeac755 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php +++ b/codegen/Marketing/Emails/Model/PublicEmailStyleSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -413,10 +413,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('email_body_padding', $data ?? [], null); $this->setIfExists('color_picker_favorite5', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php b/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php index 7197aaa95..7f68bc65f 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php +++ b/codegen/Marketing/Emails/Model/PublicEmailSubscriptionDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('office_location_id', $data ?? [], null); $this->setIfExists('preferences_group_id', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php b/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php index 09c7c2a22..b64b1c2c2 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php +++ b/codegen/Marketing/Emails/Model/PublicEmailTestingDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -374,10 +374,10 @@ public function getAbSuccessMetricAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('ab_sampling_default', $data ?? [], null); $this->setIfExists('ab_sample_size_default', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicEmailToDetails.php b/codegen/Marketing/Emails/Model/PublicEmailToDetails.php index 4f3a227c9..85e2c8270 100644 --- a/codegen/Marketing/Emails/Model/PublicEmailToDetails.php +++ b/codegen/Marketing/Emails/Model/PublicEmailToDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('contact_ils_lists', $data ?? [], null); $this->setIfExists('limit_send_frequency', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicFontStyle.php b/codegen/Marketing/Emails/Model/PublicFontStyle.php index ebb600a0c..1903d9d2d 100644 --- a/codegen/Marketing/Emails/Model/PublicFontStyle.php +++ b/codegen/Marketing/Emails/Model/PublicFontStyle.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('size', $data ?? [], null); $this->setIfExists('color', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php b/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php index 48bd59d9f..012769d37 100644 --- a/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php +++ b/codegen/Marketing/Emails/Model/PublicRssEmailDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('blog_image_max_width', $data ?? [], null); $this->setIfExists('blog_email_type', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/PublicWebversionDetails.php b/codegen/Marketing/Emails/Model/PublicWebversionDetails.php index 062188774..d05ff8677 100644 --- a/codegen/Marketing/Emails/Model/PublicWebversionDetails.php +++ b/codegen/Marketing/Emails/Model/PublicWebversionDetails.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -293,10 +293,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('domain', $data ?? [], null); $this->setIfExists('redirect_to_page_id', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/VersionPublicEmail.php b/codegen/Marketing/Emails/Model/VersionPublicEmail.php index 4887d06bb..d1b033f9c 100644 --- a/codegen/Marketing/Emails/Model/VersionPublicEmail.php +++ b/codegen/Marketing/Emails/Model/VersionPublicEmail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('user', $data ?? [], null); diff --git a/codegen/Marketing/Emails/Model/VersionUser.php b/codegen/Marketing/Emails/Model/VersionUser.php index f9efe1899..7203f26a9 100644 --- a/codegen/Marketing/Emails/Model/VersionUser.php +++ b/codegen/Marketing/Emails/Model/VersionUser.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('full_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Emails/ObjectSerializer.php b/codegen/Marketing/Emails/ObjectSerializer.php index 0618fe5d1..bf662f282 100644 --- a/codegen/Marketing/Emails/ObjectSerializer.php +++ b/codegen/Marketing/Emails/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } From 8db483f762ac1337027a00d3a8c08122f0dab3a7 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 8 Apr 2025 17:23:08 +0300 Subject: [PATCH 9/9] Bump version to 12.1.0 --- CHANGELOG.md | 14 ++++++++++++-- composer.json | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d34429f0f..7c92d3860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/12.0.0...HEAD) +## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/12.1.0...HEAD) + +## [12.1.0](https://github.com/HubSpot/hubspot-api-php/releases/tag/12.1.0) - 2024-04-08 + +## Updated + +- Added `crm()->commerce()->invoices()` api client. +- Added `crm()->exports()` api client. +- Added `crm()->objects()->dealSplits()` api client. +- Added `marketing()->emails()` api client. ## [12.0.0](https://github.com/HubSpot/hubspot-api-php/releases/tag/12.0.0) - 2024-10-28 @@ -846,7 +855,7 @@ ListAssociationsApi 25. getSubscriptions => getAll (webhooks()->subscriptionsApi()) 26. updateSubscription => update (webhooks()->subscriptionsApi()) -[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/12.0.0...HEAD +[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/12.1.0...HEAD [1.0.0-beta]: https://github.com/HubSpot/hubspot-api-php/releases/tag/v1.0.0-beta [1.1.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.1.0 [1.2.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.2.0 @@ -904,3 +913,4 @@ ListAssociationsApi [11.2.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/11.2.0 [11.3.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/11.3.0 [12.0.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/12.0.0 +[12.1.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/12.1.0 diff --git a/composer.json b/composer.json index 7e83bce1a..b1b520633 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "hubspot/api-client", - "version": "12.0.0", + "version": "12.1.0", "description": "Hubspot API client", "keywords": [ "hubspot",