From 11b91d54da517b1e8bc87f6b0fdf722042541a6e Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 20 Feb 2023 09:46:01 +0300 Subject: [PATCH] Add associations v4 (Codegen only) --- codegen/Crm/Associations/V4/Api/BatchApi.php | 1784 +++++++++++++++++ .../Associations/V4/Api/DefinitionsApi.php | 1375 +++++++++++++ codegen/Crm/Associations/V4/ApiException.php | 119 ++ codegen/Crm/Associations/V4/Configuration.php | 520 +++++ .../Crm/Associations/V4/HeaderSelector.php | 107 + .../Associations/V4/Model/AssociationSpec.php | 392 ++++ .../V4/Model/AssociationSpecWithLabel.php | 422 ++++ ...atchInputPublicAssociationMultiArchive.php | 323 +++ .../BatchInputPublicAssociationMultiPost.php | 323 +++ ...InputPublicDefaultAssociationMultiPost.php | 323 +++ ...putPublicFetchAssociationsBatchRequest.php | 323 +++ .../BatchResponseLabelsBetweenObjectPair.php | 520 +++++ ...ponseLabelsBetweenObjectPairWithErrors.php | 580 ++++++ ...esponsePublicAssociationMultiWithLabel.php | 520 +++++ ...licAssociationMultiWithLabelWithErrors.php | 580 ++++++ .../BatchResponsePublicDefaultAssociation.php | 580 ++++++ ...sponseAssociationSpecWithLabelNoPaging.php | 323 +++ codegen/Crm/Associations/V4/Model/Error.php | 509 +++++ .../Associations/V4/Model/ErrorCategory.php | 510 +++++ .../Crm/Associations/V4/Model/ErrorDetail.php | 443 ++++ .../V4/Model/LabelsBetweenObjectPair.php | 455 +++++ .../Associations/V4/Model/ModelInterface.php | 95 + .../Model/MultiAssociatedObjectWithLabel.php | 356 ++++ .../Crm/Associations/V4/Model/NextPage.php | 353 ++++ codegen/Crm/Associations/V4/Model/Paging.php | 350 ++++ .../Associations/V4/Model/PreviousPage.php | 353 ++++ ...blicAssociationDefinitionCreateRequest.php | 356 ++++ ...blicAssociationDefinitionUpdateRequest.php | 356 ++++ .../Model/PublicAssociationMultiArchive.php | 356 ++++ .../V4/Model/PublicAssociationMultiPost.php | 389 ++++ .../Model/PublicAssociationMultiWithLabel.php | 386 ++++ .../V4/Model/PublicDefaultAssociation.php | 389 ++++ .../PublicDefaultAssociationMultiPost.php | 356 ++++ .../PublicFetchAssociationsBatchRequest.php | 353 ++++ .../Associations/V4/Model/PublicObjectId.php | 323 +++ .../Associations/V4/Model/StandardError.php | 548 +++++ .../Crm/Associations/V4/ObjectSerializer.php | 504 +++++ 37 files changed, 16854 insertions(+) create mode 100644 codegen/Crm/Associations/V4/Api/BatchApi.php create mode 100644 codegen/Crm/Associations/V4/Api/DefinitionsApi.php create mode 100644 codegen/Crm/Associations/V4/ApiException.php create mode 100644 codegen/Crm/Associations/V4/Configuration.php create mode 100644 codegen/Crm/Associations/V4/HeaderSelector.php create mode 100644 codegen/Crm/Associations/V4/Model/AssociationSpec.php create mode 100644 codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php create mode 100644 codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php create mode 100644 codegen/Crm/Associations/V4/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php create mode 100644 codegen/Crm/Associations/V4/Model/Error.php create mode 100644 codegen/Crm/Associations/V4/Model/ErrorCategory.php create mode 100644 codegen/Crm/Associations/V4/Model/ErrorDetail.php create mode 100644 codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php create mode 100644 codegen/Crm/Associations/V4/Model/ModelInterface.php create mode 100644 codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php create mode 100644 codegen/Crm/Associations/V4/Model/NextPage.php create mode 100644 codegen/Crm/Associations/V4/Model/Paging.php create mode 100644 codegen/Crm/Associations/V4/Model/PreviousPage.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionCreateRequest.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionUpdateRequest.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php create mode 100644 codegen/Crm/Associations/V4/Model/PublicObjectId.php create mode 100644 codegen/Crm/Associations/V4/Model/StandardError.php create mode 100644 codegen/Crm/Associations/V4/ObjectSerializer.php diff --git a/codegen/Crm/Associations/V4/Api/BatchApi.php b/codegen/Crm/Associations/V4/Api/BatchApi.php new file mode 100644 index 00000000..6e240bc1 --- /dev/null +++ b/codegen/Crm/Associations/V4/Api/BatchApi.php @@ -0,0 +1,1784 @@ +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 + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiArchive $batch_input_public_association_multi_archive batch_input_public_association_multi_archive (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archive($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + { + $this->archiveWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_archive); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiArchive $batch_input_public_association_multi_archive (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + { + $request = $this->archiveRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_archive); + + 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\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiArchive $batch_input_public_association_multi_archive (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + { + return $this->archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiArchive $batch_input_public_association_multi_archive (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + { + $returnType = ''; + $request = $this->archiveRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_archive); + + 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 $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiArchive $batch_input_public_association_multi_archive (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_archive) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling archive' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling archive' + ); + } + // verify the required parameter 'batch_input_public_association_multi_archive' is set + if ($batch_input_public_association_multi_archive === null || (is_array($batch_input_public_association_multi_archive) && count($batch_input_public_association_multi_archive) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_multi_archive when calling archive' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_public_association_multi_archive)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_archive)); + } else { + $httpBody = $batch_input_public_association_multi_archive; + } + } 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation archiveLabels + * + * Delete Specific Labels + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post batch_input_public_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archiveLabels($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + $this->archiveLabelsWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + } + + /** + * Operation archiveLabelsWithHttpInfo + * + * Delete Specific Labels + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveLabelsWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + $request = $this->archiveLabelsRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + + 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\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveLabelsAsync + * + * Delete Specific Labels + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveLabelsAsync($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + return $this->archiveLabelsAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveLabelsAsyncWithHttpInfo + * + * Delete Specific Labels + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveLabelsAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + $returnType = ''; + $request = $this->archiveLabelsRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + + 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 'archiveLabels' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveLabelsRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling archiveLabels' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling archiveLabels' + ); + } + // verify the required parameter 'batch_input_public_association_multi_post' is set + if ($batch_input_public_association_multi_post === null || (is_array($batch_input_public_association_multi_post) && count($batch_input_public_association_multi_post) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_multi_post when calling archiveLabels' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/labels/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_public_association_multi_post)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post)); + } else { + $httpBody = $batch_input_public_association_multi_post; + } + } 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post batch_input_public_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair|\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors|\HubSpot\Client\Crm\Associations\V4\Model\Error + */ + public function create($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + list($response) = $this->createWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair|\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors|\HubSpot\Client\Crm\Associations\V4\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + $request = $this->createRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + + 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\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPairWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + return $this->createAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair'; + $request = $this->createRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post); + + 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 string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicAssociationMultiPost $batch_input_public_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($from_object_type, $to_object_type, $batch_input_public_association_multi_post) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling create' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling create' + ); + } + // verify the required parameter 'batch_input_public_association_multi_post' is set + if ($batch_input_public_association_multi_post === null || (is_array($batch_input_public_association_multi_post) && count($batch_input_public_association_multi_post) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_multi_post when calling create' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_public_association_multi_post)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post)); + } else { + $httpBody = $batch_input_public_association_multi_post; + } + } 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createDefault + * + * Create Default Associations + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicDefaultAssociationMultiPost $batch_input_public_default_association_multi_post batch_input_public_default_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation|\HubSpot\Client\Crm\Associations\V4\Model\Error + */ + public function createDefault($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + { + list($response) = $this->createDefaultWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post); + return $response; + } + + /** + * Operation createDefaultWithHttpInfo + * + * Create Default Associations + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicDefaultAssociationMultiPost $batch_input_public_default_association_multi_post (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation|\HubSpot\Client\Crm\Associations\V4\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createDefaultWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + { + $request = $this->createDefaultRequest($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post); + + 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\Associations\V4\Model\BatchResponsePublicDefaultAssociation' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createDefaultAsync + * + * Create Default Associations + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicDefaultAssociationMultiPost $batch_input_public_default_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDefaultAsync($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + { + return $this->createDefaultAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDefaultAsyncWithHttpInfo + * + * Create Default Associations + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicDefaultAssociationMultiPost $batch_input_public_default_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDefaultAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation'; + $request = $this->createDefaultRequest($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post); + + 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 'createDefault' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicDefaultAssociationMultiPost $batch_input_public_default_association_multi_post (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDefaultRequest($from_object_type, $to_object_type, $batch_input_public_default_association_multi_post) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling createDefault' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling createDefault' + ); + } + // verify the required parameter 'batch_input_public_default_association_multi_post' is set + if ($batch_input_public_default_association_multi_post === null || (is_array($batch_input_public_default_association_multi_post) && count($batch_input_public_default_association_multi_post) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_default_association_multi_post when calling createDefault' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/associate/default'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_public_default_association_multi_post)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_default_association_multi_post)); + } else { + $httpBody = $batch_input_public_default_association_multi_post; + } + } 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPage + * + * Read + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicFetchAssociationsBatchRequest $batch_input_public_fetch_associations_batch_request batch_input_public_fetch_associations_batch_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel|\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors|\HubSpot\Client\Crm\Associations\V4\Model\Error + */ + public function getPage($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + { + list($response) = $this->getPageWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request); + return $response; + } + + /** + * Operation getPageWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicFetchAssociationsBatchRequest $batch_input_public_fetch_associations_batch_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel|\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors|\HubSpot\Client\Crm\Associations\V4\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPageWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + { + $request = $this->getPageRequest($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request); + + 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\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabelWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPageAsync + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicFetchAssociationsBatchRequest $batch_input_public_fetch_associations_batch_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsync($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + { + return $this->getPageAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPageAsyncWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicFetchAssociationsBatchRequest $batch_input_public_fetch_associations_batch_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel'; + $request = $this->getPageRequest($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request); + + 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 string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\BatchInputPublicFetchAssociationsBatchRequest $batch_input_public_fetch_associations_batch_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPageRequest($from_object_type, $to_object_type, $batch_input_public_fetch_associations_batch_request) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling getPage' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling getPage' + ); + } + // verify the required parameter 'batch_input_public_fetch_associations_batch_request' is set + if ($batch_input_public_fetch_associations_batch_request === null || (is_array($batch_input_public_fetch_associations_batch_request) && count($batch_input_public_fetch_associations_batch_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_fetch_associations_batch_request when calling getPage' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_public_fetch_associations_batch_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_fetch_associations_batch_request)); + } else { + $httpBody = $batch_input_public_fetch_associations_batch_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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $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/Associations/V4/Api/DefinitionsApi.php b/codegen/Crm/Associations/V4/Api/DefinitionsApi.php new file mode 100644 index 00000000..899c90c7 --- /dev/null +++ b/codegen/Crm/Associations/V4/Api/DefinitionsApi.php @@ -0,0 +1,1375 @@ +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 + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param int $association_type_id association_type_id (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archive($from_object_type, $to_object_type, $association_type_id) + { + $this->archiveWithHttpInfo($from_object_type, $to_object_type, $association_type_id); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param int $association_type_id (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($from_object_type, $to_object_type, $association_type_id) + { + $request = $this->archiveRequest($from_object_type, $to_object_type, $association_type_id); + + 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\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param int $association_type_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($from_object_type, $to_object_type, $association_type_id) + { + return $this->archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param int $association_type_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id) + { + $returnType = ''; + $request = $this->archiveRequest($from_object_type, $to_object_type, $association_type_id); + + 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 $from_object_type (required) + * @param string $to_object_type (required) + * @param int $association_type_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($from_object_type, $to_object_type, $association_type_id) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling archive' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling archive' + ); + } + // verify the required parameter 'association_type_id' is set + if ($association_type_id === null || (is_array($association_type_id) && count($association_type_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $association_type_id when calling archive' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels/{associationTypeId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + // path params + if ($association_type_id !== null) { + $resourcePath = str_replace( + '{' . 'associationTypeId' . '}', + ObjectSerializer::toPathValue($association_type_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request public_association_definition_create_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Model\Error + */ + public function create($from_object_type, $to_object_type, $public_association_definition_create_request) + { + list($response) = $this->createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request) + { + $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request); + + 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\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($from_object_type, $to_object_type, $public_association_definition_create_request) + { + return $this->createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request); + + 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 string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($from_object_type, $to_object_type, $public_association_definition_create_request) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling create' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling create' + ); + } + // verify the required parameter 'public_association_definition_create_request' is set + if ($public_association_definition_create_request === null || (is_array($public_association_definition_create_request) && count($public_association_definition_create_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_association_definition_create_request when calling create' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($public_association_definition_create_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_create_request)); + } else { + $httpBody = $public_association_definition_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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAll + * + * Read + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Model\Error + */ + public function getAll($from_object_type, $to_object_type) + { + list($response) = $this->getAllWithHttpInfo($from_object_type, $to_object_type); + return $response; + } + + /** + * Operation getAllWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllWithHttpInfo($from_object_type, $to_object_type) + { + $request = $this->getAllRequest($from_object_type, $to_object_type); + + 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\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllAsync + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsync($from_object_type, $to_object_type) + { + return $this->getAllAsyncWithHttpInfo($from_object_type, $to_object_type) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllAsyncWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsyncWithHttpInfo($from_object_type, $to_object_type) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + $request = $this->getAllRequest($from_object_type, $to_object_type); + + 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 'getAll' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllRequest($from_object_type, $to_object_type) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling getAll' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling getAll' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request public_association_definition_update_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function update($from_object_type, $to_object_type, $public_association_definition_update_request) + { + $this->updateWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request); + } + + /** + * Operation updateWithHttpInfo + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request (required) + * + * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request) + { + $request = $this->updateRequest($from_object_type, $to_object_type, $public_association_definition_update_request); + + 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\Associations\V4\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($from_object_type, $to_object_type, $public_association_definition_update_request) + { + return $this->updateAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request) + { + $returnType = ''; + $request = $this->updateRequest($from_object_type, $to_object_type, $public_association_definition_update_request); + + 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 'update' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($from_object_type, $to_object_type, $public_association_definition_update_request) + { + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling update' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling update' + ); + } + // verify the required parameter 'public_association_definition_update_request' is set + if ($public_association_definition_update_request === null || (is_array($public_association_definition_update_request) && count($public_association_definition_update_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_association_definition_update_request when calling update' + ); + } + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($public_association_definition_update_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_update_request)); + } else { + $httpBody = $public_association_definition_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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // 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 + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $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/Associations/V4/ApiException.php b/codegen/Crm/Associations/V4/ApiException.php new file mode 100644 index 00000000..530701a6 --- /dev/null +++ b/codegen/Crm/Associations/V4/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/Associations/V4/Configuration.php b/codegen/Crm/Associations/V4/Configuration.php new file mode 100644 index 00000000..49775bb7 --- /dev/null +++ b/codegen/Crm/Associations/V4/Configuration.php @@ -0,0 +1,520 @@ +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 $booleanFormatForQueryString 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\Associations\V4) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v4' . 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 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) + { + if (null === $variables) { + $variables = []; + } + + $hosts = $this->getHostSettings(); + + // check array index out of bound + if ($index < 0 || $index >= sizeof($hosts)) { + throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + } + + $host = $hosts[$index]; + $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 (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; + } +} diff --git a/codegen/Crm/Associations/V4/HeaderSelector.php b/codegen/Crm/Associations/V4/HeaderSelector.php new file mode 100644 index 00000000..b223387f --- /dev/null +++ b/codegen/Crm/Associations/V4/HeaderSelector.php @@ -0,0 +1,107 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + 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($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { + return implode(',', $jsonAccept); + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} diff --git a/codegen/Crm/Associations/V4/Model/AssociationSpec.php b/codegen/Crm/Associations/V4/Model/AssociationSpec.php new file mode 100644 index 00000000..94be5f67 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +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 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 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->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * 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) + { + $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) + { + $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/Associations/V4/Model/AssociationSpecWithLabel.php b/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..9f840000 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * 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 CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::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->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'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 category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + 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/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php new file mode 100644 index 00000000..7b3f4c35 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php @@ -0,0 +1,323 @@ + + */ +class BatchInputPublicAssociationMultiArchive implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicAssociationMultiArchive'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiArchive[]' + ]; + + /** + * 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 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * 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\Associations\V4\Model\PublicAssociationMultiArchive[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiArchive[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $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/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php new file mode 100644 index 00000000..69af3f9f --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php @@ -0,0 +1,323 @@ + + */ +class BatchInputPublicAssociationMultiPost implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicAssociationMultiPost'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiPost[]' + ]; + + /** + * 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 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * 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\Associations\V4\Model\PublicAssociationMultiPost[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiPost[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $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/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php new file mode 100644 index 00000000..79db7b2c --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php @@ -0,0 +1,323 @@ + + */ +class BatchInputPublicDefaultAssociationMultiPost implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicDefaultAssociationMultiPost'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociationMultiPost[]' + ]; + + /** + * 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 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * 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\Associations\V4\Model\PublicDefaultAssociationMultiPost[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociationMultiPost[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $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/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php new file mode 100644 index 00000000..105e1e43 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php @@ -0,0 +1,323 @@ + + */ +class BatchInputPublicFetchAssociationsBatchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicFetchAssociationsBatchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicFetchAssociationsBatchRequest[]' + ]; + + /** + * 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 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * 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\Associations\V4\Model\PublicFetchAssociationsBatchRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicFetchAssociationsBatchRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $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/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php new file mode 100644 index 00000000..6b7d48ba --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php @@ -0,0 +1,520 @@ + + */ +class BatchResponseLabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseLabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $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) + { + $this->container['started_at'] = $started_at; + + 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php new file mode 100644 index 00000000..053b70b1 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php @@ -0,0 +1,580 @@ + + */ +class BatchResponseLabelsBetweenObjectPairWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseLabelsBetweenObjectPairWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[]', + 'num_errors' => 'int', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Model\StandardError[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'num_errors' => 'int32', + 'errors' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'num_errors' => 'numErrors', + 'errors' => 'errors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'num_errors' => 'setNumErrors', + 'errors' => 'setErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'num_errors' => 'getNumErrors', + 'errors' => 'getErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['num_errors'] = $data['num_errors'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $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) + { + $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) + { + $this->container['started_at'] = $started_at; + + 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php new file mode 100644 index 00000000..be6e4951 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php @@ -0,0 +1,520 @@ + + */ +class BatchResponsePublicAssociationMultiWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationMultiWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $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) + { + $this->container['started_at'] = $started_at; + + 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php new file mode 100644 index 00000000..687b0c0f --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php @@ -0,0 +1,580 @@ + + */ +class BatchResponsePublicAssociationMultiWithLabelWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationMultiWithLabelWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[]', + 'num_errors' => 'int', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Model\StandardError[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'num_errors' => 'int32', + 'errors' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'num_errors' => 'numErrors', + 'errors' => 'errors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'num_errors' => 'setNumErrors', + 'errors' => 'setErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'num_errors' => 'getNumErrors', + 'errors' => 'getErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['num_errors'] = $data['num_errors'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicAssociationMultiWithLabel[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $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) + { + $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) + { + $this->container['started_at'] = $started_at; + + 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php new file mode 100644 index 00000000..af4e95ef --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php @@ -0,0 +1,580 @@ + + */ +class BatchResponsePublicDefaultAssociation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicDefaultAssociation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociation[]', + 'num_errors' => 'int', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Model\StandardError[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'num_errors' => 'int32', + 'errors' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'num_errors' => 'numErrors', + 'errors' => 'errors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'num_errors' => 'setNumErrors', + 'errors' => 'setErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'num_errors' => 'getNumErrors', + 'errors' => 'getErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['num_errors'] = $data['num_errors'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociation[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociation[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $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) + { + $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) + { + $this->container['started_at'] = $started_at; + + 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php b/codegen/Crm/Associations/V4/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php new file mode 100644 index 00000000..43e64ac6 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php @@ -0,0 +1,323 @@ + + */ +class CollectionResponseAssociationSpecWithLabelNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseAssociationSpecWithLabelNoPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + '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->container['results'] = $data['results'] ?? null; + } + + /** + * 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 results + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] $results results + * + * @return self + */ + public function setResults($results) + { + $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/Associations/V4/Model/Error.php b/codegen/Crm/Associations/V4/Model/Error.php new file mode 100644 index 00000000..f2a41a74 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/Error.php @@ -0,0 +1,509 @@ + + */ +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 = [ + 'message' => 'string', + 'correlation_id' => 'string', + 'category' => 'string', + 'sub_category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[]', + 'context' => 'array', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'correlation_id' => 'uuid', + 'category' => null, + 'sub_category' => null, + 'errors' => null, + 'context' => null, + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'correlation_id' => 'correlationId', + 'category' => 'category', + 'sub_category' => 'subCategory', + 'errors' => 'errors', + 'context' => 'context', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'correlation_id' => 'setCorrelationId', + 'category' => 'setCategory', + 'sub_category' => 'setSubCategory', + 'errors' => 'setErrors', + 'context' => 'setContext', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'correlation_id' => 'getCorrelationId', + 'category' => 'getCategory', + 'sub_category' => 'getSubCategory', + 'errors' => 'getErrors', + 'context' => 'getContext', + 'links' => 'getLinks' + ]; + + /** + * 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->container['message'] = $data['message'] ?? null; + $this->container['correlation_id'] = $data['correlation_id'] ?? null; + $this->container['category'] = $data['category'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['context'] = $data['context'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * 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"; + } + if ($this->container['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' 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 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) + { + $this->container['message'] = $message; + + 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) + { + $this->container['correlation_id'] = $correlation_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) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * 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) + { + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + 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) + { + $this->container['context'] = $context; + + 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) + { + $this->container['links'] = $links; + + 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/Associations/V4/Model/ErrorCategory.php b/codegen/Crm/Associations/V4/Model/ErrorCategory.php new file mode 100644 index 00000000..6158c673 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/ErrorCategory.php @@ -0,0 +1,510 @@ + + */ +class ErrorCategory implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorCategory'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'http_status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'http_status' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'http_status' => 'httpStatus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'http_status' => 'setHttpStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'http_status' => 'getHttpStatus' + ]; + + /** + * 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 HTTP_STATUS__CONTINUE = 'CONTINUE'; + public const HTTP_STATUS_SWITCHING_PROTOCOLS = 'SWITCHING_PROTOCOLS'; + public const HTTP_STATUS_PROCESSING = 'PROCESSING'; + public const HTTP_STATUS_OK = 'OK'; + public const HTTP_STATUS_CREATED = 'CREATED'; + public const HTTP_STATUS_ACCEPTED = 'ACCEPTED'; + public const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 'NON_AUTHORITATIVE_INFORMATION'; + public const HTTP_STATUS_NO_CONTENT = 'NO_CONTENT'; + public const HTTP_STATUS_RESET_CONTENT = 'RESET_CONTENT'; + public const HTTP_STATUS_PARTIAL_CONTENT = 'PARTIAL_CONTENT'; + public const HTTP_STATUS_MULTI_STATUS = 'MULTI_STATUS'; + public const HTTP_STATUS_ALREADY_REPORTED = 'ALREADY_REPORTED'; + public const HTTP_STATUS_IM_USED = 'IM_USED'; + public const HTTP_STATUS_MULTIPLE_CHOICES = 'MULTIPLE_CHOICES'; + public const HTTP_STATUS_MOVED_PERMANENTLY = 'MOVED_PERMANENTLY'; + public const HTTP_STATUS_FOUND = 'FOUND'; + public const HTTP_STATUS_SEE_OTHER = 'SEE_OTHER'; + public const HTTP_STATUS_NOT_MODIFIED = 'NOT_MODIFIED'; + public const HTTP_STATUS_USE_PROXY = 'USE_PROXY'; + public const HTTP_STATUS_TEMPORARY_REDIRECT = 'TEMPORARY_REDIRECT'; + public const HTTP_STATUS_PERMANENT_REDIRECT = 'PERMANENT_REDIRECT'; + public const HTTP_STATUS_BAD_REQUEST = 'BAD_REQUEST'; + public const HTTP_STATUS_UNAUTHORIZED = 'UNAUTHORIZED'; + public const HTTP_STATUS_PAYMENT_REQUIRED = 'PAYMENT_REQUIRED'; + public const HTTP_STATUS_FORBIDDEN = 'FORBIDDEN'; + public const HTTP_STATUS_NOT_FOUND = 'NOT_FOUND'; + public const HTTP_STATUS_METHOD_NOT_ALLOWED = 'METHOD_NOT_ALLOWED'; + public const HTTP_STATUS_NOT_ACCEPTABLE = 'NOT_ACCEPTABLE'; + public const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 'PROXY_AUTHENTICATION_REQUIRED'; + public const HTTP_STATUS_REQUEST_TIMEOUT = 'REQUEST_TIMEOUT'; + public const HTTP_STATUS_CONFLICT = 'CONFLICT'; + public const HTTP_STATUS_GONE = 'GONE'; + public const HTTP_STATUS_LENGTH_REQUIRED = 'LENGTH_REQUIRED'; + public const HTTP_STATUS_PRECONDITION_FAILED = 'PRECONDITION_FAILED'; + public const HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 'REQUEST_ENTITY_TOO_LARGE'; + public const HTTP_STATUS_REQUEST_URI_TOO_LONG = 'REQUEST_URI_TOO_LONG'; + public const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 'UNSUPPORTED_MEDIA_TYPE'; + public const HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 'REQUESTED_RANGE_NOT_SATISFIABLE'; + public const HTTP_STATUS_EXPECTATION_FAILED = 'EXPECTATION_FAILED'; + public const HTTP_STATUS_IM_A_TEAPOT = 'IM_A_TEAPOT'; + public const HTTP_STATUS_MISDIRECTED_REQUEST = 'MISDIRECTED_REQUEST'; + public const HTTP_STATUS_UNPROCESSABLE_ENTITY = 'UNPROCESSABLE_ENTITY'; + public const HTTP_STATUS_LOCKED = 'LOCKED'; + public const HTTP_STATUS_FAILED_DEPENDENCY = 'FAILED_DEPENDENCY'; + public const HTTP_STATUS_UPGRADE_REQUIRED = 'UPGRADE_REQUIRED'; + public const HTTP_STATUS_PRECONDITION_REQUIRED = 'PRECONDITION_REQUIRED'; + public const HTTP_STATUS_TOO_MANY_REQUESTS = 'TOO_MANY_REQUESTS'; + public const HTTP_STATUS_REQUEST_HEADERS_FIELDS_TOO_LARGE = 'REQUEST_HEADERS_FIELDS_TOO_LARGE'; + public const HTTP_STATUS_INTERNAL_STALE_SERVICE_DISCOVERY = 'INTERNAL_STALE_SERVICE_DISCOVERY'; + public const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 'UNAVAILABLE_FOR_LEGAL_REASONS'; + public const HTTP_STATUS_MIGRATION_IN_PROGRESS = 'MIGRATION_IN_PROGRESS'; + public const HTTP_STATUS_INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR'; + public const HTTP_STATUS_NOT_IMPLEMENTED = 'NOT_IMPLEMENTED'; + public const HTTP_STATUS_BAD_GATEWAY = 'BAD_GATEWAY'; + public const HTTP_STATUS_SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE'; + public const HTTP_STATUS_GATEWAY_TIMEOUT = 'GATEWAY_TIMEOUT'; + public const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 'HTTP_VERSION_NOT_SUPPORTED'; + public const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 'VARIANT_ALSO_NEGOTIATES'; + public const HTTP_STATUS_INSUFFICIENT_STORAGE = 'INSUFFICIENT_STORAGE'; + public const HTTP_STATUS_LOOP_DETECTED = 'LOOP_DETECTED'; + public const HTTP_STATUS_NOT_EXTENDED = 'NOT_EXTENDED'; + public const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 'NETWORK_AUTHENTICATION_REQUIRED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpStatusAllowableValues() + { + return [ + self::HTTP_STATUS__CONTINUE, + self::HTTP_STATUS_SWITCHING_PROTOCOLS, + self::HTTP_STATUS_PROCESSING, + self::HTTP_STATUS_OK, + self::HTTP_STATUS_CREATED, + self::HTTP_STATUS_ACCEPTED, + self::HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION, + self::HTTP_STATUS_NO_CONTENT, + self::HTTP_STATUS_RESET_CONTENT, + self::HTTP_STATUS_PARTIAL_CONTENT, + self::HTTP_STATUS_MULTI_STATUS, + self::HTTP_STATUS_ALREADY_REPORTED, + self::HTTP_STATUS_IM_USED, + self::HTTP_STATUS_MULTIPLE_CHOICES, + self::HTTP_STATUS_MOVED_PERMANENTLY, + self::HTTP_STATUS_FOUND, + self::HTTP_STATUS_SEE_OTHER, + self::HTTP_STATUS_NOT_MODIFIED, + self::HTTP_STATUS_USE_PROXY, + self::HTTP_STATUS_TEMPORARY_REDIRECT, + self::HTTP_STATUS_PERMANENT_REDIRECT, + self::HTTP_STATUS_BAD_REQUEST, + self::HTTP_STATUS_UNAUTHORIZED, + self::HTTP_STATUS_PAYMENT_REQUIRED, + self::HTTP_STATUS_FORBIDDEN, + self::HTTP_STATUS_NOT_FOUND, + self::HTTP_STATUS_METHOD_NOT_ALLOWED, + self::HTTP_STATUS_NOT_ACCEPTABLE, + self::HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED, + self::HTTP_STATUS_REQUEST_TIMEOUT, + self::HTTP_STATUS_CONFLICT, + self::HTTP_STATUS_GONE, + self::HTTP_STATUS_LENGTH_REQUIRED, + self::HTTP_STATUS_PRECONDITION_FAILED, + self::HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE, + self::HTTP_STATUS_REQUEST_URI_TOO_LONG, + self::HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, + self::HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, + self::HTTP_STATUS_EXPECTATION_FAILED, + self::HTTP_STATUS_IM_A_TEAPOT, + self::HTTP_STATUS_MISDIRECTED_REQUEST, + self::HTTP_STATUS_UNPROCESSABLE_ENTITY, + self::HTTP_STATUS_LOCKED, + self::HTTP_STATUS_FAILED_DEPENDENCY, + self::HTTP_STATUS_UPGRADE_REQUIRED, + self::HTTP_STATUS_PRECONDITION_REQUIRED, + self::HTTP_STATUS_TOO_MANY_REQUESTS, + self::HTTP_STATUS_REQUEST_HEADERS_FIELDS_TOO_LARGE, + self::HTTP_STATUS_INTERNAL_STALE_SERVICE_DISCOVERY, + self::HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS, + self::HTTP_STATUS_MIGRATION_IN_PROGRESS, + self::HTTP_STATUS_INTERNAL_SERVER_ERROR, + self::HTTP_STATUS_NOT_IMPLEMENTED, + self::HTTP_STATUS_BAD_GATEWAY, + self::HTTP_STATUS_SERVICE_UNAVAILABLE, + self::HTTP_STATUS_GATEWAY_TIMEOUT, + self::HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED, + self::HTTP_STATUS_VARIANT_ALSO_NEGOTIATES, + self::HTTP_STATUS_INSUFFICIENT_STORAGE, + self::HTTP_STATUS_LOOP_DETECTED, + self::HTTP_STATUS_NOT_EXTENDED, + self::HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED, + ]; + } + + /** + * 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->container['name'] = $data['name'] ?? null; + $this->container['http_status'] = $data['http_status'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['http_status'] === null) { + $invalidProperties[] = "'http_status' can't be null"; + } + $allowedValues = $this->getHttpStatusAllowableValues(); + if (!is_null($this->container['http_status']) && !in_array($this->container['http_status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_status', must be one of '%s'", + $this->container['http_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 name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets http_status + * + * @return string + */ + public function getHttpStatus() + { + return $this->container['http_status']; + } + + /** + * Sets http_status + * + * @param string $http_status http_status + * + * @return self + */ + public function setHttpStatus($http_status) + { + $allowedValues = $this->getHttpStatusAllowableValues(); + if (!in_array($http_status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_status', must be one of '%s'", + $http_status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['http_status'] = $http_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/Associations/V4/Model/ErrorDetail.php b/codegen/Crm/Associations/V4/Model/ErrorDetail.php new file mode 100644 index 00000000..c694414c --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/ErrorDetail.php @@ -0,0 +1,443 @@ + + */ +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 = [ + 'message' => 'string', + 'in' => 'string', + 'code' => 'string', + 'sub_category' => 'string', + 'context' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'in' => null, + 'code' => null, + 'sub_category' => null, + 'context' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'in' => 'in', + 'code' => 'code', + 'sub_category' => 'subCategory', + 'context' => 'context' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'in' => 'setIn', + 'code' => 'setCode', + 'sub_category' => 'setSubCategory', + 'context' => 'setContext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'in' => 'getIn', + 'code' => 'getCode', + 'sub_category' => 'getSubCategory', + 'context' => 'getContext' + ]; + + /** + * 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->container['message'] = $data['message'] ?? null; + $this->container['in'] = $data['in'] ?? null; + $this->container['code'] = $data['code'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['context'] = $data['context'] ?? null; + } + + /** + * 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 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) + { + $this->container['message'] = $message; + + 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) + { + $this->container['in'] = $in; + + 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) + { + $this->container['code'] = $code; + + return $this; + } + + /** + * 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) + { + $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) + { + $this->container['context'] = $context; + + 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/Associations/V4/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..8f6a8798 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * 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->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' 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 from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + 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/Associations/V4/Model/ModelInterface.php b/codegen/Crm/Associations/V4/Model/ModelInterface.php new file mode 100644 index 00000000..e63f4a59 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/ModelInterface.php @@ -0,0 +1,95 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * 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->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' 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 to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + 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/Associations/V4/Model/NextPage.php b/codegen/Crm/Associations/V4/Model/NextPage.php new file mode 100644 index 00000000..744ba2d7 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/NextPage.php @@ -0,0 +1,353 @@ + + */ +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 = [ + 'after' => 'string', + 'link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'after' => null, + 'link' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'after' => 'after', + 'link' => 'link' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'after' => 'setAfter', + 'link' => 'setLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'after' => 'getAfter', + '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->container['after'] = $data['after'] ?? null; + $this->container['link'] = $data['link'] ?? null; + } + + /** + * 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 after + * + * @return string + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string $after after + * + * @return self + */ + public function setAfter($after) + { + $this->container['after'] = $after; + + 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) + { + $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/Associations/V4/Model/Paging.php b/codegen/Crm/Associations/V4/Model/Paging.php new file mode 100644 index 00000000..970c738e --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/Paging.php @@ -0,0 +1,350 @@ + + */ +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\Associations\V4\Model\NextPage', + 'prev' => '\HubSpot\Client\Crm\Associations\V4\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 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 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->container['next'] = $data['next'] ?? null; + $this->container['prev'] = $data['prev'] ?? null; + } + + /** + * 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\Associations\V4\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + $this->container['next'] = $next; + + return $this; + } + + /** + * Gets prev + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PreviousPage|null + */ + public function getPrev() + { + return $this->container['prev']; + } + + /** + * Sets prev + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PreviousPage|null $prev prev + * + * @return self + */ + public function setPrev($prev) + { + $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/Associations/V4/Model/PreviousPage.php b/codegen/Crm/Associations/V4/Model/PreviousPage.php new file mode 100644 index 00000000..dd846bd2 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PreviousPage.php @@ -0,0 +1,353 @@ + + */ +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 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 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->container['before'] = $data['before'] ?? null; + $this->container['link'] = $data['link'] ?? null; + } + + /** + * 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) + { + $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) + { + $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/Associations/V4/Model/PublicAssociationDefinitionCreateRequest.php b/codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionCreateRequest.php new file mode 100644 index 00000000..12bf14a2 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionCreateRequest.php @@ -0,0 +1,356 @@ + + */ +class PublicAssociationDefinitionCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'label' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'label' => null, + 'name' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'label' => 'label', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'label' => 'setLabel', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'label' => 'getLabel', + 'name' => 'getName' + ]; + + /** + * 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->container['label'] = $data['label'] ?? null; + $this->container['name'] = $data['name'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' 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 label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + 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/Associations/V4/Model/PublicAssociationDefinitionUpdateRequest.php b/codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionUpdateRequest.php new file mode 100644 index 00000000..476a7f04 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationDefinitionUpdateRequest.php @@ -0,0 +1,356 @@ + + */ +class PublicAssociationDefinitionUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'label' => '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 = [ + 'label' => null, + 'association_type_id' => 'int32' + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'label' => 'label', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'label' => 'setLabel', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'label' => 'getLabel', + '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; + } + + + /** + * 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->container['label'] = $data['label'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + if ($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 label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + 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) + { + $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/Associations/V4/Model/PublicAssociationMultiArchive.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php new file mode 100644 index 00000000..a160c6f8 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php @@ -0,0 +1,356 @@ + + */ +class PublicAssociationMultiArchive implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationMultiArchive'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + '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->container['from'] = $data['from'] ?? null; + $this->container['to'] = $data['to'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' 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 from + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId[] $to to + * + * @return self + */ + public function setTo($to) + { + $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/Associations/V4/Model/PublicAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php new file mode 100644 index 00000000..d3e5341b --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php @@ -0,0 +1,389 @@ + + */ +class PublicAssociationMultiPost implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationMultiPost'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'types' => '\HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null, + 'types' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'to' => 'to', + 'types' => 'types' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo', + 'types' => 'setTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo', + 'types' => 'getTypes' + ]; + + /** + * 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->container['from'] = $data['from'] ?? null; + $this->container['to'] = $data['to'] ?? null; + $this->container['types'] = $data['types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' 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 from + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $to to + * + * @return self + */ + public function setTo($to) + { + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets types + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec[] + */ + public function getTypes() + { + return $this->container['types']; + } + + /** + * Sets types + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec[] $types types + * + * @return self + */ + public function setTypes($types) + { + $this->container['types'] = $types; + + 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/Associations/V4/Model/PublicAssociationMultiWithLabel.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php new file mode 100644 index 00000000..a675a163 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php @@ -0,0 +1,386 @@ + + */ +class PublicAssociationMultiWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationMultiWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\MultiAssociatedObjectWithLabel[]', + 'paging' => '\HubSpot\Client\Crm\Associations\V4\Model\Paging' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null, + 'paging' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'to' => 'to', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo', + 'paging' => 'getPaging' + ]; + + /** + * 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->container['from'] = $data['from'] ?? null; + $this->container['to'] = $data['to'] ?? null; + $this->container['paging'] = $data['paging'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' 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 from + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\MultiAssociatedObjectWithLabel[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\MultiAssociatedObjectWithLabel[] $to to + * + * @return self + */ + public function setTo($to) + { + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\Paging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\Paging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + $this->container['paging'] = $paging; + + 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/Associations/V4/Model/PublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php new file mode 100644 index 00000000..e1503e40 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php @@ -0,0 +1,389 @@ + + */ +class PublicDefaultAssociation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDefaultAssociation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'association_spec' => '\HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null, + 'association_spec' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'to' => 'to', + 'association_spec' => 'associationSpec' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo', + 'association_spec' => 'setAssociationSpec' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo', + 'association_spec' => 'getAssociationSpec' + ]; + + /** + * 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->container['from'] = $data['from'] ?? null; + $this->container['to'] = $data['to'] ?? null; + $this->container['association_spec'] = $data['association_spec'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['association_spec'] === null) { + $invalidProperties[] = "'association_spec' 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 from + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $to to + * + * @return self + */ + public function setTo($to) + { + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets association_spec + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec + */ + public function getAssociationSpec() + { + return $this->container['association_spec']; + } + + /** + * Sets association_spec + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec $association_spec association_spec + * + * @return self + */ + public function setAssociationSpec($association_spec) + { + $this->container['association_spec'] = $association_spec; + + 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/Associations/V4/Model/PublicDefaultAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php new file mode 100644 index 00000000..606ea0f8 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php @@ -0,0 +1,356 @@ + + */ +class PublicDefaultAssociationMultiPost implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicDefaultAssociationMultiPost'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', + 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + '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->container['from'] = $data['from'] ?? null; + $this->container['to'] = $data['to'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' 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 from + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $to to + * + * @return self + */ + public function setTo($to) + { + $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/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php b/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php new file mode 100644 index 00000000..b52ca757 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php @@ -0,0 +1,353 @@ + + */ +class PublicFetchAssociationsBatchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicFetchAssociationsBatchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'after' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'after' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + '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->container['id'] = $data['id'] ?? null; + $this->container['after'] = $data['after'] ?? null; + } + + /** + * 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) + { + $this->container['id'] = $id; + + 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) + { + $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/Associations/V4/Model/PublicObjectId.php b/codegen/Crm/Associations/V4/Model/PublicObjectId.php new file mode 100644 index 00000000..27b25951 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/PublicObjectId.php @@ -0,0 +1,323 @@ + + */ +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 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 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->container['id'] = $data['id'] ?? null; + } + + /** + * 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) + { + $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/Associations/V4/Model/StandardError.php b/codegen/Crm/Associations/V4/Model/StandardError.php new file mode 100644 index 00000000..b59423e5 --- /dev/null +++ b/codegen/Crm/Associations/V4/Model/StandardError.php @@ -0,0 +1,548 @@ + + */ +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 = [ + 'status' => 'string', + 'id' => 'string', + 'category' => '\HubSpot\Client\Crm\Associations\V4\Model\ErrorCategory', + 'sub_category' => 'object', + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[]', + 'context' => 'array', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'category' => null, + 'sub_category' => null, + 'message' => null, + 'errors' => null, + 'context' => null, + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'id' => 'id', + 'category' => 'category', + 'sub_category' => 'subCategory', + 'message' => 'message', + 'errors' => 'errors', + 'context' => 'context', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'category' => 'setCategory', + 'sub_category' => 'setSubCategory', + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'context' => 'setContext', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'category' => 'getCategory', + 'sub_category' => 'getSubCategory', + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'context' => 'getContext', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['id'] = $data['id'] ?? null; + $this->container['category'] = $data['category'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['message'] = $data['message'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['context'] = $data['context'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' 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['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' 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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + 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) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\ErrorCategory + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\ErrorCategory $category category + * + * @return self + */ + public function setCategory($category) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * 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) + { + $this->container['sub_category'] = $sub_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) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Model\ErrorDetail[] $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + 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) + { + $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) + { + $this->container['links'] = $links; + + 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/Associations/V4/ObjectSerializer.php b/codegen/Crm/Associations/V4/ObjectSerializer.php new file mode 100644 index 00000000..457c6ed1 --- /dev/null +++ b/codegen/Crm/Associations/V4/ObjectSerializer.php @@ -0,0 +1,504 @@ +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', 'double', '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 ($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)); + } + + /** + * 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 { + if ( + empty($value) + && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty + ) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + $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 API's 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 API's 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', 'double', '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 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\Associations\V4\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) || !isset($data->{$instance::attributeMap()[$property]})) { + 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); + } +}