Skip to content

Commit d918506

Browse files
Merge pull request #465 from HubSpot/feature/codegenWebhooks
Codegen: Webhooks
2 parents de7d35c + 2fcceff commit d918506

21 files changed

Lines changed: 260 additions & 199 deletions

codegen/Webhooks/Api/SettingsApi.php

Lines changed: 36 additions & 46 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
/**
@@ -89,13 +89,13 @@ class SettingsApi
8989
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
9090
*/
9191
public function __construct(
92-
ClientInterface $client = null,
93-
Configuration $config = null,
94-
HeaderSelector $selector = null,
95-
$hostIndex = 0
92+
?ClientInterface $client = null,
93+
?Configuration $config = null,
94+
?HeaderSelector $selector = null,
95+
int $hostIndex = 0
9696
) {
9797
$this->client = $client ?: new Client();
98-
$this->config = $config ?: new Configuration();
98+
$this->config = $config ?: Configuration::getDefaultConfiguration();
9999
$this->headerSelector = $selector ?: new HeaderSelector();
100100
$this->hostIndex = $hostIndex;
101101
}
@@ -183,18 +183,6 @@ public function clearWithHttpInfo($app_id, string $contentType = self::contentTy
183183

184184
$statusCode = $response->getStatusCode();
185185

186-
if ($statusCode < 200 || $statusCode > 299) {
187-
throw new ApiException(
188-
sprintf(
189-
'[%d] Error connecting to the API (%s)',
190-
$statusCode,
191-
(string) $request->getUri()
192-
),
193-
$statusCode,
194-
$response->getHeaders(),
195-
(string) $response->getBody()
196-
);
197-
}
198186

199187
return [null, $statusCode, $response->getHeaders()];
200188

@@ -373,7 +361,7 @@ public function clearRequest($app_id, string $contentType = self::contentTypes['
373361
/**
374362
* Operation configure
375363
*
376-
* Delete webhook settings
364+
* Update webhook settings
377365
*
378366
* @param int $app_id The ID of the app. (required)
379367
* @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request settings_change_request (required)
@@ -392,7 +380,7 @@ public function configure($app_id, $settings_change_request, string $contentType
392380
/**
393381
* Operation configureWithHttpInfo
394382
*
395-
* Delete webhook settings
383+
* Update webhook settings
396384
*
397385
* @param int $app_id The ID of the app. (required)
398386
* @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required)
@@ -428,18 +416,6 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string
428416

429417
$statusCode = $response->getStatusCode();
430418

431-
if ($statusCode < 200 || $statusCode > 299) {
432-
throw new ApiException(
433-
sprintf(
434-
'[%d] Error connecting to the API (%s)',
435-
$statusCode,
436-
(string) $request->getUri()
437-
),
438-
$statusCode,
439-
$response->getHeaders(),
440-
(string) $response->getBody()
441-
);
442-
}
443419

444420
switch($statusCode) {
445421
case 200:
@@ -498,6 +474,19 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string
498474
];
499475
}
500476

477+
if ($statusCode < 200 || $statusCode > 299) {
478+
throw new ApiException(
479+
sprintf(
480+
'[%d] Error connecting to the API (%s)',
481+
$statusCode,
482+
(string) $request->getUri()
483+
),
484+
$statusCode,
485+
$response->getHeaders(),
486+
(string) $response->getBody()
487+
);
488+
}
489+
501490
$returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse';
502491
if ($returnType === '\SplFileObject') {
503492
$content = $response->getBody(); //stream goes to serializer
@@ -552,7 +541,7 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string
552541
/**
553542
* Operation configureAsync
554543
*
555-
* Delete webhook settings
544+
* Update webhook settings
556545
*
557546
* @param int $app_id The ID of the app. (required)
558547
* @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required)
@@ -574,7 +563,7 @@ function ($response) {
574563
/**
575564
* Operation configureAsyncWithHttpInfo
576565
*
577-
* Delete webhook settings
566+
* Update webhook settings
578567
*
579568
* @param int $app_id The ID of the app. (required)
580569
* @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required)
@@ -792,18 +781,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT
792781

793782
$statusCode = $response->getStatusCode();
794783

795-
if ($statusCode < 200 || $statusCode > 299) {
796-
throw new ApiException(
797-
sprintf(
798-
'[%d] Error connecting to the API (%s)',
799-
$statusCode,
800-
(string) $request->getUri()
801-
),
802-
$statusCode,
803-
$response->getHeaders(),
804-
(string) $response->getBody()
805-
);
806-
}
807784

808785
switch($statusCode) {
809786
case 200:
@@ -862,6 +839,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT
862839
];
863840
}
864841

842+
if ($statusCode < 200 || $statusCode > 299) {
843+
throw new ApiException(
844+
sprintf(
845+
'[%d] Error connecting to the API (%s)',
846+
$statusCode,
847+
(string) $request->getUri()
848+
),
849+
$statusCode,
850+
$response->getHeaders(),
851+
(string) $response->getBody()
852+
);
853+
}
854+
865855
$returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse';
866856
if ($returnType === '\SplFileObject') {
867857
$content = $response->getBody(); //stream goes to serializer

0 commit comments

Comments
 (0)