Skip to content

Commit 0a09f9b

Browse files
Merge pull request #461 from HubSpot/feature/codegenMarketingForms
Codegen: Marketing Forms
2 parents f6052cb + 1a1f538 commit 0a09f9b

50 files changed

Lines changed: 3083 additions & 3012 deletions

Some content is hidden

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

codegen/Marketing/Forms/Api/FormsApi.php

Lines changed: 96 additions & 103 deletions
Large diffs are not rendered by default.

codegen/Marketing/Forms/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/Marketing/Forms/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/Marketing/Forms/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/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPaging.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
/**
@@ -245,10 +245,10 @@ public function getModelName()
245245
/**
246246
* Constructor
247247
*
248-
* @param mixed[] $data Associated array of property values
248+
* @param mixed[]|null $data Associated array of property values
249249
* initializing the model
250250
*/
251-
public function __construct(array $data = null)
251+
public function __construct(?array $data = null)
252252
{
253253
$this->setIfExists('paging', $data ?? [], null);
254254
$this->setIfExists('results', $data ?? [], null);

codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPagingResultsInner.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
/**
@@ -312,10 +312,10 @@ public function getFormTypeAllowableValues()
312312
/**
313313
* Constructor
314314
*
315-
* @param mixed[] $data Associated array of property values
315+
* @param mixed[]|null $data Associated array of property values
316316
* initializing the model
317317
*/
318-
public function __construct(array $data = null)
318+
public function __construct(?array $data = null)
319319
{
320320
$this->setIfExists('form_type', $data ?? [], 'hubspot');
321321
$this->setIfExists('id', $data ?? [], null);

0 commit comments

Comments
 (0)