Skip to content

Commit e9ae6dd

Browse files
Merge pull request #452 from HubSpot/feature/CmsCodegenBlogs
Codegen: CMS Blogs clients
2 parents 504ebbf + 46afa63 commit e9ae6dd

89 files changed

Lines changed: 1243 additions & 1230 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php

Lines changed: 195 additions & 259 deletions
Large diffs are not rendered by default.

codegen/Cms/Blogs/Authors/ApiException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* OpenAPI Generator version: 7.3.0
19+
* Generator version: 7.12.0
2020
*/
2121

2222
/**
@@ -49,7 +49,7 @@ class ApiException extends Exception
4949
/**
5050
* The HTTP header of the server response.
5151
*
52-
* @var string[]|null
52+
* @var string[][]|null
5353
*/
5454
protected $responseHeaders;
5555

@@ -65,7 +65,7 @@ class ApiException extends Exception
6565
*
6666
* @param string $message Error message
6767
* @param int $code HTTP status code
68-
* @param string[]|null $responseHeaders HTTP response header
68+
* @param string[][]|null $responseHeaders HTTP response header
6969
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
7070
*/
7171
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
@@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re
7878
/**
7979
* Gets the HTTP response header
8080
*
81-
* @return string[]|null HTTP response header
81+
* @return string[][]|null HTTP response header
8282
*/
8383
public function getResponseHeaders()
8484
{

codegen/Cms/Blogs/Authors/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* OpenAPI Generator version: 7.3.0
19+
* Generator version: 7.12.0
2020
*/
2121

2222
/**
@@ -486,7 +486,7 @@ public function getHostSettings()
486486
* @param array|null $variables hash of variable and the corresponding value (optional)
487487
* @return string URL based on host settings
488488
*/
489-
public static function getHostString(array $hostSettings, $hostIndex, array $variables = null)
489+
public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null)
490490
{
491491
if (null === $variables) {
492492
$variables = [];

codegen/Cms/Blogs/Authors/HeaderSelector.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* OpenAPI Generator version: 7.3.0
19+
* Generator version: 7.12.0
2020
*/
2121

2222
/**
@@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string
8585
}
8686

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

98+
/**
99+
* Detects whether a string contains a valid JSON mime type
100+
*
101+
* @param string $searchString
102+
* @return bool
103+
*/
104+
public function isJsonMime(string $searchString): bool
105+
{
106+
return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1;
107+
}
108+
109+
/**
110+
* Select all items from a list containing a JSON mime type
111+
*
112+
* @param array $mimeList
113+
* @return array
114+
*/
115+
private function selectJsonMimeList(array $mimeList): array {
116+
$jsonMimeList = [];
117+
foreach ($mimeList as $mime) {
118+
if($this->isJsonMime($mime)) {
119+
$jsonMimeList[] = $mime;
120+
}
121+
}
122+
return $jsonMimeList;
123+
}
124+
125+
98126
/**
99127
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
100128
*

codegen/Cms/Blogs/Authors/Model/AttachToLangPrimaryRequestVNext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -258,10 +258,10 @@ public function getModelName()
258258
/**
259259
* Constructor
260260
*
261-
* @param mixed[] $data Associated array of property values
261+
* @param mixed[]|null $data Associated array of property values
262262
* initializing the model
263263
*/
264-
public function __construct(array $data = null)
264+
public function __construct(?array $data = null)
265265
{
266266
$this->setIfExists('language', $data ?? [], null);
267267
$this->setIfExists('id', $data ?? [], null);

codegen/Cms/Blogs/Authors/Model/BatchInputBlogAuthor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -240,10 +240,10 @@ public function getModelName()
240240
/**
241241
* Constructor
242242
*
243-
* @param mixed[] $data Associated array of property values
243+
* @param mixed[]|null $data Associated array of property values
244244
* initializing the model
245245
*/
246-
public function __construct(array $data = null)
246+
public function __construct(?array $data = null)
247247
{
248248
$this->setIfExists('inputs', $data ?? [], null);
249249
}

codegen/Cms/Blogs/Authors/Model/BatchInputJsonNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -240,10 +240,10 @@ public function getModelName()
240240
/**
241241
* Constructor
242242
*
243-
* @param mixed[] $data Associated array of property values
243+
* @param mixed[]|null $data Associated array of property values
244244
* initializing the model
245245
*/
246-
public function __construct(array $data = null)
246+
public function __construct(?array $data = null)
247247
{
248248
$this->setIfExists('inputs', $data ?? [], null);
249249
}

codegen/Cms/Blogs/Authors/Model/BatchInputString.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -240,10 +240,10 @@ public function getModelName()
240240
/**
241241
* Constructor
242242
*
243-
* @param mixed[] $data Associated array of property values
243+
* @param mixed[]|null $data Associated array of property values
244244
* initializing the model
245245
*/
246-
public function __construct(array $data = null)
246+
public function __construct(?array $data = null)
247247
{
248248
$this->setIfExists('inputs', $data ?? [], null);
249249
}

codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -289,10 +289,10 @@ public function getStatusAllowableValues()
289289
/**
290290
* Constructor
291291
*
292-
* @param mixed[] $data Associated array of property values
292+
* @param mixed[]|null $data Associated array of property values
293293
* initializing the model
294294
*/
295-
public function __construct(array $data = null)
295+
public function __construct(?array $data = null)
296296
{
297297
$this->setIfExists('completed_at', $data ?? [], null);
298298
$this->setIfExists('requested_at', $data ?? [], null);

codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthorWithErrors.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* The version of the OpenAPI document: v3
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 7.3.0
20+
* Generator version: 7.12.0
2121
*/
2222

2323
/**
@@ -301,10 +301,10 @@ public function getStatusAllowableValues()
301301
/**
302302
* Constructor
303303
*
304-
* @param mixed[] $data Associated array of property values
304+
* @param mixed[]|null $data Associated array of property values
305305
* initializing the model
306306
*/
307-
public function __construct(array $data = null)
307+
public function __construct(?array $data = null)
308308
{
309309
$this->setIfExists('completed_at', $data ?? [], null);
310310
$this->setIfExists('num_errors', $data ?? [], null);

0 commit comments

Comments
 (0)