Skip to content

Commit 0c3f7f5

Browse files
Merge pull request #462 from HubSpot/feature/codegenMarketingTransactional
Codegen: Marketing Transactional
2 parents 0a09f9b + b7421a3 commit 0c3f7f5

18 files changed

Lines changed: 259 additions & 188 deletions

codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php

Lines changed: 79 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
*/
1111

1212
/**
13-
* Marketing Transactional Single Send
13+
* Transactional Single Send
1414
*
1515
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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
/**
@@ -95,13 +95,13 @@ class PublicSMTPTokensApi
9595
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
9696
*/
9797
public function __construct(
98-
ClientInterface $client = null,
99-
Configuration $config = null,
100-
HeaderSelector $selector = null,
101-
$hostIndex = 0
98+
?ClientInterface $client = null,
99+
?Configuration $config = null,
100+
?HeaderSelector $selector = null,
101+
int $hostIndex = 0
102102
) {
103103
$this->client = $client ?: new Client();
104-
$this->config = $config ?: new Configuration();
104+
$this->config = $config ?: Configuration::getDefaultConfiguration();
105105
$this->headerSelector = $selector ?: new HeaderSelector();
106106
$this->hostIndex = $hostIndex;
107107
}
@@ -189,18 +189,6 @@ public function archiveTokenWithHttpInfo($token_id, string $contentType = self::
189189

190190
$statusCode = $response->getStatusCode();
191191

192-
if ($statusCode < 200 || $statusCode > 299) {
193-
throw new ApiException(
194-
sprintf(
195-
'[%d] Error connecting to the API (%s)',
196-
$statusCode,
197-
(string) $request->getUri()
198-
),
199-
$statusCode,
200-
$response->getHeaders(),
201-
(string) $response->getBody()
202-
);
203-
}
204192

205193
return [null, $statusCode, $response->getHeaders()];
206194

@@ -431,18 +419,6 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con
431419

432420
$statusCode = $response->getStatusCode();
433421

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

447423
switch($statusCode) {
448424
case 201:
@@ -501,6 +477,19 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con
501477
];
502478
}
503479

480+
if ($statusCode < 200 || $statusCode > 299) {
481+
throw new ApiException(
482+
sprintf(
483+
'[%d] Error connecting to the API (%s)',
484+
$statusCode,
485+
(string) $request->getUri()
486+
),
487+
$statusCode,
488+
$response->getHeaders(),
489+
(string) $response->getBody()
490+
);
491+
}
492+
504493
$returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView';
505494
if ($returnType === '\SplFileObject') {
506495
$content = $response->getBody(); //stream goes to serializer
@@ -776,18 +765,6 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self::
776765

777766
$statusCode = $response->getStatusCode();
778767

779-
if ($statusCode < 200 || $statusCode > 299) {
780-
throw new ApiException(
781-
sprintf(
782-
'[%d] Error connecting to the API (%s)',
783-
$statusCode,
784-
(string) $request->getUri()
785-
),
786-
$statusCode,
787-
$response->getHeaders(),
788-
(string) $response->getBody()
789-
);
790-
}
791768

792769
switch($statusCode) {
793770
case 200:
@@ -846,6 +823,19 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self::
846823
];
847824
}
848825

