Skip to content

Commit 7df07ba

Browse files
Merge pull request #533 from HubSpot/feture/crmAssociationsV4
Codegen: CRM Associations and Associations Schema v4
2 parents 618c94d + 241a6a0 commit 7df07ba

File tree

70 files changed

+5481
-5038
lines changed

Some content is hidden

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

70 files changed

+5481
-5038
lines changed

codegen/Crm/Associations/V4/Api/BasicApi.php

Lines changed: 208 additions & 336 deletions
Large diffs are not rendered by default.

codegen/Crm/Associations/V4/Api/BatchApi.php

Lines changed: 306 additions & 391 deletions
Large diffs are not rendered by default.

codegen/Crm/Associations/V4/Api/ReportApi.php

Lines changed: 83 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* ReportApi
4-
* PHP version 7.4
4+
* PHP version 8.1
55
*
66
* @category Class
77
* @package HubSpot\Client\Crm\Associations\V4
@@ -12,11 +12,11 @@
1212
/**
1313
* Associations
1414
*
15-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
15+
* Basepom for all HubSpot Projects
1616
*
1717
* The version of the OpenAPI document: v4
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.18.0
2020
*/
2121

2222
/**
@@ -34,8 +34,11 @@
3434
use GuzzleHttp\Psr7\MultipartStream;
3535
use GuzzleHttp\Psr7\Request;
3636
use GuzzleHttp\RequestOptions;
37+
use Psr\Http\Message\RequestInterface;
38+
use Psr\Http\Message\ResponseInterface;
3739
use HubSpot\Client\Crm\Associations\V4\ApiException;
3840
use HubSpot\Client\Crm\Associations\V4\Configuration;
41+
use HubSpot\Client\Crm\Associations\V4\FormDataProcessor;
3942
use HubSpot\Client\Crm\Associations\V4\HeaderSelector;
4043
use HubSpot\Client\Crm\Associations\V4\ObjectSerializer;
4144

@@ -127,7 +130,7 @@ public function getConfig()
127130
*
128131
* Report
129132
*
130-
* @param int $user_id (required)
133+
* @param int $user_id The user for the report (required)
131134
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['request'] to see the possible values for this operation
132135
*
133136
* @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response or if the response body is not in the expected format
@@ -145,7 +148,7 @@ public function request($user_id, string $contentType = self::contentTypes['requ
145148
*
146149
* Report
147150
*
148-
* @param int $user_id (required)
151+
* @param int $user_id The user for the report (required)
149152
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['request'] to see the possible values for this operation
150153
*
151154
* @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response or if the response body is not in the expected format
@@ -181,61 +184,21 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten
181184

182185
switch($statusCode) {
183186
case 200:
184-
if ('\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse' === '\SplFileObject') {
185-
$content = $response->getBody(); //stream goes to serializer
186-
} else {
187-
$content = (string) $response->getBody();
188-
if ('\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse' !== 'string') {
189-
try {
190-
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
191-
} catch (\JsonException $exception) {
192-
throw new ApiException(
193-
sprintf(
194-
'Error JSON decoding server response (%s)',
195-
$request->getUri()
196-
),
197-
$statusCode,
198-
$response->getHeaders(),
199-
$content
200-
);
201-
}
202-
}
203-
}
204-
205-
return [
206-
ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse', []),
207-
$response->getStatusCode(),
208-
$response->getHeaders()
209-
];
187+
return $this->handleResponseWithDataType(
188+
'\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse',
189+
$request,
190+
$response,
191+
);
210192
default:
211-
if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' === '\SplFileObject') {
212-
$content = $response->getBody(); //stream goes to serializer
213-
} else {
214-
$content = (string) $response->getBody();
215-
if ('\HubSpot\Client\Crm\Associations\V4\Model\Error' !== 'string') {
216-
try {
217-
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
218-
} catch (\JsonException $exception) {
219-
throw new ApiException(
220-
sprintf(
221-
'Error JSON decoding server response (%s)',
222-
$request->getUri()
223-
),
224-
$statusCode,
225-
$response->getHeaders(),
226-
$content
227-
);
228-
}
229-
}
230-
}
231-
232-
return [
233-
ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Associations\V4\Model\Error', []),
234-
$response->getStatusCode(),
235-
$response->getHeaders()
236-
];
193+
return $this->handleResponseWithDataType(
194+
'\HubSpot\Client\Crm\Associations\V4\Model\Error',
195+
$request,
196+
$response,
197+
);
237198
}
238199

200+
201+
239202
if ($statusCode < 200 || $statusCode > 299) {
240203
throw new ApiException(
241204
sprintf(
@@ -249,34 +212,11 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten
249212
);
250213
}
251214

252-
$returnType = '\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse';
253-
if ($returnType === '\SplFileObject') {
254-
$content = $response->getBody(); //stream goes to serializer
255-
} else {
256-
$content = (string) $response->getBody();
257-
if ($returnType !== 'string') {
258-
try {
259-
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
260-
} catch (\JsonException $exception) {
261-
throw new ApiException(
262-
sprintf(
263-
'Error JSON decoding server response (%s)',
264-
$request->getUri()
265-
),
266-
$statusCode,
267-
$response->getHeaders(),
268-
$content
269-
);
270-
}
271-
}
272-
}
273-
274-
return [
275-
ObjectSerializer::deserialize($content, $returnType, []),
276-
$response->getStatusCode(),
277-
$response->getHeaders()
278-
];
279-
215+
return $this->handleResponseWithDataType(
216+
'\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse',
217+
$request,
218+
$response,
219+
);
280220
} catch (ApiException $e) {
281221
switch ($e->getCode()) {
282222
case 200:
@@ -286,16 +226,18 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten
286226
$e->getResponseHeaders()
287227
);
288228
$e->setResponseObject($data);
289-
break;
229+
throw $e;
290230
default:
291231
$data = ObjectSerializer::deserialize(
292232
$e->getResponseBody(),
293233
'\HubSpot\Client\Crm\Associations\V4\Model\Error',
294234
$e->getResponseHeaders()
295235
);
296236
$e->setResponseObject($data);
297-
break;
237+
throw $e;
298238
}
239+
240+
299241
throw $e;
300242
}
301243
}
@@ -305,7 +247,7 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten
305247
*
306248
* Report
307249
*
308-
* @param int $user_id (required)
250+
* @param int $user_id The user for the report (required)
309251
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['request'] to see the possible values for this operation
310252
*
311253
* @throws \InvalidArgumentException
@@ -326,7 +268,7 @@ function ($response) {
326268
*
327269
* Report
328270
*
329-
* @param int $user_id (required)
271+
* @param int $user_id The user for the report (required)
330272
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['request'] to see the possible values for this operation
331273
*
332274
* @throws \InvalidArgumentException
@@ -376,7 +318,7 @@ function ($exception) {
376318
/**
377319
* Create request for operation 'request'
378320
*
379-
* @param int $user_id (required)
321+
* @param int $user_id The user for the report (required)
380322
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['request'] to see the possible values for this operation
381323
*
382324
* @throws \InvalidArgumentException
@@ -485,6 +427,57 @@ protected function createHttpClientOption()
485427
}
486428
}
487429

430+
if ($this->config->getCertFile()) {
431+
$options[RequestOptions::CERT] = $this->config->getCertFile();
432+
}
433+
434+
if ($this->config->getKeyFile()) {
435+
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
436+
}
437+
488438
return $options;
489439
}
440+
441+
private function handleResponseWithDataType(
442+
string $dataType,
443+
RequestInterface $request,
444+
ResponseInterface $response
445+
): array {
446+
if ($dataType === '\SplFileObject') {
447+
$content = $response->getBody(); //stream goes to serializer
448+
} else {
449+
$content = (string) $response->getBody();
450+
if ($dataType !== 'string') {
451+
try {
452+
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
453+
} catch (\JsonException $exception) {
454+
throw new ApiException(
455+
sprintf(
456+
'Error JSON decoding server response (%s)',
457+
$request->getUri()
458+
),
459+
$response->getStatusCode(),
460+
$response->getHeaders(),
461+
$content
462+
);
463+
}
464+
}
465+
}
466+
467+
return [
468+
ObjectSerializer::deserialize($content, $dataType, []),
469+
$response->getStatusCode(),
470+
$response->getHeaders()
471+
];
472+
}
473+
474+
private function responseWithinRangeCode(
475+
string $rangeCode,
476+
int $statusCode
477+
): bool {
478+
$left = (int) ($rangeCode[0].'00');
479+
$right = (int) ($rangeCode[0].'99');
480+
481+
return $statusCode >= $left && $statusCode <= $right;
482+
}
490483
}

codegen/Crm/Associations/V4/ApiException.php

Lines changed: 3 additions & 3 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\Crm\Associations\V4
@@ -12,11 +12,11 @@
1212
/**
1313
* Associations
1414
*
15-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
15+
* Basepom for all HubSpot Projects
1616
*
1717
* The version of the OpenAPI document: v4
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.18.0
2020
*/
2121

2222
/**

codegen/Crm/Associations/V4/Configuration.php

Lines changed: 61 additions & 4 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\Crm\Associations\V4
@@ -12,11 +12,11 @@
1212
/**
1313
* Associations
1414
*
15-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
15+
* Basepom for all HubSpot Projects
1616
*
1717
* The version of the OpenAPI document: v4
1818
* Generated by: https://openapi-generator.tech
19-
* Generator version: 7.12.0
19+
* Generator version: 7.18.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\Crm\Associations\V4
@@ -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
*

0 commit comments

Comments
 (0)