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
163 changes: 84 additions & 79 deletions codegen/Crm/Imports/Api/CoreApi.php

Large diffs are not rendered by default.

105 changes: 68 additions & 37 deletions codegen/Crm/Imports/Api/PublicImportsApi.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 PublicImportsApi
* @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 @@ -126,35 +126,39 @@ public function getConfig()
* Operation getErrors
*
* @param int $import_id import_id (required)
* @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional)
* @param int $limit The maximum number of results to display per page. (optional)
* @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional)
* @param int|null $limit The maximum number of results to display per page. (optional)
* @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional)
* @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging|\HubSpot\Client\Crm\Imports\Model\Error
*/
public function getErrors($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0])
public function getErrors($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0])
{
list($response) = $this->getErrorsWithHttpInfo($import_id, $after, $limit, $contentType);
list($response) = $this->getErrorsWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType);
return $response;
}

/**
* Operation getErrorsWithHttpInfo
*
* @param int $import_id (required)
* @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional)
* @param int $limit The maximum number of results to display per page. (optional)
* @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional)
* @param int|null $limit The maximum number of results to display per page. (optional)
* @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional)
* @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings)
*/
public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0])
public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0])
{
$request = $this->getErrorsRequest($import_id, $after, $limit, $contentType);
$request = $this->getErrorsRequest($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType);

try {
$options = $this->createHttpClientOption();
Expand All @@ -178,18 +182,6 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = 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:
Expand Down Expand Up @@ -248,6 +240,19 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null,
];
}

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

$returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -303,16 +308,18 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null,
* Operation getErrorsAsync
*
* @param int $import_id (required)
* @param string $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int $limit The maximum number of results to display per page. (optional)
* @param string|null $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int|null $limit The maximum number of results to display per page. (optional)
* @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional)
* @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getErrorsAsync($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0])
public function getErrorsAsync($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0])
{
return $this->getErrorsAsyncWithHttpInfo($import_id, $after, $limit, $contentType)
return $this->getErrorsAsyncWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType)
->then(
function ($response) {
return $response[0];
Expand All @@ -324,17 +331,19 @@ function ($response) {
* Operation getErrorsAsyncWithHttpInfo
*
* @param int $import_id (required)
* @param string $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int $limit The maximum number of results to display per page. (optional)
* @param string|null $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int|null $limit The maximum number of results to display per page. (optional)
* @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional)
* @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getErrorsAsyncWithHttpInfo($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0])
public function getErrorsAsyncWithHttpInfo($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0])
{
$returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging';
$request = $this->getErrorsRequest($import_id, $after, $limit, $contentType);
$request = $this->getErrorsRequest($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType);

return $this->client
->sendAsync($request, $this->createHttpClientOption())
Expand Down Expand Up @@ -376,14 +385,16 @@ function ($exception) {
* Create request for operation 'getErrors'
*
* @param int $import_id (required)
* @param string $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int $limit The maximum number of results to display per page. (optional)
* @param string|null $after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. (optional)
* @param int|null $limit The maximum number of results to display per page. (optional)
* @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional)
* @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getErrorsRequest($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0])
public function getErrorsRequest($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0])
{

// verify the required parameter 'import_id' is set
Expand All @@ -396,6 +407,8 @@ public function getErrorsRequest($import_id, $after = null, $limit = null, strin





$resourcePath = '/crm/v3/imports/{importId}/errors';
$formParams = [];
$queryParams = [];
Expand All @@ -421,6 +434,24 @@ public function getErrorsRequest($import_id, $after = null, $limit = null, strin
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$include_error_message,
'includeErrorMessage', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$include_row_data,
'includeRowData', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);


// path params
Expand Down
8 changes: 4 additions & 4 deletions codegen/Crm/Imports/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/Imports/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/Imports/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/Imports/Model/ActionResponse.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 @@ -282,10 +282,10 @@ public function getStatusAllowableValues()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('completed_at', $data ?? [], null);
$this->setIfExists('requested_at', $data ?? [], null);
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 @@ -245,10 +245,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('paging', $data ?? [], null);
$this->setIfExists('results', $data ?? [], null);
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 @@ -245,10 +245,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('paging', $data ?? [], null);
$this->setIfExists('results', $data ?? [], null);
Expand Down
Loading