826+
if ($statusCode < 200 || $statusCode > 299) {
827+
throw new ApiException(
828+
sprintf(
829+
'[%d] Error connecting to the API (%s)',
830+
$statusCode,
831+
(string) $request->getUri()
832+
),
833+
$statusCode,
834+
$response->getHeaders(),
835+
(string) $response->getBody()
836+
);
837+
}
838+
849839
$returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView';
850840
if ($returnType === '\SplFileObject') {
851841
$content = $response->getBody(); //stream goes to serializer
@@ -1071,10 +1061,10 @@ public function getTokenByIdRequest($token_id, string $contentType = self::conte
10711061
*
10721062
* Query SMTP API tokens by campaign name or an emailCampaignId.
10731063
*
1074-
* @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1075-
* @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1076-
* @param string $after Starting point to get the next set of results. (optional)
1077-
* @param int $limit Maximum number of tokens to return. (optional)
1064+
* @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1065+
* @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1066+
* @param string|null $after Starting point to get the next set of results. (optional)
1067+
* @param int|null $limit Maximum number of tokens to return. (optional)
10781068
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation
10791069
*
10801070
* @throws \HubSpot\Client\Marketing\Transactional\ApiException on non-2xx response or if the response body is not in the expected format
@@ -1092,10 +1082,10 @@ public function getTokensPage($campaign_name = null, $email_campaign_id = null,
10921082
*
10931083
* Query SMTP API tokens by campaign name or an emailCampaignId.
10941084
*
1095-
* @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1096-
* @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1097-
* @param string $after Starting point to get the next set of results. (optional)
1098-
* @param int $limit Maximum number of tokens to return. (optional)
1085+
* @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1086+
* @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1087+
* @param string|null $after Starting point to get the next set of results. (optional)
1088+
* @param int|null $limit Maximum number of tokens to return. (optional)
10991089
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation
11001090
*
11011091
* @throws \HubSpot\Client\Marketing\Transactional\ApiException on non-2xx response or if the response body is not in the expected format
@@ -1128,18 +1118,6 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign
11281118

11291119
$statusCode = $response->getStatusCode();
11301120

1131-
if ($statusCode < 200 || $statusCode > 299) {
1132-
throw new ApiException(
1133-
sprintf(
1134-
'[%d] Error connecting to the API (%s)',
1135-
$statusCode,
1136-
(string) $request->getUri()
1137-
),
1138-
$statusCode,
1139-
$response->getHeaders(),
1140-
(string) $response->getBody()
1141-
);
1142-
}
11431121

11441122
switch($statusCode) {
11451123
case 200:
@@ -1198,6 +1176,19 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign
11981176
];
11991177
}
12001178

1179+
if ($statusCode < 200 || $statusCode > 299) {
1180+
throw new ApiException(
1181+
sprintf(
1182+
'[%d] Error connecting to the API (%s)',
1183+
$statusCode,
1184+
(string) $request->getUri()
1185+
),
1186+
$statusCode,
1187+
$response->getHeaders(),
1188+
(string) $response->getBody()
1189+
);
1190+
}
1191+
12011192
$returnType = '\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging';
12021193
if ($returnType === '\SplFileObject') {
12031194
$content = $response->getBody(); //stream goes to serializer
@@ -1254,10 +1245,10 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign
12541245
*
12551246
* Query SMTP API tokens by campaign name or an emailCampaignId.
12561247
*
1257-
* @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1258-
* @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1259-
* @param string $after Starting point to get the next set of results. (optional)
1260-
* @param int $limit Maximum number of tokens to return. (optional)
1248+
* @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1249+
* @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1250+
* @param string|null $after Starting point to get the next set of results. (optional)
1251+
* @param int|null $limit Maximum number of tokens to return. (optional)
12611252
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation
12621253
*
12631254
* @throws \InvalidArgumentException
@@ -1278,10 +1269,10 @@ function ($response) {
12781269
*
12791270
* Query SMTP API tokens by campaign name or an emailCampaignId.
12801271
*
1281-
* @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1282-
* @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1283-
* @param string $after Starting point to get the next set of results. (optional)
1284-
* @param int $limit Maximum number of tokens to return. (optional)
1272+
* @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1273+
* @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1274+
* @param string|null $after Starting point to get the next set of results. (optional)
1275+
* @param int|null $limit Maximum number of tokens to return. (optional)
12851276
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation
12861277
*
12871278
* @throws \InvalidArgumentException
@@ -1331,10 +1322,10 @@ function ($exception) {
13311322
/**
13321323
* Create request for operation 'getTokensPage'
13331324
*
1334-
* @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1335-
* @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1336-
* @param string $after Starting point to get the next set of results. (optional)
1337-
* @param int $limit Maximum number of tokens to return. (optional)
1325+
* @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional)
1326+
* @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional)
1327+
* @param string|null $after Starting point to get the next set of results. (optional)
1328+
* @param int|null $limit Maximum number of tokens to return. (optional)
13381329
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation
13391330
*
13401331
* @throws \InvalidArgumentException
@@ -1508,18 +1499,6 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self:
15081499

15091500
$statusCode = $response->getStatusCode();
15101501

1511-
if ($statusCode < 200 || $statusCode > 299) {
1512-
throw new ApiException(
1513-
sprintf(
1514-
'[%d] Error connecting to the API (%s)',
1515-
$statusCode,
1516-
(string) $request->getUri()
1517-
),
1518-
$statusCode,
1519-
$response->getHeaders(),
1520-
(string) $response->getBody()
1521-
);
1522-
}
15231502

15241503
switch($statusCode) {
15251504
case 200:
@@ -1578,6 +1557,19 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self:
15781557
];
15791558
}
15801559

1560+
if ($statusCode < 200 || $statusCode > 299) {
1561+
throw new ApiException(
1562+
sprintf(
1563+
'[%d] Error connecting to the API (%s)',
1564+
$statusCode,
1565+
(string) $request->getUri()
1566+
),
1567+
$statusCode,
1568+
$response->getHeaders(),
1569+
(string) $response->getBody()
1570+
);
1571+
}
1572+
15811573
$returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView';
15821574
if ($returnType === '\SplFileObject') {
15831575
$content = $response->getBody(); //stream goes to serializer

codegen/Marketing/Transactional/Api/SingleSendApi.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
*/
1111

1212
/**
13-
* Marketing Transactional Single Send
13+
* Transactional Single Send
1414
*
1515
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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
/**
@@ -83,13 +83,13 @@ class SingleSendApi
8383
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
8484
*/
8585
public function __construct(
86-
ClientInterface $client = null,
87-
Configuration $config = null,
88-
HeaderSelector $selector = null,
89-
$hostIndex = 0
86+
?ClientInterface $client = null,
87+
?Configuration $config = null,
88+
?HeaderSelector $selector = null,
89+
int $hostIndex = 0
9090
) {
9191
$this->client = $client ?: new Client();
92-
$this->config = $config ?: new Configuration();
92+
$this->config = $config ?: Configuration::getDefaultConfiguration();
9393
$this->headerSelector = $selector ?: new HeaderSelector();
9494
$this->hostIndex = $hostIndex;
9595
}
@@ -178,18 +178,6 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c
178178

179179
$statusCode = $response->getStatusCode();
180180

181-
if ($statusCode < 200 || $statusCode > 299) {
182-
throw new ApiException(
183-
sprintf(
184-
'[%d] Error connecting to the API (%s)',
185-
$statusCode,
186-
(string) $request->getUri()
187-
),
188-
$statusCode,
189-
$response->getHeaders(),
190-
(string) $response->getBody()
191-
);
192-
}
193181

194182
switch($statusCode) {
195183
case 200:
@@ -248,6 +236,19 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c
248236
];
249237
}
250238

239+
if ($statusCode < 200 || $statusCode > 299) {
240+
throw new ApiException(
241+
sprintf(
242+
'[%d] Error connecting to the API (%s)',
243+
$statusCode,
244+
(string) $request->getUri()
245+
),
246+
$statusCode,
247+
$response->getHeaders(),
248+
(string) $response->getBody()
249+
);
250+
}
251+
251252
$returnType = '\HubSpot\Client\Marketing\Transactional\Model\EmailSendStatusView';
252253
if ($returnType === '\SplFileObject') {
253254
$content = $response->getBody(); //stream goes to serializer

0 commit comments

Comments
 (0)