From 2ced5776815a95a7ffcd8d0febcd6a5bb86a4e4e Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Tue, 22 Oct 2024 10:48:55 +0300 Subject: [PATCH] Codegen: CRM Companies, Contacts and Deals --- codegen/Crm/Companies/Api/BasicApi.php | 20 +- codegen/Crm/Companies/Api/BatchApi.php | 391 +++++++++- codegen/Crm/Companies/Api/GDPRApi.php | 383 ---------- .../Api/{PublicObjectApi.php => MergeApi.php} | 6 +- .../Crm/Companies/Model/AssociationSpec.php | 14 +- ...putSimplePublicObjectBatchInputUpsert.php} | 80 +- .../BatchResponseSimplePublicUpsertObject.php | 629 ++++++++++++++++ ...onseSimplePublicUpsertObjectWithErrors.php | 697 ++++++++++++++++++ .../Model/PublicAssociationsForObject.php | 14 +- .../Crm/Companies/Model/PublicObjectId.php | 7 +- .../Model/PublicObjectSearchRequest.php | 35 +- .../Model/SimplePublicObjectBatchInput.php | 34 + .../SimplePublicObjectBatchInputUpsert.php | 517 +++++++++++++ .../Model/SimplePublicObjectInput.php | 34 + .../SimplePublicObjectInputForCreate.php | 41 +- .../Model/SimplePublicUpsertObject.php | 662 +++++++++++++++++ codegen/Crm/Contacts/Api/BatchApi.php | 391 +++++++++- .../Api/{PublicObjectApi.php => MergeApi.php} | 6 +- .../Crm/Contacts/Model/AssociationSpec.php | 14 +- ...nputSimplePublicObjectBatchInputUpsert.php | 412 +++++++++++ .../BatchResponseSimplePublicUpsertObject.php | 629 ++++++++++++++++ ...onseSimplePublicUpsertObjectWithErrors.php | 697 ++++++++++++++++++ .../Model/PublicAssociationsForObject.php | 14 +- codegen/Crm/Contacts/Model/PublicObjectId.php | 7 +- .../Model/PublicObjectSearchRequest.php | 35 +- .../Model/SimplePublicObjectBatchInput.php | 34 + .../SimplePublicObjectBatchInputUpsert.php | 517 +++++++++++++ .../Model/SimplePublicObjectInput.php | 34 + .../SimplePublicObjectInputForCreate.php | 41 +- .../Model/SimplePublicUpsertObject.php | 662 +++++++++++++++++ codegen/Crm/Deals/Api/BasicApi.php | 20 +- codegen/Crm/Deals/Api/BatchApi.php | 391 +++++++++- codegen/Crm/Deals/Api/GDPRApi.php | 383 ---------- .../Api/{PublicObjectApi.php => MergeApi.php} | 14 +- codegen/Crm/Deals/Model/AssociationSpec.php | 14 +- ...putSimplePublicObjectBatchInputUpsert.php} | 80 +- .../BatchResponseSimplePublicUpsertObject.php | 629 ++++++++++++++++ ...onseSimplePublicUpsertObjectWithErrors.php | 697 ++++++++++++++++++ .../Model/PublicAssociationsForObject.php | 14 +- codegen/Crm/Deals/Model/PublicObjectId.php | 7 +- .../Deals/Model/PublicObjectSearchRequest.php | 35 +- .../Model/SimplePublicObjectBatchInput.php | 34 + .../SimplePublicObjectBatchInputUpsert.php | 517 +++++++++++++ .../Deals/Model/SimplePublicObjectInput.php | 34 + .../SimplePublicObjectInputForCreate.php | 41 +- .../Deals/Model/SimplePublicUpsertObject.php | 662 +++++++++++++++++ 46 files changed, 9539 insertions(+), 1090 deletions(-) delete mode 100644 codegen/Crm/Companies/Api/GDPRApi.php rename codegen/Crm/Companies/Api/{PublicObjectApi.php => MergeApi.php} (99%) rename codegen/Crm/Companies/Model/{PublicGdprDeleteInput.php => BatchInputSimplePublicObjectBatchInputUpsert.php} (82%) create mode 100644 codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php create mode 100644 codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php create mode 100644 codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Companies/Model/SimplePublicUpsertObject.php rename codegen/Crm/Contacts/Api/{PublicObjectApi.php => MergeApi.php} (99%) create mode 100644 codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php create mode 100644 codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php create mode 100644 codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php delete mode 100644 codegen/Crm/Deals/Api/GDPRApi.php rename codegen/Crm/Deals/Api/{PublicObjectApi.php => MergeApi.php} (98%) rename codegen/Crm/Deals/Model/{PublicGdprDeleteInput.php => BatchInputSimplePublicObjectBatchInputUpsert.php} (82%) create mode 100644 codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php create mode 100644 codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php create mode 100644 codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php create mode 100644 codegen/Crm/Deals/Model/SimplePublicUpsertObject.php diff --git a/codegen/Crm/Companies/Api/BasicApi.php b/codegen/Crm/Companies/Api/BasicApi.php index c083424e..84a9ac97 100644 --- a/codegen/Crm/Companies/Api/BasicApi.php +++ b/codegen/Crm/Companies/Api/BasicApi.php @@ -730,7 +730,7 @@ public function createRequest($simple_public_object_input_for_create, string $co * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -753,7 +753,7 @@ public function getById($company_id, $properties = null, $properties_with_histor * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -917,7 +917,7 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -943,7 +943,7 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -998,7 +998,7 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1564,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $company_id company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1584,7 @@ public function update($company_id, $simple_public_object_input, $id_property = * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1745,7 +1745,7 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1768,7 @@ function ($response) { * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1820,7 @@ function ($exception) { * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Companies/Api/BatchApi.php b/codegen/Crm/Companies/Api/BatchApi.php index 738520f4..aade2b85 100644 --- a/codegen/Crm/Companies/Api/BatchApi.php +++ b/codegen/Crm/Companies/Api/BatchApi.php @@ -83,6 +83,9 @@ class BatchApi 'update' => [ 'application/json', ], + 'upsert' => [ + 'application/json', + ], ]; /** @@ -1149,7 +1152,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of companies + * Update a batch of companies by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1167,7 +1170,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of companies + * Update a batch of companies by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1361,7 +1364,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of companies + * Update a batch of companies by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1382,7 +1385,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of companies + * Update a batch of companies by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1526,6 +1529,386 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str ); } + /** + * Operation upsert + * + * Create or update a batch of companies by unique property values + * + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error + */ + public function upsert($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or update a batch of companies by unique property values + * + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Companies\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or update a batch of companies by unique property values + * + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or update a batch of companies by unique property values + * + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upsert' + * + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_upsert' is set + if ($batch_input_simple_public_object_batch_input_upsert === null || (is_array($batch_input_simple_public_object_batch_input_upsert) && count($batch_input_simple_public_object_batch_input_upsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/companies/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_upsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_upsert; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Create http client option * diff --git a/codegen/Crm/Companies/Api/GDPRApi.php b/codegen/Crm/Companies/Api/GDPRApi.php deleted file mode 100644 index 21552525..00000000 --- a/codegen/Crm/Companies/Api/GDPRApi.php +++ /dev/null @@ -1,383 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation purge - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); - } - - /** - * Operation purgeWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation purgeAsync - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation purgeAsyncWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'purge' - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - - // verify the required parameter 'public_gdpr_delete_input' is set - if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_gdpr_delete_input when calling purge' - ); - } - - - $resourcePath = '/crm/v3/objects/companies/gdpr-delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_gdpr_delete_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); - } else { - $httpBody = $public_gdpr_delete_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * 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/Companies/Api/PublicObjectApi.php b/codegen/Crm/Companies/Api/MergeApi.php similarity index 99% rename from codegen/Crm/Companies/Api/PublicObjectApi.php rename to codegen/Crm/Companies/Api/MergeApi.php index ce43ff70..458d19f1 100644 --- a/codegen/Crm/Companies/Api/PublicObjectApi.php +++ b/codegen/Crm/Companies/Api/MergeApi.php @@ -1,6 +1,6 @@ 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( @@ -310,9 +307,6 @@ public function listInvalidProperties() ); } - if ($this->container['association_type_id'] === null) { - $invalidProperties[] = "'association_type_id' can't be null"; - } return $invalidProperties; } @@ -331,7 +325,7 @@ public function valid() /** * Gets association_category * - * @return string + * @return string|null */ public function getAssociationCategory() { @@ -341,7 +335,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category association_category + * @param string|null $association_category association_category * * @return self */ @@ -368,7 +362,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int + * @return int|null */ public function getAssociationTypeId() { @@ -378,7 +372,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id association_type_id + * @param int|null $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicGdprDeleteInput.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php similarity index 82% rename from codegen/Crm/Companies/Model/PublicGdprDeleteInput.php rename to codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 38534c5a..399a836b 100644 --- a/codegen/Crm/Companies/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -1,6 +1,6 @@ */ -class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * * @var string */ - protected static $openAPIModelName = 'PublicGdprDeleteInput'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputUpsert'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,8 +57,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'id_property' => 'string', - 'object_id' => 'string' + 'inputs' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputUpsert[]' ]; /** @@ -69,8 +68,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @psalm-var array */ protected static $openAPIFormats = [ - 'id_property' => null, - 'object_id' => null + 'inputs' => null ]; /** @@ -79,8 +77,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @var boolean[] */ protected static array $openAPINullables = [ - 'id_property' => false, - 'object_id' => false + 'inputs' => false ]; /** @@ -169,8 +166,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'id_property' => 'idProperty', - 'object_id' => 'objectId' + 'inputs' => 'inputs' ]; /** @@ -179,8 +175,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'id_property' => 'setIdProperty', - 'object_id' => 'setObjectId' + 'inputs' => 'setInputs' ]; /** @@ -189,8 +184,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'id_property' => 'getIdProperty', - 'object_id' => 'getObjectId' + 'inputs' => 'getInputs' ]; /** @@ -250,8 +244,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('id_property', $data ?? [], null); - $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); } /** @@ -281,8 +274,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['object_id'] === null) { - $invalidProperties[] = "'object_id' can't be null"; + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; } return $invalidProperties; } @@ -300,55 +293,28 @@ public function valid() /** - * Gets id_property + * Gets inputs * - * @return string|null + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputUpsert[] */ - public function getIdProperty() + public function getInputs() { - return $this->container['id_property']; + return $this->container['inputs']; } /** - * Sets id_property + * Sets inputs * - * @param string|null $id_property id_property + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs * * @return self */ - public function setIdProperty($id_property) + public function setInputs($inputs) { - if (is_null($id_property)) { - throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); } - $this->container['id_property'] = $id_property; - - return $this; - } - - /** - * Gets object_id - * - * @return string - */ - public function getObjectId() - { - return $this->container['object_id']; - } - - /** - * Sets object_id - * - * @param string $object_id object_id - * - * @return self - */ - public function setObjectId($object_id) - { - if (is_null($object_id)) { - throw new \InvalidArgumentException('non-nullable object_id cannot be null'); - } - $this->container['object_id'] = $object_id; + $this->container['inputs'] = $inputs; return $this; } diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php new file mode 100644 index 00000000..1a10382d --- /dev/null +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php new file mode 100644 index 00000000..83c11134 --- /dev/null +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[]', + 'errors' => '\HubSpot\Client\Crm\Companies\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Companies\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Companies\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php index 0b0550e5..3e89e8c1 100644 --- a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php @@ -281,12 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['types'] === null) { - $invalidProperties[] = "'types' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } return $invalidProperties; } @@ -305,7 +299,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] + * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null */ public function getTypes() { @@ -315,7 +309,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $types types + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null $types types * * @return self */ @@ -332,7 +326,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId + * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null */ public function getTo() { @@ -342,7 +336,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId $to to + * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null $to to * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectId.php b/codegen/Crm/Companies/Model/PublicObjectId.php index d46f8828..5f4b7d3e 100644 --- a/codegen/Crm/Companies/Model/PublicObjectId.php +++ b/codegen/Crm/Companies/Model/PublicObjectId.php @@ -274,9 +274,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } return $invalidProperties; } @@ -295,7 +292,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -305,7 +302,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string|null $id id * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php index 5976f3ac..2195bec7 100644 --- a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php @@ -309,21 +309,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['limit'] === null) { - $invalidProperties[] = "'limit' can't be null"; - } - if ($this->container['after'] === null) { - $invalidProperties[] = "'after' can't be null"; - } - if ($this->container['sorts'] === null) { - $invalidProperties[] = "'sorts' can't be null"; - } - if ($this->container['properties'] === null) { - $invalidProperties[] = "'properties' can't be null"; - } - if ($this->container['filter_groups'] === null) { - $invalidProperties[] = "'filter_groups' can't be null"; - } return $invalidProperties; } @@ -369,7 +354,7 @@ public function setQuery($query) /** * Gets limit * - * @return int + * @return int|null */ public function getLimit() { @@ -379,7 +364,7 @@ public function getLimit() /** * Sets limit * - * @param int $limit limit + * @param int|null $limit limit * * @return self */ @@ -396,7 +381,7 @@ public function setLimit($limit) /** * Gets after * - * @return string + * @return string|null */ public function getAfter() { @@ -406,7 +391,7 @@ public function getAfter() /** * Sets after * - * @param string $after after + * @param string|null $after after * * @return self */ @@ -423,7 +408,7 @@ public function setAfter($after) /** * Gets sorts * - * @return string[] + * @return string[]|null */ public function getSorts() { @@ -433,7 +418,7 @@ public function getSorts() /** * Sets sorts * - * @param string[] $sorts sorts + * @param string[]|null $sorts sorts * * @return self */ @@ -450,7 +435,7 @@ public function setSorts($sorts) /** * Gets properties * - * @return string[] + * @return string[]|null */ public function getProperties() { @@ -460,7 +445,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties properties + * @param string[]|null $properties properties * * @return self */ @@ -477,7 +462,7 @@ public function setProperties($properties) /** * Gets filter_groups * - * @return \HubSpot\Client\Crm\Companies\Model\FilterGroup[] + * @return \HubSpot\Client\Crm\Companies\Model\FilterGroup[]|null */ public function getFilterGroups() { @@ -487,7 +472,7 @@ public function getFilterGroups() /** * Sets filter_groups * - * @param \HubSpot\Client\Crm\Companies\Model\FilterGroup[] $filter_groups filter_groups + * @param \HubSpot\Client\Crm\Companies\Model\FilterGroup[]|null $filter_groups filter_groups * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php index a5014a53..8aed582b 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php @@ -58,6 +58,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPITypes = [ 'id_property' => 'string', + 'object_write_trace_id' => 'string', 'id' => 'string', 'properties' => 'array' ]; @@ -71,6 +72,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPIFormats = [ 'id_property' => null, + 'object_write_trace_id' => null, 'id' => null, 'properties' => null ]; @@ -82,6 +84,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'id_property' => false, + 'object_write_trace_id' => false, 'id' => false, 'properties' => false ]; @@ -173,6 +176,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', 'id' => 'id', 'properties' => 'properties' ]; @@ -184,6 +188,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'id' => 'setId', 'properties' => 'setProperties' ]; @@ -195,6 +200,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'id' => 'getId', 'properties' => 'getProperties' ]; @@ -257,6 +263,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -336,6 +343,33 @@ public function setIdProperty($id_property) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets id * diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php new file mode 100644 index 00000000..7fcc17cb --- /dev/null +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property id_property + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php index feeca4e6..54e096d2 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php @@ -57,6 +57,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -68,6 +69,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ + 'object_write_trace_id' => null, 'properties' => null ]; @@ -77,6 +79,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ + 'object_write_trace_id' => false, 'properties' => false ]; @@ -166,6 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -175,6 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -184,6 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -244,6 +250,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -292,6 +299,33 @@ public function valid() } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php index c17fe5c4..f5dcae09 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php @@ -58,6 +58,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -70,6 +71,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, + 'object_write_trace_id' => null, 'properties' => null ]; @@ -80,6 +82,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, + 'object_write_trace_id' => false, 'properties' => false ]; @@ -170,6 +173,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -180,6 +184,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -190,6 +195,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,6 +257,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -281,9 +288,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -305,7 +309,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -315,7 +319,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -329,6 +333,33 @@ public function setAssociations($associations) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php new file mode 100644 index 00000000..e0bd3e59 --- /dev/null +++ b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php @@ -0,0 +1,662 @@ + + */ +class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'new' => 'bool', + 'properties_with_history' => 'array', + 'id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'new' => null, + 'properties_with_history' => null, + 'id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'new' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'new' => 'new', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'new' => 'setNew', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'new' => 'getNew', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('new', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['new'] === null) { + $invalidProperties[] = "'new' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets new + * + * @return bool + */ + public function getNew() + { + return $this->container['new']; + } + + /** + * Sets new + * + * @param bool $new new + * + * @return self + */ + public function setNew($new) + { + if (is_null($new)) { + throw new \InvalidArgumentException('non-nullable new cannot be null'); + } + $this->container['new'] = $new; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Api/BatchApi.php b/codegen/Crm/Contacts/Api/BatchApi.php index 805ff5fc..545e4622 100644 --- a/codegen/Crm/Contacts/Api/BatchApi.php +++ b/codegen/Crm/Contacts/Api/BatchApi.php @@ -83,6 +83,9 @@ class BatchApi 'update' => [ 'application/json', ], + 'upsert' => [ + 'application/json', + ], ]; /** @@ -1149,7 +1152,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of contacts + * Update a batch of contacts by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1167,7 +1170,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of contacts + * Update a batch of contacts by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1361,7 +1364,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of contacts + * Update a batch of contacts by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1382,7 +1385,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of contacts + * Update a batch of contacts by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1526,6 +1529,386 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str ); } + /** + * Operation upsert + * + * Create or update a batch of contacts by unique property values + * + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error + */ + public function upsert($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or update a batch of contacts by unique property values + * + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Contacts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or update a batch of contacts by unique property values + * + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or update a batch of contacts by unique property values + * + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upsert' + * + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_upsert' is set + if ($batch_input_simple_public_object_batch_input_upsert === null || (is_array($batch_input_simple_public_object_batch_input_upsert) && count($batch_input_simple_public_object_batch_input_upsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/contacts/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_upsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_upsert; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Create http client option * diff --git a/codegen/Crm/Contacts/Api/PublicObjectApi.php b/codegen/Crm/Contacts/Api/MergeApi.php similarity index 99% rename from codegen/Crm/Contacts/Api/PublicObjectApi.php rename to codegen/Crm/Contacts/Api/MergeApi.php index 00554d3b..b0634af9 100644 --- a/codegen/Crm/Contacts/Api/PublicObjectApi.php +++ b/codegen/Crm/Contacts/Api/MergeApi.php @@ -1,6 +1,6 @@ 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( @@ -310,9 +307,6 @@ public function listInvalidProperties() ); } - if ($this->container['association_type_id'] === null) { - $invalidProperties[] = "'association_type_id' can't be null"; - } return $invalidProperties; } @@ -331,7 +325,7 @@ public function valid() /** * Gets association_category * - * @return string + * @return string|null */ public function getAssociationCategory() { @@ -341,7 +335,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category association_category + * @param string|null $association_category association_category * * @return self */ @@ -368,7 +362,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int + * @return int|null */ public function getAssociationTypeId() { @@ -378,7 +372,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id association_type_id + * @param int|null $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php new file mode 100644 index 00000000..1e37e2ac --- /dev/null +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputUpsert[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputUpsert[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php new file mode 100644 index 00000000..712b889e --- /dev/null +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php new file mode 100644 index 00000000..5fc4f886 --- /dev/null +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[]', + 'errors' => '\HubSpot\Client\Crm\Contacts\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Contacts\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Contacts\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php index 53e2965d..a3aecce1 100644 --- a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php @@ -281,12 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['types'] === null) { - $invalidProperties[] = "'types' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } return $invalidProperties; } @@ -305,7 +299,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] + * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null */ public function getTypes() { @@ -315,7 +309,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $types types + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null $types types * * @return self */ @@ -332,7 +326,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId + * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null */ public function getTo() { @@ -342,7 +336,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId $to to + * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null $to to * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicObjectId.php b/codegen/Crm/Contacts/Model/PublicObjectId.php index c9b073cc..93e83f08 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectId.php +++ b/codegen/Crm/Contacts/Model/PublicObjectId.php @@ -274,9 +274,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } return $invalidProperties; } @@ -295,7 +292,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -305,7 +302,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string|null $id id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php index 5f81320b..470555fa 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php @@ -309,21 +309,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['limit'] === null) { - $invalidProperties[] = "'limit' can't be null"; - } - if ($this->container['after'] === null) { - $invalidProperties[] = "'after' can't be null"; - } - if ($this->container['sorts'] === null) { - $invalidProperties[] = "'sorts' can't be null"; - } - if ($this->container['properties'] === null) { - $invalidProperties[] = "'properties' can't be null"; - } - if ($this->container['filter_groups'] === null) { - $invalidProperties[] = "'filter_groups' can't be null"; - } return $invalidProperties; } @@ -369,7 +354,7 @@ public function setQuery($query) /** * Gets limit * - * @return int + * @return int|null */ public function getLimit() { @@ -379,7 +364,7 @@ public function getLimit() /** * Sets limit * - * @param int $limit limit + * @param int|null $limit limit * * @return self */ @@ -396,7 +381,7 @@ public function setLimit($limit) /** * Gets after * - * @return string + * @return string|null */ public function getAfter() { @@ -406,7 +391,7 @@ public function getAfter() /** * Sets after * - * @param string $after after + * @param string|null $after after * * @return self */ @@ -423,7 +408,7 @@ public function setAfter($after) /** * Gets sorts * - * @return string[] + * @return string[]|null */ public function getSorts() { @@ -433,7 +418,7 @@ public function getSorts() /** * Sets sorts * - * @param string[] $sorts sorts + * @param string[]|null $sorts sorts * * @return self */ @@ -450,7 +435,7 @@ public function setSorts($sorts) /** * Gets properties * - * @return string[] + * @return string[]|null */ public function getProperties() { @@ -460,7 +445,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties properties + * @param string[]|null $properties properties * * @return self */ @@ -477,7 +462,7 @@ public function setProperties($properties) /** * Gets filter_groups * - * @return \HubSpot\Client\Crm\Contacts\Model\FilterGroup[] + * @return \HubSpot\Client\Crm\Contacts\Model\FilterGroup[]|null */ public function getFilterGroups() { @@ -487,7 +472,7 @@ public function getFilterGroups() /** * Sets filter_groups * - * @param \HubSpot\Client\Crm\Contacts\Model\FilterGroup[] $filter_groups filter_groups + * @param \HubSpot\Client\Crm\Contacts\Model\FilterGroup[]|null $filter_groups filter_groups * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php index 51932e40..2f900c1f 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php @@ -58,6 +58,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPITypes = [ 'id_property' => 'string', + 'object_write_trace_id' => 'string', 'id' => 'string', 'properties' => 'array' ]; @@ -71,6 +72,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPIFormats = [ 'id_property' => null, + 'object_write_trace_id' => null, 'id' => null, 'properties' => null ]; @@ -82,6 +84,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'id_property' => false, + 'object_write_trace_id' => false, 'id' => false, 'properties' => false ]; @@ -173,6 +176,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', 'id' => 'id', 'properties' => 'properties' ]; @@ -184,6 +188,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'id' => 'setId', 'properties' => 'setProperties' ]; @@ -195,6 +200,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'id' => 'getId', 'properties' => 'getProperties' ]; @@ -257,6 +263,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -336,6 +343,33 @@ public function setIdProperty($id_property) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets id * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php new file mode 100644 index 00000000..4e73e5e2 --- /dev/null +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property id_property + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php index 55b52b39..5cfb7dbf 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php @@ -57,6 +57,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -68,6 +69,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ + 'object_write_trace_id' => null, 'properties' => null ]; @@ -77,6 +79,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ + 'object_write_trace_id' => false, 'properties' => false ]; @@ -166,6 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -175,6 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -184,6 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -244,6 +250,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -292,6 +299,33 @@ public function valid() } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php index bdf6c4ba..2a0b7b78 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php @@ -58,6 +58,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -70,6 +71,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, + 'object_write_trace_id' => null, 'properties' => null ]; @@ -80,6 +82,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, + 'object_write_trace_id' => false, 'properties' => false ]; @@ -170,6 +173,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -180,6 +184,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -190,6 +195,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,6 +257,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -281,9 +288,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -305,7 +309,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -315,7 +319,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -329,6 +333,33 @@ public function setAssociations($associations) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php new file mode 100644 index 00000000..6373a477 --- /dev/null +++ b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php @@ -0,0 +1,662 @@ + + */ +class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'new' => 'bool', + 'properties_with_history' => 'array', + 'id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'new' => null, + 'properties_with_history' => null, + 'id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'new' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'new' => 'new', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'new' => 'setNew', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'new' => 'getNew', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('new', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['new'] === null) { + $invalidProperties[] = "'new' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets new + * + * @return bool + */ + public function getNew() + { + return $this->container['new']; + } + + /** + * Sets new + * + * @param bool $new new + * + * @return self + */ + public function setNew($new) + { + if (is_null($new)) { + throw new \InvalidArgumentException('non-nullable new cannot be null'); + } + $this->container['new'] = $new; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Api/BasicApi.php b/codegen/Crm/Deals/Api/BasicApi.php index 25be0129..75ffd833 100644 --- a/codegen/Crm/Deals/Api/BasicApi.php +++ b/codegen/Crm/Deals/Api/BasicApi.php @@ -730,7 +730,7 @@ public function createRequest($simple_public_object_input_for_create, string $co * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -753,7 +753,7 @@ public function getById($deal_id, $properties = null, $properties_with_history = * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -917,7 +917,7 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -943,7 +943,7 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -998,7 +998,7 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1564,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $deal_id deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1584,7 @@ public function update($deal_id, $simple_public_object_input, $id_property = nul * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1745,7 +1745,7 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1768,7 @@ function ($response) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1820,7 @@ function ($exception) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Deals/Api/BatchApi.php b/codegen/Crm/Deals/Api/BatchApi.php index 266eb8fb..1e58ad29 100644 --- a/codegen/Crm/Deals/Api/BatchApi.php +++ b/codegen/Crm/Deals/Api/BatchApi.php @@ -83,6 +83,9 @@ class BatchApi 'update' => [ 'application/json', ], + 'upsert' => [ + 'application/json', + ], ]; /** @@ -1149,7 +1152,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of deals + * Update a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1167,7 +1170,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of deals + * Update a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1361,7 +1364,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of deals + * Update a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1382,7 +1385,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of deals + * Update a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1526,6 +1529,386 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str ); } + /** + * Operation upsert + * + * Create or update a batch of deals by unique property values + * + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error + */ + public function upsert($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or update a batch of deals by unique property values + * + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Deals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or update a batch of deals by unique property values + * + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or update a batch of deals by unique property values + * + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upsert' + * + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_upsert' is set + if ($batch_input_simple_public_object_batch_input_upsert === null || (is_array($batch_input_simple_public_object_batch_input_upsert) && count($batch_input_simple_public_object_batch_input_upsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/deals/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_upsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_upsert; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Create http client option * diff --git a/codegen/Crm/Deals/Api/GDPRApi.php b/codegen/Crm/Deals/Api/GDPRApi.php deleted file mode 100644 index d9965dee..00000000 --- a/codegen/Crm/Deals/Api/GDPRApi.php +++ /dev/null @@ -1,383 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation purge - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); - } - - /** - * Operation purgeWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation purgeAsync - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation purgeAsyncWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'purge' - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - - // verify the required parameter 'public_gdpr_delete_input' is set - if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_gdpr_delete_input when calling purge' - ); - } - - - $resourcePath = '/crm/v3/objects/deals/gdpr-delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_gdpr_delete_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); - } else { - $httpBody = $public_gdpr_delete_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * 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/Deals/Api/PublicObjectApi.php b/codegen/Crm/Deals/Api/MergeApi.php similarity index 98% rename from codegen/Crm/Deals/Api/PublicObjectApi.php rename to codegen/Crm/Deals/Api/MergeApi.php index 726bc65a..cc97229c 100644 --- a/codegen/Crm/Deals/Api/PublicObjectApi.php +++ b/codegen/Crm/Deals/Api/MergeApi.php @@ -1,6 +1,6 @@ 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( @@ -310,9 +307,6 @@ public function listInvalidProperties() ); } - if ($this->container['association_type_id'] === null) { - $invalidProperties[] = "'association_type_id' can't be null"; - } return $invalidProperties; } @@ -331,7 +325,7 @@ public function valid() /** * Gets association_category * - * @return string + * @return string|null */ public function getAssociationCategory() { @@ -341,7 +335,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category association_category + * @param string|null $association_category association_category * * @return self */ @@ -368,7 +362,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int + * @return int|null */ public function getAssociationTypeId() { @@ -378,7 +372,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id association_type_id + * @param int|null $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicGdprDeleteInput.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php similarity index 82% rename from codegen/Crm/Deals/Model/PublicGdprDeleteInput.php rename to codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index b579241e..8914f0a6 100644 --- a/codegen/Crm/Deals/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -1,6 +1,6 @@ */ -class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * * @var string */ - protected static $openAPIModelName = 'PublicGdprDeleteInput'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputUpsert'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,8 +57,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'id_property' => 'string', - 'object_id' => 'string' + 'inputs' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputUpsert[]' ]; /** @@ -69,8 +68,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @psalm-var array */ protected static $openAPIFormats = [ - 'id_property' => null, - 'object_id' => null + 'inputs' => null ]; /** @@ -79,8 +77,7 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali * @var boolean[] */ protected static array $openAPINullables = [ - 'id_property' => false, - 'object_id' => false + 'inputs' => false ]; /** @@ -169,8 +166,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'id_property' => 'idProperty', - 'object_id' => 'objectId' + 'inputs' => 'inputs' ]; /** @@ -179,8 +175,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'id_property' => 'setIdProperty', - 'object_id' => 'setObjectId' + 'inputs' => 'setInputs' ]; /** @@ -189,8 +184,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'id_property' => 'getIdProperty', - 'object_id' => 'getObjectId' + 'inputs' => 'getInputs' ]; /** @@ -250,8 +244,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('id_property', $data ?? [], null); - $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); } /** @@ -281,8 +274,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['object_id'] === null) { - $invalidProperties[] = "'object_id' can't be null"; + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; } return $invalidProperties; } @@ -300,55 +293,28 @@ public function valid() /** - * Gets id_property + * Gets inputs * - * @return string|null + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputUpsert[] */ - public function getIdProperty() + public function getInputs() { - return $this->container['id_property']; + return $this->container['inputs']; } /** - * Sets id_property + * Sets inputs * - * @param string|null $id_property id_property + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs * * @return self */ - public function setIdProperty($id_property) + public function setInputs($inputs) { - if (is_null($id_property)) { - throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); } - $this->container['id_property'] = $id_property; - - return $this; - } - - /** - * Gets object_id - * - * @return string - */ - public function getObjectId() - { - return $this->container['object_id']; - } - - /** - * Sets object_id - * - * @param string $object_id object_id - * - * @return self - */ - public function setObjectId($object_id) - { - if (is_null($object_id)) { - throw new \InvalidArgumentException('non-nullable object_id cannot be null'); - } - $this->container['object_id'] = $object_id; + $this->container['inputs'] = $inputs; return $this; } diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php new file mode 100644 index 00000000..b6b4c84b --- /dev/null +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php new file mode 100644 index 00000000..0edd2e58 --- /dev/null +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[]', + 'errors' => '\HubSpot\Client\Crm\Deals\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Deals\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Deals\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php index bf3fde71..51949fc2 100644 --- a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php @@ -281,12 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['types'] === null) { - $invalidProperties[] = "'types' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } return $invalidProperties; } @@ -305,7 +299,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] + * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null */ public function getTypes() { @@ -315,7 +309,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $types types + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null $types types * * @return self */ @@ -332,7 +326,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId + * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null */ public function getTo() { @@ -342,7 +336,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId $to to + * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null $to to * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicObjectId.php b/codegen/Crm/Deals/Model/PublicObjectId.php index 54205739..76e487cc 100644 --- a/codegen/Crm/Deals/Model/PublicObjectId.php +++ b/codegen/Crm/Deals/Model/PublicObjectId.php @@ -274,9 +274,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } return $invalidProperties; } @@ -295,7 +292,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -305,7 +302,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string|null $id id * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php index f94bb98e..0251d13d 100644 --- a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php @@ -309,21 +309,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['limit'] === null) { - $invalidProperties[] = "'limit' can't be null"; - } - if ($this->container['after'] === null) { - $invalidProperties[] = "'after' can't be null"; - } - if ($this->container['sorts'] === null) { - $invalidProperties[] = "'sorts' can't be null"; - } - if ($this->container['properties'] === null) { - $invalidProperties[] = "'properties' can't be null"; - } - if ($this->container['filter_groups'] === null) { - $invalidProperties[] = "'filter_groups' can't be null"; - } return $invalidProperties; } @@ -369,7 +354,7 @@ public function setQuery($query) /** * Gets limit * - * @return int + * @return int|null */ public function getLimit() { @@ -379,7 +364,7 @@ public function getLimit() /** * Sets limit * - * @param int $limit limit + * @param int|null $limit limit * * @return self */ @@ -396,7 +381,7 @@ public function setLimit($limit) /** * Gets after * - * @return string + * @return string|null */ public function getAfter() { @@ -406,7 +391,7 @@ public function getAfter() /** * Sets after * - * @param string $after after + * @param string|null $after after * * @return self */ @@ -423,7 +408,7 @@ public function setAfter($after) /** * Gets sorts * - * @return string[] + * @return string[]|null */ public function getSorts() { @@ -433,7 +418,7 @@ public function getSorts() /** * Sets sorts * - * @param string[] $sorts sorts + * @param string[]|null $sorts sorts * * @return self */ @@ -450,7 +435,7 @@ public function setSorts($sorts) /** * Gets properties * - * @return string[] + * @return string[]|null */ public function getProperties() { @@ -460,7 +445,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties properties + * @param string[]|null $properties properties * * @return self */ @@ -477,7 +462,7 @@ public function setProperties($properties) /** * Gets filter_groups * - * @return \HubSpot\Client\Crm\Deals\Model\FilterGroup[] + * @return \HubSpot\Client\Crm\Deals\Model\FilterGroup[]|null */ public function getFilterGroups() { @@ -487,7 +472,7 @@ public function getFilterGroups() /** * Sets filter_groups * - * @param \HubSpot\Client\Crm\Deals\Model\FilterGroup[] $filter_groups filter_groups + * @param \HubSpot\Client\Crm\Deals\Model\FilterGroup[]|null $filter_groups filter_groups * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php index 8493345d..c20d0960 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php @@ -58,6 +58,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPITypes = [ 'id_property' => 'string', + 'object_write_trace_id' => 'string', 'id' => 'string', 'properties' => 'array' ]; @@ -71,6 +72,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static $openAPIFormats = [ 'id_property' => null, + 'object_write_trace_id' => null, 'id' => null, 'properties' => null ]; @@ -82,6 +84,7 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'id_property' => false, + 'object_write_trace_id' => false, 'id' => false, 'properties' => false ]; @@ -173,6 +176,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', 'id' => 'id', 'properties' => 'properties' ]; @@ -184,6 +188,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'id' => 'setId', 'properties' => 'setProperties' ]; @@ -195,6 +200,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'id' => 'getId', 'properties' => 'getProperties' ]; @@ -257,6 +263,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -336,6 +343,33 @@ public function setIdProperty($id_property) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets id * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php new file mode 100644 index 00000000..41103472 --- /dev/null +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property id_property + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php index f1b379a0..68034dc1 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php @@ -57,6 +57,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -68,6 +69,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ + 'object_write_trace_id' => null, 'properties' => null ]; @@ -77,6 +79,7 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ + 'object_write_trace_id' => false, 'properties' => false ]; @@ -166,6 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -175,6 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -184,6 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -244,6 +250,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -292,6 +299,33 @@ public function valid() } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php index a9878dde..803bfebf 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php @@ -58,6 +58,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -70,6 +71,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, + 'object_write_trace_id' => null, 'properties' => null ]; @@ -80,6 +82,7 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, + 'object_write_trace_id' => false, 'properties' => false ]; @@ -170,6 +173,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -180,6 +184,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -190,6 +195,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,6 +257,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -281,9 +288,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -305,7 +309,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -315,7 +319,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -329,6 +333,33 @@ public function setAssociations($associations) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php new file mode 100644 index 00000000..927175ea --- /dev/null +++ b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php @@ -0,0 +1,662 @@ + + */ +class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'new' => 'bool', + 'properties_with_history' => 'array', + 'id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'new' => null, + 'properties_with_history' => null, + 'id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'new' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'new' => 'new', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'new' => 'setNew', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'new' => 'getNew', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('new', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['new'] === null) { + $invalidProperties[] = "'new' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets new + * + * @return bool + */ + public function getNew() + { + return $this->container['new']; + } + + /** + * Sets new + * + * @param bool $new new + * + * @return self + */ + public function setNew($new) + { + if (is_null($new)) { + throw new \InvalidArgumentException('non-nullable new cannot be null'); + } + $this->container['new'] = $new; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + +