Skip to content

Commit f92c346

Browse files
Codegen: CMS Blogs Authors and Tags
1 parent ccdf2b0 commit f92c346

48 files changed

Lines changed: 1426 additions & 1838 deletions

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: 260 additions & 751 deletions
Large diffs are not rendered by default.

codegen/Cms/Blogs/Authors/ApiException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* ApiException
4-
* PHP version 7.4
4+
* PHP version 8.1
55
*
66
* @category Class
77
* @package HubSpot\Client\Cms\Blogs\Authors
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.17.0
2020
*/
2121

2222
/**

codegen/Cms/Blogs/Authors/Configuration.php

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Configuration
4-
* PHP version 7.4
4+
* PHP version 8.1
55
*
66
* @category Class
77
* @package HubSpot\Client\Cms\Blogs\Authors
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.17.0
2020
*/
2121

2222
/**
@@ -29,7 +29,7 @@
2929

3030
/**
3131
* Configuration Class Doc Comment
32-
* PHP version 7.4
32+
* PHP version 8.1
3333
*
3434
* @category Class
3535
* @package HubSpot\Client\Cms\Blogs\Authors
@@ -123,6 +123,20 @@ class Configuration
123123
*/
124124
protected $tempFolderPath;
125125

126+
/**
127+
* Path to a certificate file, for mTLS
128+
*
129+
* @var string
130+
*/
131+
protected $certFile;
132+
133+
/**
134+
* Path to a key file, for mTLS
135+
*
136+
* @var string
137+
*/
138+
protected $keyFile;
139+
126140
/**
127141
* Constructor
128142
*/
@@ -396,6 +410,49 @@ public function getTempFolderPath()
396410
return $this->tempFolderPath;
397411
}
398412

413+
/**
414+
* Sets the certificate file path, for mTLS
415+
*
416+
* @return $this
417+
*/
418+
public function setCertFile($certFile)
419+
{
420+
$this->certFile = $certFile;
421+
return $this;
422+
}
423+
424+
/**
425+
* Gets the certificate file path, for mTLS
426+
*
427+
* @return string Certificate file path
428+
*/
429+
public function getCertFile()
430+
{
431+
return $this->certFile;
432+
}
433+
434+
/**
435+
* Sets the certificate key path, for mTLS
436+
*
437+
* @return $this
438+
*/
439+
public function setKeyFile($keyFile)
440+
{
441+
$this->keyFile = $keyFile;
442+
return $this;
443+
}
444+
445+
/**
446+
* Gets the certificate key path, for mTLS
447+
*
448+
* @return string Certificate key path
449+
*/
450+
public function getKeyFile()
451+
{
452+
return $this->keyFile;
453+
}
454+
455+
399456
/**
400457
* Gets the default configuration instance
401458
*
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
<?php
2+
/**
3+
* FormDataProcessor
4+
* PHP version 7.4
5+
*
6+
* @category Class
7+
* @package HubSpot\Client\Cms\Blogs\Authors
8+
* @author OpenAPI Generator team
9+
* @link https://openapi-generator.tech
10+
*/
11+
12+
/**
13+
* Authors
14+
*
15+
* Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags
16+
*
17+
* The version of the OpenAPI document: v3
18+
* Generated by: https://openapi-generator.tech
19+
* Generator version: 7.17.0
20+
*/
21+
22+
/**
23+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
24+
* https://openapi-generator.tech
25+
* Do not edit the class manually.
26+
*/
27+
28+
namespace HubSpot\Client\Cms\Blogs\Authors;
29+
30+
use ArrayAccess;
31+
use DateTime;
32+
use GuzzleHttp\Psr7\Utils;
33+
use Psr\Http\Message\StreamInterface;
34+
use SplFileObject;
35+
use HubSpot\Client\Cms\Blogs\Authors\Model\ModelInterface;
36+
37+
/**
38+
* FormDataProcessor Class Doc Comment
39+
*
40+
* @category Class
41+
* @package HubSpot\Client\Cms\Blogs\Authors
42+
* @author OpenAPI Generator team
43+
* @link https://openapi-generator.tech
44+
*/
45+
class FormDataProcessor
46+
{
47+
/**
48+
* Tags whether payload passed to ::prepare() contains one or more
49+
* SplFileObject or stream values.
50+
*/
51+
public bool $has_file = false;
52+
53+
/**
54+
* Take value and turn it into an array suitable for inclusion in
55+
* the http body (form parameter). If it's a string, pass through unchanged
56+
* If it's a datetime object, format it in ISO8601
57+
*
58+
* @param array<string|bool|array|DateTime|ArrayAccess|SplFileObject> $values the value of the form parameter
59+
*
60+
* @return array [key => value] of formdata
61+
*/
62+
public function prepare(array $values): array
63+
{
64+
$this->has_file = false;
65+
$result = [];
66+
67+
foreach ($values as $k => $v) {
68+
if ($v === null) {
69+
continue;
70+
}
71+
72+
$result[$k] = $this->makeFormSafe($v);
73+
}
74+
75+
return $result;
76+
}
77+
78+
/**
79+
* Flattens a multi-level array of data and generates a single-level array
80+
* compatible with formdata - a single-level array where the keys use bracket
81+
* notation to signify nested data.
82+
*
83+
* credit: https://github.com/FranBar1966/FlatPHP
84+
*/
85+
public static function flatten(array $source, string $start = ''): array
86+
{
87+
$opt = [
88+
'prefix' => '[',
89+
'suffix' => ']',
90+
'suffix-end' => true,
91+
'prefix-list' => '[',
92+
'suffix-list' => ']',
93+
'suffix-list-end' => true,
94+
];
95+
96+
if ($start === '') {
97+
$currentPrefix = '';
98+
$currentSuffix = '';
99+
$currentSuffixEnd = false;
100+
} elseif (array_is_list($source)) {
101+
$currentPrefix = $opt['prefix-list'];
102+
$currentSuffix = $opt['suffix-list'];
103+
$currentSuffixEnd = $opt['suffix-list-end'];
104+
} else {
105+
$currentPrefix = $opt['prefix'];
106+
$currentSuffix = $opt['suffix'];
107+
$currentSuffixEnd = $opt['suffix-end'];
108+
}
109+
110+
$currentName = $start;
111+
$result = [];
112+
113+
foreach ($source as $key => $val) {
114+
$currentName .= $currentPrefix.$key;
115+
116+
if (is_array($val) && !empty($val)) {
117+
$currentName .= $currentSuffix;
118+
$result += self::flatten($val, $currentName);
119+
} else {
120+
if ($currentSuffixEnd) {
121+
$currentName .= $currentSuffix;
122+
}
123+
124+
if (is_resource($val)) {
125+
$result[$currentName] = $val;
126+
} else {
127+
$result[$currentName] = ObjectSerializer::toString($val);
128+
}
129+
}
130+
131+
$currentName = $start;
132+
}
133+
134+
return $result;
135+
}
136+
137+
/**
138+
* formdata must be limited to scalars or arrays of scalar values,
139+
* or a resource for a file upload. Here we iterate through all available
140+
* data and identify how to handle each scenario
141+
*/
142+
protected function makeFormSafe($value)
143+
{
144+
if ($value instanceof SplFileObject) {
145+
return $this->processFiles([$value])[0];
146+
}
147+
148+
if (is_resource($value)) {
149+
$this->has_file = true;
150+
151+
return $value;
152+
}
153+
154+
if ($value instanceof ModelInterface) {
155+
return $this->processModel($value);
156+
}
157+
158+
if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) {
159+
$data = [];
160+
161+
foreach ($value as $k => $v) {
162+
$data[$k] = $this->makeFormSafe($v);
163+
}
164+
165+
return $data;
166+
}
167+
168+
return ObjectSerializer::toString($value);
169+
}
170+
171+
/**
172+
* We are able to handle nested ModelInterface. We do not simply call
173+
* json_decode(json_encode()) because any given model may have binary data
174+
* or other data that cannot be serialized to a JSON string
175+
*/
176+
protected function processModel(ModelInterface $model): array
177+
{
178+
$result = [];
179+
180+
foreach ($model::openAPITypes() as $name => $type) {
181+
$value = $model->offsetGet($name);
182+
183+
if ($value === null) {
184+
continue;
185+
}
186+
187+
if (strpos($type, '\SplFileObject') !== false) {
188+
$file = is_array($value) ? $value : [$value];
189+
$result[$name] = $this->processFiles($file);
190+
191+
continue;
192+
}
193+
194+
if ($value instanceof ModelInterface) {
195+
$result[$name] = $this->processModel($value);
196+
197+
continue;
198+
}
199+
200+
if (is_array($value) || is_object($value)) {
201+
$result[$name] = $this->makeFormSafe($value);
202+
203+
continue;
204+
}
205+
206+
$result[$name] = ObjectSerializer::toString($value);
207+
}
208+
209+
return $result;
210+
}
211+
212+
/**
213+
* Handle file data
214+
*/
215+
protected function processFiles(array $files): array
216+
{
217+
$this->has_file = true;
218+
219+
$result = [];
220+
221+
foreach ($files as $i => $file) {
222+
if (is_array($file)) {
223+
$result[$i] = $this->processFiles($file);
224+
225+
continue;
226+
}
227+
228+
if ($file instanceof StreamInterface) {
229+
$result[$i] = $file;
230+
231+
continue;
232+
}
233+
234+
if ($file instanceof SplFileObject) {
235+
$result[$i] = $this->tryFopen($file);
236+
}
237+
}
238+
239+
return $result;
240+
}
241+
242+
private function tryFopen(SplFileObject $file)
243+
{
244+
return Utils::tryFopen($file->getRealPath(), 'rb');
245+
}
246+
}

codegen/Cms/Blogs/Authors/HeaderSelector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* HeaderSelector
4-
* PHP version 7.4
4+
* PHP version 8.1
55
*
66
* @category Class
77
* @package HubSpot\Client\Cms\Blogs\Authors
@@ -16,7 +16,7 @@
1616
*
1717
* The version of the OpenAPI document: v3
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.17.0
2020
*/
2121

2222
/**

0 commit comments

Comments
 (0)