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
514 changes: 167 additions & 347 deletions codegen/Crm/Commerce/Invoices/Api/BasicApi.php

Large diffs are not rendered by default.

637 changes: 154 additions & 483 deletions codegen/Crm/Commerce/Invoices/Api/BatchApi.php

Large diffs are not rendered by default.

179 changes: 86 additions & 93 deletions codegen/Crm/Commerce/Invoices/Api/SearchApi.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* SearchApi
* PHP version 7.4
* PHP version 8.1
*
* @category Class
* @package HubSpot\Client\Crm\Commerce\Invoices
Expand All @@ -12,11 +12,11 @@
/**
* Invoices
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* CRM objects such as companies, contacts, deals, line items, products, tickets, and quotes are standard objects in HubSpot’s CRM. These core building blocks support custom properties, store critical information, and play a central role in the HubSpot application. ## Supported Object Types This API provides access to collections of CRM objects, which return a map of property names to values. Each object type has its own set of default properties, which can be found by exploring the [CRM Object Properties API](https://developers.hubspot.com/docs/methods/crm-properties/crm-properties-overview). |Object Type |Properties returned by default | |--|--| | `companies` | `name`, `domain` | | `contacts` | `firstname`, `lastname`, `email` | | `deals` | `dealname`, `amount`, `closedate`, `pipeline`, `dealstage` | | `products` | `name`, `description`, `price` | | `tickets` | `content`, `hs_pipeline`, `hs_pipeline_stage`, `hs_ticket_category`, `hs_ticket_priority`, `subject` | Find a list of all properties for an object type using the [CRM Object Properties](https://developers.hubspot.com/docs/methods/crm-properties/get-properties) API. e.g. `GET https://api.hubapi.com/properties/v2/companies/properties`. Change the properties returned in the response using the `properties` array in the request body.
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.12.0
* Generator version: 7.19.0
*/

/**
Expand All @@ -34,8 +34,11 @@
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use HubSpot\Client\Crm\Commerce\Invoices\ApiException;
use HubSpot\Client\Crm\Commerce\Invoices\Configuration;
use HubSpot\Client\Crm\Commerce\Invoices\FormDataProcessor;
use HubSpot\Client\Crm\Commerce\Invoices\HeaderSelector;
use HubSpot\Client\Crm\Commerce\Invoices\ObjectSerializer;

Expand Down Expand Up @@ -125,14 +128,14 @@ public function getConfig()
/**
* Operation doSearch
*
* Search for invoices
* Search for invoices using specified criteria.
*
* @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error
* @return \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error
*/
public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0])
{
Expand All @@ -143,14 +146,14 @@ public function doSearch($public_object_search_request, string $contentType = se
/**
* Operation doSearchWithHttpInfo
*
* Search for invoices
* Search for invoices using specified criteria.
*
* @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Crm\Commerce\Invoices\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings)
* @return array of \HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObject|\HubSpot\Client\Crm\Commerce\Invoices\Model\Error, HTTP status code, HTTP response headers (array of strings)
*/
public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0])
{
Expand Down Expand Up @@ -181,61 +184,21 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont

switch($statusCode) {
case 200:
if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
}
}

return [
ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging', []),
$response->getStatusCode(),
$response->getHeaders()
];
return $this->handleResponseWithDataType(
'\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObject',
$request,
$response,
);
default:
if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\HubSpot\Client\Crm\Commerce\Invoices\Model\Error' !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
}
}

return [
ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Commerce\Invoices\Model\Error', []),
$response->getStatusCode(),
$response->getHeaders()
];
return $this->handleResponseWithDataType(
'\HubSpot\Client\Crm\Commerce\Invoices\Model\Error',
$request,
$response,
);
}



if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
Expand All @@ -249,61 +212,40 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont
);
}

$returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
}
}

return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];

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


throw $e;
}
}

/**
* Operation doSearchAsync
*
* Search for invoices
* Search for invoices using specified criteria.
*
* @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
Expand All @@ -324,7 +266,7 @@ function ($response) {
/**
* Operation doSearchAsyncWithHttpInfo
*
* Search for invoices
* Search for invoices using specified criteria.
*
* @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicObjectSearchRequest $public_object_search_request (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation
Expand All @@ -334,7 +276,7 @@ function ($response) {
*/
public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0])
{
$returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging';
$returnType = '\HubSpot\Client\Crm\Commerce\Invoices\Model\CollectionResponseWithTotalSimplePublicObject';
$request = $this->doSearchRequest($public_object_search_request, $contentType);

return $this->client
Expand Down Expand Up @@ -484,6 +426,57 @@ protected function createHttpClientOption()
}
}

if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}

if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}

return $options;
}

private function handleResponseWithDataType(
string $dataType,
RequestInterface $request,
ResponseInterface $response
): array {
if ($dataType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($dataType !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$response->getStatusCode(),
$response->getHeaders(),
$content
);
}
}
}

return [
ObjectSerializer::deserialize($content, $dataType, []),
$response->getStatusCode(),
$response->getHeaders()
];
}

private function responseWithinRangeCode(
string $rangeCode,
int $statusCode
): bool {
$left = (int) ($rangeCode[0].'00');
$right = (int) ($rangeCode[0].'99');

return $statusCode >= $left && $statusCode <= $right;
}
}
6 changes: 3 additions & 3 deletions codegen/Crm/Commerce/Invoices/ApiException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ApiException
* PHP version 7.4
* PHP version 8.1
*
* @category Class
* @package HubSpot\Client\Crm\Commerce\Invoices
Expand All @@ -12,11 +12,11 @@
/**
* Invoices
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* CRM objects such as companies, contacts, deals, line items, products, tickets, and quotes are standard objects in HubSpot’s CRM. These core building blocks support custom properties, store critical information, and play a central role in the HubSpot application. ## Supported Object Types This API provides access to collections of CRM objects, which return a map of property names to values. Each object type has its own set of default properties, which can be found by exploring the [CRM Object Properties API](https://developers.hubspot.com/docs/methods/crm-properties/crm-properties-overview). |Object Type |Properties returned by default | |--|--| | `companies` | `name`, `domain` | | `contacts` | `firstname`, `lastname`, `email` | | `deals` | `dealname`, `amount`, `closedate`, `pipeline`, `dealstage` | | `products` | `name`, `description`, `price` | | `tickets` | `content`, `hs_pipeline`, `hs_pipeline_stage`, `hs_ticket_category`, `hs_ticket_priority`, `subject` | Find a list of all properties for an object type using the [CRM Object Properties](https://developers.hubspot.com/docs/methods/crm-properties/get-properties) API. e.g. `GET https://api.hubapi.com/properties/v2/companies/properties`. Change the properties returned in the response using the `properties` array in the request body.
*
* The version of the OpenAPI document: v3
* Generated by: https://openapi-generator.tech
* Generator version: 7.12.0
* Generator version: 7.19.0
*/

/**
Expand Down
Loading