Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
326 changes: 325 additions & 1 deletion codegen/Crm/Timeline/Api/EventsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down Expand Up @@ -86,6 +86,9 @@ class EventsApi
'getDetailById' => [
'application/json',
],
'getRenderById' => [
'application/json',
],
];

/**
Expand Down Expand Up @@ -1276,6 +1279,327 @@ public function getDetailByIdRequest($event_template_id, $event_id, string $cont
);
}

/**
* Operation getRenderById
*
* Get event render by ID
*
* @param string $event_id The event ID. (required)
* @param string $event_template_id The event template ID. (required)
* @param bool|null $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return string|\HubSpot\Client\Crm\Timeline\Model\Error
*/
public function getRenderById($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0])
{
list($response) = $this->getRenderByIdWithHttpInfo($event_id, $event_template_id, $detail, $contentType);
return $response;
}

/**
* Operation getRenderByIdWithHttpInfo
*
* Get event render by ID
*
* @param string $event_id The event ID. (required)
* @param string $event_template_id The event template ID. (required)
* @param bool|null $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of string|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings)
*/
public function getRenderByIdWithHttpInfo($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0])
{
$request = $this->getRenderByIdRequest($event_id, $event_template_id, $detail, $contentType);

try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}

$statusCode = $response->getStatusCode();


switch($statusCode) {
case 200:
return $this->handleResponseWithDataType(
'string',
$request,
$response,
);
default:
return $this->handleResponseWithDataType(
'\HubSpot\Client\Crm\Timeline\Model\Error',
$request,
$response,
);
}



if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

return $this->handleResponseWithDataType(
'string',
$request,
$response,
);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
default:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\HubSpot\Client\Crm\Timeline\Model\Error',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
}


throw $e;
}
}

/**
* Operation getRenderByIdAsync
*
* Get event render by ID
*
* @param string $event_id The event ID. (required)
* @param string $event_template_id The event template ID. (required)
* @param bool|null $detail Set to &#39;true&#39;, we want to render the &#x60;detailTemplate&#x60; instead of the &#x60;headerTemplate&#x60;. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRenderByIdAsync($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0])
{
return $this->getRenderByIdAsyncWithHttpInfo($event_id, $event_template_id, $detail, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}

/**
* Operation getRenderByIdAsyncWithHttpInfo
*
* Get event render by ID
*
* @param string $event_id The event ID. (required)
* @param string $event_template_id The event template ID. (required)
* @param bool|null $detail Set to &#39;true&#39;, we want to render the &#x60;detailTemplate&#x60; instead of the &#x60;headerTemplate&#x60;. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRenderByIdAsyncWithHttpInfo($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0])
{
$returnType = 'string';
$request = $this->getRenderByIdRequest($event_id, $event_template_id, $detail, $contentType);

return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}

return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}

/**
* Create request for operation 'getRenderById'
*
* @param string $event_id The event ID. (required)
* @param string $event_template_id The event template ID. (required)
* @param bool|null $detail Set to &#39;true&#39;, we want to render the &#x60;detailTemplate&#x60; instead of the &#x60;headerTemplate&#x60;. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getRenderByIdRequest($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0])
{

// verify the required parameter 'event_id' is set
if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $event_id when calling getRenderById'
);
}

// verify the required parameter 'event_template_id' is set
if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $event_template_id when calling getRenderById'
);
}



$resourcePath = '/integrators/timeline/v3/events/{eventTemplateId}/{eventId}/render';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;

// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$detail,
'detail', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);


// path params
if ($event_id !== null) {
$resourcePath = str_replace(
'{' . 'eventId' . '}',
ObjectSerializer::toPathValue($event_id),
$resourcePath
);
}
// path params
if ($event_template_id !== null) {
$resourcePath = str_replace(
'{' . 'eventTemplateId' . '}',
ObjectSerializer::toPathValue($event_template_id),
$resourcePath
);
}


$headers = $this->headerSelector->selectHeaders(
['text/html', '*/*', ],
$contentType,
$multipart
);

// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);

} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}

// this endpoint requires OAuth (access token)
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}

$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}

$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);

$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}

/**
* Create http client option
*
Expand Down
2 changes: 1 addition & 1 deletion codegen/Crm/Timeline/Api/TemplatesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion codegen/Crm/Timeline/Api/TokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion codegen/Crm/Timeline/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion codegen/Crm/Timeline/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion codegen/Crm/Timeline/FormDataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.17.0
* Generator version: 7.19.0
*/

/**
Expand Down
Loading