Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
643 changes: 492 additions & 151 deletions codegen/Crm/Companies/Api/BasicApi.php

Large diffs are not rendered by default.

198 changes: 95 additions & 103 deletions codegen/Crm/Companies/Api/BatchApi.php

Large diffs are not rendered by default.

488 changes: 0 additions & 488 deletions codegen/Crm/Companies/Api/MergeApi.php

This file was deleted.

45 changes: 27 additions & 18 deletions codegen/Crm/Companies/Api/SearchApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -83,13 +83,13 @@ class SearchApi
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
?ClientInterface $client = null,
?Configuration $config = null,
?HeaderSelector $selector = null,
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
Expand Down Expand Up @@ -125,6 +125,8 @@ public function getConfig()
/**
* Operation doSearch
*
* Search for companies
*
* @param \HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
Expand All @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se
/**
* Operation doSearchWithHttpInfo
*
* Search for companies
*
* @param \HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
Expand Down Expand Up @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 200:
Expand Down Expand Up @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont
/**
* Operation doSearchAsync
*
* Search for companies
*
* @param \HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
Expand All @@ -317,6 +324,8 @@ function ($response) {
/**
* Operation doSearchAsyncWithHttpInfo
*
* Search for companies
*
* @param \HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
Expand Down
8 changes: 4 additions & 4 deletions codegen/Crm/Companies/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ class ApiException extends Exception
/**
* The HTTP header of the server response.
*
* @var string[]|null
* @var string[][]|null
*/
protected $responseHeaders;

Expand All @@ -65,7 +65,7 @@ class ApiException extends Exception
*
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param string[][]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
Expand All @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re
/**
* Gets the HTTP response header
*
* @return string[]|null HTTP response header
* @return string[][]|null HTTP response header
*/
public function getResponseHeaders()
{
Expand Down
4 changes: 2 additions & 2 deletions codegen/Crm/Companies/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -486,7 +486,7 @@ public function getHostSettings()
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostSettings, $hostIndex, array $variables = null)
public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null)
{
if (null === $variables) {
$variables = [];
Expand Down
32 changes: 30 additions & 2 deletions codegen/Crm/Companies/HeaderSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string
}

# If none of the available Accept headers is of type "json", then just use all them
$headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
$headersWithJson = $this->selectJsonMimeList($accept);
if (count($headersWithJson) === 0) {
return implode(',', $accept);
}
Expand All @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string
return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
}

/**
* Detects whether a string contains a valid JSON mime type
*
* @param string $searchString
* @return bool
*/
public function isJsonMime(string $searchString): bool
{
return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1;
}

/**
* Select all items from a list containing a JSON mime type
*
* @param array $mimeList
* @return array
*/
private function selectJsonMimeList(array $mimeList): array {
$jsonMimeList = [];
foreach ($mimeList as $mime) {
if($this->isJsonMime($mime)) {
$jsonMimeList[] = $mime;
}
}
return $jsonMimeList;
}


/**
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
*
Expand Down
6 changes: 3 additions & 3 deletions codegen/Crm/Companies/Model/AssociatedId.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -245,10 +245,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
Expand Down
20 changes: 13 additions & 7 deletions codegen/Crm/Companies/Model/AssociationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('association_category', $data ?? [], null);
$this->setIfExists('association_type_id', $data ?? [], null);
Expand Down Expand Up @@ -298,6 +298,9 @@ public function listInvalidProperties()
{
$invalidProperties = [];

if ($this->container['association_category'] === null) {
$invalidProperties[] = "'association_category' can't be null";
}
$allowedValues = $this->getAssociationCategoryAllowableValues();
if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
Expand All @@ -307,6 +310,9 @@ public function listInvalidProperties()
);
}

if ($this->container['association_type_id'] === null) {
$invalidProperties[] = "'association_type_id' can't be null";
}
return $invalidProperties;
}

Expand All @@ -325,7 +331,7 @@ public function valid()
/**
* Gets association_category
*
* @return string|null
* @return string
*/
public function getAssociationCategory()
{
Expand All @@ -335,7 +341,7 @@ public function getAssociationCategory()
/**
* Sets association_category
*
* @param string|null $association_category association_category
* @param string $association_category For [labeled associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#associate-records-with-a-label), the category of the association.
*
* @return self
*/
Expand All @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category)
/**
* Gets association_type_id
*
* @return int|null
* @return int
*/
public function getAssociationTypeId()
{
Expand All @@ -372,7 +378,7 @@ public function getAssociationTypeId()
/**
* Sets association_type_id
*
* @param int|null $association_type_id association_type_id
* @param int $association_type_id The [association type ID](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#association-type-id-values) (e.g., `4` for contact-to-company associations).
*
* @return self
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -239,10 +239,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('inputs', $data ?? [], null);
}
Expand Down
Loading
Loading