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
117 changes: 59 additions & 58 deletions codegen/Cms/AuditLogs/Api/AuditLogsApi.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 AuditLogsApi
* @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 @@ -127,14 +127,14 @@ public function getConfig()
*
* Query audit logs
*
* @param string[] $user_id Comma separated list of user ids to filter by. (optional)
* @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[] $object_id Comma separated list of object ids to filter by. (optional)
* @param string $after Timestamp after which audit logs will be returned (optional)
* @param string $before Timestamp before which audit logs will be returned (optional)
* @param int $limit The number of logs to return. (optional)
* @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string[]|null $user_id Comma separated list of user ids to filter by. (optional)
* @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[]|null $object_id Comma separated list of object ids to filter by. (optional)
* @param string|null $after Timestamp after which audit logs will be returned (optional)
* @param string|null $before Timestamp before which audit logs will be returned (optional)
* @param int|null $limit The number of logs to return. (optional)
* @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Cms\AuditLogs\ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -152,14 +152,14 @@ public function getPage($user_id = null, $event_type = null, $object_type = null
*
* Query audit logs
*
* @param string[] $user_id Comma separated list of user ids to filter by. (optional)
* @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[] $object_id Comma separated list of object ids to filter by. (optional)
* @param string $after Timestamp after which audit logs will be returned (optional)
* @param string $before Timestamp before which audit logs will be returned (optional)
* @param int $limit The number of logs to return. (optional)
* @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string[]|null $user_id Comma separated list of user ids to filter by. (optional)
* @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[]|null $object_id Comma separated list of object ids to filter by. (optional)
* @param string|null $after Timestamp after which audit logs will be returned (optional)
* @param string|null $before Timestamp before which audit logs will be returned (optional)
* @param int|null $limit The number of logs to return. (optional)
* @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Cms\AuditLogs\ApiException on non-2xx response or if the response body is not in the expected format
Expand Down Expand Up @@ -192,18 +192,6 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object

$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 @@ -262,6 +250,19 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object
];
}

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\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -318,14 +319,14 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object
*
* Query audit logs
*
* @param string[] $user_id Comma separated list of user ids to filter by. (optional)
* @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[] $object_id Comma separated list of object ids to filter by. (optional)
* @param string $after Timestamp after which audit logs will be returned (optional)
* @param string $before Timestamp before which audit logs will be returned (optional)
* @param int $limit The number of logs to return. (optional)
* @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string[]|null $user_id Comma separated list of user ids to filter by. (optional)
* @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[]|null $object_id Comma separated list of object ids to filter by. (optional)
* @param string|null $after Timestamp after which audit logs will be returned (optional)
* @param string|null $before Timestamp before which audit logs will be returned (optional)
* @param int|null $limit The number of logs to return. (optional)
* @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand All @@ -346,14 +347,14 @@ function ($response) {
*
* Query audit logs
*
* @param string[] $user_id Comma separated list of user ids to filter by. (optional)
* @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[] $object_id Comma separated list of object ids to filter by. (optional)
* @param string $after Timestamp after which audit logs will be returned (optional)
* @param string $before Timestamp before which audit logs will be returned (optional)
* @param int $limit The number of logs to return. (optional)
* @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string[]|null $user_id Comma separated list of user ids to filter by. (optional)
* @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[]|null $object_id Comma separated list of object ids to filter by. (optional)
* @param string|null $after Timestamp after which audit logs will be returned (optional)
* @param string|null $before Timestamp before which audit logs will be returned (optional)
* @param int|null $limit The number of logs to return. (optional)
* @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -403,14 +404,14 @@ function ($exception) {
/**
* Create request for operation 'getPage'
*
* @param string[] $user_id Comma separated list of user ids to filter by. (optional)
* @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[] $object_id Comma separated list of object ids to filter by. (optional)
* @param string $after Timestamp after which audit logs will be returned (optional)
* @param string $before Timestamp before which audit logs will be returned (optional)
* @param int $limit The number of logs to return. (optional)
* @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string[]|null $user_id Comma separated list of user ids to filter by. (optional)
* @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional)
* @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional)
* @param string[]|null $object_id Comma separated list of object ids to filter by. (optional)
* @param string|null $after Timestamp after which audit logs will be returned (optional)
* @param string|null $before Timestamp before which audit logs will be returned (optional)
* @param int|null $limit The number of logs to return. (optional)
* @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down
8 changes: 4 additions & 4 deletions codegen/Cms/AuditLogs/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/Cms/AuditLogs/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/Cms/AuditLogs/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
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 @@ -246,10 +246,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('paging', $data ?? [], null);
$this->setIfExists('results', $data ?? [], null);
Expand Down
6 changes: 3 additions & 3 deletions codegen/Cms/AuditLogs/Model/Error.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 @@ -275,10 +275,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('sub_category', $data ?? [], null);
$this->setIfExists('context', $data ?? [], null);
Expand Down
6 changes: 3 additions & 3 deletions codegen/Cms/AuditLogs/Model/ErrorDetail.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 @@ -263,10 +263,10 @@ public function getModelName()
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* @param mixed[]|null $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$this->setIfExists('sub_category', $data ?? [], null);
$this->setIfExists('code', $data ?? [], null);
Expand Down
2 changes: 1 addition & 1 deletion codegen/Cms/AuditLogs/Model/ModelInterface.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
6 changes: 3 additions & 3 deletions codegen/Cms/AuditLogs/Model/NextPage.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('link', $data ?? [], null);
$this->setIfExists('after', $data ?? [], null);
Expand Down
Loading